mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2025-02-12 09:40:38 +03:00
Fix several errors caused by migration to mv3 (storage, blocking requests, top level await, <all_urls>)
This commit is contained in:
parent
5a66e5b350
commit
0116f18c70
|
@ -146,7 +146,8 @@ console.log('Extension started.');
|
||||||
}
|
}
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
const item = await storage.get(key);
|
const item = await storage.get(key);
|
||||||
return item && JSON.parse(item);
|
console.log('ITEM:', item);
|
||||||
|
return item;
|
||||||
}
|
}
|
||||||
if (value instanceof Date) {
|
if (value instanceof Date) {
|
||||||
throw new TypeError('Converting Date format to JSON is not supported.');
|
throw new TypeError('Converting Date format to JSON is not supported.');
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
{urls: ['<all_urls>']},
|
{urls: ['<all_urls>']},
|
||||||
['blocking'],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const forgetRequestId = (details) => {
|
const forgetRequestId = (details) => {
|
||||||
|
|
|
@ -137,7 +137,7 @@
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err.message === 'proxy.settings requires private browsing permission.') {
|
if (err.message === 'proxy.settings requires private browsing permission.') {
|
||||||
clarifyThen(
|
clarifyThen(
|
||||||
chrome.i18n.getMessage('AllowExtensionToRunInPrivateWindows'),
|
chrome.i18n.getMessage('AllowExtensionToRunInPrivateglobalThiss'),
|
||||||
cb,
|
cb,
|
||||||
)(err);
|
)(err);
|
||||||
return;
|
return;
|
||||||
|
@ -677,8 +677,8 @@
|
||||||
|
|
||||||
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.59')) {
|
if (globalThis.apis.version.isLeq(oldAntiCensorRu.version, '0.0.1.59')) {
|
||||||
window.apis.antiCensorRu.pacProviders['Антизапрет'].pacUrls = [
|
globalThis.apis.antiCensorRu.pacProviders['Антизапрет'].pacUrls = [
|
||||||
'https://antizapret.prostovpn.org:8443/proxy.pac',
|
'https://antizapret.prostovpn.org:8443/proxy.pac',
|
||||||
'https://antizapret.prostovpn.org:18443/proxy.pac',
|
'https://antizapret.prostovpn.org:18443/proxy.pac',
|
||||||
'https://antizapret.prostovpn.org/proxy.pac',
|
'https://antizapret.prostovpn.org/proxy.pac',
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
'use strict';
|
/* Not used.
|
||||||
|
{
|
||||||
chrome.commands.onCommand.addListener((command) => {
|
chrome.commands.onCommand.addListener((command) => {
|
||||||
if (command === 'toggle-pac-script') {
|
if (command === 'toggle-pac-script') {
|
||||||
console.log("Toggling PAC-script!");
|
console.log('Toggling PAC-script!');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
, "alarms"
|
, "alarms"
|
||||||
, "storage"
|
, "storage"
|
||||||
, "unlimitedStorage"
|
, "unlimitedStorage"
|
||||||
, "<all_urls>"
|
|
||||||
, "tabs"
|
, "tabs"
|
||||||
, "contextMenus"
|
, "contextMenus"
|
||||||
, "notifications"
|
, "notifications"
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
|
|
||||||
|
(async () => {
|
||||||
const chromified = globalThis.utils.chromified;
|
const chromified = globalThis.utils.chromified;
|
||||||
|
|
||||||
const lastErrors = [];
|
const lastErrors = [];
|
||||||
const lastErrorsLength = 20;
|
const lastErrorsLength = 20;
|
||||||
|
|
||||||
const state = await globalThis.utils.createstate('err-to-exc');
|
const state = await globalThis.utils.createStorage('err-to-exc');
|
||||||
const IF_COLL_KEY = 'if-coll';
|
const IF_COLL_KEY = 'if-coll';
|
||||||
|
|
||||||
|
|
||||||
const privates = {
|
const privates = {
|
||||||
ifCollecting: (await state.get(IF_COLL_KEY)) || false,
|
ifCollecting: (await state(IF_COLL_KEY)) || false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const that = globalThis.apis.lastNetErrors = {
|
const that = globalThis.apis.lastNetErrors = {
|
||||||
|
@ -22,7 +23,7 @@ const that = globalThis.apis.lastNetErrors = {
|
||||||
set ifCollecting(newValue) {
|
set ifCollecting(newValue) {
|
||||||
|
|
||||||
privates.ifCollecting = newValue;
|
privates.ifCollecting = newValue;
|
||||||
state.set(IF_COLL_KEY, newValue);
|
state(IF_COLL_KEY, newValue);
|
||||||
|
|
||||||
},
|
},
|
||||||
get: () => lastErrors,
|
get: () => lastErrors,
|
||||||
|
@ -51,3 +52,4 @@ chrome.webRequest.onErrorOccurred.addListener(chromified((err/* Ignored */, deta
|
||||||
|
|
||||||
}), {urls: ['<all_urls>']},
|
}), {urls: ['<all_urls>']},
|
||||||
);
|
);
|
||||||
|
})();
|
||||||
|
|
|
@ -16,7 +16,7 @@ const commonContext = {
|
||||||
|
|
||||||
const contexts = {};
|
const contexts = {};
|
||||||
|
|
||||||
const extraPermissions = ', "webRequest", "webRequestBlocking", "webNavigation"';
|
const extraPermissions = ', "webRequest", "webNavigation"';
|
||||||
|
|
||||||
contexts.full = Object.assign({}, commonContext, {
|
contexts.full = Object.assign({}, commonContext, {
|
||||||
manifestVersion: '3',
|
manifestVersion: '3',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user