mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-23 18:03:44 +03:00
Persist state between relaunches for Firefox
This commit is contained in:
parent
a35ab098d4
commit
4738bcf9af
|
@ -256,11 +256,13 @@
|
|||
|
||||
if (!chrome.proxy.settings) {
|
||||
|
||||
let currentSettings = {};
|
||||
const ffxStore = window.utils.createStorage('firefox-only');
|
||||
|
||||
|
||||
chrome.proxy.settings = {
|
||||
get: (_, cb) => {
|
||||
|
||||
let currentSettings = ffxStore('proxySettings') || {};
|
||||
currentSettings.levelOfControl = 'controlled_by_this_extension'; // May be lie, but this field is required.
|
||||
cb(currentSettings);
|
||||
|
||||
|
@ -274,14 +276,19 @@
|
|||
browser.proxy.register('./default.pac.js');
|
||||
|
||||
|
||||
browser.proxy.onProxyError.addListener((...err) => { console.log('ERROR IN PAC:', ...err) });
|
||||
// browser.proxy.onProxyError.addListener((...err) => { console.log('ERROR IN PAC:', ...err) });
|
||||
|
||||
browser.runtime.sendMessage(details, {toProxyScript: true});
|
||||
currentSettings = details;
|
||||
ffxStore('proxySettings', details);
|
||||
cb();
|
||||
|
||||
},
|
||||
};
|
||||
const proxySettings = ffxStore('proxySettings');
|
||||
if (proxySettings) {
|
||||
chrome.proxy.settings.set(proxySettings);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -242,12 +242,6 @@
|
|||
|
||||
},
|
||||
|
||||
clearLastModified() {
|
||||
|
||||
this.setLastModified(0);
|
||||
|
||||
},
|
||||
|
||||
mustBeKey(key = mandatory()) {
|
||||
|
||||
if ( !(key === null || this.pacProviders[key]) ) {
|
||||
|
@ -525,10 +519,6 @@
|
|||
// LAUNCH, RELOAD, ENABLE
|
||||
antiCensorRu.pacProviders = oldStorage.pacProviders;
|
||||
console.log('Extension launched, reloaded or enabled.');
|
||||
if (window.apis.platform.ifFirefox) {
|
||||
antiCensorRu.clearLastModified();
|
||||
await new Promise((r) => antiCensorRu.syncWithPacProviderAsync(r)); // On each launch, ffx has no memory.
|
||||
}
|
||||
return resolve();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user