mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-24 02:13:43 +03:00
Merge branch 'development' into production
This commit is contained in:
commit
ea85cf941b
0
.gitignore
vendored
Executable file → Normal file
0
.gitignore
vendored
Executable file → Normal file
6
README.md
Executable file → Normal file
6
README.md
Executable file → Normal file
|
@ -23,15 +23,15 @@ My maxim is _"Your freedom ends when it starts to confine the freedom of others"
|
||||||
|
|
||||||
See [my other arguments against censorship (ru)](https://rebrand.ly/ac-arguments)
|
See [my other arguments against censorship (ru)](https://rebrand.ly/ac-arguments)
|
||||||
|
|
||||||
Looking at how Russian government [distorts TV](https://therussianreader.wordpress.com/2015/11/22/russian-truckers-strike-dagestan/) and blocks [critics of Putin](http://www.reuters.com/article/2014/03/13/us-russia-internet-idUSBREA2C21L20140313),
|
Looking at how Russian government [distorts TV](https://therussianreader.wordpress.com/2015/11/22/russian-truckers-strike-dagestan/) and blocks [critics of Putin](https://www.reuters.com/article/us-russia-internet-idUSBREA2C21L20140313),
|
||||||
I decided to write an anticensorship extension for Chromium before they strike me first.
|
I decided to write an anticensorship extension for Chromium before they strike me first.
|
||||||
|
|
||||||
## How it Works
|
## How it Works
|
||||||
|
|
||||||
0. PAC script is a JavaScript file, triggered on every URL request, which says browser which proxy to use if any for this particular URL.
|
0. PAC script is a JavaScript file, triggered on every URL request, which says browser which proxy to use if any for this particular URL.
|
||||||
1. The Chrome Extension sets PAC script in browser settings and keeps it synced with PAC script on the server (offering Antizapret (hosted on a dedicated server) or Anticensority (hosted on GitHub + CloudFlare)).
|
1. The Chrome Extension sets PAC script in browser settings and keeps it synced with PAC script on the server (offering Antizapret (hosted on a dedicated server) or Anticensority (hosted on GitHub)).
|
||||||
2. On every request PAC script checks if host is blocked or if its IP is blocked.
|
2. On every request PAC script checks if host is blocked or if its IP is blocked.
|
||||||
3. If address is blocked PAC script returns proxy server to the browser, both Antizapret and Anticensority use Antizapret proxy servers.
|
3. If address is blocked PAC script returns proxy server to the browser. Antizapret PAC-script uses its own proxy servers and Anticensority PAC-script uses local Tor.
|
||||||
4. PAC scripts on servers are updated periodically from https://github.com/zapret-info/z-i.
|
4. PAC scripts on servers are updated periodically from https://github.com/zapret-info/z-i.
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
|
@ -1,12 +1,20 @@
|
||||||
# Install
|
# Install
|
||||||
|
|
||||||
|
Tested on NodeJS versoin: 12.
|
||||||
|
|
||||||
```
|
```
|
||||||
npm install
|
npm install
|
||||||
cd src/extension-common/pages/options/
|
cd src/extension-common/pages/options/
|
||||||
npm install
|
npm install
|
||||||
cd -
|
cd -
|
||||||
npm start
|
|
||||||
use your build/extension-beta
|
# For debugging:
|
||||||
|
npm start
|
||||||
|
# Use your build/extension-beta
|
||||||
|
|
||||||
|
# For production:
|
||||||
|
npm run release
|
||||||
|
# Use your build/extension-full or build/extension-mini
|
||||||
```
|
```
|
||||||
|
|
||||||
# Release
|
# Release
|
||||||
|
|
|
@ -122,6 +122,13 @@
|
||||||
url: 'https://rebrand.ly/ac-own-proxy',
|
url: 'https://rebrand.ly/ac-own-proxy',
|
||||||
order: 7,
|
order: 7,
|
||||||
},
|
},
|
||||||
|
ifUseOwnProxiesOnlyForOwnSites: {
|
||||||
|
dflt: false,
|
||||||
|
category: 'ownProxies',
|
||||||
|
label: 'СВОИ прокси только для СВОИХ сайтов',
|
||||||
|
desc: 'Не использовать СВОИ прокси для всех сайтов из PAC-скрипта, а только для добавленных вручную исключений.',
|
||||||
|
order: 7.5,
|
||||||
|
},
|
||||||
ifProxyMoreDomains: {
|
ifProxyMoreDomains: {
|
||||||
ifDisabled: true,
|
ifDisabled: true,
|
||||||
dflt: false,
|
dflt: false,
|
||||||
|
@ -451,7 +458,7 @@ ${ pacMods.filteredCustomsString
|
||||||
/******/ return "DIRECT";
|
/******/ return "DIRECT";
|
||||||
/******/ }
|
/******/ }
|
||||||
/******/ return ` +
|
/******/ return ` +
|
||||||
(pacMods.filteredCustomsString
|
((pacMods.filteredCustomsString && !pacMods.ifUseOwnProxiesOnlyForOwnSites)
|
||||||
? 'filteredCustomProxies + "; " + '
|
? 'filteredCustomProxies + "; " + '
|
||||||
: ''
|
: ''
|
||||||
) +
|
) +
|
||||||
|
|
|
@ -145,20 +145,28 @@
|
||||||
|
|
||||||
httpLib.ifModifiedSince(pacUrl, lastModifiedStr, (err, newLastModifiedStr) => {
|
httpLib.ifModifiedSince(pacUrl, lastModifiedStr, (err, newLastModifiedStr) => {
|
||||||
|
|
||||||
if (!newLastModifiedStr) {
|
/*
|
||||||
const ifWasEverModified = lastModifiedStr !== new Date(0).toUTCString();
|
TODO: Get rid of this dirty hack
|
||||||
if (ifWasEverModified) {
|
IPFS used by AntiZapret always returns last-modified date as new Date(1000) which is 1 sec since unix epoch.
|
||||||
|
Last-modified isn't changed but target redireciton URL is and this URL should be compared to the last cached URL.
|
||||||
|
Hack here is to consider 5 seconds since epoch time the same way as the unix epoch start.
|
||||||
|
If you think etags are the solution then know that etags can't be read from the fetch API, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
TODO: I turn off caching for now because I see no easy way out.
|
||||||
|
|
||||||
addWarning(
|
const ifWasEverModified = new Date(lastModifiedStr) - new Date(0) > 5000;
|
||||||
(ifRu
|
if (!newLastModifiedStr && ifWasEverModified) {
|
||||||
? 'Ваш PAC-скрипт не нуждается в обновлении. Его дата: '
|
addWarning(
|
||||||
: 'Your PAC-script doesn\\'t need to be updated. It\\'s date: '
|
(ifRu
|
||||||
) + lastModifiedStr,
|
? 'Ваш PAC-скрипт не нуждается в обновлении. Его дата: '
|
||||||
);
|
: 'Your PAC-script doesn\\'t need to be updated. It\\'s date: '
|
||||||
const res = {lastModified: lastModifiedStr};
|
) + lastModifiedStr,
|
||||||
return cb(null, res);
|
);
|
||||||
}
|
const res = {lastModified: lastModifiedStr};
|
||||||
|
return cb(null, res);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Employ all urls, the latter are fallbacks for the former.
|
// Employ all urls, the latter are fallbacks for the former.
|
||||||
const pacDataPromise = provider.pacUrls.reduce(
|
const pacDataPromise = provider.pacUrls.reduce(
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"description": "__MSG_extDesc__",
|
"description": "__MSG_extDesc__",
|
||||||
"version": "0.0.${version}",
|
"version": "0.0.${version}",
|
||||||
"icons": {
|
"icons": {
|
||||||
"128": "/icons/default-128.png"
|
"128": "icons/default-128.png"
|
||||||
},
|
},
|
||||||
"author": "anticensority+owners@googlegroups.com",
|
"author": "anticensority+owners@googlegroups.com",
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ export default function getExcEditor(theState) {
|
||||||
props.currentTab &&
|
props.currentTab &&
|
||||||
props.currentTab.url &&
|
props.currentTab.url &&
|
||||||
!props.currentTab.url.startsWith('chrome')
|
!props.currentTab.url.startsWith('chrome')
|
||||||
? new URL(props.currentTab.url).hostname
|
? new URL(props.currentTab.url).hostname.replace(/^www\./g, '')
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
const pacMods = props.apis.pacKitchen.getPacMods();
|
const pacMods = props.apis.pacKitchen.getPacMods();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import Inferno from 'inferno';
|
import Inferno from 'inferno';
|
||||||
import css from 'csjs-inject';
|
import css from 'csjs-inject';
|
||||||
|
|
||||||
export default function getFooter() {
|
export default function getFooter(theState) {
|
||||||
|
|
||||||
const scopedCss = css`
|
const scopedCss = css`
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ export default function getFooter() {
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<footer class={scopedCss.controlRow + ' horFlex nowrap'}>
|
<footer class={scopedCss.controlRow + ' horFlex nowrap'}>
|
||||||
<input type="button" value={chrome.i18n.getMessage('Finish')} disabled={props.ifInputsDisabled} onClick={() => window.close()} />
|
<input type="button" value={chrome.i18n.getMessage('Finish')} disabled={props.ifInputsDisabled} style={{ display: theState.flags.ifInsideEdgeOptionsPage ? 'none' : 'initial' }} onClick={() => window.close()} />
|
||||||
<a href="https://rebrand.ly/ac-donate">{chrome.i18n.getMessage('Donate')}</a>
|
<a href="https://rebrand.ly/ac-donate">{chrome.i18n.getMessage('Donate')}</a>
|
||||||
<a data-in-bg="false" href="../troubleshoot/index.html">
|
<a data-in-bg="false" href="../troubleshoot/index.html">
|
||||||
{chrome.i18n.getMessage('ProblemsQ')}
|
{chrome.i18n.getMessage('ProblemsQ')}
|
||||||
|
|
|
@ -42,7 +42,9 @@ chrome.runtime.getBackgroundPage( (bgWindow) =>
|
||||||
);
|
);
|
||||||
winChrome.runtime.sendMessage({ currentTab, eventName: 'POPUP_OPENED' });
|
winChrome.runtime.sendMessage({ currentTab, eventName: 'POPUP_OPENED' });
|
||||||
|
|
||||||
theState.flags.ifInsideOptionsPage = !currentTab || currentTab.url.startsWith('chrome://extensions/?options=') || currentTab.url.startsWith('about:addons');
|
theState.flags.ifInsideOptionsPage = !currentTab || /.*:\/\/extensions\/\?options=/g.test(currentTab.url) || currentTab.url.startsWith('about:addons');
|
||||||
|
theState.flags.ifInsideEdgeOptionsPage = theState.flags.ifInsideOptionsPage && currentTab.url.startsWith('edge://');
|
||||||
|
|
||||||
theState.currentTab = currentTab;
|
theState.currentTab = currentTab;
|
||||||
|
|
||||||
// If opened not via popup and not via options modal.
|
// If opened not via popup and not via options modal.
|
||||||
|
|
|
@ -10,7 +10,7 @@ const pacUrls = [
|
||||||
];
|
];
|
||||||
|
|
||||||
const commonContext = {
|
const commonContext = {
|
||||||
version: '1.38',
|
version: '1.42',
|
||||||
anticensorityPacUrls: [
|
anticensorityPacUrls: [
|
||||||
...pacUrls,
|
...pacUrls,
|
||||||
],
|
],
|
||||||
|
|
0
package.json
Executable file → Normal file
0
package.json
Executable file → Normal file
Loading…
Reference in New Issue
Block a user