mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-24 10:23:43 +03:00
bump 0.0.0.5
This commit is contained in:
parent
7947a01d73
commit
5ea4cb1a25
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
"name": "Ненавязчивый РосКомНадзор",
|
"name": "Ненавязчивый РосКомНадзор",
|
||||||
"description": "Аргументы против цензуры: https://git.io/vEkI9",
|
"description": "Аргументы против цензуры: https://git.io/vEkI9",
|
||||||
"version": "0.0.0.4",
|
"version": "0.0.0.5",
|
||||||
"icons": {
|
"icons": {
|
||||||
"128": "/icons/rkn-empty.png"
|
"128": "/icons/rkn-empty.png"
|
||||||
},
|
},
|
||||||
|
|
|
@ -28,11 +28,13 @@ window.antiCensorRu = {
|
||||||
},
|
},
|
||||||
Антиценз: {
|
Антиценз: {
|
||||||
pacUrl: 'https://config.anticenz.org/proxy.pac',
|
pacUrl: 'https://config.anticenz.org/proxy.pac',
|
||||||
proxyHosts: ['gw2.anticenz.org']
|
proxyHosts: ['gw2.anticenz.org'],
|
||||||
|
proxyIps: {'185.120.5.7': true}
|
||||||
},
|
},
|
||||||
Оба_и_на_свитчах: {
|
Оба_и_на_свитчах: {
|
||||||
pacUrl: 'https://drive.google.com/uc?export=download&id=0B-ZCVSvuNWf0akpCOURNS2VCTmc',
|
pacUrl: 'https://drive.google.com/uc?export=download&id=0B-ZCVSvuNWf0akpCOURNS2VCTmc',
|
||||||
proxyHosts: ['gw2.anticenz.org', 'proxy.antizapret.prostovpn.org']
|
proxyHosts: ['gw2.anticenz.org', 'proxy.antizapret.prostovpn.org'],
|
||||||
|
proxyIps: {'195.154.110.37': true, '185.120.5.7': true}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -85,6 +87,8 @@ window.antiCensorRu = {
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_periodicUpdateAlarmReason: 'Периодичное обновление PAC-скрипта Антизапрет',
|
||||||
|
|
||||||
installPac(key, cb) {
|
installPac(key, cb) {
|
||||||
|
|
||||||
if(typeof(key) === 'function') {
|
if(typeof(key) === 'function') {
|
||||||
|
@ -96,18 +100,12 @@ window.antiCensorRu = {
|
||||||
this.currentPacProviderKey = key;
|
this.currentPacProviderKey = key;
|
||||||
|
|
||||||
var cb = asyncLogGroup('Installing PAC...', cb);
|
var cb = asyncLogGroup('Installing PAC...', cb);
|
||||||
var reason = 'Периодичное обновление PAC-скрипта Антизапрет';
|
|
||||||
|
|
||||||
chrome.alarms.onAlarm.addListener(
|
chrome.alarms.clear(this._periodicUpdateAlarmReason,
|
||||||
alarm => {
|
() => chrome.alarms.create(this._periodicUpdateAlarmReason, {
|
||||||
if (alarm.name === reason)
|
|
||||||
this.syncWithPacProvider();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
chrome.alarms.create(reason, {
|
|
||||||
periodInMinutes: 4*60
|
periodInMinutes: 4*60
|
||||||
});
|
})
|
||||||
|
);
|
||||||
|
|
||||||
this.syncWithPacProvider(cb);
|
this.syncWithPacProvider(cb);
|
||||||
},
|
},
|
||||||
|
@ -125,24 +123,48 @@ window.antiCensorRu = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
chrome.runtime.onStartup.addListener( () => {
|
window.ifPulled = false;
|
||||||
console.log('Starting...');
|
window.onPulled = () => {};
|
||||||
window.antiCensorRu.pullFromStorage(
|
|
||||||
() =>
|
|
||||||
chrome.storage.onChanged.addListener( () => window.antiCensorRu.pullFromStorage() )
|
|
||||||
)
|
|
||||||
});
|
|
||||||
|
|
||||||
chrome.runtime.onInstalled.addListener( details => {
|
chrome.runtime.onInstalled.addListener( details => {
|
||||||
console.log('Installing...');
|
console.log('Installing, reason:', details.reason);
|
||||||
|
var myOnPulled;
|
||||||
switch(details.reason) {
|
switch(details.reason) {
|
||||||
case 'update':
|
case 'update':
|
||||||
window.antiCensorRu.installPac();
|
myOnPulled = () => window.antiCensorRu.installPac();
|
||||||
break;
|
break;
|
||||||
case 'install':
|
case 'install':
|
||||||
|
myOnPulled = () => {
|
||||||
window.antiCensorRu.ifNotInstalled = true;
|
window.antiCensorRu.ifNotInstalled = true;
|
||||||
chrome.runtime.openOptionsPage();
|
chrome.runtime.openOptionsPage();
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
myOnPulled = () => {};
|
||||||
}
|
}
|
||||||
|
if (window.ifPulled)
|
||||||
|
myOnPulled();
|
||||||
|
else {
|
||||||
|
var _onPulled = window.onPulled;
|
||||||
|
window.onPulled = () => {_onPulled(); myOnPulled()};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
window.antiCensorRu.pullFromStorage( () => {
|
||||||
|
console.log('Pulled from storage.');
|
||||||
|
|
||||||
|
chrome.alarms.onAlarm.addListener(
|
||||||
|
alarm => {
|
||||||
|
if (alarm.name === window.antiCensorRu._periodicUpdateAlarmReason) {
|
||||||
|
console.log('Periodic update triggered.');
|
||||||
|
window.antiCensorRu.syncWithPacProvider();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
console.log('Installed alarm listener.');
|
||||||
|
|
||||||
|
window.onPulled();
|
||||||
|
window.ifPulled = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
// PRIVATE
|
// PRIVATE
|
||||||
|
@ -189,8 +211,7 @@ function updatePacProxyIps(provider, cb) {
|
||||||
provider.proxyIps = provider.proxyIps || {};
|
provider.proxyIps = provider.proxyIps || {};
|
||||||
provider.proxyIps[ JSON.parse(res).answer[0].rdata ] = true;
|
provider.proxyIps[ JSON.parse(res).answer[0].rdata ] = true;
|
||||||
}
|
}
|
||||||
++i;
|
if ( ++i == provider.proxyHosts.length )
|
||||||
if ( i == provider.proxyHosts.length )
|
|
||||||
return cb(err, 'Complete.');
|
return cb(err, 'Complete.');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user