mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-27 20:03:45 +03:00
Merge branch 'development' into production
This commit is contained in:
commit
9596af084e
41
README.md
41
README.md
|
@ -1,6 +1,13 @@
|
|||
# [Maintainer Needed! Нужен разработчик!](https://github.com/anticensorship-russia/chromium-extension/issues/2)
|
||||
If you __unstar__, please, [leave us a note](https://github.com/anticensorship-russia/chromium-extension/issues) why you do so.
|
||||
|
||||
Also, if you __unstar__, please, [leave us a note](https://github.com/anticensorship-russia/chromium-extension/issues) why you do so.
|
||||
[d1]: https://img.shields.io/badge/Поддержать-❤-green.svg
|
||||
[d2]: https://rebrand.ly/ac-donate
|
||||
|
||||
[oo1]: https://opencollective.com/anticensority
|
||||
[![Backers](https://opencollective.com/anticensority/tiers/backer.svg?avatarHeight=100&width=600)][oo1]
|
||||
[![Поддержать][d1]][d2]
|
||||
[![Backers on Open Collective](https://opencollective.com/anticensority/backers/badge.svg)](#backers)
|
||||
[![Sponsors on Open Collective](https://opencollective.com/anticensority/sponsors/badge.svg)](#sponsors)
|
||||
|
||||
# Russian Anti-Censorship on PAC-Scripts
|
||||
|
||||
|
@ -33,3 +40,33 @@ I decided to write an anti-censorship extension for Chromium before they strike
|
|||
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.
|
||||
4. PAC scripts on servers are updated periodically from https://github.com/zapret-info/z-i.
|
||||
|
||||
## Contributors
|
||||
|
||||
This project exists thanks to all the people who contribute.
|
||||
<a href="graphs/contributors"><img src="https://opencollective.com/anticensority/contributors.svg?width=890&button=false" /></a>
|
||||
|
||||
|
||||
## Backers
|
||||
|
||||
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/anticensority#backer)]
|
||||
|
||||
<a href="https://opencollective.com/anticensority#backers" target="_blank"><img src="https://opencollective.com/anticensority/backers.svg?width=890"></a>
|
||||
|
||||
|
||||
## Sponsors
|
||||
|
||||
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/anticensority#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/anticensority/sponsor/0/website" target="_blank"><img src="https://opencollective.com/anticensority/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/anticensority/sponsor/1/website" target="_blank"><img src="https://opencollective.com/anticensority/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/anticensority/sponsor/2/website" target="_blank"><img src="https://opencollective.com/anticensority/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/anticensority/sponsor/3/website" target="_blank"><img src="https://opencollective.com/anticensority/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/anticensority/sponsor/4/website" target="_blank"><img src="https://opencollective.com/anticensority/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/anticensority/sponsor/5/website" target="_blank"><img src="https://opencollective.com/anticensority/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/anticensority/sponsor/6/website" target="_blank"><img src="https://opencollective.com/anticensority/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/anticensority/sponsor/7/website" target="_blank"><img src="https://opencollective.com/anticensority/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/anticensority/sponsor/8/website" target="_blank"><img src="https://opencollective.com/anticensority/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/anticensority/sponsor/9/website" target="_blank"><img src="https://opencollective.com/anticensority/sponsor/9/avatar.svg"></a>
|
||||
|
||||
|
||||
|
|
|
@ -78,7 +78,9 @@
|
|||
openAndFocus(
|
||||
'http://rebrand.ly/ac-error/?json=' + encodeURIComponent(json) +
|
||||
(type ? '&type=' + encodeURIComponent(type) : '') +
|
||||
'&version=' + chrome.runtime.getManifest().version
|
||||
'&version=' + chrome.runtime.getManifest().version +
|
||||
'&useragent=' + encodeURIComponent(navigator.userAgent) +
|
||||
'&platform=' + encodeURIComponent(navigator.platform),
|
||||
);
|
||||
|
||||
},
|
||||
|
|
|
@ -78,6 +78,31 @@
|
|||
|
||||
},
|
||||
|
||||
head(url, cb = mandatory()) {
|
||||
|
||||
const start = Date.now();
|
||||
fetch(url, {cache: 'no-store', method: 'HEAD'}).then(
|
||||
(res) => {
|
||||
|
||||
const status = res.status;
|
||||
if ( !( status >= 200 && status < 300 || status === 304 ) ) {
|
||||
return cb(
|
||||
errorsLib.clarify(
|
||||
res,
|
||||
'Получен ответ с неудачным HTTP-кодом ' + status + '.'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
console.log('HEADed with success:', url, Date.now() - start);
|
||||
cb();
|
||||
|
||||
},
|
||||
errorsLib.clarifyThen(checkCon, cb)
|
||||
);
|
||||
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -315,6 +315,12 @@
|
|||
|
||||
cook(pacData, pacMods = mandatory()) {
|
||||
|
||||
pacData = pacData.replace(
|
||||
new RegExp(kitchenStartsMark + '[\\s\\S]*$', 'g'),
|
||||
''
|
||||
);
|
||||
/a/.test('a'); // GC RegExp.input and friends.
|
||||
|
||||
return pacMods.ifNoMods ? pacData : pacData + `${ kitchenStartsMark }
|
||||
/******/
|
||||
/******/;(function(global) {
|
||||
|
@ -483,12 +489,6 @@ ${ pacMods.filteredCustomsString
|
|||
) {
|
||||
const pac = window.utils.getProp(details, 'value.pacScript');
|
||||
if (pac && pac.data) {
|
||||
// Delete old kitchen modifications.
|
||||
pac.data = pac.data.replace(
|
||||
new RegExp(kitchenStartsMark + '[\\s\\S]*$', 'g'),
|
||||
''
|
||||
);
|
||||
/a/.test('a'); // GC RegExp.input and friends.
|
||||
return chrome.proxy.settings.set(details, chromified(cb));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
|
||||
};
|
||||
|
||||
const setPacScriptFromProviderAsync = function setPacScriptFromProviderAsync(
|
||||
const setPacScriptFromProviderAsync = async function setPacScriptFromProviderAsync(
|
||||
provider, lastModifiedStr = mandatory(), cb = throwIfError
|
||||
) {
|
||||
|
||||
|
@ -106,6 +106,29 @@
|
|||
'Getting PAC script from provider...', pacUrl,
|
||||
cb
|
||||
);
|
||||
// TODO: dirty hack (labels should be UI related only)
|
||||
if (provider.label === 'Антицензорити') {
|
||||
const azUrl = window.apis.antiCensorRu.pacProviders['Антизапрет'].pacUrls[0];
|
||||
console.log('HEADing antizapret...');
|
||||
let headError = null;
|
||||
const numberOfTries = 2;
|
||||
let i = 0;
|
||||
while (i++ < numberOfTries) {
|
||||
await new Promise((resolve) =>
|
||||
httpLib.head(azUrl, (err) => {
|
||||
headError = err;
|
||||
if (!headError) {
|
||||
i = numberOfTries;
|
||||
}
|
||||
resolve();
|
||||
})
|
||||
);
|
||||
}
|
||||
if (headError) {
|
||||
clarifyThen(\`\${azUrl} недоступен!\`, cb)(headError);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
httpLib.ifModifiedSince(pacUrl, lastModifiedStr, (err, newLastModifiedStr) => {
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
"options_ui": {
|
||||
"page": "/pages/options/index.html",
|
||||
"chrome_style": false
|
||||
},
|
||||
}
|
||||
|
||||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ const pacUrls = [
|
|||
];
|
||||
|
||||
const commonContext = {
|
||||
version: '1.16',
|
||||
version: '1.19',
|
||||
anticensorityPacUrls: [
|
||||
...pacUrls,
|
||||
],
|
||||
|
|
14
package.json
14
package.json
|
@ -5,14 +5,22 @@
|
|||
"main": "index.js",
|
||||
"scripts": {
|
||||
"generate": "cd pac-generator && npm start",
|
||||
"prestart": "npm run generate",
|
||||
"start": "npm run bench",
|
||||
"prestart": "npm run generate",
|
||||
"start": "npm run bench",
|
||||
"bench": "cd ./pac-performance-analyses/benchmark && dnx run ../../pac-generator/generated-PACs",
|
||||
"test": "rm -r pac-generator/generated-PACs"
|
||||
"test": "rm -r pac-generator/generated-PACs",
|
||||
"postinstall": "opencollective postinstall"
|
||||
},
|
||||
"author": "ilyaigpetrov",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"http-server": "^0.8.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"opencollective": "^1.0.3"
|
||||
},
|
||||
"collective": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/anticensority"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user