mirror of
				https://github.com/anticensority/runet-censorship-bypass.git
				synced 2025-10-31 16:07:31 +03:00 
			
		
		
		
	Lint
This commit is contained in:
		
							parent
							
								
									5af9458eae
								
							
						
					
					
						commit
						fda42ee307
					
				|  | @ -1,24 +1,33 @@ | ||||||
| module.exports = { | module.exports = { | ||||||
|     "extends": ["airbnb"], |     extends: ['google'], | ||||||
|     "env": { |     env: { | ||||||
|       "browser": true, |       browser: true, | ||||||
|       "webextensions": true, |       webextensions: true, | ||||||
|       "es6": true |       es6: true | ||||||
|     }, |     }, | ||||||
|     "globals": { |     globals: { | ||||||
|       "chrome": true |       chrome: true | ||||||
|     }, |     }, | ||||||
|     "parserOptions": { |     parserOptions: { | ||||||
|       "sourceType": "script", |       sourceType: 'script', | ||||||
|       "ecmaVersion": 2017, |       ecmaVersion: 2017, | ||||||
|       "ecmaFeatures": { |       ecmaFeatures: { | ||||||
|         "impliedStrict": false |         impliedStrict: false | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "rules": { |     rules: { | ||||||
|       "strict": ["error", "global"], |       strict: ['error', 'global'], | ||||||
|       "no-console": "off", |       'no-console': 'off', | ||||||
|       "padded-blocks": "off", |       'padded-blocks': 'off', | ||||||
|       "require-jsdoc": "off" |       'require-jsdoc': 'off', | ||||||
|     } | 
 | ||||||
|  |       // Taken from airbnb:
 | ||||||
|  |       'max-len': ['error', 100, 2, { | ||||||
|  |         ignoreUrls: true, | ||||||
|  |         ignoreComments: false, | ||||||
|  |         ignoreRegExpLiterals: true, | ||||||
|  |         ignoreStrings: true, | ||||||
|  |         ignoreTemplateLiterals: true, | ||||||
|  |       }], | ||||||
|  |     }, | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -11,9 +11,6 @@ | ||||||
|   "license": "GPLv3", |   "license": "GPLv3", | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "eslint": "^3.15.0", |     "eslint": "^3.15.0", | ||||||
|     "eslint-config-airbnb": "^14.0.0", |     "eslint-config-google": "^0.7.1" | ||||||
|     "eslint-plugin-import": "^2.2.0", |  | ||||||
|     "eslint-plugin-jsx-a11y": "^3.0.2", |  | ||||||
|     "eslint-plugin-react": "^6.9.0" |  | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -102,7 +102,7 @@ | ||||||
|         } |         } | ||||||
|         localStorage.setItem(key, JSON.stringify(value)); |         localStorage.setItem(key, JSON.stringify(value)); | ||||||
| 
 | 
 | ||||||
|       } |       }; | ||||||
| 
 | 
 | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -20,7 +20,7 @@ | ||||||
| 
 | 
 | ||||||
|     const m = (str.match(ipRe) || []).filter( (c) => c ); |     const m = (str.match(ipRe) || []).filter( (c) => c ); | ||||||
|     const port = m.length > 1 ? m.pop() : false; |     const port = m.length > 1 ? m.pop() : false; | ||||||
|     return { ifMatched: m.length, port: port }; |     return {ifMatched: m.length, port: port}; | ||||||
| 
 | 
 | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|  | @ -57,9 +57,9 @@ | ||||||
| 
 | 
 | ||||||
|   const _createHostObj = function _addHostObj(hostStr) { |   const _createHostObj = function _addHostObj(hostStr) { | ||||||
| 
 | 
 | ||||||
|     return (privates._strToHostObj[hostStr] = { host: hostStr }); |     return (privates._strToHostObj[hostStr] = {host: hostStr}); | ||||||
| 
 | 
 | ||||||
|   } |   }; | ||||||
| 
 | 
 | ||||||
|   const _getHostObj = function _getHostObj(hostStr) { |   const _getHostObj = function _getHostObj(hostStr) { | ||||||
| 
 | 
 | ||||||
|  | @ -186,16 +186,16 @@ | ||||||
|     console.log('Canonized hosts/ips:', hostSet.size + '/' + ipSet.size); |     console.log('Canonized hosts/ips:', hostSet.size + '/' + ipSet.size); | ||||||
|     return [ipSet, hostSet]; |     return [ipSet, hostSet]; | ||||||
| 
 | 
 | ||||||
|   } |   }; | ||||||
| 
 | 
 | ||||||
|   const self = window.apis.ipToHost = { |   window.apis.ipToHost = { | ||||||
| 
 | 
 | ||||||
|     persist() { |     persist() { | ||||||
| 
 | 
 | ||||||
|       console.log('Persisting ipToHost...', privates); |       console.log('Persisting ipToHost...', privates); | ||||||
|       const ipToHost = {}; |       const ipToHost = {}; | ||||||
|       for( const ip of Object.keys(privates._ipToHostObj) ) { |       for( const ip of Object.keys(privates._ipToHostObj) ) { | ||||||
|         ipToHost[ ip ] = privates._ipToHostObj[ ip ].host; |         ipToHost[ip] = privates._ipToHostObj[ip].host; | ||||||
|       } |       } | ||||||
|       _state(ip2host, ipToHost); |       _state(ip2host, ipToHost); | ||||||
| 
 | 
 | ||||||
|  | @ -247,7 +247,12 @@ | ||||||
|       console.log('Update all:', hostArr); |       console.log('Update all:', hostArr); | ||||||
| 
 | 
 | ||||||
|       const promises = hostArr.map( |       const promises = hostArr.map( | ||||||
|         (hostStr) => new Promise( (resolve) => this._addAsync(hostStr, (...args) => resolve(args) ) ) |         (hostStr) => new Promise( | ||||||
|  |           (resolve) => this._addAsync( | ||||||
|  |             hostStr, | ||||||
|  |             (...args) => resolve(args) | ||||||
|  |           ) | ||||||
|  |         ) | ||||||
|       ); |       ); | ||||||
|       Promise.all( promises ).then( (cbsRes) => { |       Promise.all( promises ).then( (cbsRes) => { | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -85,7 +85,7 @@ | ||||||
|     const pacMods = getCurrentConfigs(); |     const pacMods = getCurrentConfigs(); | ||||||
|     return Object.keys(configs).reduce((arr, key) => { |     return Object.keys(configs).reduce((arr, key) => { | ||||||
| 
 | 
 | ||||||
|       const conf = configs[key] |       const conf = configs[key]; | ||||||
|       if(typeof(conf.index) === 'number') { |       if(typeof(conf.index) === 'number') { | ||||||
|         arr[conf.index] = conf; |         arr[conf.index] = conf; | ||||||
|         conf.value = pacMods[key]; |         conf.value = pacMods[key]; | ||||||
|  | @ -144,7 +144,7 @@ | ||||||
|         this.excluded = []; |         this.excluded = []; | ||||||
|         for(const host of Object.keys(this.exceptions)) { |         for(const host of Object.keys(this.exceptions)) { | ||||||
|           if (this.exceptions[host]) { |           if (this.exceptions[host]) { | ||||||
|             this.included.push(host) |             this.included.push(host); | ||||||
|           } else { |           } else { | ||||||
|             this.excluded.push(host); |             this.excluded.push(host); | ||||||
|           } |           } | ||||||
|  | @ -320,7 +320,7 @@ | ||||||
|             return cb(null, res, ...warns); |             return cb(null, res, ...warns); | ||||||
|           } |           } | ||||||
| 
 | 
 | ||||||
|           const hosts = par.map( (ps) => ps.split(/\s+/)[1] ) |           const hosts = par.map( (ps) => ps.split(/\s+/)[1] ); | ||||||
|           window.apis.ipToHost.replaceAllAsync( |           window.apis.ipToHost.replaceAllAsync( | ||||||
|             hosts, |             hosts, | ||||||
|             (...args) => cb(...args, ...warns) |             (...args) => cb(...args, ...warns) | ||||||
|  | @ -355,7 +355,7 @@ | ||||||
|     } |     } | ||||||
|     const pacMods = getCurrentConfigs(); |     const pacMods = getCurrentConfigs(); | ||||||
|     pac.data = pacKitchen.cook( pac.data, pacMods ); |     pac.data = pacKitchen.cook( pac.data, pacMods ); | ||||||
|     originalSet({ value: details.value }, (/* No args. */) => { |     originalSet({value: details.value}, (/* No args. */) => { | ||||||
| 
 | 
 | ||||||
|       kitchenState(ifIncontinence, null); |       kitchenState(ifIncontinence, null); | ||||||
|       cb && cb(); |       cb && cb(); | ||||||
|  |  | ||||||
|  | @ -26,7 +26,6 @@ | ||||||
|   const chromified = window.utils.chromified; |   const chromified = window.utils.chromified; | ||||||
|   const checkChromeError = window.utils.checkChromeError; |   const checkChromeError = window.utils.checkChromeError; | ||||||
| 
 | 
 | ||||||
|   const clarify = window.apis.errorsLib.clarify; |  | ||||||
|   const clarifyThen = window.apis.errorsLib.clarifyThen; |   const clarifyThen = window.apis.errorsLib.clarifyThen; | ||||||
|   const Warning = window.apis.errorsLib.Warning; |   const Warning = window.apis.errorsLib.Warning; | ||||||
| 
 | 
 | ||||||
|  | @ -332,7 +331,7 @@ | ||||||
|           } |           } | ||||||
|           const warns = pacWarns; |           const warns = pacWarns; | ||||||
|           if (ipsErr) { |           if (ipsErr) { | ||||||
|             warns.push(ipsErr) |             warns.push(ipsErr); | ||||||
|           } |           } | ||||||
|           this.pushToStorageAsync( |           this.pushToStorageAsync( | ||||||
|             (pushErr) => cb(pacErr || pushErr, null, ...warns) |             (pushErr) => cb(pacErr || pushErr, null, ...warns) | ||||||
|  |  | ||||||
|  | @ -144,11 +144,6 @@ | ||||||
|       ) |       ) | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|   }; |  | ||||||
| 
 |  | ||||||
|   const isInsideTabWithIp = function isInsideTabWithIp(requestDetails) { |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   const onRequest = function onRequest(requestDetails) { |   const onRequest = function onRequest(requestDetails) { | ||||||
|  |  | ||||||
|  | @ -75,7 +75,11 @@ chrome.runtime.getBackgroundPage( (backgroundPage) => | ||||||
|         return document.getElementById(id); |         return document.getElementById(id); | ||||||
| 
 | 
 | ||||||
|       }; |       }; | ||||||
|       const checkChosenProvider = () => currentProviderRadio().checked = true; |       const checkChosenProvider = () => { | ||||||
|  | 
 | ||||||
|  |         currentProviderRadio().checked = true; | ||||||
|  | 
 | ||||||
|  |       }; | ||||||
| 
 | 
 | ||||||
|       const showErrors = (err, ...warns) => { |       const showErrors = (err, ...warns) => { | ||||||
| 
 | 
 | ||||||
|  | @ -227,14 +231,14 @@ chrome.runtime.getBackgroundPage( (backgroundPage) => | ||||||
| 
 | 
 | ||||||
|       const currentTab = await new Promise( |       const currentTab = await new Promise( | ||||||
|         (resolve) => chrome.tabs.query( |         (resolve) => chrome.tabs.query( | ||||||
|           { active: true, currentWindow: true }, |           {active: true, currentWindow: true}, | ||||||
|           ([tab]) => resolve(tab) |           ([tab]) => resolve(tab) | ||||||
|         ) |         ) | ||||||
|       ); |       ); | ||||||
| 
 | 
 | ||||||
|       const ifInsideOptions = !currentTab || currentTab.url.startsWith('chrome://extensions/?options='); |       const ifInsideOptions = !currentTab || currentTab.url.startsWith('chrome://extensions/?options='); | ||||||
|       if (ifInsideOptions) { |       if (ifInsideOptions) { | ||||||
|         document.documentElement.classList.add('if-options-page') |         document.documentElement.classList.add('if-options-page'); | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       // EXCEPTIONS PANEL
 |       // EXCEPTIONS PANEL
 | ||||||
|  | @ -347,7 +351,7 @@ chrome.runtime.getBackgroundPage( (backgroundPage) => | ||||||
|               excEditor.dataset.moveCursorTo = nu; |               excEditor.dataset.moveCursorTo = nu; | ||||||
|               window.setTimeout(moveCursorIfNeeded, 0); |               window.setTimeout(moveCursorIfNeeded, 0); | ||||||
| 
 | 
 | ||||||
|             } |             }; | ||||||
| 
 | 
 | ||||||
|             const originalHost = excEditor.value.trim(); |             const originalHost = excEditor.value.trim(); | ||||||
|             const ifInit = !event; |             const ifInit = !event; | ||||||
|  | @ -525,7 +529,7 @@ HTTPS foobar.com:3143; | ||||||
| HTTPS 11.22.33.44:8080;">${conf.value || localStorage.getItem(uiRaw) || ''}</textarea>`; | HTTPS 11.22.33.44:8080;">${conf.value || localStorage.getItem(uiRaw) || ''}</textarea>`; | ||||||
|             li.querySelector('textarea').onkeyup = function() { |             li.querySelector('textarea').onkeyup = function() { | ||||||
| 
 | 
 | ||||||
|               this.dispatchEvent(new Event('change', { 'bubbles': true })); |               this.dispatchEvent( new Event('change', {'bubbles': true}) ); | ||||||
| 
 | 
 | ||||||
|             }; |             }; | ||||||
|           } |           } | ||||||
|  | @ -555,14 +559,14 @@ HTTPS 11.22.33.44:8080;">${conf.value || localStorage.getItem(uiRaw) || ''}</tex | ||||||
|                 .split(/\s*[;\n\r]+\s*/g) |                 .split(/\s*[;\n\r]+\s*/g) | ||||||
|                 .filter( (str) => str ) |                 .filter( (str) => str ) | ||||||
|                 .every( |                 .every( | ||||||
|                 (str) => |                   (str) => | ||||||
|                   /^(?:DIRECT|(?:(?:HTTPS?|PROXY|SOCKS(?:4|5)?)\s+\S+))$/g |                     /^(?:DIRECT|(?:(?:HTTPS?|PROXY|SOCKS(?:4|5)?)\s+\S+))$/g | ||||||
|                     .test(str) |                       .test(str) | ||||||
|                 ) |                 ); | ||||||
|               if (!ifValid) { |               if (!ifValid) { | ||||||
|                 return showErrors(new TypeError( |                 return showErrors(new TypeError( | ||||||
|                   'Неверный формат своих прокси. Свертесь с <a href="https://rebrand.ly/ac-own-proxy" data-in-bg="true">документацией</a>.' |                   'Неверный формат своих прокси. Свертесь с <a href="https://rebrand.ly/ac-own-proxy" data-in-bg="true">документацией</a>.' | ||||||
|                 )) |                 )); | ||||||
|               } |               } | ||||||
|               oldMods[customProxyStringKey] = taVal; |               oldMods[customProxyStringKey] = taVal; | ||||||
|             } else { |             } else { | ||||||
|  | @ -575,7 +579,11 @@ HTTPS 11.22.33.44:8080;">${conf.value || localStorage.getItem(uiRaw) || ''}</tex | ||||||
|             'Применяем настройки...', |             'Применяем настройки...', | ||||||
|             (cb) => pacKitchen.keepCookedNowAsync(oldMods, cb), |             (cb) => pacKitchen.keepCookedNowAsync(oldMods, cb), | ||||||
|             'Настройки применены.', |             'Настройки применены.', | ||||||
|             () => { document.getElementById('apply-mods').disabled = true; } |             () => { | ||||||
|  | 
 | ||||||
|  |               document.getElementById('apply-mods').disabled = true; | ||||||
|  | 
 | ||||||
|  |             } | ||||||
|           ); |           ); | ||||||
| 
 | 
 | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user