Add one more source for AntiZapret. Delete old update code. Move notes for reviewers from README to a separate file

This commit is contained in:
ilyaigpetrov 2023-04-25 22:59:20 +05:00
parent 6858c56534
commit 689f9266f7
4 changed files with 52 additions and 92 deletions

View File

@ -23,19 +23,7 @@ npm start
# For Reviewers # For Reviewers
Steps to reproduce the same zip: See ./src/extension-common/FOR-REVIEWERS.md.
```
npm ci
cd src/extension-common/pages/options/
npm ci
cd -
npm start
# See ./build/extension-full
cd ./build/extension-full
zip -r runet-censorship-bypass-full.zip ./*
```
https://antizapret.prostovpn.org/proxy.pac is generated by https://bitbucket.org/anticensority/antizapret-pac-generator-light/, reviewers may find justifications related to this PAC-script in that repo.
# Release Instructions # Release Instructions

View File

@ -230,7 +230,7 @@
); );
return (ifUnattended return (ifUnattended
? tryPromiseSeveralTimesAsync(tryAllUrlsAsync, [20, 40, 60]) ? tryPromiseSeveralTimesAsync(tryAllUrlsAsync, [20, 40, 60])
: tryAllUrlsAsync() : tryAllUrlsAsync()
).catch( ).catch(
(err) => Promise.reject(clarify( (err) => Promise.reject(clarify(
err, err,
@ -276,7 +276,7 @@
\`, \`,
order: 0, order: 0,
pacUrls: [ pacUrls: [
'https://antizapret.prostovpn.org/proxy.pac', 'https://antizapret.prostovpn.org:8443/proxy.pac',
'https://rebrand.ly/ac-antizapret-pac', 'https://rebrand.ly/ac-antizapret-pac',
], ],
}, },
@ -588,34 +588,6 @@
'handlers-ext-error', 'handlers-ext-error',
'handlers-no-control', 'handlers-no-control',
]; ];
if (!Object.keys(oldAntiCensorRu).length) {
const storage = await window.utils.promisedLocalStorage.get(null);
if (storage.version && window.apis.version.isLeq(storage.version, '0.0.1.48')) {
const ffxPacData = storage['firefox-only-pac-data'];
delete storage['firefox-only-pac-data'];
await window.utils.promisedLocalStorage.clear();
for(const key of otherKeys) {
await window.utils.promisedLocalStorage.set({ [key]: storage[key] });
delete storage[key];
}
await window.utils.promisedLocalStorage.set({ antiCensorRu: storage });
oldAntiCensorRu = storage;
}
}
if (oldAntiCensorRu.version && window.apis.version.isLeq(oldAntiCensorRu.version, '0.0.1.49')) {
const modsMutated = window.apis.pacKitchen.getPacModsRaw();
if (modsMutated && modsMutated.exceptions) {
modsMutated.exceptions = Object.entries(modsMutated.exceptions).reduce((acc, [host, ifProxy]) => {
acc[\`*.\${host}\`] = ifProxy;
return acc;
}, {});
await new Promise(
(resolve) => window.apis.pacKitchen.keepCookedNowAsync(modsMutated, resolve),
);
}
}
/* /*
Event handlers that ALWAYS work (even if installation is not done Event handlers that ALWAYS work (even if installation is not done
or failed). or failed).
@ -706,54 +678,9 @@
console.log('Updating from', oldAntiCensorRu.version, 'to', antiCensorRu.version); console.log('Updating from', oldAntiCensorRu.version, 'to', antiCensorRu.version);
try { try {
if (window.apis.version.isLeq(oldAntiCensorRu.version, '0.0.1.5')) { if (window.apis.version.isLeq(oldAntiCensorRu.version, '0.0.1.56')) {
window.apis.antiCensorRu.pacProviders['Антизапрет'].pacUrls[0] = 'https://antizapret.prostovpn.org:8443/proxy.pac';
// Change semicolons to semicolons followed by newlines in proxy string (raw). console.log('Successfully updated to 0.0.1.57.');
const migrateProxies = (oldStr) => oldStr.replace(/;\\r?\\n?/g, ';\\n');
const modsMutated = window.apis.pacKitchen.getPacModsRaw();
if (modsMutated) {
modsMutated['customProxyStringRaw'] = migrateProxies(modsMutated['customProxyStringRaw']);
await new Promise(
(resolve) => window.apis.pacKitchen.keepCookedNowAsync(modsMutated, resolve),
);
}
}
if (window.apis.version.isLeq(oldAntiCensorRu.version, '0.0.1.25')) {
console.log('Switch to Antizapret automatically, only from Anitcensority without own proxies.');
const provKey = antiCensorRu.getCurrentPacProviderKey();
if (provKey !== 'Антицензорити' && provKey !== 'Антизапрет') {
console.log('Current provider', provKey, '!== Anticensority or Antizapret');
return; // Not Anticensority.
}
const pacMods = window.apis.pacKitchen.getPacMods();
if (pacMods.filteredCustomsString) {
console.log('Proxies found:', pacMods.filteredCustomsString);
return; // Own proxies or Tor are used.
}
antiCensorRu.setCurrentPacProviderKey('Антизапрет');
antiCensorRu.setLastModified(0);
await new Promise((resolveSwitch) =>
antiCensorRu.syncWithPacProviderAsync((err, res, warns) => {
if (warns) {
console.log(warns);
}
if (err) {
console.log(
'Ungraceful update from 1.25: couldn\\'t fetch Antizapret:',
);
console.error(err);
} else {
console.log('Update from 1.25 applied successfully.');
}
resolveSwitch();
}),
);
} }
} catch (e) { } catch (e) {
// Log update error. // Log update error.

View File

@ -0,0 +1,46 @@
# For Reviewers
## Prerequirements
You need a globally installed `gulp-cli@2.3.0`.
See https://gulpjs.com/docs/en/getting-started/quick-start#install-the-gulp-command-line-utility.
## Steps
Steps to reproduce the same zip:
```
npm ci
cd src/extension-common/pages/options/
npm ci
cd -
npm start
# See ./build/extension-full
cd ./build/extension-full
zip -r runet-censorship-bypass-full.zip ./*
```
## Minified Files
### Ace Editor
https://ace.c9.io -> https://github.com/ajaxorg/ace -> Building Ace -> "The ace-builds repository endeavours to maintain the latest build" -> https://github.com/ajaxorg/ace-builds/ -> Select tag of 1.2.5, open https://github.com/ajaxorg/ace-builds/tree/v1.2.5/src-min and download the files you want to check.
```
mkdir downloaded
cd downloaded
wget https://raw.githubusercontent.com/ajaxorg/ace-builds/v1.2.5/src-min/ace.js
wget https://raw.githubusercontent.com/ajaxorg/ace-builds/v1.2.5/src-min/ext-searchbox.js
wget https://raw.githubusercontent.com/ajaxorg/ace-builds/v1.2.5/src-min/mode-javascript.js
wget https://raw.githubusercontent.com/ajaxorg/ace-builds/v1.2.5/src-min/worker-javascript.js
downloaded$ for i in ./*; do md5sum "$i"; done
2b9a1157bb3ba711a0402b6751d9ac71 ./ace.js
1f73efaff2853571af0e701c5e9a15ee ./ext-searchbox.js
e5eebd85c4e66667c28f124e6a07e3ed ./mode-javascript.js
f0d1342102d16ab7abe319b2683d10ea ./worker-javascript.js
```
## PAC-Script AntiZapret
https://antizapret.prostovpn.org/proxy.pac is generated by https://bitbucket.org/anticensority/antizapret-pac-generator-light/, reviewers may find justifications related to this PAC-script in that repo.

View File

@ -1 +0,0 @@
Files of this directory must be copied into final build without modifications.