From b45faad6cb624f9a769411dd91184193307e6876 Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Wed, 29 Nov 2017 15:29:58 +0500 Subject: [PATCH 01/15] Add another type check protection --- .../src/extension-common/11-error-handlers-api.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 9090c55..aadbb7c 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 @@ -155,7 +155,9 @@ timeouted( (details) => { - this.isControllable(details); + if (details) { + this.isControllable(details); + } cb(); } From 220d368d8932358a73cc86c084f36647820dc2a4 Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Wed, 29 Nov 2017 16:00:24 +0500 Subject: [PATCH 02/15] Bump 0.0.1.17 --- .../chromium/runet-censorship-bypass/src/templates-data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/chromium/runet-censorship-bypass/src/templates-data.js b/extensions/chromium/runet-censorship-bypass/src/templates-data.js index ffa4bc4..792b68c 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.17', anticensorityPacUrls: [ ...pacUrls, ], From e7fed46cc95b74316484ebcd8d84f3d8f2272af0 Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Sun, 3 Dec 2017 17:40:22 +0500 Subject: [PATCH 03/15] Remove advert about coworker --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 4478db7..6dd9c36 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -# [Maintainer Needed! Нужен разработчик!](https://github.com/anticensorship-russia/chromium-extension/issues/2) - -Also, if you __unstar__, please, [leave us a note](https://github.com/anticensorship-russia/chromium-extension/issues) why you do so. +If you __unstar__, please, [leave us a note](https://github.com/anticensorship-russia/chromium-extension/issues) why you do so. # Russian Anti-Censorship on PAC-Scripts From 04a6f7e13af7cd0e8c6a69cb615e3a14a29d38ca Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Sun, 3 Dec 2017 18:37:40 +0500 Subject: [PATCH 04/15] Fove Firefox pac file to its folder --- .../src/{extension-common => extension-firefox}/default.pac.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename extensions/chromium/runet-censorship-bypass/src/{extension-common => extension-firefox}/default.pac.js (100%) 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 From 49cac9da1551a782aa621ab1d03196195dc370db Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Sun, 3 Dec 2017 19:29:27 +0500 Subject: [PATCH 05/15] Send useragent with error info --- .../src/extension-common/11-error-handlers-api.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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..4f676f7 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,8 @@ 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), ); }, From 08da89030d2f0d292804ff2f636118a08e24b959 Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Sun, 3 Dec 2017 19:51:03 +0500 Subject: [PATCH 06/15] Send platform with error info --- .../src/extension-common/11-error-handlers-api.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 4f676f7..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 @@ -79,7 +79,8 @@ 'http://rebrand.ly/ac-error/?json=' + encodeURIComponent(json) + (type ? '&type=' + encodeURIComponent(type) : '') + '&version=' + chrome.runtime.getManifest().version + - '&useragent=' + encodeURIComponent(navigator.userAgent), + '&useragent=' + encodeURIComponent(navigator.userAgent) + + '&platform=' + encodeURIComponent(navigator.platform), ); }, From 2576ec99bac02a7ea445722635a0fa9021a1f98e Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Sun, 3 Dec 2017 20:07:01 +0500 Subject: [PATCH 07/15] Bump 0.0.1.18 --- .../chromium/runet-censorship-bypass/src/templates-data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/chromium/runet-censorship-bypass/src/templates-data.js b/extensions/chromium/runet-censorship-bypass/src/templates-data.js index 792b68c..5fbc8da 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.17', + version: '1.18', anticensorityPacUrls: [ ...pacUrls, ], From 8bd853fe57801af7bb655f1d7557f28e19f39cdd Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Tue, 19 Dec 2017 14:27:35 +0500 Subject: [PATCH 08/15] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 6dd9c36..4da6a1e 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ If you __unstar__, please, [leave us a note](https://github.com/anticensorship-russia/chromium-extension/issues) why you do so. +[oo1]: https://opencollective.com/anticensority +[![Backers](https://opencollective.com/anticensority/tiers/backer.svg?avatarHeight=100&width=600)][oo1] + # Russian Anti-Censorship on PAC-Scripts This repo contains: From f40f371dd772c0e66035aa9601c0e84e5d8038e5 Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Thu, 21 Dec 2017 12:03:20 +0500 Subject: [PATCH 09/15] Update README.md --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4da6a1e..1ec5c85 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ -If you __unstar__, please, [leave us a note](https://github.com/anticensorship-russia/chromium-extension/issues) why you do so. +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] +[![Backers](https://opencollective.com/anticensority/tiers/backer.svg?avatarHeight=100&width=600)][oo1] +[![Поддержать][d1]][d2] # Russian Anti-Censorship on PAC-Scripts From 59229bc63e571a551ecfff77726bae1a10391eb7 Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Fri, 19 Jan 2018 15:45:50 +0500 Subject: [PATCH 10/15] Remove unsafe content-security policy used for Firefox --- .../src/extension-common/manifest.tmpl.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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'" } From a592b4c4aeefd1be8330006607fc48ef81464dd6 Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Fri, 19 Jan 2018 15:46:07 +0500 Subject: [PATCH 11/15] Bump 0.0.0.19 --- .../chromium/runet-censorship-bypass/src/templates-data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/chromium/runet-censorship-bypass/src/templates-data.js b/extensions/chromium/runet-censorship-bypass/src/templates-data.js index 5fbc8da..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.18', + version: '1.19', anticensorityPacUrls: [ ...pacUrls, ], From c59ffda2e2a55fdb3ef432ad45ab2153fad7aa35 Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Wed, 24 Jan 2018 19:55:22 +0500 Subject: [PATCH 12/15] Move adding pac kitchen to lower level (during cook) --- .../src/extension-common/35-pac-kitchen-api.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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)); } } From 8d749eb2ae061926f19372e39710f00aa40f5a87 Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Sat, 27 Jan 2018 17:21:28 +0500 Subject: [PATCH 13/15] Make HEAD to Antizapret --- .../src/extension-common/13-http-lib.js | 25 +++++++++++++++++++ ...c-pac-script-with-pac-provider-api.tmpl.js | 25 ++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) 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/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) => { From afbe1f453743c67551b8009ccddfab917a669a29 Mon Sep 17 00:00:00 2001 From: Jess Date: Fri, 23 Feb 2018 18:33:00 +0900 Subject: [PATCH 14/15] Added backers and sponsors on the README --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index 1ec5c85..1c7a741 100755 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ If you __unstar__, please, [leave us a note](https://github.com/anticensorship-r [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 @@ -38,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)] + + + + + + + + + + + + + From 99e8c105ed70d6a6445510b5d7e32904eff491bc Mon Sep 17 00:00:00 2001 From: Jess Date: Fri, 23 Feb 2018 18:33:00 +0900 Subject: [PATCH 15/15] Added call to donate after npm install (optional) --- package.json | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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