Refactor slightly, change badge color

This commit is contained in:
Ilya Ig. Petrov 2016-11-12 06:35:50 -08:00
parent cf448ee3e2
commit 0aeae88bc4
3 changed files with 16 additions and 22 deletions

View File

@ -35,8 +35,8 @@ window.antiCensorRu = {
} }
}, },
Обаа_свитчах: { Обаа_свитчах: {
pacUrl: 'https://drive.google.com/uc?export=download&id=0B-ZCVSvuNWf0akpCOURNS2VCTmc', //pacUrl: 'https://drive.google.com/uc?export=download&id=0B-ZCVSvuNWf0akpCOURNS2VCTmc',
//pacUrl: 'https://drive.google.com/uc?export=download&id=0B-ZCVSvuNWf0WGczNmJzY3gzMWc', // Beta pacUrl: 'https://drive.google.com/uc?export=download&id=0B-ZCVSvuNWf0WGczNmJzY3gzMWc', // Beta
proxyHosts: ['proxy.antizapret.prostovpn.org', 'gw2.anticenz.org'], proxyHosts: ['proxy.antizapret.prostovpn.org', 'gw2.anticenz.org'],
proxyIps: { proxyIps: {
'195.123.209.38': 'proxy.antizapret.prostovpn.org', '195.123.209.38': 'proxy.antizapret.prostovpn.org',
@ -256,20 +256,14 @@ chrome.storage.local.get(null, (oldStorage) => {
} }
/* /*
History of Changes to Storage (Migration Guide) History of Changes to Storage (Migration Guide)
----------------------------------------------- -----------------------------------------------
Version 0.0.0.10 Version 0.0.0.10
* Added this.version * Added this.version
* PacProvider.proxyIps changed from {ip -> Boolean} to {ip -> hostname} * PacProvider.proxyIps changed from {ip -> Boolean} to {ip -> hostname}
Version 0.0.0.8-9 Version 0.0.0.8-9
* Changed storage.ifNotInstalled to storage.ifFirstInstall * Changed storage.ifNotInstalled to storage.ifFirstInstall
* Added storage.lastPacUpdateStamp * Added storage.lastPacUpdateStamp
**/ **/
}); });
@ -283,6 +277,7 @@ function asyncLogGroup() {
console.groupEnd(); console.groupEnd();
console.log('Group finished.'); console.log('Group finished.');
return cb.apply(this, arguments); return cb.apply(this, arguments);
} }
} }
@ -445,7 +440,7 @@ function setPacScriptFromProvider(provider, cb) {
httpGet( httpGet(
provider.pacUrl, provider.pacUrl,
(err, res) => { (err, pacData) => {
if (err) { if (err) {
err.clarification = { err.clarification = {
@ -454,6 +449,7 @@ function setPacScriptFromProvider(provider, cb) {
}; };
return cb(err); return cb(err);
} }
console.log('Clearing chrome proxy settings...'); console.log('Clearing chrome proxy settings...');
return chrome.proxy.settings.clear({}, () => { return chrome.proxy.settings.clear({}, () => {
@ -461,7 +457,7 @@ function setPacScriptFromProvider(provider, cb) {
mode: 'pac_script', mode: 'pac_script',
pacScript: { pacScript: {
mandatory: false, mandatory: false,
data: res data: pacData
} }
}; };
console.log('Setting chrome proxy settings...'); console.log('Setting chrome proxy settings...');

View File

@ -12,13 +12,11 @@
Crazy parallel Chrome. Crazy parallel Chrome.
**/ **/
window.tabWithError2ip = {}; // For errors only: Error? -> Check this IP! window.chrome.browserAction.setBadgeBackgroundColor({
color: '#D00000'
});
function createLink(url) { window.tabWithError2ip = {}; // For errors only: Error? -> Check this IP!
const a = document.createElement('a');
a.href = url;
return a;
}
+function() { +function() {
@ -83,7 +81,7 @@ function createLink(url) {
var ifTitleSetAlready = /\n/.test(title); var ifTitleSetAlready = /\n/.test(title);
var proxyHost = window.antiCensorRu.pacProvider.proxyIps[ requestDetails.ip ]; var proxyHost = window.antiCensorRu.pacProvider.proxyIps[ requestDetails.ip ];
var hostname = createLink( requestDetails.url ).hostname; var hostname = new URL( requestDetails.url ).hostname;
var ifShouldUpdateTitle = false; var ifShouldUpdateTitle = false;
var indent = ' '; var indent = ' ';

View File

@ -3,12 +3,12 @@
"name": "Обход блокировок Рунета", "name": "Обход блокировок Рунета",
"description": "Аргументы против цензуры: https://git.io/vEkI9", "description": "Аргументы против цензуры: https://git.io/vEkI9",
"version": "0.0.0.14", "version": "0.0.0.15",
"icons": { "icons": {
"128": "/icons/ribbon128.png" "128": "/icons/ribbon128.png"
}, },
"author": "ilyaigpetrov@gmail.com", "author": "ilyaigpetrov@gmail.com",
"homepage_url": "https://github.com/ilyaigpetrov/anti-censorship-russia", "homepage_url": "https://github.com/anticensorship-russia/chromium-extension",
"permissions": [ "permissions": [
"proxy", "proxy",
@ -23,7 +23,7 @@
"scripts": ["1-sync-pac-script-with-pac-provider.js", "2-block-informer.js", "3-context-menus.js"] "scripts": ["1-sync-pac-script-with-pac-provider.js", "2-block-informer.js", "3-context-menus.js"]
}, },
"browser_action": { "browser_action": {
"default_title": "Этот сайт благословлён РКН", "default_title": "Этот сайт благословлён",
"default_popup": "/pages/choose-pac-provider/index.html" "default_popup": "/pages/choose-pac-provider/index.html"
}, },
"options_ui": { "options_ui": {