Resolve recent merge conflicts. Fix typos in the recent refactoring

This commit is contained in:
ilyaigpetrov 2023-05-03 19:48:58 +05:00
parent ee4bf3cb0a
commit a166e70884
2 changed files with 3 additions and 109 deletions

View File

@ -136,12 +136,8 @@
if (err) { if (err) {
if (err.message === 'proxy.settings requires private browsing permission.') { if (err.message === 'proxy.settings requires private browsing permission.') {
<<<<<<< HEAD:extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.tmpl.mjs
// globalThis.utils.openAndFocus('https://rebrand.ly/ac-allow-private-globalThiss');
=======
>>>>>>> development:extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.tmpl.js
clarifyThen( clarifyThen(
chrome.i18n.getMessage('AllowExtensionToRunInPrivateglobalThiss'), chrome.i18n.getMessage('AllowExtensionToRunInPrivateWindows'),
cb, cb,
)(err); )(err);
return; return;
@ -302,7 +298,7 @@
order: 1, order: 1,
/* /*
Don't use in system configs! Because globalThiss does poor caching. Don't use in system configs! Because globalThis does poor caching.
Some urls are encoded to counter abuse. Some urls are encoded to counter abuse.
Version: 0.17 Version: 0.17
*/ */
@ -591,37 +587,6 @@
'handlers-ext-error', 'handlers-ext-error',
'handlers-no-control', 'handlers-no-control',
]; ];
<<<<<<< HEAD:extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.tmpl.mjs
if (!Object.keys(oldAntiCensorRu).length) {
const storage = await globalThis.utils.promisedLocalStorage.get(null);
if (storage.version && globalThis.apis.version.isLeq(storage.version, '0.0.1.48')) {
const ffxPacData = storage['firefox-only-pac-data'];
delete storage['firefox-only-pac-data'];
await globalThis.utils.promisedLocalStorage.clear();
for(const key of otherKeys) {
await globalThis.utils.promisedLocalStorage.set({ [key]: storage[key] });
delete storage[key];
}
await globalThis.utils.promisedLocalStorage.set({ antiCensorRu: storage });
oldAntiCensorRu = storage;
}
}
if (oldAntiCensorRu.version && globalThis.apis.version.isLeq(oldAntiCensorRu.version, '0.0.1.49')) {
const modsMutated = globalThis.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) => globalThis.apis.pacKitchen.keepCookedNowAsync(modsMutated, resolve),
);
}
}
=======
>>>>>>> development:extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.tmpl.js
/* /*
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).
@ -712,56 +677,6 @@
console.log('Updating from', oldAntiCensorRu.version, 'to', antiCensorRu.version); console.log('Updating from', oldAntiCensorRu.version, 'to', antiCensorRu.version);
try { try {
<<<<<<< HEAD:extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.tmpl.mjs
if (globalThis.apis.version.isLeq(oldAntiCensorRu.version, '0.0.1.5')) {
// Change semicolons to semicolons followed by newlines in proxy string (raw).
const migrateProxies = (oldStr) => oldStr.replace(/;\\r?\\n?/g, ';\\n');
const modsMutated = globalThis.apis.pacKitchen.getPacModsRaw();
if (modsMutated) {
modsMutated['customProxyStringRaw'] = migrateProxies(modsMutated['customProxyStringRaw']);
await new Promise(
(resolve) => globalThis.apis.pacKitchen.keepCookedNowAsync(modsMutated, resolve),
);
}
}
if (globalThis.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 = globalThis.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();
}),
);
=======
if (window.apis.version.isLeq(oldAntiCensorRu.version, '0.0.1.57')) { if (window.apis.version.isLeq(oldAntiCensorRu.version, '0.0.1.57')) {
const azWithPort = 'https://antizapret.prostovpn.org:8443/proxy.pac'; const azWithPort = 'https://antizapret.prostovpn.org:8443/proxy.pac';
const azWithPortAlt = 'https://antizapret.prostovpn.org:18443/proxy.pac'; const azWithPortAlt = 'https://antizapret.prostovpn.org:18443/proxy.pac';
@ -769,7 +684,6 @@
urls[0] = 'https://antizapret.prostovpn.org/proxy.pac'; urls[0] = 'https://antizapret.prostovpn.org/proxy.pac';
urls.unshift(azWithPort, azWithPortAlt); urls.unshift(azWithPort, azWithPortAlt);
console.log('Successfully updated to 0.0.1.58.'); console.log('Successfully updated to 0.0.1.58.');
>>>>>>> development:extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.tmpl.js
} }
} catch (e) { } catch (e) {
// Log update error. // Log update error.

View File

@ -31,27 +31,7 @@
} }
}, },
<<<<<<< HEAD
${background}, ${background},
=======
"background": {
${persistent}
"scripts": [
"00-init-apis.js"
${scripts_0x}
, "11-error-handlers-api.js"
, "12-errors-lib.js"
, "13-http-lib.js"
, "15-firefox-proxy-settings.js"
${scripts_2x}
, "35-pac-kitchen-api.js"
, "37-sync-pac-script-with-pac-provider-api.js"
${scripts_8x}
, "70-menu-items.js"
, "75-context-menus.js"
]
},
>>>>>>> development
"${action}": { "${action}": {
"default_title": "Этот сайт благословлён | Версия ${version + versionSuffix}", "default_title": "Этот сайт благословлён | Версия ${version + versionSuffix}",