diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/35-pac-kitchen-api.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/35-pac-kitchen-api.js
index 72f6ae8..80ede86 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/35-pac-kitchen-api.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/35-pac-kitchen-api.js
@@ -214,7 +214,7 @@
});
if (self.included.length && !self.filteredCustomsString) {
return [null, self, new TypeError(
- 'Имеются сайты, добавленные вручную. Они проксироваться не будут, т.к. нет СВОИХ проски, удовлетворяющих вашим запросам!'
+ 'Имеются сайты, добавленные вручную. Они проксироваться не будут, т.к. нет СВОИХ проски, удовлетворяющих вашим требованиям! Если прокси всё же имеются, то проверьте требования (модификаторы).'
)];
}
}
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.js
index c09c197..5706775 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.js
@@ -193,13 +193,16 @@
// First official, shortened:
'https://rebrand.ly/ac-chrome-anticensority-pac',
// Second official, Cloud Flare with caching:
+ 'https://anticensority.tk/generated-pac-scripts/anticensority.pac',
+ // GitHub.io (anticensority):
+ '\x68\x74\x74\x70\x73\x3a\x2f\x2f\x61\x6e\x74\x69\x63\x65\x6e\x73\x6f\x72\x69\x74\x79\x2e\x67\x69\x74\x68\x75\x62\x2e\x69\x6f\x2f\x67\x65\x6e\x65\x72\x61\x74\x65\x64\x2d\x70\x61\x63\x2d\x73\x63\x72\x69\x70\x74\x73\x2f\x61\x6e\x74\x69\x63\x65\x6e\x73\x6f\x72\x69\x74\x79\x2e\x70\x61\x63',
+ // GitHub repo (anticensority):
+ '\x68\x74\x74\x70\x73\x3a\x2f\x2f\x72\x61\x77\x2e\x67\x69\x74\x68\x75\x62\x75\x73\x65\x72\x63\x6f\x6e\x74\x65\x6e\x74\x2e\x63\x6f\x6d\x2f\x61\x6e\x74\x69\x63\x65\x6e\x73\x6f\x72\x69\x74\x79\x2f\x67\x65\x6e\x65\x72\x61\x74\x65\x64\x2d\x70\x61\x63\x2d\x73\x63\x72\x69\x70\x74\x73\x2f\x6d\x61\x73\x74\x65\x72\x2f\x61\x6e\x74\x69\x63\x65\x6e\x73\x6f\x72\x69\x74\x79\x2e\x70\x61\x63',
+ // Old, deprecated:
'https://anticensorship-russia.tk/generated-pac-scripts/anticensority.pac',
- // GitHub.io:
- '\x68\x74\x74\x70\x73\x3a\x2f\x2f\x61\x6e\x74\x69\x63\x65\x6e\x73\x6f\x72\x73\x68\x69\x70\x2d\x72\x75\x73\x73\x69\x61\x2e\x67\x69\x74\x68\x75\x62\x2e\x69\x6f\x2f\x67\x65\x6e\x65\x72\x61\x74\x65\x64\x2d\x70\x61\x63\x2d\x73\x63\x72\x69\x70\x74\x73\x2f\x61\x6e\x74\x69\x63\x65\x6e\x73\x6f\x72\x69\x74\x79\x2e\x70\x61\x63', // eslint-disable-line max-len
- // GitHub repo:
- '\x68\x74\x74\x70\x73\x3a\x2f\x2f\x72\x61\x77\x2e\x67\x69\x74\x68\x75\x62\x75\x73\x65\x72\x63\x6f\x6e\x74\x65\x6e\x74\x2e\x63\x6f\x6d\x2f\x61\x6e\x74\x69\x63\x65\x6e\x73\x6f\x72\x73\x68\x69\x70\x2d\x72\x75\x73\x73\x69\x61\x2f\x67\x65\x6e\x65\x72\x61\x74\x65\x64\x2d\x70\x61\x63\x2d\x73\x63\x72\x69\x70\x74\x73\x2f\x6d\x61\x73\x74\x65\x72\x2f\x61\x6e\x74\x69\x63\x65\x6e\x73\x6f\x72\x69\x74\x79\x2e\x70\x61\x63', // eslint-disable-line max-len
- // Google Drive (0.17):
- '\x68\x74\x74\x70\x73\x3a\x2f\x2f\x64\x72\x69\x76\x65\x2e\x67\x6f\x6f\x67\x6c\x65\x2e\x63\x6f\x6d\x2f\x75\x63\x3f\x65\x78\x70\x6f\x72\x74\x3d\x64\x6f\x77\x6e\x6c\x6f\x61\x64\x26\x69\x64\x3d\x30\x42\x2d\x5a\x43\x56\x53\x76\x75\x4e\x57\x66\x30\x54\x44\x46\x52\x4f\x47\x35\x46\x62\x55\x39\x4f\x64\x44\x67'], // eslint-disable-line max-len
+ // Google Drive (0.17, anticensority):
+ '\x68\x74\x74\x70\x73\x3a\x2f\x2f\x64\x72\x69\x76\x65\x2e\x67\x6f\x6f\x67\x6c\x65\x2e\x63\x6f\x6d\x2f\x75\x63\x3f\x65\x78\x70\x6f\x72\x74\x3d\x64\x6f\x77\x6e\x6c\x6f\x61\x64\x26\x69\x64\x3d\x30\x42\x32\x6d\x68\x42\x67\x46\x6e\x66\x34\x70\x45\x4c\x56\x6c\x47\x4e\x54\x42\x45\x4d\x58\x4e\x6d\x52\x58\x63',
+ ],
},
onlyOwnSites: {
label: 'Только свои сайты и свои прокси',
@@ -538,12 +541,7 @@
const key = antiCensorRu._currentPacProviderKey;
if (key !== null) {
const ifVeryOld = !Object.keys(antiCensorRu.pacProviders).includes(key);
- const ifNeedsForcing = (oldStorage.version < '0.0.0.2') && !localStorage.getItem('provider-backup');
- if ( ifVeryOld || ifNeedsForcing ) {
- if (ifNeedsForcing) {
- console.log('Update forces antizapret...')
- localStorage.setItem('provider-backup', antiCensorRu._currentPacProviderKey);
- }
+ if (ifVeryOld) {
antiCensorRu._currentPacProviderKey = 'Антизапрет';
}
}
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/70-menu-items.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/70-menu-items.js
index cd34579..6008e50 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/70-menu-items.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/70-menu-items.js
@@ -39,7 +39,7 @@
support: {
title: 'Документация / Помощь / Поддержка',
- getUrl: (blockedUrl) => 'https://rebrand.ly/ac-support',
+ getUrl: (blockedUrl) => 'https://rebrand.ly/ac-wiki',
order: 99,
},
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/old/index.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/old/index.js
deleted file mode 100644
index 388d0da..0000000
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/old/index.js
+++ /dev/null
@@ -1,780 +0,0 @@
-'use strict';
-
-const START = Date.now();
-{
-
- const enableButton = function enablebutton() {
-
- document.getElementById('apply-mods').disabled = false;
-
- };
-
- const onModChanged = function onModChanged(ev) {
-
- enableButton();
-
- };
- ['pac-mods', 'own-mods'].forEach((id) => {
-
- document.getElementById(id).onchange = onModChanged;
-
- });
-
-}
-
-chrome.runtime.getBackgroundPage( (backgroundPage) =>
- backgroundPage.apis.errorHandlers.installListenersOn(
- window, 'PUP', async() => {
-
- const getStatus = () => document.querySelector('#status');
-
- const setStatusTo = (msg) => {
-
- getStatus().innerHTML = msg || 'Хорошего настроения Вам!';
-
- };
-
- const antiCensorRu = backgroundPage.apis.antiCensorRu;
- const errorHandlers = backgroundPage.apis.errorHandlers;
-
- // SET DATE
-
- const setDate = () => {
-
- let dateForUser = 'никогда';
- if( antiCensorRu.lastPacUpdateStamp ) {
- let diff = Date.now() - antiCensorRu.lastPacUpdateStamp;
- let units = 'мс';
- const gauges = [
- [1000, 'с'],
- [60, 'мин'],
- [60, 'ч'],
- [24, 'дн'],
- [7, ' недель'],
- [4, ' месяцев'],
- ];
- for(const g of gauges) {
- const diffy = Math.floor(diff / g[0]);
- if (!diffy)
- break;
- diff = diffy;
- units = g[1];
- }
- dateForUser = diff + units + ' назад';
- }
-
- const dateElement = document.querySelector('.update-date');
- dateElement.innerText = dateForUser + ' / ' +
- (antiCensorRu.pacUpdatePeriodInMinutes/60) + 'ч';
- dateElement.title = new Date(antiCensorRu.lastPacUpdateStamp)
- .toLocaleString('ru-RU');
-
- };
-
- setDate();
- chrome.storage.onChanged.addListener(
- (changes) => changes.lastPacUpdateStamp.newValue && setDate()
- );
-
- // CLOSE BUTTON
-
- document.querySelector('.close-button').onclick = () => window.close();
-
- // RADIOS FOR PROVIDERS
-
- const currentProviderRadio = () => {
-
- const iddy = antiCensorRu.getCurrentPacProviderKey() || 'none';
- return document.getElementById(iddy);
-
- };
- const checkChosenProvider = () => {
-
- currentProviderRadio().checked = true;
-
- };
-
- const showErrors = (err, ...warns) => {
-
- const warning = warns
- .map(
- (w) => w && w.message || ''
- )
- .filter( (m) => m )
- .map( (m) => '✘ ' + m )
- .join('
');
-
- let message = '';
- if (err) {
- let wrapped = err.wrapped;
- message = err.message || '';
-
- while( wrapped ) {
- const deeperMsg = wrapped && wrapped.message;
- if (deeperMsg) {
- message = message + ' > ' + deeperMsg;
- }
- wrapped = wrapped.wrapped;
- }
- }
- message = message.trim();
- if (warning) {
- message = message ? message + '
' + warning : warning;
- }
- setStatusTo(
- `
- ${err ? '🔥 Ошибка!' : 'Некритичная ошибка.'}
-
-
- ${message}
- ${err ? '[Техн.детали]' : ''}`
- );
- if (err) {
- getStatus().querySelector('.link-button').onclick = function() {
-
- errorHandlers.viewError('pup-ext-err', err);
- return false;
-
- };
- }
-
- };
-
- const switchInputs = function(val) {
-
- const inputs = document.querySelectorAll('input');
- for ( let i = 0; i < inputs.length; i++ ) {
- const input = inputs[i];
- if (val === 'off') {
- input.dataset.previousDisabledValue = input.disabled;
- input.disabled = true;
- } else {
- input.disabled = input.dataset.previousDisabledValue === 'true';
- }
- }
-
- };
-
- const conduct = (beforeStatus, operation, afterStatus, onSuccess = () => {}, onError = () => {}) => {
-
- setStatusTo(beforeStatus);
- switchInputs('off');
- operation((err, res, ...warns) => {
-
- warns = warns.filter( (w) => w );
- if (err || warns.length) {
- showErrors(err, ...warns);
- } else {
- setStatusTo(afterStatus);
- }
- switchInputs('on');
- if (!err) {
- onSuccess(res);
- } else {
- onError(err);
- }
- });
-
- };
-
- const infoIcon = ``;
-
- const infoSign = function infoSign(tooltip) {
-
- return `
- ${infoIcon}
-
${tooltip}
-
`;
-
- };
-
- const infoUrl = (url) => `${infoIcon}`;
-
- const camelToDash = (name) => name.replace(/([A-Z])/g, (_, p1) => '-' + p1.toLowerCase());
- // const dashToCamel = (name) => name.replace(/-(.)/g, (_, p1) => p1.toUpperCase());
-
- const appendInfoRow = (mountEl, conf, inputTypeAndName,
- {
- idPrefix = 'mods-',
- ifDashify = true,
- htmlAfterLabel = ''
- } = {}) => {
-
- mountEl.classList.add('info-row', 'hor-flex');
- if (conf.ifDisabled) {
- mountEl.title = 'В РАЗРАБОТКЕ!';
- }
- const iddy = idPrefix + ( ifDashify ? camelToDash(conf.key) : conf.key );
- mountEl.innerHTML = `
-
-
-
- ${htmlAfterLabel}
-
` + (conf.desc ? infoSign(conf.desc) : infoUrl(conf.url));
-
- };
-
- { // PAC-PROVIDERS starts.
-
- const ul = document.getElementById('list-of-providers');
- const _firstChildOrNull = ul.firstChild;
- for(
- const provConf of antiCensorRu.getSortedEntriesForProviders()
- ) {
- const li = document.createElement('li');
- appendInfoRow(li, provConf, 'type="radio" name="pacProvider"',
- { idPrefix: '',
- ifDashify: false,
- htmlAfterLabel: `
- [обновить]`
- }
- );
- li.querySelector('.link-button').onclick =
- () => {
- conduct(
- 'Обновляем...', (cb) => antiCensorRu.syncWithPacProviderAsync(cb),
- 'Обновлено.'
- );
- return false;
- };
- ul.insertBefore( li, _firstChildOrNull );
- }
- checkChosenProvider();
-
- const radioClickHandler = function radioClickHandler(event) {
-
- const pacKey = event.target.id;
- if (
- pacKey === (
- antiCensorRu.getCurrentPacProviderKey() || 'none'
- )
- ) {
- return false;
- }
- if (pacKey === 'none') {
- conduct(
- 'Отключение...',
- (cb) => antiCensorRu.clearPacAsync(cb),
- 'Отключено.',
- checkChosenProvider
- );
- } else {
- conduct(
- 'Установка...',
- (cb) => antiCensorRu.installPacAsync(pacKey, cb),
- 'PAC-скрипт установлен.',
- checkChosenProvider
- );
- }
- return false;
-
- };
-
- document.querySelectorAll('input[name=pacProvider]').forEach((radio) => {
-
- radio.onclick = radioClickHandler;
-
- });
-
- } // PAC-PROVIDERS ends.
-
- // IF MINI
-
- if (backgroundPage.apis.version.ifMini) {
- document.documentElement.classList.add('if-version-mini');
- }
-
- // IF INSIDE OPTIONS TAB
-
- const currentTab = await new Promise(
- (resolve) => chrome.tabs.query(
- {active: true, currentWindow: true},
- ([tab]) => resolve(tab)
- )
- );
-
- const ifInsideOptions = !currentTab || currentTab.url.startsWith('chrome://extensions/?options=');
- if (ifInsideOptions) {
- document.documentElement.classList.add('if-options-page');
- }
-
-
- { // KITCHEN PANELS starts.
-
- const pacKitchen = backgroundPage.apis.pacKitchen;
- const modKeyToLi = {};
-
- const applyMods = function applyMods(newMods) {
-
- conduct(
- 'Применяем настройки...',
- (cb) => pacKitchen.keepCookedNowAsync(newMods, cb),
- 'Настройки применены.',
- () => {
-
- document.getElementById('apply-mods').disabled = true;
-
- }
- );
-
- };
-
- { // EXCEPTIONS TAB starts.
-
- { // EXC-MODS starts.
-
- const emodsList = document.getElementById('exc-mods');
- const _firstChildOrNull = emodsList.firstChild;
-
- for(const conf of pacKitchen.getOrderedConfigs('exceptions')) {
-
- const li = document.createElement('li');
- appendInfoRow(li, conf, `type="checkbox" ${conf.value ? 'checked' : ''}`);
- emodsList.insertBefore( li, _firstChildOrNull );
-
- const key = conf.key;
- modKeyToLi[key] = li;
- li.querySelector('input').onclick = function() {
-
- const oldMods = pacKitchen.getPacMods();
- oldMods[key] = this.checked;
- applyMods(oldMods);
-
- };
-
- };
-
- }// EXC-MODS ends.
-
- { // EXC-EDITOR starts.
-
- const excEditor = document.getElementById('exc-editor');
-
- const validateHost = function validateHost(host) {
-
- const ValidHostnameRegex = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/;
- if(!ValidHostnameRegex.test(host)) {
- showErrors(new TypeError('Должно быть только доменное имя, без протокола, порта и пути. Попробуйте ещё раз.'));
- return false;
- }
- return true;
-
- };
-
- const labelIfProxied = '✔';
- const labelIfNotProxied = '✘';
- const labelIfAuto = '↻';
-
- const addOption = function addOption(host, yesNoUndefined) {
-
- const opt = document.createElement('option');
- // `value` may be changed for hiding line in the tooltip.
- opt.value = host;
- opt.dataset.host = host;
- switch(yesNoUndefined) {
- case true:
- opt.label = labelIfProxied;
- break;
- case false:
- opt.label = labelIfNotProxied;
- break;
- default:
- opt.label = labelIfAuto;
- }
- const editorHost = excEditor.value.trim();
- if (host === editorHost) {
- excList.insertBefore( opt, excList.firstChild );
- } else {
- excList.appendChild(opt);
- }
- return opt;
-
- };
-
- const thisYes = document.getElementById('this-yes');
- const thisNo = document.getElementById('this-no');
- const thisAuto = document.getElementById('this-auto');
- const yesClass = 'if-yes';
- const noClass = 'if-no';
-
- function moveCursorIfNeeded() {
-
- const nu = excEditor.dataset.moveCursorTo;
- if(nu !== undefined) {
- excEditor.setSelectionRange(nu, nu);
- delete excEditor.dataset.moveCursorTo;
- }
-
- }
-
- const hideOpt = (opt) => opt.value = '\n';
- const unhideOptAndAddSpace = (opt) => opt.value = opt.dataset.host + ' ';
-
- const excList = document.getElementById('exc-list');
-
- excEditor.onkeydown = function(event) {
-
- moveCursorIfNeeded();
- if(event.key === 'Enter') {
- // Hide all.
- excList.childNodes.forEach( hideOpt );
- }
- return true;
-
- };
-
- const renderExceptionsPanelFromExcList = function renderExceptionsPanelFromExcList(event) {
-
- // If triangle button on right of datalist input clicked.
-
- let ifTriangleClicked = false;
- const ifClick = event && event.type === 'click';
-
- {
- const maxIndentFromRightInPx = 15;
- ifTriangleClicked = ifClick
- && !excEditor.selectionStart && !excEditor.selectionEnd
- && event.x > excEditor.getBoundingClientRect().right - maxIndentFromRightInPx;
- }
-
- const setInputValue = (newValue) => {
-
- if (ifClick && !ifTriangleClicked) {
- // Don't jerk cursor on simple clicks.
- return;
- }
- // See bug in my comment to http://stackoverflow.com/a/32394157/521957
- // First click on empty input may be still ignored.
- const nu = excEditor.selectionStart + newValue.length - excEditor.value.length;
- excEditor.value = newValue;
- excEditor.dataset.moveCursorTo = nu;
- window.setTimeout(moveCursorIfNeeded, 0);
-
- };
-
- const originalHost = excEditor.value.trim();
- const ifInit = !event;
- const currentHost = ifTriangleClicked ? '' : (originalHost || (ifInit ? '' : ' '));
- setInputValue(currentHost);
-
- let exactOpt = false;
- let editedOpt = false;
- excList.childNodes.forEach(
- (opt) => {
-
- unhideOptAndAddSpace(opt);
-
- if(opt.label === labelIfAuto) {
- editedOpt = opt;
- return;
- }
- if (opt.dataset.host === originalHost) {
- exactOpt = opt;
- }
-
- }
- );
-
- thisAuto.checked = true;
- excEditor.parentNode.classList.remove(noClass, yesClass);
-
- const ifInputEmpty = !originalHost;
- if (ifTriangleClicked || ifInputEmpty) {
- // Show all opts.
- if (editedOpt) {
- // Example of editedOpt.value: 'abcde ' <- Mind the space (see unhideOptAndAddSpace)!
- const ifBackspacedOneChar = ifInputEmpty && editedOpt.value.length < 3;
- if (ifBackspacedOneChar) {
- editedOpt.remove();
- }
- }
- return true;
- }
-
- if (editedOpt) {
- const ifEditedOptAlreadyExists = editedOpt.dataset.host === originalHost;
- if(ifEditedOptAlreadyExists) {
- hideOpt(editedOpt);
- return true;
- }
- // Not exact! Update!
- editedOpt.remove();
- }
-
- if (!exactOpt) {
- editedOpt = addOption(originalHost, undefined);
- if (!ifClick) {
- // New value was typed -- don't show tooltip.
- hideOpt(editedOpt);
- }
- return true;
- }
-
- // Exact found!
- excList.childNodes.forEach(hideOpt);
- if(exactOpt.label === labelIfProxied) {
- thisYes.checked = true;
- excEditor.parentNode.classList.add(yesClass);
- } else {
- thisNo.checked = true;
- excEditor.parentNode.classList.add(noClass);
- }
- return true;
-
- };
-
- excEditor.onclick = excEditor.oninput = renderExceptionsPanelFromExcList;
-
- if (currentTab && !currentTab.url.startsWith('chrome')) {
- excEditor.value = new URL(currentTab.url).hostname;
- } else {
- // Show placeholder.
- excEditor.value = '';
- }
-
- { // Populate selector.
-
- const pacMods = pacKitchen.getPacMods();
- for(const host of Object.keys(pacMods.exceptions || {}).sort()) {
- addOption(host, pacMods.exceptions[host]);
- }
- renderExceptionsPanelFromExcList(); // Colorize input.
-
- }
-
- document.getElementById('exc-radio').onclick = function(event) {
-
- /* ON CLICK */
- if(event.target.tagName !== 'INPUT') {
- // Only label on checkbox.
- return true;
- }
-
- const host = excEditor.value.trim();
-
- const pacMods = pacKitchen.getPacMods();
- pacMods.exceptions = pacMods.exceptions || {};
-
- let fixOptions;
- const curOptOrNull = excList.querySelector(`[data-host="${host}"]`);
-
- if (thisAuto.checked) {
- delete pacMods.exceptions[host];
- fixOptions = () => {
- curOptOrNull && curOptOrNull.remove();
- }
- } else {
- // YES or NO checked.
- const ifYesClicked = thisYes.checked;
- if (!validateHost(host)) {
- return false;
- }
- if (ifYesClicked && !pacMods.filteredCustomsString) {
- showErrors( new TypeError(
- 'Проксировать СВОИ сайты можно только при наличии СВОИХ прокси (см. «Модификаторы» ). Нет своих прокси, удовлетворяющих вашим требованиям.'
- ));
- return false;
- }
- //const ifNew = !(host in pacMods.exceptions);
- pacMods.exceptions[host] = ifYesClicked;
- // Change label.
- fixOptions = () => {
- if (curOptOrNull) {
- curOptOrNull.label = ifYesClicked ? labelIfProxied : labelIfNotProxied;
- } else {
- addOption(host, ifYesClicked);
- }
- };
- }
-
- conduct(
- 'Применяем исключения...',
- (cb) => pacKitchen.keepCookedNowAsync(pacMods, cb),
- 'Исключения применены. Не забывайте о кэше!',
- () => {
-
- fixOptions();
- // Window may be closed before this line executes.
- renderExceptionsPanelFromExcList();
-
- }
- );
- return false; // Don't check before operation is finished.
-
- };
-
- } // EXC-EDITOR ends.
-
- } // EXCEPTIONS TAB ends.
-
- { // PAC MODS TAB starts.
-
- const modsList = document.getElementById('pac-mods');
- const _firstChildOrNull = modsList.firstChild;
-
- for(const conf of pacKitchen.getOrderedConfigs('general')) {
-
- const li = document.createElement('li');
- appendInfoRow(li, conf, `type="checkbox" ${conf.value ? 'checked' : ''}`);
- modsList.insertBefore( li, _firstChildOrNull );
- modKeyToLi[conf.key] = li;
-
- };
-
- } // PAC MODS TAB ends.
-
- const customProxyStringKey = 'customProxyStringRaw';
- const uiRaw = 'ui-proxy-string-raw';
-
- { // OWN PROXIES TAB starts.
-
- const ownsList = document.getElementById('own-mods');
- const _firstChildOrNull = ownsList.firstChild;
-
- for(const conf of pacKitchen.getOrderedConfigs('ownProxies')) {
-
- const li = document.createElement('li');
- appendInfoRow(li, conf, `type="checkbox" ${conf.value ? 'checked' : ''}`);
-
- const key = conf.key;
- const ifMultiline = key === customProxyStringKey;
- if (ifMultiline) {
- li.style.flexWrap = 'wrap';
- li.innerHTML += `
-
- `;
- li.querySelector('textarea').onkeyup = function() {
-
- this.dispatchEvent( new Event('change', {'bubbles': true}) );
-
- };
- }
-
- ownsList.insertBefore( li, _firstChildOrNull );
- modKeyToLi[key] = li;
-
- }
-
- } // OWN PROXIES TAB ends.
-
- { // APPLY MODS PANEL starts.
-
- document.getElementById('apply-mods').onclick = () => {
-
- const oldMods = pacKitchen.getPacMods();
- for(const key of Object.keys(modKeyToLi)) {
- oldMods[key] = modKeyToLi[key].querySelector('input').checked;
- };
-
- {
- // OWN PROXY
-
- const liPs = modKeyToLi[customProxyStringKey];
- oldMods[customProxyStringKey]
- = liPs.querySelector('input').checked
- && liPs.querySelector('textarea').value.trim();
-
- const taVal = liPs.querySelector('textarea').value;
- if (oldMods[customProxyStringKey] !== false) {
- const ifValidArr = taVal
- .trim()
- .replace(/#.*$/mg, '')
- .split(/\s*[;\n\r]+\s*/g)
- .filter( (str) => str );
- const ifValid = ifValidArr.every(
- (str) =>
- /^(?:DIRECT|(?:(?:HTTPS|PROXY|SOCKS(?:4|5)?)\s+\S+))$/g
- .test(str.trim())
- );
- if (!(ifValidArr.length && ifValid)) {
- return showErrors(new TypeError(
- 'Неверный формат своих прокси. Свертесь с документацией.'
- ));
- }
- oldMods[customProxyStringKey] = taVal;
- } else {
- localStorage.setItem(uiRaw, taVal);
- }
-
- }
- applyMods(oldMods);
-
- };
-
- document.getElementById('reset-mods').onclick = () => {
-
- const ifSure = backgroundPage.confirm('Сбросить все модификаторы и ИСКЛЮЧЕНИЯ?');
- if (!ifSure) {
- return false;
- }
- conduct(
- 'Сбрасываем...',
- (cb) => {
-
- pacKitchen.resetToDefaults();
- backgroundPage.utils.fireRequest('ip-to-host-reset-to-defaults', cb);
-
- },
- 'Откройте окно заново для отображения эффекта.',
- () => window.close()
- );
-
- }
-
- } // APPLY MODS PANEL ends.
-
- } // KITCHEN PANELS ends.
-
- // NOTIFICATIONS PANEL
-
- const conPanel = document.getElementById('list-of-notifiers');
- errorHandlers.getEventsMap().forEach( (value, name) => {
-
- const li = document.createElement('li');
- li.innerHTML = `
-
- `;
- const box = li.querySelector('input');
- box.checked = backgroundPage.apis.errorHandlers.isOn(name);
- box.onclick = function() {
-
- const id = this.id.replace('if-on-', '');
- return backgroundPage.apis.errorHandlers.switch(
- this.checked ? 'on' : 'off',
- id
- );
-
- };
- conPanel.appendChild(li);
-
- });
-
- if( !errorHandlers.ifControllable ) {
- document.getElementById('which-extension').innerHTML
- = backgroundPage.utils.messages.whichExtensionHtml();
- document.querySelectorAll('.if-not-controlled').forEach( (node) => {
-
- node.style.display = 'block';
-
- });
- }
- setStatusTo('');
-
- if (antiCensorRu.ifFirstInstall) {
- const id = antiCensorRu.getCurrentPacProviderKey() || 'none';
- document.querySelector('#update-' + id).click();
- }
- document.documentElement.style.display = 'initial';
-
- console.log(Date.now() - START);
-
- })
-);
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/old/old.html b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/old/old.html
deleted file mode 100644
index a1d1577..0000000
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/old/old.html
+++ /dev/null
@@ -1,608 +0,0 @@
-
-
-
-
- Настройки
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/package.json b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/package.json
index 925b86a..6d4f4e1 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/package.json
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/package.json
@@ -9,7 +9,6 @@
"babel-plugin-dynamic-import-webpack": "^1.0.1",
"babel-preset-flow": "^6.23.0",
"babel-preset-react": "^6.24.1",
- "babili-webpack-plugin": "^0.0.11",
"concat-stream": "^1.6.0",
"csjs-inject": "^1.0.1",
"flow-bin": "^0.45.0",
@@ -24,7 +23,7 @@
"build:dev:nocomp": "NODE_ENV=development webpack --define process.env.NODE_ENV=\"'development'\" --env=dev",
"build:dev": "NODE_ENV=development webpack --debug --define process.env.NODE_ENV=\"'development'\" --output-pathinfo --env=dev",
"gulp": "cd .. && npm run gulp",
- "build": "npm run build:dev",
+ "build": "npm run build:prod",
"start": "cd .. && npm start"
},
"dependencies": {
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/App.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/App.js
index 73a022c..4bfd555 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/App.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/App.js
@@ -79,23 +79,32 @@ export default function getApp(theState) {
headers: new Headers(headers),
};
- const ghUrl = `https://api.github.com/repos/anticensorship-russia/for-testing-github-api/issues/1/comments${query}`;
- const [comments, etag] = await fetch(
+ const ghUrl = `https://api.github.com/repos/anticensority/chromium-extension/issues/10/comments${query}`;
+
+ const [error, comments, etag] = await fetch(
ghUrl,
params
).then(
(res) => !( res.status >= 200 && res.status < 300 || res.status === 304 )
- ? Promise.reject(new Error(`Полечен ответ с неудачным кодом ${res.status}.`))
+ ? Promise.reject({message: `Получен ответ с неудачным кодом ${res.status}.`, data: res})
: res
).then(
(res) => Promise.all([
+ null,
res.status !== 304 ? res.json() : false,
res.headers.get('ETag')
]),
(err) => {
- this.showErrors({message: 'Не удалось достать новости: что-то не так с сетью.', wrapped: err});
- return [false, false];
+ const statusCode = err.data && err.data.status;
+ const ifCritical = null;
+ this.showErrors(ifCritical, {
+ message: statusCode === 403
+ ? 'Слишком много запросов :-( Сообщите разработчику, как вам удалось всё истратить.'
+ : 'Не удалось достать новости: что-то не так с сетью.',
+ wrapped: err,
+ });
+ return [err, false, false];
}
);
@@ -103,21 +112,25 @@ export default function getApp(theState) {
localStorage[uiComEtag] = etag;
}
+ if (error) {
+ return; // Let the user see the error message and contemplate.
+ }
- const ifNews = (() => {
+ const ifNewsWasSet = (() => {
- if (!(comments && comments.length)) {
- const news = JSON.parse(localStorage[uiLastNewsArr]);
- if (news) {
+ if (comments === false) {
+ // 304
+ const json = localStorage[uiLastNewsArr];
+ const news = json && JSON.parse(json);
+ if (news && news.length) {
this.setNewsStatusTo(news);
return true;
}
return false;
}
- let minDate;
- const news = [];
- comments.forEach((comment) => {
+ let minDate; // Minimal date among all news-comments.
+ const news = comments.reduce((acc, comment) => {
const curDate = comment.updated_at || comment.created_at;
const newsTitle = this.getNewsHeadline( comment.body );
@@ -125,21 +138,25 @@ export default function getApp(theState) {
if (!minDate || curDate <= minDate) {
minDate = curDate;
}
- news.push([newsTitle, comment.html_url]);
+ acc.push([newsTitle, comment.html_url]);
}
+ return acc;
- });
- if (!news.length) {
- return false;
- }
- localStorage[uiComDate] = minDate;
+ }, []);
+ // Response with empty news is cached too.
localStorage[uiLastNewsArr] = JSON.stringify(news);
- this.setNewsStatusTo(news);
- return true;
+ if (news.length) {
+ if (minDate) {
+ localStorage[uiComDate] = minDate;
+ }
+ this.setNewsStatusTo(news);
+ return true;
+ }
+ return false;
})();
- if (!ifNews) {
- this.setStatusTo('Ничего нового.');
+ if (!ifNewsWasSet) {
+ this.setStatusTo('Хорошего настроения Вам!');
}
}
@@ -171,18 +188,11 @@ export default function getApp(theState) {
: () => {};
const warns = args;
- const warningHtml = warns
- .map(
- (w) => w && w.message || ''
- )
- .filter( (m) => m )
- .map( (m) => '✘ ' + m )
- .join('
');
+ const errToHtmlMessage = (error) => {
- let messageHtml = '';
- if (err) {
- let wrapped = err.wrapped;
- messageHtml = err.message || '';
+ let messageHtml = '';
+ let wrapped = error.wrapped;
+ messageHtml = error.message || '';
while( wrapped ) {
const deeperMsg = wrapped && wrapped.message;
@@ -191,7 +201,20 @@ export default function getApp(theState) {
}
wrapped = wrapped.wrapped;
}
- }
+ return messageHtml;
+
+ };
+
+ let messageHtml = err ? errToHtmlMessage(err) : '';
+
+ const warningHtml = warns
+ .filter((w) => w)
+ .map(
+ (w) => errToHtmlMessage(w)
+ )
+ .map( (m) => '✘ ' + m )
+ .join('
');
+
messageHtml = messageHtml.trim();
if (warningHtml) {
messageHtml = messageHtml ? messageHtml + '
' + warningHtml : warningHtml;
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ApplyMods.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ApplyMods.js
index 244e214..94d8b03 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ApplyMods.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ApplyMods.js
@@ -14,6 +14,7 @@ export default function getApplyMods(theState) {
props.apis.pacKitchen.resetToDefaults();
props.bgWindow.utils.fireRequest('ip-to-host-reset-to-defaults', cb);
+ window.localStorage.clear();
},
'Откройте окно заново для отображения эффекта.',
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ExcEditor.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ExcEditor.js
index 2b4b3ec..378e92b 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ExcEditor.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ExcEditor.js
@@ -83,6 +83,8 @@ export default function getExcEditor(theState) {
sortedListOfOptions: this.modsToOpts(pacMods),
isHostHidden: {}
};
+ this.handleRadioClick = this.handleRadioClick.bind(this);
+ this.handleInputOrClick = this.handleInputOrClick.bind(this);
}
@@ -135,7 +137,7 @@ export default function getExcEditor(theState) {
case 'this-no':
if (ifYesClicked && !pacMods.filteredCustomsString) {
this.props.funs.showErrors( new TypeError(
- 'Проксировать СВОИ сайты можно только при наличии СВОИХ прокси (см. «Модификаторы» ). Нет своих прокси, удовлетворяющих вашим требованиям.'
+ 'Проксировать СВОИ сайты можно только при наличии СВОИХ прокси. Нет своих прокси, удовлетворяющих вашим требованиям.'
));
return false;
}
@@ -289,9 +291,6 @@ export default function getExcEditor(theState) {
}, undefined);
- const onradio = this.handleRadioClick.bind(this);
- const oninput = this.handleInputOrClick.bind(this);
-
return (
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/Exceptions.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/Exceptions.js
index 21dc93c..ff695a7 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/Exceptions.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/Exceptions.js
@@ -71,10 +71,10 @@ export default function getExceptions(theState) {
key: 'lookupLastErrors',
desc: 'Собирать последние ошибки в запросах, чтобы вручную добавлять избранные из них в исключения.',
}}
- checked={props.bgWindow.apis.lastErrors.ifCollecting}
+ checked={props.bgWindow.apis.lastNetErrors.ifCollecting}
onChange={(event) => {
- props.bgWindow.apis.lastErrors.ifCollecting = event.target.checked;
+ props.bgWindow.apis.lastNetErrors.ifCollecting = event.target.checked;
props.funs.setStatusTo('Сделано.');
}}
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/InfoLi.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/InfoLi.js
index c6ee8c2..131ff77 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/InfoLi.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/InfoLi.js
@@ -88,9 +88,6 @@ export default function getInfoLi() {
/* CHILDREN */
- input:not(:checked) ~ .children {
- display: none;
- }
.children {
flex-grow: 9999;
}
@@ -110,17 +107,30 @@ export default function getInfoLi() {
};
- return function InfoLi(props) {
+ return function InfoLi(originalProps) {
- props = Object.assign({}, {
+ const props = Object.assign({}, {
idPrefix: '',
ifDashify: false,
- }, props);
+ }, originalProps);
const iddy = props.idPrefix + ( props.ifDashify ? camelToDash(props.conf.key) : props.conf.key );
+
+ const inputProps = {
+ id: iddy,
+ name: props.name,
+ type: props.type,
+ checked: props.checked,
+ onClick: props.onClick,
+ onChange: props.onChange,
+ class: props.class,
+ disabled: props.ifInputsDisabled,
+ };
+ delete inputProps.children;
+
return (
- { createElement('input', Object.assign({}, props, {id: iddy})) }
+ {createElement('input', inputProps)}
{props.nodeAfterLabel}
@@ -136,8 +146,8 @@ export default function getInfoLi() {
: (
) // Affects vertical align of flexbox items.
)
}
- { props.checked && props.children }
- {/* props.checked && (
{props.children}
)*/}
+ {/* props.checked && props.children */}
+ {props.checked && props.children && (
{props.children}
)}
);
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ModList.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ModList.js
index fa3628f..d43c1c1 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ModList.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ModList.js
@@ -64,6 +64,7 @@ export default function getModList(theState) {
checked={this.state.checks[index]}
key={index}
onChange={(event) => this.handleCheck(confMeta, event.target.checked)}
+ ifInputsDisabled={props.ifInputsDisabled}
>
{child}
);
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/PacChooser.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/PacChooser.js
index b6143c3..c5b45b3 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/PacChooser.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/PacChooser.js
@@ -68,6 +68,8 @@ export default function getPacChooser(theState) {
onSuccess
);
};
+ this.radioClickHandler = this.radioClickHandler.bind(this);
+ this.updateClickHandler = this.updateClickHandler.bind(this);
}
@@ -77,6 +79,13 @@ export default function getPacChooser(theState) {
}
+ updateClickHandler(event) {
+
+ event.preventDefault();
+ this.updatePac();
+
+ }
+
radioClickHandler(event) {
const checkChosenProvider = () =>
@@ -120,18 +129,13 @@ export default function getPacChooser(theState) {
{
[...props.apis.antiCensorRu.getSortedEntriesForProviders(), {key: 'none', label: 'Отключить'}].map((provConf) =>
(
{
-
- evt.preventDefault();
- this.updatePac();
-
- }}>[обновить]}
+ ifInputsDisabled={props.ifInputsDisabled}
+ nodeAfterLabel={[обновить]}
/>)
)
}
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ProxyEditor.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ProxyEditor.js
index af4edc0..759aab7 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ProxyEditor.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ProxyEditor.js
@@ -7,10 +7,6 @@ export default function getProxyEditor(theState) {
const scopedCss = css`
- form.root {
- width: 100%;
- }
-
table.editor {
border-collapse: collapse;
/*border-style: hidden;*/
@@ -19,6 +15,10 @@ export default function getProxyEditor(theState) {
background-color: #f3f5f6;
}
+ .tabledEditor, .exportsEditor {
+ /* Empty, but not undefined. */
+ }
+
table.editor ::-webkit-input-placeholder {
color: #c9c9c9;
}
@@ -110,9 +110,10 @@ export default function getProxyEditor(theState) {
}
/* LAST COLUMN: BUTTONS */
- table.editor tr > *:nth-last-child(1),
- table.editor tr > *:nth-last-child(2),
- table.editor tr.proxyRow > td:first-child {
+ table.editor tr > *:nth-last-child(1), /* Buttons */
+ table.tabledEditor tr > *:nth-last-child(2), /* Port */
+ table.tabledEditor tr.proxyRow > td:first-child /* Type */
+ {
text-align: center;
padding: 0;
position: relative;
@@ -258,8 +259,8 @@ export default function getProxyEditor(theState) {
render(props) {
return (
-