summaryrefslogtreecommitdiff
path: root/data/extensions/tortm-browser-button@jeremybenthum/lib/proxy.js
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2020-06-15 04:02:57 -0400
committerMark H Weaver <mhw@netris.org>2020-06-30 18:55:14 -0400
commit6909320776d9fdc7181db51d03596075534e2689 (patch)
tree32926f1360e125c116c45944c6b5ddfc990bc2ac /data/extensions/tortm-browser-button@jeremybenthum/lib/proxy.js
parentd7acf32ad905a3382cb2353577a96d29aa58f589 (diff)
Remove bundled tortm-browser-button extension.
This extension malfunctions with both IceCat and Firefox 68 ESR. It tells the user that it's connected to Tor, but fails to route traffic through it. Remove this extension from IceCat, pending further investigation. * data/extensions/tortm-browser-button@jeremybenthum: Remove. * data/update-extensions.sh: Remove associated bits.
Diffstat (limited to 'data/extensions/tortm-browser-button@jeremybenthum/lib/proxy.js')
-rw-r--r--data/extensions/tortm-browser-button@jeremybenthum/lib/proxy.js56
1 files changed, 0 insertions, 56 deletions
diff --git a/data/extensions/tortm-browser-button@jeremybenthum/lib/proxy.js b/data/extensions/tortm-browser-button@jeremybenthum/lib/proxy.js
deleted file mode 100644
index a8e3748..0000000
--- a/data/extensions/tortm-browser-button@jeremybenthum/lib/proxy.js
+++ /dev/null
@@ -1,56 +0,0 @@
-if (/Firefox/.test(navigator.userAgent)) {
- chrome.proxy = {"settings": {}};
- chrome.proxy.convert = {
- "to": ({value}) => {
- const mode = value.mode;
- const settings = {
- "autoLogin": value.noPrompt,
- "proxyDNS": value.remoteDNS,
- "autoConfigUrl": mode === 'pac_script' ? value.pacScript.url : '',
- "socksVersion": mode === 'fixed_servers' && value.rules.singleProxy.scheme === 'socks5' ? 5 : 4,
- "passthrough": mode === 'fixed_servers' && value.rules.bypassList && value.rules.bypassList.length ? value.rules.bypassList.join(', ') : '',
- "proxyType": {'direct': 'none', 'system': 'system', 'auto_detect': 'autoDetect', 'fixed_servers': 'manual', 'pac_script': 'autoConfig'}[mode]
- };
- /* */
- if (mode === 'fixed_servers') {
- const rules = value.rules;
- const url = ({host, port, scheme}) => {return host && port ? (scheme === "https" ? "https://" : '') + (host.trim().replace(/.*:\/\//, '') + ':' + port) : ''};
- if (rules.singleProxy.scheme.startsWith('socks')) {
- settings.http = settings.ssl = settings.ftp = '';
- settings.socks = url(rules.singleProxy);
- } else settings.ssl = settings.ftp = settings.http = url(rules.singleProxy);
- }
- /* */
- return {"value": settings};
- },
- "from": ({value}) => {
- const config = {"value": {"remoteDNS": value.proxyDNS, "noPrompt": value.autoLogin}};
- config.value.mode = {'none': 'direct', 'system': 'system', 'autoDetect': 'auto_detect', 'manual': 'fixed_servers', 'autoConfig': 'pac_script'}[value.proxyType];
- if (value.proxyType === 'autoConfig' || value.proxyType === 'manual') config.value.rules = {};
- /* */
- if (value.proxyType === 'autoConfig') config.value.pacScript = {"url": value.autoConfigUrl};
- else if (value.proxyType === 'manual') {
- config.value.rules.bypassList = value.passthrough ? value.passthrough.split(', ') : [];
- const type = url => {return value.socks ? 'socks' + value.socksVersion : (url.startsWith('https://') ? 'https' : 'http')};
- const parse = url => {
- const scheme = type(url);
- const [host, port] = url.split('://')[0].split(':');
- return {scheme, host, "port": Number(port)};
- };
- /* */
- config.value.rules.singleProxy = parse(value.http || value.socks);
- }
- /* */
- return config;
- }
- };
- /* */
- chrome.proxy.settings.clear = (o, callback) => browser.proxy.settings.clear(o).then(callback);
- chrome.proxy.settings.get = (o, callback) => browser.proxy.settings.get(o).then(e => callback(chrome.proxy.convert.from(e)));
- chrome.proxy.settings.set = async(o, callback = function () {}) => {
- const settings = chrome.proxy.convert.to(o);
- await browser.proxy.settings.clear({});
- browser.proxy.settings.set(settings);
- callback();
- };
-}