From 6909320776d9fdc7181db51d03596075534e2689 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Mon, 15 Jun 2020 04:02:57 -0400 Subject: 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. --- .../lib/chrome/background.html | 9 -- .../lib/chrome/chrome.js | 65 --------------- .../lib/common.js | 95 ---------------------- .../lib/config.js | 48 ----------- .../lib/proxy.js | 56 ------------- 5 files changed, 273 deletions(-) delete mode 100644 data/extensions/tortm-browser-button@jeremybenthum/lib/chrome/background.html delete mode 100644 data/extensions/tortm-browser-button@jeremybenthum/lib/chrome/chrome.js delete mode 100644 data/extensions/tortm-browser-button@jeremybenthum/lib/common.js delete mode 100644 data/extensions/tortm-browser-button@jeremybenthum/lib/config.js delete mode 100644 data/extensions/tortm-browser-button@jeremybenthum/lib/proxy.js (limited to 'data/extensions/tortm-browser-button@jeremybenthum/lib') diff --git a/data/extensions/tortm-browser-button@jeremybenthum/lib/chrome/background.html b/data/extensions/tortm-browser-button@jeremybenthum/lib/chrome/background.html deleted file mode 100644 index 12a37a9..0000000 --- a/data/extensions/tortm-browser-button@jeremybenthum/lib/chrome/background.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/data/extensions/tortm-browser-button@jeremybenthum/lib/chrome/chrome.js b/data/extensions/tortm-browser-button@jeremybenthum/lib/chrome/chrome.js deleted file mode 100644 index f2963a6..0000000 --- a/data/extensions/tortm-browser-button@jeremybenthum/lib/chrome/chrome.js +++ /dev/null @@ -1,65 +0,0 @@ -var app = {}; - -app.button = {set icon (o) {chrome.browserAction.setIcon(o)}}; -app.version = function () {return chrome.runtime.getManifest().version}; -app.homepage = function () {return chrome.runtime.getManifest().homepage_url}; -chrome.runtime.setUninstallURL(app.homepage() + "?v=" + app.version() + "&type=uninstall", function () {}); - -app.tab = { - "reload": function (url) {chrome.tabs.reload(function () {})}, - "open": function (url) {chrome.tabs.create({"url": url, "active": true})} -}; - -chrome.runtime.onInstalled.addListener(function (e) { - window.setTimeout(function () { - var previous = e.previousVersion !== undefined && e.previousVersion !== app.version(); - var doupdate = previous && parseInt((Date.now() - config.welcome.lastupdate) / (24 * 3600 * 1000)) > 45; - if (e.reason === "install" || (e.reason === "update" && doupdate)) { - var parameter = (e.previousVersion ? "&p=" + e.previousVersion : '') + "&type=" + e.reason; -// app.tab.open(app.homepage() + "?v=" + app.version() + parameter); - config.welcome.lastupdate = Date.now(); - } - }, 3000); -}); - -app.storage = (function () { - var objs = {}; - window.setTimeout(function () { - chrome.storage.local.get(null, function (o) { - objs = o; - var script = document.createElement("script"); - script.src = "../common.js"; - document.body.appendChild(script); - }); - }, 300); - /* */ - return { - "read": function (id) {return objs[id]}, - "write": function (id, data) { - var tmp = {}; - tmp[id] = data; - objs[id] = data; - chrome.storage.local.set(tmp, function () {}); - } - } -})(); - -app.popup = (function () { - var tmp = {}; - chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) { - for (var id in tmp) { - if (tmp[id] && (typeof tmp[id] === "function")) { - if (request.path === 'popup-to-background') { - if (request.method === id) tmp[id](request.data); - } - } - } - }); - /* */ - return { - "receive": function (id, callback) {tmp[id] = callback}, - "send": function (id, data, tabId) { - chrome.runtime.sendMessage({"path": 'background-to-popup', "method": id, "data": data}); - } - } -})(); diff --git a/data/extensions/tortm-browser-button@jeremybenthum/lib/common.js b/data/extensions/tortm-browser-button@jeremybenthum/lib/common.js deleted file mode 100644 index 7d95722..0000000 --- a/data/extensions/tortm-browser-button@jeremybenthum/lib/common.js +++ /dev/null @@ -1,95 +0,0 @@ -var core = { - "popup": { - "send": function () { - tor.icon(tor.id); - app.popup.send("tor-data", { - "id": tor.id, - "log": tor.log, - "whitelist": config.addon.whitelist - }); - } - }, - "apply": { - "proxy": function (callback) { - if (tor.id === "OFF") chrome.proxy.settings.set({"scope": "regular", "value": {"mode": "system"}}, callback); - else chrome.proxy.settings.set({ - "scope": "regular", - "value": { - "mode": "fixed_servers", - "rules": { - "bypassList": tor.bypassList, - "singleProxy": {"scheme": "socks5", "host": "127.0.0.1", "port": 9050} - } - } - }, callback); - } - } -}; - -var tor = { - "id": "OFF", - "bypassList": [], - "log": "Onion Browser Button", - "stop": function () { - tor.id = "OFF"; - tor.log = "TOR proxy is disabled"; - core.apply.proxy(core.popup.send); - }, - "start": function () { - tor.id = "ON"; - tor.log = "Connected to 127.0.0.1:9050"; - config.notifications.create("TOR is running. Connected to 127.0.0.1:9050"); - tor.bypassList = config.addon.whitelist ? config.addon.whitelist.split(',') : []; - core.apply.proxy(core.popup.send); - }, - "once": function (callback) { - tor.id = "CHECK"; - tor.log = "Checking tor proxy connection..."; - tor.bypassList = config.addon.whitelist ? config.addon.whitelist.split(',') : []; - core.apply.proxy(function () {window.setTimeout(function () {callback(true)}, 300)}); - core.popup.send(); - }, - "icon": function (state) { - app.button.icon = { - "path": { - "16": "../../data/icons/" + (state ? state + "/" : '') + "16.png", - "32": "../../data/icons/" + (state ? state + "/" : '') + "32.png", - "48": "../../data/icons/" + (state ? state + "/" : '') + "48.png", - "64": "../../data/icons/" + (state ? state + "/" : '') + "64.png" - } - }; - }, - "update": function () { - if (config.addon.state === "ON") { - tor.once(function () { - var url = config.url.tor + "?t=" + new Date().getTime() + "&r=" + Math.round(Math.random() * 10000); - config.request(url, function (e) { - if (e === "ok") config.addon.state === "ON" ? tor.start() : tor.stop(); - else { - tor.stop(); - config.notifications.create("TOR is NOT running. Please connect your computer to TOR network and try again."); - } - }); - }); - } else tor.stop(); - } -}; - -app.popup.receive("popup-data", function (e) { - if (e.name === "reload") app.tab.reload(); - if (e.name === "ip") app.tab.open(config.url.ip); - if (e.name === "check") app.tab.open(config.url.tor); - if (e.name === "support") app.tab.open(app.homepage()); - if (e.name === "install") app.tab.open(config.url.github); - if (e.name === "bypassList") { - config.addon.whitelist = e.whitelist; - tor.update(); - } - if (e.name === "ON" || e.name === "OFF") { - config.addon.state = e.name; - tor.update(); - } -}); - -window.setTimeout(tor.update, 0); -app.popup.receive("load", core.popup.send); diff --git a/data/extensions/tortm-browser-button@jeremybenthum/lib/config.js b/data/extensions/tortm-browser-button@jeremybenthum/lib/config.js deleted file mode 100644 index 7d0a801..0000000 --- a/data/extensions/tortm-browser-button@jeremybenthum/lib/config.js +++ /dev/null @@ -1,48 +0,0 @@ -var config = {}; - -config.url = { - "tor": "https://check.torproject.org/", - "ip": "https://webbrowsertools.com/ip-address/", - "github": "https://github.com/jeremy-jr-benthum/tor-button/releases", -}; - -config.welcome = { - set lastupdate (val) {app.storage.write("lastupdate", val)}, - get lastupdate () {return app.storage.read("lastupdate") !== undefined ? app.storage.read("lastupdate") : 0} -}; - -config.addon = { - set state (val) {app.storage.write("state", val)}, - set whitelist (val) {app.storage.write("whitelist", val)}, - get whitelist () {return app.storage.read("whitelist") || ''}, - get state () {return app.storage.read("state") !== undefined ? app.storage.read("state") : "OFF"} -}; - -config.request = function (url, callback) { - var xhr = new XMLHttpRequest(); - try { - xhr.onload = function () {xhr.status >= 200 && xhr.status < 304 ? callback("ok") : callback("error")}; - xhr.open("HEAD", url, true); - xhr.onerror = function () {callback("error")}; - xhr.ontimeout = function () {callback("error")}; - xhr.send(''); - } catch (e) {callback("error")} -}; - -config.notifications = (function () { - chrome.notifications.onClicked.addListener(function (id) { - if (id === config.notifications.id) app.tab.open(app.homepage() + "#faq"); - }); - /* */ - return { - "id": "onion-button-notifications-id", - "create": function (message) { - chrome.notifications.create(config.notifications.id, { - "type": "basic", - "message": message, - "title": "Onion Browser Button", - "iconUrl": /Firefox/.test(navigator.userAgent) ? "data/icons/64.png" : chrome.runtime.getURL("data/icons/64.png") - }, function () {}); - } - } -})(); 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(); - }; -} -- cgit v1.2.3