From 518e04a40b918be537696767b1a6cbdbfeac779d Mon Sep 17 00:00:00 2001 From: idk Date: Tue, 14 Jan 2020 18:18:13 -0500 Subject: [PATCH] make it so that onboarding slides show in one click the first time --- Makefile | 1 + background.js | 190 +++++++++++++++++++++---------------------- bookmarks.js | 74 ++++++++--------- config.js | 10 +-- content.js | 68 ++++++++-------- context.js | 8 +- handler.js | 84 +++++++++---------- home.html | 4 +- home.js | 34 ++++---- host.js | 94 ++++++++++----------- info.css | 3 + info.js | 24 +++--- options/options.html | 110 ++++++++++++------------- platform.js | 8 +- privacy.js | 16 ++-- proxy.js | 122 +++++++++++++-------------- scrub.js | 162 ++++++++++++++++++------------------ window.html | 181 ++++++++++++++++++++--------------------- 18 files changed, 597 insertions(+), 596 deletions(-) diff --git a/Makefile b/Makefile index 4c91f91..1973a27 100644 --- a/Makefile +++ b/Makefile @@ -242,6 +242,7 @@ fmt: tidy --as-xhtml --drop-empty-elements no --input-xml --tidy-mark no -indent --indent-spaces 4 -wrap 0 --new-blocklevel-tags article,header,footer --new-inline-tags video,audio,canvas,ruby,rt,rp --break-before-br yes --sort-attributes alpha --vertical-space yes window.html > .window.html; mv .window.html window.html tidy --as-xhtml --drop-empty-elements no --input-xml --tidy-mark no -indent --indent-spaces 4 -wrap 0 --new-blocklevel-tags article,header,footer --new-inline-tags video,audio,canvas,ruby,rt,rp --break-before-br yes --sort-attributes alpha --vertical-space yes home.html > .home.html; mv .home.html home.html tidy --as-xhtml --drop-empty-elements no --input-xml --tidy-mark no -indent --indent-spaces 4 -wrap 0 --new-blocklevel-tags article,header,footer --new-inline-tags video,audio,canvas,ruby,rt,rp --break-before-br yes --sort-attributes alpha --vertical-space yes toopie.html > .toopie.html; mv .toopie.html toopie.html + tidy --as-xhtml --drop-empty-elements no --input-xml --tidy-mark no -indent --indent-spaces 4 -wrap 0 --new-blocklevel-tags article,header,footer --new-inline-tags video,audio,canvas,ruby,rt,rp --break-before-br yes --sort-attributes alpha --vertical-space yes options/options.html > options/.options.html; mv options/.options.html options/options.html find . -path ./node_modules -prune -o -name '*.js' -exec prettier --write {} \; find . -path ./node_modules -prune -o -name '*.json' -exec prettier --write {} \; diff --git a/background.js b/background.js index f627884..7734558 100644 --- a/background.js +++ b/background.js @@ -1,18 +1,18 @@ -var titlepref = chrome.i18n.getMessage('titlePreface'); -var titleprefpriv = chrome.i18n.getMessage('titlePrefacePrivate'); -var webpref = chrome.i18n.getMessage('webPreface'); -var webprefpriv = chrome.i18n.getMessage('webPrefacePrivate'); -var routerpref = chrome.i18n.getMessage('routerPreface'); -var routerprefpriv = chrome.i18n.getMessage('routerPrefacePrivate'); -var mailpref = chrome.i18n.getMessage('mailPreface'); -var mailprefpriv = chrome.i18n.getMessage('mailPrefacePrivate'); -var torrentpref = chrome.i18n.getMessage('torrentPreface'); -var torrentprefpriv = chrome.i18n.getMessage('torrentPrefacePrivate'); -var tunnelpref = chrome.i18n.getMessage('i2ptunnelPreface'); -var tunnelprefpriv = chrome.i18n.getMessage('i2ptunnelPrefacePrivate'); -var localpref = chrome.i18n.getMessage('localPreface'); -var localprefpriv = chrome.i18n.getMessage('localPrefacePrivate'); -var extensionpref = chrome.i18n.getMessage('extensionPreface'); +var titlepref = chrome.i18n.getMessage("titlePreface"); +var titleprefpriv = chrome.i18n.getMessage("titlePrefacePrivate"); +var webpref = chrome.i18n.getMessage("webPreface"); +var webprefpriv = chrome.i18n.getMessage("webPrefacePrivate"); +var routerpref = chrome.i18n.getMessage("routerPreface"); +var routerprefpriv = chrome.i18n.getMessage("routerPrefacePrivate"); +var mailpref = chrome.i18n.getMessage("mailPreface"); +var mailprefpriv = chrome.i18n.getMessage("mailPrefacePrivate"); +var torrentpref = chrome.i18n.getMessage("torrentPreface"); +var torrentprefpriv = chrome.i18n.getMessage("torrentPrefacePrivate"); +var tunnelpref = chrome.i18n.getMessage("i2ptunnelPreface"); +var tunnelprefpriv = chrome.i18n.getMessage("i2ptunnelPrefacePrivate"); +var localpref = chrome.i18n.getMessage("localPreface"); +var localprefpriv = chrome.i18n.getMessage("localPrefacePrivate"); +var extensionpref = chrome.i18n.getMessage("extensionPreface"); function onContextsGot(contexts) { var ids = []; @@ -20,13 +20,13 @@ function onContextsGot(contexts) { console.log(`Name : ${context.name}`); ids.push(context.name); } - console.log('Checking new contexts'); + console.log("Checking new contexts"); if (ids.indexOf(titlepref) == -1) { browser.contextualIdentities .create({ name: titlepref, - color: 'orange', - icon: 'fingerprint' + color: "orange", + icon: "fingerprint" }) .then(onCreated, onNotCreated); } @@ -34,8 +34,8 @@ function onContextsGot(contexts) { browser.contextualIdentities .create({ name: webpref, - color: 'red', - icon: 'circle' + color: "red", + icon: "circle" }) .then(onCreated, onNotCreated); } @@ -43,8 +43,8 @@ function onContextsGot(contexts) { browser.contextualIdentities .create({ name: routerpref, - color: 'blue', - icon: 'briefcase' + color: "blue", + icon: "briefcase" }) .then(onCreated, onNotCreated); } @@ -52,8 +52,8 @@ function onContextsGot(contexts) { browser.contextualIdentities .create({ name: tunnelpref, - color: 'green', - icon: 'tree' + color: "green", + icon: "tree" }) .then(onCreated, onNotCreated); } @@ -61,8 +61,8 @@ function onContextsGot(contexts) { browser.contextualIdentities .create({ name: mailpref, - color: 'yellow', - icon: 'briefcase' + color: "yellow", + icon: "briefcase" }) .then(onCreated, onNotCreated); } @@ -70,8 +70,8 @@ function onContextsGot(contexts) { browser.contextualIdentities .create({ name: torrentpref, - color: 'purple', - icon: 'chill' + color: "purple", + icon: "chill" }) .then(onCreated, onNotCreated); } @@ -79,30 +79,30 @@ function onContextsGot(contexts) { browser.contextualIdentities .create({ name: localpref, - color: 'red', - icon: 'fence' + color: "red", + icon: "fence" }) .then(onCreated, onNotCreated); } } function onContextsError() { - console.log('Error finding contextual identities, is the API enabled?'); + console.log("Error finding contextual identities, is the API enabled?"); } function onCreated(context) { - console.log(' ID:', context.cookieStoreId, 'created.'); + console.log(" ID:", context.cookieStoreId, "created."); } function onNotCreated(context) { - console.log('ID:', context.cookieStoreId, 'not created.'); + console.log("ID:", context.cookieStoreId, "not created."); } browser.contextualIdentities.query({}).then(onContextsGot, onContextsError); var gettingInfo = browser.runtime.getPlatformInfo(); gettingInfo.then(got => { - if (got.os != 'android') { + if (got.os != "android") { browser.windows.onCreated.addListener(themeWindow); browser.windows.onFocusChanged.addListener(themeWindow); browser.windows.onRemoved.addListener(themeWindow); @@ -115,7 +115,7 @@ function themeWindowByTab(tabId) { function tabWindow(tab) { var gettingPlatformInfo = browser.runtime.getPlatformInfo(); gettingPlatformInfo.then(got => { - if (got.os == 'android') { + if (got.os == "android") { let getwindow = browser.tabs.get(tab.tabId); getwindow.then(themeWindow); } else { @@ -124,7 +124,7 @@ function themeWindowByTab(tabId) { } }); } - if (typeof tabId === 'number') { + if (typeof tabId === "number") { let tab = browser.tabs.get(tabId); tab.then(tabWindow); } else { @@ -150,108 +150,108 @@ var getOldTheme = async function getOldTheme() { let foundtheme = await browser.theme.getCurrent(); if (!isEmpty(foundtheme)) { oldtheme = foundtheme; - console.log('Found old theme', oldtheme); + console.log("Found old theme", oldtheme); } return oldtheme; -} +}; getOldTheme(); function themeWindow(window) { // Check if the window is in private browsing function onThemeError() { - console.log('got theme', oldtheme); + console.log("got theme", oldtheme); browser.theme.update(oldtheme); } function logTabs(tabInfo) { function onContextGotTheme(context) { if (context.name == titlepref) { - console.log('Active in I2P window'); + console.log("Active in I2P window"); if (window.incognito) { browser.theme.update(window.id, { colors: { - frame: '#FFC56D', - toolbar: '#FFC56D' + frame: "#FFC56D", + toolbar: "#FFC56D" } }); } else { browser.theme.update(window.id, { colors: { - frame: '#FFC56D', - toolbar: '#FFC56D' + frame: "#FFC56D", + toolbar: "#FFC56D" } }); } } else if (context.name == routerpref) { - console.log('Active in Router Console window'); + console.log("Active in Router Console window"); if (window.incognito) { browser.theme.update(window.id, { colors: { - frame: '#A4C8E1', - toolbar: '#A4C8E1' + frame: "#A4C8E1", + toolbar: "#A4C8E1" } }); } else { browser.theme.update(window.id, { colors: { - frame: '#A4C8E1', - toolbar: '#A4C8E1' + frame: "#A4C8E1", + toolbar: "#A4C8E1" } }); } } else if (context.name == tunnelpref) { - console.log('Active in Hidden Services Manager window'); + console.log("Active in Hidden Services Manager window"); if (window.incognito) { browser.theme.update(window.id, { colors: { - frame: '#D9D9D6', - toolbar: '#D9D9D6' + frame: "#D9D9D6", + toolbar: "#D9D9D6" } }); } else { browser.theme.update(window.id, { colors: { - frame: '#D9D9D6', - toolbar: '#D9D9D6' + frame: "#D9D9D6", + toolbar: "#D9D9D6" } }); } } else if (context.name == mailpref) { - console.log('Active in Web Mail window'); + console.log("Active in Web Mail window"); if (window.incognito) { browser.theme.update(window.id, { colors: { - frame: '#F7E59A', - toolbar: '#F7E59A' + frame: "#F7E59A", + toolbar: "#F7E59A" } }); } else { browser.theme.update(window.id, { colors: { - frame: '#F7E59A', - toolbar: '#F7E59A' + frame: "#F7E59A", + toolbar: "#F7E59A" } }); } } else if (context.name == torrentpref) { - console.log('Active in Bittorrent window'); + console.log("Active in Bittorrent window"); if (window.incognito) { browser.theme.update(window.id, { colors: { - frame: '#A48FE1', - toolbar: '#A48FE1' + frame: "#A48FE1", + toolbar: "#A48FE1" } }); } else { browser.theme.update(window.id, { colors: { - frame: '#A48FE1', - toolbar: '#A48FE1' + frame: "#A48FE1", + toolbar: "#A48FE1" } }); } } else { - console.log('Not active in I2P window'); + console.log("Not active in I2P window"); if (isEmpty(oldtheme)) { browser.theme.reset(); } else { @@ -260,8 +260,8 @@ function themeWindow(window) { } } if ( - tabInfo[0].cookieStoreId != 'firefox-default' && - tabInfo[0].cookieStoreId != 'firefox-private' + tabInfo[0].cookieStoreId != "firefox-default" && + tabInfo[0].cookieStoreId != "firefox-private" ) { browser.contextualIdentities .get(tabInfo[0].cookieStoreId) @@ -283,109 +283,109 @@ function themeWindow(window) { function setTitle(window) { // Check if the window is in private browsing function onContextError() { - console.log('Context Error'); + console.log("Context Error"); } function logTabs(tabInfo) { function onContextGotTitle(context) { if (context.name == titlepref) { - console.log('Active in I2P window'); + console.log("Active in I2P window"); if (window.incognito) { browser.windows.update(window.id, { - titlePreface: titleprefpriv + ': ' + titlePreface: titleprefpriv + ": " }); } else { browser.windows.update(window.id, { - titlePreface: titlepref + ': ' + titlePreface: titlepref + ": " }); } } else if (context.name == webpref) { - console.log('Active in Web window'); + console.log("Active in Web window"); if (window.incognito) { browser.windows.update(window.id, { - titlePreface: webprefpriv + ' - ' + titlePreface: webprefpriv + " - " }); } else { browser.windows.update(window.id, { - titlePreface: webpref + ' - ' + titlePreface: webpref + " - " }); } } else if (context.name == routerpref) { - console.log('Active in Router Console window'); + console.log("Active in Router Console window"); if (window.incognito) { browser.windows.update(window.id, { - titlePreface: titleprefpriv + ' - ' + routerprefpriv + ': ' + titlePreface: titleprefpriv + " - " + routerprefpriv + ": " }); } else { browser.windows.update(window.id, { - titlePreface: titlepref + ' - ' + routerpref + ': ' + titlePreface: titlepref + " - " + routerpref + ": " }); } } else if (context.name == tunnelpref) { - console.log('Active in Hidden Services Manager window'); + console.log("Active in Hidden Services Manager window"); if (window.incognito) { browser.windows.update(window.id, { - titlePreface: titleprefpriv + ' - ' + tunnelprefpriv + ': ' + titlePreface: titleprefpriv + " - " + tunnelprefpriv + ": " }); } else { browser.windows.update(window.id, { - titlePreface: titlepref + ' - ' + tunnelpref + ': ' + titlePreface: titlepref + " - " + tunnelpref + ": " }); } } else if (context.name == mailpref) { - console.log('Active in I2P Web Mail window'); + console.log("Active in I2P Web Mail window"); if (window.incognito) { browser.windows.update(window.id, { - titlePreface: titleprefpriv + ' - ' + mailprefpriv + ': ' + titlePreface: titleprefpriv + " - " + mailprefpriv + ": " }); } else { browser.windows.update(window.id, { - titlePreface: titlepref + ' - ' + mailpref + ': ' + titlePreface: titlepref + " - " + mailpref + ": " }); } } else if (context.name == torrentpref) { - console.log('Active in I2P Torrent window'); + console.log("Active in I2P Torrent window"); if (window.incognito) { browser.windows.update(window.id, { - titlePreface: titleprefpriv + ' - ' + torrentprefpriv + ': ' + titlePreface: titleprefpriv + " - " + torrentprefpriv + ": " }); } else { browser.windows.update(window.id, { - titlePreface: titlepref + ' - ' + torrentpref + ': ' + titlePreface: titlepref + " - " + torrentpref + ": " }); } } else if (context.name == localpref) { - console.log('Active in Localhost window'); + console.log("Active in Localhost window"); if (window.incognito) { browser.windows.update(window.id, { - titlePreface: localprefpriv + ' - ' + localprefpriv + ': ' + titlePreface: localprefpriv + " - " + localprefpriv + ": " }); } else { browser.windows.update(window.id, { - titlePreface: localpref + ' - ' + localpref + ': ' + titlePreface: localpref + " - " + localpref + ": " }); } } } if ( - tabInfo[0].cookieStoreId != 'firefox-default' && - tabInfo[0].cookieStoreId != 'firefox-private' + tabInfo[0].cookieStoreId != "firefox-default" && + tabInfo[0].cookieStoreId != "firefox-private" ) { browser.contextualIdentities .get(tabInfo[0].cookieStoreId) .then(onContextGotTitle, onContextError); } else if (window.incognito) { browser.windows.update(window.id, { - titlePreface: '' + titlePreface: "" }); } else { browser.windows.update(window.id, { - titlePreface: '' + titlePreface: "" }); } } @@ -400,9 +400,9 @@ function setTitle(window) { var gettingListenerInfo = browser.runtime.getPlatformInfo(); gettingListenerInfo.then(got => { function onPlatformError() { - console.log('Error finding platform info'); + console.log("Error finding platform info"); } - if (got.os != 'android') { + if (got.os != "android") { browser.tabs.onCreated.addListener(() => { var getting = browser.windows.getCurrent({ populate: true diff --git a/bookmarks.js b/bookmarks.js index 7c2048d..3705f53 100644 --- a/bookmarks.js +++ b/bookmarks.js @@ -1,28 +1,28 @@ var gettingInfo = browser.runtime.getPlatformInfo(); gettingInfo.then(got => { - if (got.os != 'android') { + if (got.os != "android") { function bookmarks(bookmarkToolbar) { - console.log('Setting up bookmark toolbar', bookmarkToolbar); + console.log("Setting up bookmark toolbar", bookmarkToolbar); function bookHome(bookmarkItems) { if (!bookmarkItems.length) { function gotProxyInfo(info) { - let port = info.value.http.split(':')[1]; - if (port == '7644') { + let port = info.value.http.split(":")[1]; + if (port == "7644") { let createRhizomeBookmark = browser.bookmarks.create({ - url: 'about:I2p', - title: 'I2P Home Page', + url: "about:I2p", + title: "I2P Home Page", parentId: bookmarkToolbar[0].id }); createRhizomeBookmark.then(onCreated); } else { let createBookmark = browser.bookmarks.create({ - url: browser.runtime.getURL('home.html'), - title: 'I2P Home Page', + url: browser.runtime.getURL("home.html"), + title: "I2P Home Page", parentId: bookmarkToolbar[0].id }); createBookmark.then(onCreated); } - console.log('(bookmarks) adding home page bookmark'); + console.log("(bookmarks) adding home page bookmark"); } console.log( "(bookmarks) checking if we're running in an I2P Browser" @@ -34,19 +34,19 @@ gettingInfo.then(got => { function bookTorrent(bookmarkItems) { if (!bookmarkItems.length) { function gotProxyInfo(info) { - let port = info.value.http.split(':')[1]; - if (port == '7644') { + let port = info.value.http.split(":")[1]; + if (port == "7644") { let createBookmark = browser.bookmarks.create({ - url: 'http://localhost:7647/i2psnark', - title: 'Bittorrent', + url: "http://localhost:7647/i2psnark", + title: "Bittorrent", parentId: bookmarkToolbar[0].id }); createBookmark.then(onCreated); } else { let createRhizomeBookmark = browser.bookmarks.create({ url: - 'http://' + control_host + ':' + control_port + '/i2psnark', - title: 'Bittorrent', + "http://" + control_host + ":" + control_port + "/i2psnark", + title: "Bittorrent", parentId: bookmarkToolbar[0].id }); createRhizomeBookmark.then(onCreated); @@ -62,23 +62,23 @@ gettingInfo.then(got => { function bookMail(bookmarkItems) { if (!bookmarkItems.length) { function gotProxyInfo(info) { - let port = info.value.http.split(':')[1]; - if (port == '7644') { + let port = info.value.http.split(":")[1]; + if (port == "7644") { let createBookmark = browser.bookmarks.create({ - url: 'http://localhost:7647/webmail', - title: 'Web Mail', + url: "http://localhost:7647/webmail", + title: "Web Mail", parentId: bookmarkToolbar[0].id }); createBookmark.then(onCreated); } else { let createRhizomeBookmark = browser.bookmarks.create({ - url: 'http://' + control_host + ':' + control_port + '/webmail', - title: 'Web Mail', + url: "http://" + control_host + ":" + control_port + "/webmail", + title: "Web Mail", parentId: bookmarkToolbar[0].id }); createRhizomeBookmark.then(onCreated); } - console.log('(bookmarks) adding webmail bookmark'); + console.log("(bookmarks) adding webmail bookmark"); } console.log( "(bookmarks) checking if we're running in an I2P Browser" @@ -90,28 +90,28 @@ gettingInfo.then(got => { function bookI2PTunnel(bookmarkItems) { if (!bookmarkItems.length) { function gotProxyInfo(info) { - let port = info.value.http.split(':')[1]; - if (port == '7644') { + let port = info.value.http.split(":")[1]; + if (port == "7644") { var createBookmark = browser.bookmarks.create({ - url: 'http://localhost:7647/i2ptunnelmgr', - title: 'Hidden Services Manager', + url: "http://localhost:7647/i2ptunnelmgr", + title: "Hidden Services Manager", parentId: bookmarkToolbar[0].id }); createBookmark.then(onCreated); } else { var createRhizomeBookmark = browser.bookmarks.create({ url: - 'http://' + + "http://" + control_host + - ':' + + ":" + control_port + - '/i2ptunnelmgr', - title: 'Hidden Services Manager', + "/i2ptunnelmgr", + title: "Hidden Services Manager", parentId: bookmarkToolbar[0].id }); createRhizomeBookmark.then(onCreated); } - console.log('(bookmarks) adding i2ptunnel bookmark'); + console.log("(bookmarks) adding i2ptunnel bookmark"); } console.log( "(bookmarks) checking if we're running in an I2P Browser" @@ -125,32 +125,32 @@ gettingInfo.then(got => { console.log(`An error : ${error}`); } function onCreated(node) { - console.log('Bookmarked', node); + console.log("Bookmarked", node); } var b0 = browser.bookmarks.search({ - title: 'I2P Home Page' + title: "I2P Home Page" }); b0.then(bookHome, onRejected); var b1 = browser.bookmarks.search({ - title: 'Bittorrent' + title: "Bittorrent" }); b1.then(bookTorrent, onRejected); var b2 = browser.bookmarks.search({ - title: 'Hidden Services Manager' + title: "Hidden Services Manager" }); b2.then(bookI2PTunnel, onRejected); var b3 = browser.bookmarks.search({ - title: 'Web Mail' + title: "Web Mail" }); b3.then(bookMail, onRejected); } var bt = browser.bookmarks.search({ - query: 'Toolbar' + query: "Toolbar" }); bt.then(bookmarks); diff --git a/config.js b/config.js index 8470891..6709690 100644 --- a/config.js +++ b/config.js @@ -1,6 +1,6 @@ -var proxy_scheme = 'HTTP'; -var proxy_host = '127.0.0.1'; -var proxy_port = '4444'; -var control_host = '127.0.0.1'; -var control_port = '7657'; +var proxy_scheme = "HTTP"; +var proxy_host = "127.0.0.1"; +var proxy_port = "4444"; +var control_host = "127.0.0.1"; +var control_port = "7657"; var disable_history = false; diff --git a/content.js b/content.js index 51ff4d2..f215d54 100644 --- a/content.js +++ b/content.js @@ -2,51 +2,51 @@ function contentUpdateById(id, message) { let infoTitle = document.getElementById(id); let messageContent = chrome.i18n.getMessage(message); if (infoTitle === null) { - console.log('content error', id, messageContent); + console.log("content error", id, messageContent); return; } infoTitle.textContent = messageContent; } // Information Section -contentUpdateById('text-section-header', 'extensionName'); -contentUpdateById('description', 'extensionDescription'); -contentUpdateById('beta', 'extensionStatus'); -contentUpdateById('proxy-check', 'proxyFailedStatus'); +contentUpdateById("text-section-header", "extensionName"); +contentUpdateById("description", "extensionDescription"); +contentUpdateById("beta", "extensionStatus"); +contentUpdateById("proxy-check", "proxyFailedStatus"); // Control Section -contentUpdateById('controlHeader', 'controlHeader'); -contentUpdateById('controlExplain', 'controlExplain'); -contentUpdateById('clear-browser-data', 'clearData'); -contentUpdateById('clear-desc', 'clearDesc'); -contentUpdateById('enable-web-rtc', 'enableWebRTC'); -contentUpdateById('rtcDesc', 'rtcDesc'); -contentUpdateById('disable-history', 'disableHistory'); -contentUpdateById('histDesc', 'histDesc'); +contentUpdateById("controlHeader", "controlHeader"); +contentUpdateById("controlExplain", "controlExplain"); +contentUpdateById("clear-browser-data", "clearData"); +contentUpdateById("clear-desc", "clearDesc"); +contentUpdateById("enable-web-rtc", "enableWebRTC"); +contentUpdateById("rtcDesc", "rtcDesc"); +contentUpdateById("disable-history", "disableHistory"); +contentUpdateById("histDesc", "histDesc"); // Application Section -contentUpdateById('applicationHeader', 'applicationHeader'); -contentUpdateById('applicationExplain', 'applicationExplain'); -contentUpdateById('window-visit-index', 'windowVisitHelppage'); -contentUpdateById('help', 'help'); -contentUpdateById('window-visit-homepage', 'windowVisitHomepage'); -contentUpdateById('abouthome', 'abouthome'); -contentUpdateById('window-visit-i2ptunnel', 'windowVisitI2ptunnel'); -contentUpdateById('i2ptunnel', 'i2ptunnel'); -contentUpdateById('window-visit-susimail', 'windowVisitSusiMail'); -contentUpdateById('susimail', 'susimail'); -contentUpdateById('window-visit-snark', 'windowVisitSnark'); -contentUpdateById('snark', 'snark'); +contentUpdateById("applicationHeader", "applicationHeader"); +contentUpdateById("applicationExplain", "applicationExplain"); +contentUpdateById("window-visit-index", "windowVisitHelppage"); +contentUpdateById("help", "help"); +contentUpdateById("window-visit-homepage", "windowVisitHomepage"); +contentUpdateById("abouthome", "abouthome"); +contentUpdateById("window-visit-i2ptunnel", "windowVisitI2ptunnel"); +contentUpdateById("i2ptunnel", "i2ptunnel"); +contentUpdateById("window-visit-susimail", "windowVisitSusiMail"); +contentUpdateById("susimail", "susimail"); +contentUpdateById("window-visit-snark", "windowVisitSnark"); +contentUpdateById("snark", "snark"); // Homepage Section -contentUpdateById('window-visit-webpage', 'windowVisitWebPage'); -contentUpdateById('webpage', 'help'); -contentUpdateById('window-visit-sources', 'windowVisitSources'); -contentUpdateById('sources', 'sources'); -contentUpdateById('window-visit-releases', 'windowVisitReleases'); -contentUpdateById('releases', 'releases'); +contentUpdateById("window-visit-webpage", "windowVisitWebPage"); +contentUpdateById("webpage", "help"); +contentUpdateById("window-visit-sources", "windowVisitSources"); +contentUpdateById("sources", "sources"); +contentUpdateById("window-visit-releases", "windowVisitReleases"); +contentUpdateById("releases", "releases"); -fetch('http://proxy.i2p').then(myJson => { - console.log('FETCH RESULT', myJson); - contentUpdateById('proxy-check', 'proxySuccessStatus'); +fetch("http://proxy.i2p").then(myJson => { + console.log("FETCH RESULT", myJson); + contentUpdateById("proxy-check", "proxySuccessStatus"); }); diff --git a/context.js b/context.js index b73eff5..49f4bce 100644 --- a/context.js +++ b/context.js @@ -1,5 +1,5 @@ //var windowIds = [] -var titlepref = chrome.i18n.getMessage('titlePreface'); +var titlepref = chrome.i18n.getMessage("titlePreface"); function onError(error) { console.log(`Error : ${error}`); @@ -10,17 +10,17 @@ function eventHandler(event) { console.log(`Created window : ${windowInfo.id}`); browser.tabs.create({ windowId: windowInfo.id, - url: 'about:blank', + url: "about:blank", cookieStoreId: event.target.dataset.identity }); } - if (event.target.dataset.action == 'create') { + if (event.target.dataset.action == "create") { var creating = browser.tabs.create({ cookieStoreId: event.target.dataset.identity }); creating.then(onCreated, onError); } - if (event.target.dataset.action == 'close-all') { + if (event.target.dataset.action == "close-all") { browser.tabs .query({ cookieStoreId: event.target.dataset.identity diff --git a/handler.js b/handler.js index f48624c..ae04606 100644 --- a/handler.js +++ b/handler.js @@ -1,43 +1,43 @@ function routerHost(url) { - let hostname = ''; - let path = ''; + let hostname = ""; + let path = ""; function pathcheck(str) { if (str != undefined) { - let final = str.split('/')[0]; - if (final === 'i2ptunnelmgr' || final === 'i2ptunnel') { - console.log('(urlcheck) application path', final); - return 'i2ptunnelmgr'; - } else if (final === 'i2psnark' || final === 'torrents') { - console.log('(urlcheck) application path', final); - return 'i2psnark'; - } else if (final === 'webmail' || final === 'susimail') { - console.log('(urlcheck) application path', final); - return 'webmail'; + let final = str.split("/")[0]; + if (final === "i2ptunnelmgr" || final === "i2ptunnel") { + console.log("(urlcheck) application path", final); + return "i2ptunnelmgr"; + } else if (final === "i2psnark" || final === "torrents") { + console.log("(urlcheck) application path", final); + return "i2psnark"; + } else if (final === "webmail" || final === "susimail") { + console.log("(urlcheck) application path", final); + return "webmail"; } else if ( - final === 'home' || - final === 'console' || - final === 'dns' || - final.startsWith('config') + final === "home" || + final === "console" || + final === "dns" || + final.startsWith("config") ) { - console.log('(urlcheck) application path', final); - return 'routerconsole'; + console.log("(urlcheck) application path", final); + return "routerconsole"; } } return true; } - if (url.indexOf('://') > -1) { - hostname = url.split('/')[2]; - let prefix = url.substr(0, url.indexOf('://') + 3); - path = url.replace(prefix + hostname + '/', ''); + if (url.indexOf("://") > -1) { + hostname = url.split("/")[2]; + let prefix = url.substr(0, url.indexOf("://") + 3); + path = url.replace(prefix + hostname + "/", ""); } else if (identifyProtocolHandler(url)) { let newurl = identifyProtocolHandler(url); return routerHost(newurl); } else { - hostname = url.split('/')[0]; - path = url.replace(hostname + '/', ''); + hostname = url.split("/")[0]; + path = url.replace(hostname + "/", ""); } - if (hostname === control_host + ':' + control_port) { - console.log('(hostcheck) router console found on configured ports'); + if (hostname === control_host + ":" + control_port) { + console.log("(hostcheck) router console found on configured ports"); return pathcheck(path); } @@ -47,28 +47,28 @@ function routerHost(url) { function identifyProtocolHandler(url) { //console.log("looking for handler-able requests") if (routerHost(url)) { - if (url.includes(encodeURIComponent('ext+rc:'))) { - return url.replace(encodeURIComponent('ext+rc:'), ''); - } else if (url.includes('ext+rc:')) { - return url.replace('ext+rc:', ''); + if (url.includes(encodeURIComponent("ext+rc:"))) { + return url.replace(encodeURIComponent("ext+rc:"), ""); + } else if (url.includes("ext+rc:")) { + return url.replace("ext+rc:", ""); } - } else if (url.includes('ext+rc:')) { + } else if (url.includes("ext+rc:")) { return url; } return false; } function trimHost(url) { - let hostname = ''; - let prefix = ''; - if (url.indexOf('://') > -1) { - prefix = url.substr(0, url.indexOf('://') + 3); - hostname = url.split('/')[2]; + let hostname = ""; + let prefix = ""; + if (url.indexOf("://") > -1) { + prefix = url.substr(0, url.indexOf("://") + 3); + hostname = url.split("/")[2]; } else { - hostname = url.split('/')[0]; + hostname = url.split("/")[0]; } - let path = url.replace(prefix + hostname, ''); - console.log('(handler) path', prefix + hostname, path); + let path = url.replace(prefix + hostname, ""); + console.log("(handler) path", prefix + hostname, path); return path; } @@ -76,7 +76,7 @@ var handlerSetup = function(requestDetails) { //console.log("checking protocol handler listener") let rwurl = identifyProtocolHandler(requestDetails.url); if (rwurl != false) { - console.log('(handler) rewrite URL requested', rwurl); + console.log("(handler) rewrite URL requested", rwurl); requestDetails.redirectUrl = rwurl; requestDetails.url = trimHost(rwurl); requestDetails.originUrl = trimHost(rwurl); @@ -86,6 +86,6 @@ var handlerSetup = function(requestDetails) { browser.webRequest.onBeforeRequest.addListener( handlerSetup, - { urls: [''] }, - ['blocking'] + { urls: [""] }, + ["blocking"] ); diff --git a/home.html b/home.html index 1c1f3e8..e579f1c 100644 --- a/home.html +++ b/home.html @@ -9,7 +9,7 @@ - +
@@ -41,7 +41,7 @@

New to I2P? Learn more here.

-

+

I2P Browser allows you to surf the internet using the private and secure I2P network. When using it, you are protected against tracking, surveillance, and censorship as a first-class participant in the I2P network. I2P Browser isolates cookies and deletes your browser history after your session. These modifications ensure your privacy and security are protected in the browser.

diff --git a/home.js b/home.js index ad4cdc1..86d470b 100644 --- a/home.js +++ b/home.js @@ -1,25 +1,25 @@ -document.addEventListener('click', clickEvent => { - if (clickEvent.target.id === 'onboardingButtonZero') { - flipVisibility('onboardingContentZero'); - } else if (clickEvent.target.id === 'onboardingButtonOne') { - flipVisibility('onboardingContentOne'); - } else if (clickEvent.target.id === 'onboardingButtonTwo') { - flipVisibility('onboardingContentTwo'); - } else if (clickEvent.target.id === 'onboardingButtonThree') { - flipVisibility('onboardingContentThree'); - } else if (clickEvent.target.id === 'onboardingButtonFour') { - flipVisibility('onboardingContentFour'); - } else if (clickEvent.target.id === 'fliplinks') { - flipVisibility('info-content'); +document.addEventListener("click", clickEvent => { + if (clickEvent.target.id === "onboardingButtonZero") { + flipVisibility("onboardingContentZero"); + } else if (clickEvent.target.id === "onboardingButtonOne") { + flipVisibility("onboardingContentOne"); + } else if (clickEvent.target.id === "onboardingButtonTwo") { + flipVisibility("onboardingContentTwo"); + } else if (clickEvent.target.id === "onboardingButtonThree") { + flipVisibility("onboardingContentThree"); + } else if (clickEvent.target.id === "onboardingButtonFour") { + flipVisibility("onboardingContentFour"); + } else if (clickEvent.target.id === "fliplinks") { + flipVisibility("info-content"); } }); function flipVisibility(div) { - console.log("(home) seeking flippable", div) + console.log("(home) seeking flippable", div); let flippable = document.getElementById(div); - if (flippable.style.display === 'none') { - flippable.style.display = 'block'; + if (flippable.style.display !== "block") { + flippable.style.display = "block"; } else { - flippable.style.display = 'none'; + flippable.style.display = "none"; } } diff --git a/host.js b/host.js index 56a6067..bb56ecc 100644 --- a/host.js +++ b/host.js @@ -1,27 +1,27 @@ function proxyHost(url) { - let hostname = ''; - if (url.indexOf('://') > -1) { - hostname = url.split('/')[2]; + let hostname = ""; + if (url.indexOf("://") > -1) { + hostname = url.split("/")[2]; } else { - hostname = url.split('/')[0]; + hostname = url.split("/")[0]; } - if (hostname == 'proxy.i2p') { + if (hostname == "proxy.i2p") { return true; } return false; } function localHost(url) { - let hostname = ''; - if (url.indexOf('://') > -1) { - hostname = url.split('/')[2]; + let hostname = ""; + if (url.indexOf("://") > -1) { + hostname = url.split("/")[2]; } else { - hostname = url.split('/')[0]; + hostname = url.split("/")[0]; } - hostname = hostname.split(':')[0]; - if (hostname === '127.0.0.1') { + hostname = hostname.split(":")[0]; + if (hostname === "127.0.0.1") { return true; - } else if (hostname === 'localhost') { + } else if (hostname === "localhost") { return true; } @@ -30,74 +30,74 @@ function localHost(url) { function extensionHost(url) { if (url.originUrl !== undefined) { - var res = url.originUrl.startsWith(browser.runtime.getURL('')); + var res = url.originUrl.startsWith(browser.runtime.getURL("")); if (res) return res; } if (url.url !== undefined) { - var res = url.url.startsWith(browser.runtime.getURL('')); + var res = url.url.startsWith(browser.runtime.getURL("")); if (res) return res; } } function i2pHostName(url) { - let hostname = ''; - if (url.indexOf('://') > -1) { - hostname = url.split('/')[2]; + let hostname = ""; + if (url.indexOf("://") > -1) { + hostname = url.split("/")[2]; } else { - hostname = url.split('/')[0]; + hostname = url.split("/")[0]; } return hostname; } function i2pHost(url) { let hostname = i2pHostName(url); - return hostname.endsWith('.i2p'); + return hostname.endsWith(".i2p"); } function routerHost(url) { - let hostname = ''; - let path = ''; + let hostname = ""; + let path = ""; function pathcheck(str) { if (str != undefined) { - let final = str.split('/')[0]; - if (final === 'i2ptunnelmgr' || final === 'i2ptunnel') { - console.log('(urlcheck) application path', final); - return 'i2ptunnelmgr'; + let final = str.split("/")[0]; + if (final === "i2ptunnelmgr" || final === "i2ptunnel") { + console.log("(urlcheck) application path", final); + return "i2ptunnelmgr"; } else if ( - final === 'i2psnark' || - final === 'torrents' || - final.startsWith('transmission') + final === "i2psnark" || + final === "torrents" || + final.startsWith("transmission") ) { - console.log('(urlcheck) application path', final); - return 'i2psnark'; - } else if (final === 'webmail' || final === 'susimail') { - console.log('(urlcheck) application path', final); - return 'webmail'; + console.log("(urlcheck) application path", final); + return "i2psnark"; + } else if (final === "webmail" || final === "susimail") { + console.log("(urlcheck) application path", final); + return "webmail"; } else if ( - final === 'home' || - final === 'console' || - final === 'dns' || - final.startsWith('config') + final === "home" || + final === "console" || + final === "dns" || + final.startsWith("config") ) { - console.log('(urlcheck) application path', final); - return 'routerconsole'; + console.log("(urlcheck) application path", final); + return "routerconsole"; } } return true; } - if (url.indexOf('://') > -1) { - hostname = url.split('/')[2]; - let prefix = url.substr(0, url.indexOf('://') + 3); - path = url.replace(prefix + hostname + '/', ''); + if (url.indexOf("://") > -1) { + hostname = url.split("/")[2]; + let prefix = url.substr(0, url.indexOf("://") + 3); + path = url.replace(prefix + hostname + "/", ""); } else if (identifyProtocolHandler(url)) { let newurl = identifyProtocolHandler(url); return routerHost(newurl); } else { - hostname = url.split('/')[0]; - path = url.replace(hostname + '/', ''); + hostname = url.split("/")[0]; + path = url.replace(hostname + "/", ""); } - if (hostname === control_host + ':' + control_port) { - console.log('(hostcheck) router console found on configured ports'); + if (hostname === control_host + ":" + control_port) { + console.log("(hostcheck) router console found on configured ports"); return pathcheck(path); } diff --git a/info.css b/info.css index c079180..032b236 100644 --- a/info.css +++ b/info.css @@ -51,4 +51,7 @@ img.readyness { } #consoleOn { min-height: 2rem +} +#torrentpanel { + display: none } \ No newline at end of file diff --git a/info.js b/info.js index cefa816..ace9331 100644 --- a/info.js +++ b/info.js @@ -2,8 +2,8 @@ function checkPeerConnection() { let getting = browser.privacy.network.peerConnectionEnabled.get({}); getting.then(got => { let webrtc = got.value; - console.log('checking webrtc', webrtc); - document.getElementById('enable-web-rtc').checked = webrtc; + console.log("checking webrtc", webrtc); + document.getElementById("enable-web-rtc").checked = webrtc; }); } @@ -142,18 +142,18 @@ gettingInfo.then(got => { } }); -function showBrowsing(){ - var x = document.getElementById("browserpanel"); - x.style.display = "block"; - var y = document.getElementById("torrentpanel"); - y.style.display = "none"; +function showBrowsing() { + var x = document.getElementById("browserpanel"); + x.style.display = "block"; + var y = document.getElementById("torrentpanel"); + y.style.display = "none"; } -function showTorrents(){ - var x = document.getElementById("browserpanel"); - x.style.display = "none"; - var y = document.getElementById("torrentpanel"); - y.style.display = "block"; +function showTorrents() { + var x = document.getElementById("browserpanel"); + x.style.display = "none"; + var y = document.getElementById("torrentpanel"); + y.style.display = "block"; } function goHome() { diff --git a/options/options.html b/options/options.html index 98b1c83..4661a0b 100644 --- a/options/options.html +++ b/options/options.html @@ -1,31 +1,35 @@ - - + - - - - - + + + + + +
- Proxy Scheme: - + Proxy Scheme:
-
Proxy Options
-

- - -
- - -
+
+ Proxy Options +
+

+

+ +
+ +
+
+ Router Console Options +
-
Router Console Options
-

Configure your router console options here.

- - -
- - +

Configure your router console options here.

+ +
+
-
I2PControl RPC Client Options
-

Configure your I2PControl options here.

- - -
- - -
- - -
+
+ I2PControl RPC Client Options +
+ +

Configure your I2PControl options here.

+ +
+ +
+
-
-
Bittorrent RPC Client Options
-

Configure your Bittorrent options here.

- - -
- - -
- - -
+
+
+ Bittorrent RPC Client Options +
+ +

Configure your Bittorrent options here.

+ +
+ +
+ +
- - - + - - + diff --git a/platform.js b/platform.js index c382a07..1a89ace 100644 --- a/platform.js +++ b/platform.js @@ -2,19 +2,19 @@ var android = false; var gettingInfo = browser.runtime.getPlatformInfo(); gettingInfo.then(got => { - if (got.os == 'android') { - console.log('Running in Android detected'); + if (got.os == "android") { + console.log("Running in Android detected"); android = true; return true; } else { - console.log('Running in Desktop detected'); + console.log("Running in Desktop detected"); android = false; return false; } }); function isDroid() { - console.log('android?', android); + console.log("android?", android); if (android == undefined) { return false; } diff --git a/privacy.js b/privacy.js index 1e8e6b2..2f57657 100644 --- a/privacy.js +++ b/privacy.js @@ -1,10 +1,10 @@ -var titlepref = chrome.i18n.getMessage('titlePreface'); +var titlepref = chrome.i18n.getMessage("titlePreface"); function onSet(result) { if (result) { - console.log('->: Value was updated'); + console.log("->: Value was updated"); } else { - console.log('-X: Value was not updated'); + console.log("-X: Value was not updated"); } } @@ -14,7 +14,7 @@ function disableHyperlinkAuditing() { var setting = browser.privacy.websites.hyperlinkAuditingEnabled.set({ value: false }); - console.log('Disabling hyperlink auditing/val=', { + console.log("Disabling hyperlink auditing/val=", { value: false }); setting.then(onSet); @@ -25,7 +25,7 @@ function enableFirstPartyIsolation() { var setting = browser.privacy.websites.firstPartyIsolate.set({ value: true }); - console.log('Enabling first party isolation/val=', { + console.log("Enabling first party isolation/val=", { value: true }); setting.then(onSet); @@ -39,13 +39,13 @@ function disableEvilCookies() { getting.then(got => { var setting = browser.privacy.websites.cookieConfig.set({ value: { - behavior: 'reject_third_party', + behavior: "reject_third_party", nonPersistentCookies: got.value.nonPersistentCookies } }); - console.log('Setting cookie behavior/val=', { + console.log("Setting cookie behavior/val=", { value: { - behavior: 'reject_third_party', + behavior: "reject_third_party", nonPersistentCookies: got.value.nonPersistentCookies } }); diff --git a/proxy.js b/proxy.js index 9826d25..7f76838 100644 --- a/proxy.js +++ b/proxy.js @@ -1,18 +1,18 @@ -var titlepref = chrome.i18n.getMessage('titlePreface'); -var webpref = chrome.i18n.getMessage('webPreface'); -var routerpref = chrome.i18n.getMessage('routerPreface'); -var routerprefpriv = chrome.i18n.getMessage('routerPrefacePrivate'); +var titlepref = chrome.i18n.getMessage("titlePreface"); +var webpref = chrome.i18n.getMessage("webPreface"); +var routerpref = chrome.i18n.getMessage("routerPreface"); +var routerprefpriv = chrome.i18n.getMessage("routerPrefacePrivate"); browser.privacy.network.peerConnectionEnabled.set({ value: false }); -console.log('Preliminarily disabled WebRTC.'); +console.log("Preliminarily disabled WebRTC."); chrome.privacy.network.networkPredictionEnabled.set({ value: false }); chrome.privacy.network.webRTCIPHandlingPolicy.set({ - value: 'disable_non_proxied_udp' + value: "disable_non_proxied_udp" }); function shouldProxyRequest(requestInfo) { @@ -20,14 +20,14 @@ function shouldProxyRequest(requestInfo) { } var handleContextProxyRequest = async function(requestDetails) { - console.log('(proxy)Searching for proxy by context'); + console.log("(proxy)Searching for proxy by context"); try { var handleProxyRequest = function(context) { proxy = { failoverTimeout: 0, proxyDns: false }; - if (context == 'firefox-default' || context == 'firefox-private') { + if (context == "firefox-default" || context == "firefox-private") { proxy = null; return proxy; } @@ -47,9 +47,9 @@ var handleContextProxyRequest = async function(requestDetails) { return proxy; } else if (!routerHost(requestDetails.url)) { proxy = { - type: 'http', - host: 'localhost', - port: '65535' + type: "http", + host: "localhost", + port: "65535" }; } proxy = { @@ -65,22 +65,22 @@ var handleContextProxyRequest = async function(requestDetails) { if (localHost(requestDetails.url)) { if (!routerHost(requestDetails.url)) { proxy = { - type: 'http', - host: 'localhost', - port: '65535' + type: "http", + host: "localhost", + port: "65535" }; } } - console.log('(proxy)', context.name); - console.log('Using', proxy.type); - console.log('proxy ', proxy.host + ':' + proxy.port); + console.log("(proxy)", context.name); + console.log("Using", proxy.type); + console.log("proxy ", proxy.host + ":" + proxy.port); return proxy; } } if (!routerHost(requestDetails.url)) { if (localHost(requestDetails.url)) { console.log( - '(proxy) non-routerconsole localhost url, will not interfere', + "(proxy) non-routerconsole localhost url, will not interfere", requestDetails.url ); /*proxy = { @@ -114,7 +114,7 @@ var handleContextProxyRequest = async function(requestDetails) { let tabInfo = await browser.tabs.get(tabId); return tabInfo; } catch (error) { - console.log('(proxy)Tab error', error); + console.log("(proxy)Tab error", error); } }; if (proxyHost(requestDetails.url)) { @@ -126,8 +126,8 @@ var handleContextProxyRequest = async function(requestDetails) { return proxy; } if ( - requestDetails.cookieStoreId == 'firefox-default' || - requestDetails.cookieStoreId == 'firefox-private' + requestDetails.cookieStoreId == "firefox-default" || + requestDetails.cookieStoreId == "firefox-private" ) { return browser.proxy.settings.get({}); } @@ -146,7 +146,7 @@ var handleContextProxyRequest = async function(requestDetails) { requestDetails.tabId = tab; var context = tab.then(contextGet); var proxy = await context.then(handleProxyRequest); - console.log('(proxy)Returning I2P Proxy', proxy); + console.log("(proxy)Returning I2P Proxy", proxy); return proxy; } else { var tab = tabGet(requestDetails.tabId); @@ -160,62 +160,62 @@ var handleContextProxyRequest = async function(requestDetails) { return proxy;*/ } } catch (error) { - console.log('(proxy)Not using I2P Proxy.', error); + console.log("(proxy)Not using I2P Proxy.", error); } -} +}; function SetupSettings() { - console.log('Initialising Settings'); + console.log("Initialising Settings"); function onSetupError() { - console.log('Settings initialization error'); + console.log("Settings initialization error"); } // function checkSchemeStoredSettings(storedSettings) { if (storedSettings.proxy_scheme == undefined) - storedSettings.proxy_scheme = 'http'; + storedSettings.proxy_scheme = "http"; else proxy_scheme = storedSettings.proxy_scheme; - console.log('Initialising Proxy Scheme', storedSettings.proxy_scheme); + console.log("Initialising Proxy Scheme", storedSettings.proxy_scheme); setupProxy(); } - var gettingSchemeStoredSettings = browser.storage.local.get('proxy_scheme'); + var gettingSchemeStoredSettings = browser.storage.local.get("proxy_scheme"); gettingSchemeStoredSettings.then(checkSchemeStoredSettings, onSetupError); // function checkHostStoredSettings(storedSettings) { if (storedSettings.proxy_host == undefined) - storedSettings.proxy_host = '127.0.0.1'; + storedSettings.proxy_host = "127.0.0.1"; else proxy_host = storedSettings.proxy_host; - console.log('Initialising Host', storedSettings.proxy_host); + console.log("Initialising Host", storedSettings.proxy_host); setupProxy(); } - var gettingHostStoredSettings = browser.storage.local.get('proxy_host'); + var gettingHostStoredSettings = browser.storage.local.get("proxy_host"); gettingHostStoredSettings.then(checkHostStoredSettings, onSetupError); // function checkPortStoredSettings(storedSettings) { if (storedSettings.proxy_port == undefined) - storedSettings.proxy_port = '4444'; + storedSettings.proxy_port = "4444"; else proxy_port = storedSettings.proxy_port; - console.log('Initialising Port', storedSettings.proxy_port); + console.log("Initialising Port", storedSettings.proxy_port); setupProxy(); } - var gettingPortStoredSettings = browser.storage.local.get('proxy_port'); + var gettingPortStoredSettings = browser.storage.local.get("proxy_port"); gettingPortStoredSettings.then(checkPortStoredSettings, onSetupError); // function checkControlHostStoredSettings(storedSettings) { if (storedSettings.control_host == undefined) - storedSettings.control_host = '127.0.0.1'; + storedSettings.control_host = "127.0.0.1"; else control_host = storedSettings.control_host; - console.log('Initialising Control Host', storedSettings.control_host); + console.log("Initialising Control Host", storedSettings.control_host); setupProxy(); } var gettingControlHostStoredSettings = browser.storage.local.get( - 'control_host' + "control_host" ); gettingControlHostStoredSettings.then( checkControlHostStoredSettings, @@ -225,14 +225,14 @@ function SetupSettings() { // function checkControlPortStoredSettings(storedSettings) { if (storedSettings.control_port == undefined) - storedSettings.control_port = '7657'; + storedSettings.control_port = "7657"; else control_port = storedSettings.control_port; - console.log('Initialising Control Port', storedSettings.control_port); + console.log("Initialising Control Port", storedSettings.control_port); setupProxy(); } var gettingControlPortStoredSettings = browser.storage.local.get( - 'control_port' + "control_port" ); gettingControlPortStoredSettings.then( checkControlPortStoredSettings, @@ -246,28 +246,28 @@ function SetupSettings() { else disable_history = storedSettings.disable_history; console.log( - 'Initialising Disabled History', + "Initialising Disabled History", storedSettings.disable_history ); setupProxy(); } var gettingHistoryStoredSettings = browser.storage.local.get( - 'disable_history' + "disable_history" ); gettingHistoryStoredSettings.then(checkHistoryStoredSettings, onSetupError); } function getScheme() { - if (proxy_scheme == 'HTTP') return 'http'; - if (proxy_scheme == 'SOCKS') return 'socks'; - if (proxy_scheme == 'http') return 'http'; - if (proxy_scheme == 'socks') return 'socks'; - else return 'http'; + if (proxy_scheme == "HTTP") return "http"; + if (proxy_scheme == "SOCKS") return "socks"; + if (proxy_scheme == "http") return "http"; + if (proxy_scheme == "socks") return "socks"; + else return "http"; } function getHost() { if (proxy_host == undefined) { - proxy_host = '127.0.0.1'; + proxy_host = "127.0.0.1"; } return proxy_host; } @@ -275,30 +275,30 @@ function getHost() { function getPort() { if (proxy_port == undefined) { var scheme = getScheme(); - if (scheme == 'socks') proxy_port = '4446'; - else proxy_port = '4444'; + if (scheme == "socks") proxy_port = "4446"; + else proxy_port = "4444"; } return proxy_port; } function setupProxy() { - console.log('Setting up Firefox WebExtension proxy'); + console.log("Setting up Firefox WebExtension proxy"); browser.proxy.onRequest.addListener(handleContextProxyRequest, { - urls: [''] + urls: [""] }); - console.log('i2p settings created for WebExtension Proxy'); + console.log("i2p settings created for WebExtension Proxy"); } function update() { - console.log('restoring proxy scheme:', proxy_scheme); - console.log('restoring proxy host:', proxy_host); - console.log('restoring proxy port:', proxy_port); - console.log('restoring control host:', control_host); - console.log('restoring control port:', control_port); + console.log("restoring proxy scheme:", proxy_scheme); + console.log("restoring proxy host:", proxy_host); + console.log("restoring proxy port:", proxy_port); + console.log("restoring control host:", control_host); + console.log("restoring control port:", control_port); } function updateFromStorage() { - console.log('updating settings from storage'); + console.log("updating settings from storage"); chrome.storage.local.get(function() { SetupSettings(); update(); @@ -306,7 +306,7 @@ function updateFromStorage() { }); var gettingInfo = browser.runtime.getPlatformInfo(); gettingInfo.then(got => { - if (got.os != 'android') { + if (got.os != "android") { browser.windows.getAll().then(wins => wins.forEach(themeWindow)); } }); diff --git a/scrub.js b/scrub.js index da54362..9d37b45 100644 --- a/scrub.js +++ b/scrub.js @@ -1,28 +1,28 @@ -var titlepref = chrome.i18n.getMessage('titlePreface'); -var webpref = chrome.i18n.getMessage('webPreface'); -var routerpref = chrome.i18n.getMessage('routerPreface'); -var mailpref = chrome.i18n.getMessage('mailPreface'); -var torrentpref = chrome.i18n.getMessage('torrentPreface'); -var tunnelpref = chrome.i18n.getMessage('i2ptunnelPreface'); -var localpref = chrome.i18n.getMessage('localPreface'); -var extensionpref = chrome.i18n.getMessage('extensionPreface'); +var titlepref = chrome.i18n.getMessage("titlePreface"); +var webpref = chrome.i18n.getMessage("webPreface"); +var routerpref = chrome.i18n.getMessage("routerPreface"); +var mailpref = chrome.i18n.getMessage("mailPreface"); +var torrentpref = chrome.i18n.getMessage("torrentPreface"); +var tunnelpref = chrome.i18n.getMessage("i2ptunnelPreface"); +var localpref = chrome.i18n.getMessage("localPreface"); +var extensionpref = chrome.i18n.getMessage("extensionPreface"); var contextScrub = async function(requestDetails) { function onHeaderError() { - console.log('Header scrub error'); + console.log("Header scrub error"); } - console.log('(scrub)Scrubbing info from contextualized request'); + console.log("(scrub)Scrubbing info from contextualized request"); try { var headerScrub = function(context) { - var ua = 'MYOB/6.66 (AN/ON)'; + var ua = "MYOB/6.66 (AN/ON)"; if (!context) { - console.log('Context not found', context); + console.log("Context not found", context); } else if (context.name == titlepref) { if (i2pHost(requestDetails.url)) { for (var header of requestDetails.requestHeaders) { - if (header.name.toLowerCase() === 'user-agent') { + if (header.name.toLowerCase() === "user-agent") { header.value = ua; - console.log('(scrub)User-Agent header modified', header.value); + console.log("(scrub)User-Agent header modified", header.value); } } } @@ -32,9 +32,9 @@ var contextScrub = async function(requestDetails) { } else if (context.name == routerpref) { if (i2pHost(requestDetails.url)) { for (var header of requestDetails.requestHeaders) { - if (header.name.toLowerCase() === 'user-agent') { + if (header.name.toLowerCase() === "user-agent") { header.value = ua; - console.log('(scrub)User-Agent header modified', header.value); + console.log("(scrub)User-Agent header modified", header.value); } } } @@ -45,7 +45,7 @@ var contextScrub = async function(requestDetails) { }; var contextGet = async function(tabInfo) { try { - console.log('(scrub)Tab info from Function', tabInfo); + console.log("(scrub)Tab info from Function", tabInfo); let context = await browser.contextualIdentities.get( tabInfo.cookieStoreId ); @@ -56,7 +56,7 @@ var contextScrub = async function(requestDetails) { }; var tabGet = async function(tabId) { try { - console.log('(scrub)Tab ID from Request', tabId); + console.log("(scrub)Tab ID from Request", tabId); let tabInfo = await browser.tabs.get(tabId); return tabInfo; } catch (error) { @@ -68,31 +68,31 @@ var contextScrub = async function(requestDetails) { var context = {}; var req = {}; if (i2pHost(requestDetails.url)) { - console.log('(scrub)I2P URL detected, '); + console.log("(scrub)I2P URL detected, "); tab = tabGet(requestDetails.tabId); context = tab.then(contextGet, onHeaderError); req = await context.then(headerScrub, onHeaderError); - console.log('(scrub)Scrubbing I2P Request', req); + console.log("(scrub)Scrubbing I2P Request", req); return req; } else if (routerHost(requestDetails.url)) { tab = tabGet(requestDetails.tabId); context = tab.then(contextGet, onHeaderError); req = await context.then(headerScrub, onHeaderError); - console.log('(scrub)Scrubbing non-I2P Request', req); + console.log("(scrub)Scrubbing non-I2P Request", req); return req; } return req; } } catch (error) { - console.log('(scrub)Not scrubbing non-I2P request.', error); + console.log("(scrub)Not scrubbing non-I2P request.", error); } -} +}; var contextSetup = function(requestDetails) { function onContextError() { - console.log('Context launcher error'); + console.log("Context launcher error"); } - console.log('(isolate)Forcing I2P requests into context'); + console.log("(isolate)Forcing I2P requests into context"); try { var i2pTabFind = async function(tabId) { try { @@ -100,15 +100,15 @@ var contextSetup = function(requestDetails) { name: titlepref }); if (tabId.cookieStoreId != context[0].cookieStoreId) { - console.log('(isolate) I2P context', context[0].cookieStoreId); - console.log('tab context', tabId.cookieStoreId); + console.log("(isolate) I2P context", context[0].cookieStoreId); + console.log("tab context", tabId.cookieStoreId); function Create() { function onCreated(tab) { function closeOldTab() { if (tabId.id != tab.id) { - console.log('(isolate) Closing un-isolated tab', tabId.id); - console.log('in favor of', tab.id); - console.log('with context', tab.cookieStoreId); + console.log("(isolate) Closing un-isolated tab", tabId.id); + console.log("in favor of", tab.id); + console.log("with context", tab.cookieStoreId); browser.tabs.remove(tabId.id); } } @@ -126,7 +126,7 @@ var contextSetup = function(requestDetails) { return tabId; } } catch (error) { - console.log('(isolate)Context Error', error); + console.log("(isolate)Context Error", error); } }; var routerTabFind = async function(tabId) { @@ -135,15 +135,15 @@ var contextSetup = function(requestDetails) { name: routerpref }); if (tabId.cookieStoreId != context[0].cookieStoreId) { - console.log('(isolate) I2P context', context[0].cookieStoreId); - console.log('tab context', tabId.cookieStoreId); + console.log("(isolate) I2P context", context[0].cookieStoreId); + console.log("tab context", tabId.cookieStoreId); function Create() { function onCreated(tab) { function closeOldTab() { if (tabId.id != tab.id) { - console.log('(isolate) Closing un-isolated tab', tabId.id); - console.log('in favor of', tab.id); - console.log('with context', tab.cookieStoreId); + console.log("(isolate) Closing un-isolated tab", tabId.id); + console.log("in favor of", tab.id); + console.log("with context", tab.cookieStoreId); browser.tabs.remove(tabId.id); } } @@ -161,7 +161,7 @@ var contextSetup = function(requestDetails) { return tabId; } } catch (error) { - console.log('(isolate)Context Error', error); + console.log("(isolate)Context Error", error); } }; var i2ptunnelTabFind = async function(tabId) { @@ -170,15 +170,15 @@ var contextSetup = function(requestDetails) { name: tunnelpref }); if (tabId.cookieStoreId != context[0].cookieStoreId) { - console.log('(isolate) I2P context', context[0].cookieStoreId); - console.log('tab context', tabId.cookieStoreId); + console.log("(isolate) I2P context", context[0].cookieStoreId); + console.log("tab context", tabId.cookieStoreId); function Create() { function onCreated(tab) { function closeOldTab() { if (tabId.id != tab.id) { - console.log('(isolate) Closing un-isolated tab', tabId.id); - console.log('in favor of', tab.id); - console.log('with context', tab.cookieStoreId); + console.log("(isolate) Closing un-isolated tab", tabId.id); + console.log("in favor of", tab.id); + console.log("with context", tab.cookieStoreId); browser.tabs.remove(tabId.id); } } @@ -196,7 +196,7 @@ var contextSetup = function(requestDetails) { return tabId; } } catch (error) { - console.log('(isolate)Context Error', error); + console.log("(isolate)Context Error", error); } }; var snarkTabFind = async function(tabId) { @@ -205,15 +205,15 @@ var contextSetup = function(requestDetails) { name: torrentpref }); if (tabId.cookieStoreId != context[0].cookieStoreId) { - console.log('(isolate) I2P context', context[0].cookieStoreId); - console.log('tab context', tabId.cookieStoreId); + console.log("(isolate) I2P context", context[0].cookieStoreId); + console.log("tab context", tabId.cookieStoreId); function Create() { function onCreated(tab) { function closeOldTab() { if (tabId.id != tab.id) { - console.log('(isolate) Closing un-isolated tab', tabId.id); - console.log('in favor of', tab.id); - console.log('with context', tab.cookieStoreId); + console.log("(isolate) Closing un-isolated tab", tabId.id); + console.log("in favor of", tab.id); + console.log("with context", tab.cookieStoreId); browser.tabs.remove(tabId.id); } } @@ -231,7 +231,7 @@ var contextSetup = function(requestDetails) { return tabId; } } catch (error) { - console.log('(isolate)Context Error', error); + console.log("(isolate)Context Error", error); } }; var mailTabFind = async function(tabId) { @@ -240,15 +240,15 @@ var contextSetup = function(requestDetails) { name: mailpref }); if (tabId.cookieStoreId != context[0].cookieStoreId) { - console.log('(isolate) I2P context', context[0].cookieStoreId); - console.log('tab context', tabId.cookieStoreId); + console.log("(isolate) I2P context", context[0].cookieStoreId); + console.log("tab context", tabId.cookieStoreId); function Create() { function onCreated(tab) { function closeOldTab() { if (tabId.id != tab.id) { - console.log('(isolate) Closing un-isolated tab', tabId.id); - console.log('in favor of', tab.id); - console.log('with context', tab.cookieStoreId); + console.log("(isolate) Closing un-isolated tab", tabId.id); + console.log("in favor of", tab.id); + console.log("with context", tab.cookieStoreId); browser.tabs.remove(tabId.id); } } @@ -266,7 +266,7 @@ var contextSetup = function(requestDetails) { return tabId; } } catch (error) { - console.log('(isolate)Context Error', error); + console.log("(isolate)Context Error", error); } }; var localTabFind = async function(tabId) { @@ -275,15 +275,15 @@ var contextSetup = function(requestDetails) { name: localpref }); if (tabId.cookieStoreId != context[0].cookieStoreId) { - console.log('(isolate) I2P context', context[0].cookieStoreId); - console.log('tab context', tabId.cookieStoreId); + console.log("(isolate) I2P context", context[0].cookieStoreId); + console.log("tab context", tabId.cookieStoreId); function Create() { function onCreated(tab) { function closeOldTab() { if (tabId.id != tab.id) { - console.log('(isolate) Closing un-isolated tab', tabId.id); - console.log('in favor of', tab.id); - console.log('with context', tab.cookieStoreId); + console.log("(isolate) Closing un-isolated tab", tabId.id); + console.log("in favor of", tab.id); + console.log("with context", tab.cookieStoreId); browser.tabs.remove(tabId.id); } } @@ -301,7 +301,7 @@ var contextSetup = function(requestDetails) { return tabId; } } catch (error) { - console.log('(isolate)Context Error', error); + console.log("(isolate)Context Error", error); } }; var anyTabFind = async function(tabId) { @@ -309,21 +309,21 @@ var contextSetup = function(requestDetails) { var context = await browser.contextualIdentities.query({ name: webpref }); - console.log('(ISOLATE)', tabId.cookieStoreId); + console.log("(ISOLATE)", tabId.cookieStoreId); if ( - tabId.cookieStoreId == 'firefox-default' || - tabId.cookieStoreId == 'firefox-private' + tabId.cookieStoreId == "firefox-default" || + tabId.cookieStoreId == "firefox-private" ) { if (tabId.cookieStoreId != context[0].cookieStoreId) { - console.log('(isolate) I2P context', context[0].cookieStoreId); - console.log('tab context', tabId.cookieStoreId); + console.log("(isolate) I2P context", context[0].cookieStoreId); + console.log("tab context", tabId.cookieStoreId); function Create() { function onCreated(tab) { function closeOldTab() { if (tabId.id != tab.id) { - console.log('(isolate) Closing un-isolated tab', tabId.id); - console.log('in favor of', tab.id); - console.log('with context', tab.cookieStoreId); + console.log("(isolate) Closing un-isolated tab", tabId.id); + console.log("in favor of", tab.id); + console.log("with context", tab.cookieStoreId); browser.tabs.remove(tabId.id); } } @@ -342,16 +342,16 @@ var contextSetup = function(requestDetails) { } } } catch (error) { - console.log('(isolate)Context Error', error); + console.log("(isolate)Context Error", error); } }; var tabGet = async function(tabId) { try { - console.log('(isolate)Tab ID from Request', tabId); + console.log("(isolate)Tab ID from Request", tabId); let tabInfo = await browser.tabs.get(tabId); return tabInfo; } catch (error) { - console.log('(isolate)Tab error', error); + console.log("(isolate)Tab error", error); } }; if (requestDetails == undefined) { @@ -391,16 +391,16 @@ var contextSetup = function(requestDetails) { } } if (routerhost) { - if (routerhost === 'i2ptunnelmgr') { + if (routerhost === "i2ptunnelmgr") { var tunneltab = tab.then(i2ptunnelTabFind, onContextError); return requestDetails; - } else if (routerhost === 'i2psnark') { + } else if (routerhost === "i2psnark") { var snarktab = tab.then(snarkTabFind, onContextError); return requestDetails; - } else if (routerhost === 'webmail') { + } else if (routerhost === "webmail") { var mailtab = tab.then(mailTabFind, onContextError); return requestDetails; - } else if (routerhost === 'routerconsole') { + } else if (routerhost === "routerconsole") { var routertab = tab.then(routerTabFind, onContextError); return requestDetails; } @@ -409,18 +409,18 @@ var contextSetup = function(requestDetails) { } } } catch (error) { - console.log('(isolate)Not an I2P request, blackholing', error); + console.log("(isolate)Not an I2P request, blackholing", error); } }; browser.webRequest.onBeforeRequest.addListener( contextSetup, - { urls: [''] }, - ['blocking'] + { urls: [""] }, + ["blocking"] ); browser.webRequest.onBeforeSendHeaders.addListener( contextScrub, - { urls: [''] }, - ['blocking', 'requestHeaders'] + { urls: [""] }, + ["blocking", "requestHeaders"] ); diff --git a/window.html b/window.html index 90dfa2c..ada140d 100644 --- a/window.html +++ b/window.html @@ -11,120 +11,117 @@ +
-
- -
-
-

The Invisible Internet Browser

+
+
+
+

The Invisible Internet Browser

+
-
-
- Home Page -
- -
+
+ Home Page +
+ +
+
+ +
+
+ +
+
+ +
+

You are now able to use I2P in this browser.

+ +

It is experimental.

+
+ +
+ Proxy is ready. +
-
-
+
+

+

-
-

You are now able to use I2P in this browser.

+

Controls

-

It is experimental.

-
+

These controls are used to tailor your I2P Browsing Experience

-
- Proxy is ready. -
-
+
    +
  • + Clear Browsing Data: Use this to erase your browsing data. +
  • -
    -
    +
  • WebRTC is disabled by default, but can be enabled by checking this box.
  • -
    -

    -

    - -

    Controls

    - -

    These controls are used to tailor your I2P Browsing Experience

    - -
      -
    • - Clear Browsing Data: Use this to erase your browsing data. -
    • - -
    • WebRTC is disabled by default, but can be enabled by checking this box.
    • - -
    • -
      -
      - -
      -
      +
    • +
      -
    - -
  • History is automatically cleared when your I2P tabs are closed. If you want to clear history as you go, check this box.
  • -
+
+
+
+
+ -

-

+
  • History is automatically cleared when your I2P tabs are closed. If you want to clear history as you go, check this box.
  • + -

    -

    +

    +

    + +

    +

    +
    + +
    +
    + +
    +

    +

    + +

    Applications

    + +

    These applications use I2P to provide them with security and privacy.

    + +
      +
    • For more information about this extension, go here:
    • + +
    • For information about your I2P router status, go here:
    • + +
    • I2P has a web-based interface for configuring .i2p services like web sites, to set up your own web sites, go here:
    • + +
    • I2P also bundles a webmail client which can be used to access in-I2P e-mail. To use it, go here:
    • + +
    • I2P is capable of anonymous Peer-to-Peer file sharing, to use the built-in bittorrent client go here:
    • +
    + +

    +

    + +

    +

    +
    -
    -
    - -
    -

    -

    - -

    Applications

    - -

    These applications use I2P to provide them with security and privacy.

    - -
      -
    • For more information about this extension, go here:
    • - -
    • For information about your I2P router status, go here:
    • - -
    • I2P has a web-based interface for configuring .i2p services like web sites, to set up your own web sites, go here:
    • - -
    • I2P also bundles a webmail client which can be used to access in-I2P e-mail. To use it, go here:
    • - -
    • I2P is capable of anonymous Peer-to-Peer file sharing, to use the built-in bittorrent client go here:
    • -
    - -

    -

    - -

    -

    -
    -
    - Torrents go here. + Torrents go here.
    - - - - + + + +