diff --git a/README.md b/README.md
index 4478db7..1c7a741 100755
--- a/README.md
+++ b/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.
+
+
+
+## Backers
+
+Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/anticensority#backer)]
+
+
+
+
+## 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)]
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/11-error-handlers-api.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/11-error-handlers-api.js
index aadbb7c..430f0aa 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/11-error-handlers-api.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/11-error-handlers-api.js
@@ -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),
);
},
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/13-http-lib.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/13-http-lib.js
index 6444844..8681a0b 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/13-http-lib.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/13-http-lib.js
@@ -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)
+ );
+
+ },
+
};
}
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/35-pac-kitchen-api.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/35-pac-kitchen-api.js
index 1d0ad68..8ac1bc3 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/35-pac-kitchen-api.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/35-pac-kitchen-api.js
@@ -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));
}
}
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.tmpl.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.tmpl.js
index 9c07766..1c05be9 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.tmpl.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.tmpl.js
@@ -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) => {
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/manifest.tmpl.json b/extensions/chromium/runet-censorship-bypass/src/extension-common/manifest.tmpl.json
index 6e1cb73..074937b 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/manifest.tmpl.json
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/manifest.tmpl.json
@@ -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'"
}
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/default.pac.js b/extensions/chromium/runet-censorship-bypass/src/extension-firefox/default.pac.js
similarity index 100%
rename from extensions/chromium/runet-censorship-bypass/src/extension-common/default.pac.js
rename to extensions/chromium/runet-censorship-bypass/src/extension-firefox/default.pac.js
diff --git a/extensions/chromium/runet-censorship-bypass/src/templates-data.js b/extensions/chromium/runet-censorship-bypass/src/templates-data.js
index ffa4bc4..074c1bc 100644
--- a/extensions/chromium/runet-censorship-bypass/src/templates-data.js
+++ b/extensions/chromium/runet-censorship-bypass/src/templates-data.js
@@ -12,7 +12,7 @@ const pacUrls = [
];
const commonContext = {
- version: '1.16',
+ version: '1.19',
anticensorityPacUrls: [
...pacUrls,
],
diff --git a/package.json b/package.json
index c4afd1a..ddf0692 100755
--- a/package.json
+++ b/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"
}
-}
+}
\ No newline at end of file