mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2025-01-31 20:04:11 +03:00
Restyle
This commit is contained in:
parent
f98c81ff84
commit
44af8bd85a
|
@ -11,7 +11,9 @@
|
||||||
const modsKey = 'mods';
|
const modsKey = 'mods';
|
||||||
|
|
||||||
let proxyHostToCredsList = {};
|
let proxyHostToCredsList = {};
|
||||||
const ifAuthSupported = chrome.webRequest && chrome.webRequest.onAuthRequired && !globalThis.apis.version.ifMini;
|
const ifAuthSupported = chrome.webRequest &&
|
||||||
|
chrome.webRequest.onAuthRequired &&
|
||||||
|
!globalThis.apis.version.ifMini;
|
||||||
if (ifAuthSupported) {
|
if (ifAuthSupported) {
|
||||||
|
|
||||||
const requestIdToTries = {};
|
const requestIdToTries = {};
|
||||||
|
@ -202,8 +204,8 @@
|
||||||
.reduce((arr, key) => {
|
.reduce((arr, key) => {
|
||||||
|
|
||||||
const conf = configs[key];
|
const conf = configs[key];
|
||||||
if(typeof(conf.order) === 'number') {
|
if (typeof(conf.order) === 'number') {
|
||||||
if(!category || category === (conf.category || 'general')) {
|
if (!category || category === (conf.category || 'general')) {
|
||||||
conf.value = pacMods[key];
|
conf.value = pacMods[key];
|
||||||
conf.key = key;
|
conf.key = key;
|
||||||
conf.category = category || 'general';
|
conf.category = category || 'general';
|
||||||
|
@ -229,7 +231,8 @@
|
||||||
Boolean(configs[dProp].dflt) !== Boolean(mods[dProp])
|
Boolean(configs[dProp].dflt) !== Boolean(mods[dProp])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
const ifMods = configs[dProp].ifDfltMods; // If default value implies PAC-script modification.
|
const ifMods = configs[dProp].ifDfltMods;
|
||||||
|
// If default value implies PAC-script modification.
|
||||||
return ifDflt ? !ifMods : ifMods;
|
return ifDflt ? !ifMods : ifMods;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -279,7 +282,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
proxyHostToCredsList = {};
|
proxyHostToCredsList = {};
|
||||||
protectedProxies.forEach(({ hostname, port, username, password }) => {
|
protectedProxies.forEach(({hostname, port, username, password}) => {
|
||||||
|
|
||||||
proxyHostToCredsList[`${hostname}:${port}`] =
|
proxyHostToCredsList[`${hostname}:${port}`] =
|
||||||
proxyHostToCredsList[`${hostname}:${port}`] || [];
|
proxyHostToCredsList[`${hostname}:${port}`] || [];
|
||||||
|
@ -317,7 +320,7 @@
|
||||||
if (self.ifMindExceptions && self.exceptions) {
|
if (self.ifMindExceptions && self.exceptions) {
|
||||||
self.included = [];
|
self.included = [];
|
||||||
self.excluded = [];
|
self.excluded = [];
|
||||||
for(const host of Object.keys(self.exceptions)) {
|
for (const host of Object.keys(self.exceptions)) {
|
||||||
const ifProxy = self.exceptions[host] || false;
|
const ifProxy = self.exceptions[host] || false;
|
||||||
if (ifProxy) {
|
if (ifProxy) {
|
||||||
self.included.push(host);
|
self.included.push(host);
|
||||||
|
@ -335,7 +338,7 @@
|
||||||
});
|
});
|
||||||
if (self.included.length && !self.filteredCustomsString) {
|
if (self.included.length && !self.filteredCustomsString) {
|
||||||
return [null, self, new TypeError(
|
return [null, self, new TypeError(
|
||||||
'Имеются сайты, добавленные вручную. Они проксироваться не будут, т.к. нет СВОИХ проски, удовлетворяющих вашим требованиям! Если прокси всё же имеются, то проверьте требования (модификаторы).'
|
'Имеются сайты, добавленные вручную. Они проксироваться не будут, т.к. нет СВОИХ проски, удовлетворяющих вашим требованиям! Если прокси всё же имеются, то проверьте требования (модификаторы).',
|
||||||
)];
|
)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,7 +356,7 @@
|
||||||
|
|
||||||
pacData = pacData.replace(
|
pacData = pacData.replace(
|
||||||
new RegExp(kitchenStartsMark + '[\\s\\S]*$', 'g'),
|
new RegExp(kitchenStartsMark + '[\\s\\S]*$', 'g'),
|
||||||
''
|
'',
|
||||||
);
|
);
|
||||||
/a/.test('a'); // GC RegExp.input and friends.
|
/a/.test('a'); // GC RegExp.input and friends.
|
||||||
|
|
||||||
|
@ -470,9 +473,9 @@
|
||||||
/******/ return "DIRECT";
|
/******/ return "DIRECT";
|
||||||
/******/ }
|
/******/ }
|
||||||
/******/ // Always proxy it!
|
/******/ // Always proxy it!
|
||||||
${ pacMods.filteredCustomsString
|
${ pacMods.filteredCustomsString ?
|
||||||
? `/******/ return filteredCustomProxies + "; " + directIfAllowed;`
|
`/******/ return filteredCustomProxies + "; " + directIfAllowed;` :
|
||||||
: '/******/ /* No custom proxies -- continue. */'
|
'/******/ /* No custom proxies -- continue. */'
|
||||||
}
|
}
|
||||||
/******/ }
|
/******/ }
|
||||||
/******/ /* EXCEPTIONS END */
|
/******/ /* EXCEPTIONS END */
|
||||||
|
@ -484,7 +487,7 @@ ${ pacMods.filteredCustomsString
|
||||||
? '.replace(/DIRECT/g, "")'
|
? '.replace(/DIRECT/g, "")'
|
||||||
: ' + "; " + directIfAllowed'
|
: ' + "; " + directIfAllowed'
|
||||||
};`;
|
};`;
|
||||||
if(
|
if (
|
||||||
!pacMods.ifUseSecureProxiesOnly &&
|
!pacMods.ifUseSecureProxiesOnly &&
|
||||||
!pacMods.filteredCustomsString &&
|
!pacMods.filteredCustomsString &&
|
||||||
pacMods.ifUsePacScriptProxies
|
pacMods.ifUsePacScriptProxies
|
||||||
|
@ -502,9 +505,9 @@ ${ pacMods.filteredCustomsString
|
||||||
/******/ return "DIRECT";
|
/******/ return "DIRECT";
|
||||||
/******/ }
|
/******/ }
|
||||||
/******/ return ` +
|
/******/ return ` +
|
||||||
((pacMods.filteredCustomsString && !pacMods.ifUseOwnProxiesOnlyForOwnSites)
|
((pacMods.filteredCustomsString && !pacMods.ifUseOwnProxiesOnlyForOwnSites) ?
|
||||||
? 'filteredCustomProxies + "; " + '
|
'filteredCustomProxies + "; " + ' :
|
||||||
: ''
|
''
|
||||||
) +
|
) +
|
||||||
function() {
|
function() {
|
||||||
|
|
||||||
|
@ -525,9 +528,9 @@ ${ pacMods.filteredCustomsString
|
||||||
|
|
||||||
/******/ };
|
/******/ };
|
||||||
${
|
${
|
||||||
!pacMods.replaceDirectWith
|
!pacMods.replaceDirectWith ?
|
||||||
? ''
|
'' :
|
||||||
: `
|
`
|
||||||
/******/ const oldTmp = tmp;
|
/******/ const oldTmp = tmp;
|
||||||
/******/ tmp = function(url, host) {
|
/******/ tmp = function(url, host) {
|
||||||
/******/ const ip = dnsResolve(host);
|
/******/ const ip = dnsResolve(host);
|
||||||
|
@ -579,9 +582,9 @@ ${
|
||||||
|
|
||||||
new Promise((resolve) =>
|
new Promise((resolve) =>
|
||||||
|
|
||||||
details
|
details ?
|
||||||
? resolve(details)
|
resolve(details) :
|
||||||
: chrome.proxy.settings.get({}, timeouted(resolve) ),
|
chrome.proxy.settings.get({}, timeouted(resolve) ),
|
||||||
|
|
||||||
).then((details) => {
|
).then((details) => {
|
||||||
|
|
||||||
|
@ -606,7 +609,11 @@ ${
|
||||||
checkIncontinence(details) {
|
checkIncontinence(details) {
|
||||||
|
|
||||||
if ( kitchenState(ifIncontinence) ) {
|
if ( kitchenState(ifIncontinence) ) {
|
||||||
this.setNowAsync(details, (err) => { if (err) { throw err; } }); // TODO: suppress?
|
this.setNowAsync(details, (err) => {
|
||||||
|
if (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}); // TODO: suppress?
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,7 +8,7 @@ import getApp from './components/App';
|
||||||
|
|
||||||
chrome.runtime.getBackgroundPage( (bgWindow) =>
|
chrome.runtime.getBackgroundPage( (bgWindow) =>
|
||||||
bgWindow.apis.errorHandlers.installListenersOn(
|
bgWindow.apis.errorHandlers.installListenersOn(
|
||||||
window, 'PUP', async() => {
|
window, 'PUP', async () => {
|
||||||
/*
|
/*
|
||||||
`Extension context invalidated` error is thrown if `window.closed` is true and call to
|
`Extension context invalidated` error is thrown if `window.closed` is true and call to
|
||||||
`window.chrome.i18n` or other `window.chrome` api happens. Use bgWindow.chrome instead.
|
`window.chrome.i18n` or other `window.chrome` api happens. Use bgWindow.chrome instead.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user