From 458f20def61cec2db8d4d682fd38e825e9fb270e Mon Sep 17 00:00:00 2001 From: idk Date: Sun, 8 May 2022 17:52:14 -0400 Subject: [PATCH] fmt --- background.js | 6 +- handler.js | 2 +- host.js | 2 +- index.html | 380 ++++++++++++++++++++++++-------------------------- info.js | 2 +- proxy.js | 176 +++++++++++------------ scrub.js | 6 +- 7 files changed, 280 insertions(+), 294 deletions(-) diff --git a/background.js b/background.js index 6e314e9..b1bf9da 100644 --- a/background.js +++ b/background.js @@ -18,8 +18,8 @@ var muwireprefpriv = chrome.i18n.getMessage('muwirePrefacePrivate'); var botepref = chrome.i18n.getMessage('botePreface'); var blogpref = chrome.i18n.getMessage('blogPreface'); var blogprefpriv = chrome.i18n.getMessage('blogPrefacePrivate'); -var torpref = chrome.i18n.getMessage("torPreface"); -var torprefpriv = chrome.i18n.getMessage("torPrefacePrivate"); +var torpref = chrome.i18n.getMessage('torPreface'); +var torprefpriv = chrome.i18n.getMessage('torPrefacePrivate'); function onError(err) { console.log('(background)', err); @@ -489,4 +489,4 @@ if (browser.windows != undefined) { console.log("windows unavailable on android", browser.runtime.PlatformOs); browser.windows.onRemoved.addListener(onClosedWindowCheck); browser.windows.onCreated.addListener(onOpenedWindowCheck); -} \ No newline at end of file +} diff --git a/handler.js b/handler.js index 4df6ac0..72262ff 100644 --- a/handler.js +++ b/handler.js @@ -123,4 +123,4 @@ var handlerSetup = function(requestDetails) { browser.webRequest.onBeforeRequest.addListener(handlerSetup, { urls: [''], }); -*/ \ No newline at end of file +*/ diff --git a/host.js b/host.js index 405cfdc..05fb23b 100644 --- a/host.js +++ b/host.js @@ -184,4 +184,4 @@ function routerHost(url) { return pathcheck(path); } return false; -} \ No newline at end of file +} diff --git a/index.html b/index.html index a5019ee..3f079ce 100644 --- a/index.html +++ b/index.html @@ -1,243 +1,229 @@ - I2P in Private Browsing Mode - - + I2P in Private Browsing Mode + + -

I2P in Private Browsing Mode(Firefox-Only)

+

I2P in Private Browsing Mode(Firefox-Only)

-

This is an webextension which introduces a set of new "Private Browsing" modes -to Firefox-based browsers(Supporting webextensions, must be current ESR or -greater) that makes it easier to configure a browser to use I2P securely and -adds features for making I2P applications easier to use. It does this by -isolating I2P-specific settings to Contextual Identities within Firefox, then -loading them automatically when the user requests them. It also adds convenience -and management features, like an embedded I2P console and Bittorrent integration -with clients using the transmission-rpc API and via in-browser protocol handling -integrations.

+

This is an webextension which introduces a set of new "Private Browsing" modes to Firefox-based browsers(Supporting webextensions, must be current ESR or greater) that makes it easier to configure a browser to use I2P securely and adds features for making I2P applications easier to use. It does this by isolating I2P-specific settings to Contextual Identities within Firefox, then loading them automatically when the user requests them. It also adds convenience and management features, like an embedded I2P console and Bittorrent integration with clients using the transmission-rpc API and via in-browser protocol handling integrations.

-

Privacy Policy

+

Privacy Policy

-

This browser extension does not collect any personal information. It requires -access to local storage and browsing data permissions in order to delete them -when directed to by the user. This browser extension does not transmit any -information to any third party, nor will it, ever.

+

This browser extension does not collect any personal information. It requires access to local storage and browsing data permissions in order to delete them when directed to by the user. This browser extension does not transmit any information to any third party, nor will it, ever.

-

This browser extension cannot influence telemetry carried out by browser vendors -to determine performance in their distribution channels, nor can it mitigate any -other browser vendor telemetry.

+

This browser extension cannot influence telemetry carried out by browser vendors to determine performance in their distribution channels, nor can it mitigate any other browser vendor telemetry.

-

This browser extension is entirely Free, Open-Source software.

+

This browser extension is entirely Free, Open-Source software.

-

Installation(Cross-Platform):

+

Installation(Cross-Platform):

-

For desktop users this addon is available from addons.mozilla.org, where you -will be able to recive automatic updates: -I2P in Private Browsing.

+

For desktop users this addon is available from addons.mozilla.org, where you will be able to recive automatic updates: I2P in Private Browsing.

-

Setting the Homepage

+

Setting the Homepage

-

The first time you run the extension, Firefox will offer you the option of setting -your homepage and new tab page to the homepage contained within the extension. You -can decline this or edit it later and it will not affect your anonymity. Enabling -this feature allows the extension to set your homepage to a local document with a -number of useful I2P links.

+

The first time you run the extension, Firefox will offer you the option of setting your homepage and new tab page to the homepage contained within the extension. You can decline this or edit it later and it will not affect your anonymity. Enabling this feature allows the extension to set your homepage to a local document with a number of useful I2P links.

-

Debian Installation:

+

Debian Installation:

-

Should you prefer, it is possible to install this extension system-wide by -side-loading it into Debian. You can generate your own deb file by running the -command:

+

Should you prefer, it is possible to install this extension system-wide by side-loading it into Debian. You can generate your own deb file by running the command:

-
    make deb
+    
    make deb
 
+

and then you can install it with:

-

and then you can install it with:

- -
    sudo apt install ../i2psetproxy.js_*.deb
+    
    sudo apt install ../i2psetproxy.js_*.deb
 
+

Bittorrent Download:

-

Bittorrent Download:

+

The self-hosted plugin is available from bittorrent both within the I2P and Clearnet Bittorrent network(With a web seed to support it in case one goes dead).

-

The self-hosted plugin is available from bittorrent both within the I2P and -Clearnet Bittorrent network(With a web seed to support it in case one goes -dead).

+ -

Usage:

+

Usage:

-
    -
  • Basically, it "Just Works." After you install the plugin, browsing to an I2P -domain will automatically stop the current tab and re-open the I2P site in an -I2P Browser tab.
  • -
  • Besides that, four bookmarks are added to the "Bookmarks Toolbar," which -will take you to visit your Java I2P applications, or the "Simplified I2P -Landing Page" embedded in the plugin:
  • -
  • Landing page
  • -
  • Also, there's a menu for accessing I2P functionality while you're browsing. -It lets you control a few settings in a granular way.
  • -
  • Menu
  • -
  • You can re-enable WebRTC but force it to always use the proxy that is -enforced by the tab.
  • -
  • You can either force the browser to delete all history for I2P sites -immediately, or you can close all your I2P Browser tabs at once and delete -the history for I2P browsing when you're done.
  • -
  • That's all there is to it! Your browser is configured to safely use and -administer I2P.
  • -
  • Optionally, you can add I2PSnark-RPC and use Bittorrent-over-I2P via the -transmission-rpc interface. To do this, have a look at the torrent guide: -Torrent guide
  • -
+
    +
  • Basically, it "Just Works." After you install the plugin, browsing to an I2P domain will automatically stop the current tab and re-open the I2P site in an I2P Browser tab.
  • -

    Features

    +
  • Besides that, four bookmarks are added to the "Bookmarks Toolbar," which will take you to visit your Java I2P applications, or the "Simplified I2P Landing Page" embedded in the plugin:
  • -
      -
    • [done] Provide a way to launch into an I2P-Specific contextual identity -(container). Intercept requests to .i2p domains and automatically route them -to the I2P container. Isolate the router console from other local -applications by automatically intercepting requests to the router console to -another container.
    • -
    • Visiting i2p-projekt.i2p
    • -
    • [done] Indicate the I2P browser is in use visually. Find an -acceptable way to indicate it on Android.
    • -
    • Visiting webmail
    • -
    • [done] Set the http proxy to use the local I2P proxy automatically. -Provide specific configuration for other types of I2P proxies(SOCKS, -isolating HTTP)
    • -
    • [done] Disable risky webRTC features/offer the option to re-enable -them with the proxy enforced.
    • -
    • [done] Change the color of the browser window to indicate that I2P is in -use
    • -
    • Visiting i2ptunnel
    • -
    • [ready] Provide help in a variety of languages.
    • -
    • [done] Monitor the health and readiness of the I2P router it is -instructed to use. Currently the plugin checks whether the HTTP Proxy is -working by fetching an image from "http://proxy.i2p" and displaying a result. -A work-in-progress binding to i2pcontrol is available in ./i2pcontrol, it is -inert at this time.
    • -
    • Visiting toopie.html
    • -
    • [Done] Handle router console applications under their own origins and -within their own contextual identity. (1) The router console is automatically -confined to it's own container tab. (2) Use a custom protocol handler to -place each i2p application/plugin under it's own origin, shortening router -console URL's and placing applications under their own origin.
    • -
    • Visiting routerconsole
    • -
    • [Done] Handle Torrents by talking to i2psnark-rpc plugin and then -adding them directly into the Firefox downloads drop-downs, menus, etc. Enable -the use of I2PSnark as a peer-to-peer delivery mechanism for media files.
    • -
    • Visiting i2psnark
    • -
    • Monitoring torrents
    • -
    • [Done] Enhance the I2P browsing experience by allowing site developers -distribute some or all of their resources as torrents, allowing the torrents to -be treated effectively as a CDN.
    • -
    • Distribute your site as a torrent.
    • -
    • [Done] Indicate the level of authenticity provided by TLS. TLS is -optional on I2P for now, but some sites offer it anyway. TLS support is -experimental and in the works.
    • -
    • Use HTTPS with your I2P Site.
    • -
    • [Done] Provide alternate, in-I2P destinations for web sites that want to -mirror their content within I2P.
    • -
    • [barely started] Isolate traffic by contextual identity to it's own HTTP -Proxy tunnel, each reflecting it's own pseudonymous identity within I2P. The -contextual identities. For now, the contextual identities used to manage -browsing are "I2P Browsing" and "Web Browsing" where I2P Browsing is capable -of using an outproxy but in the case of traffic destined for the clearnet -does not do header rewriting, and Web Browsing falls back to the Proxy -configured in Firefox. The I2P Browsing will be expanded to -
        -
      • I2P Amnesiac Browsing: Use for General Browsing, stores no history and -uses an HTTP Proxy with a very short tunnel-close timeout and no key-reuse.
      • -
      • I2P Social Networking: Use this for logging into social network accounts, -forums, and other interactive asynchronous public communication platforms -where your identity is behaviorally linkable. This has a very long -tunnel-close timeout and key-reuse until specifically invoked.
      • -
      • I2P Blogging: Use this for posting content to the web interface of your -blog or to other similar websites that you create content on.
      • -
    • -
    • Visiting clearweb
    • -
    +
  • Landing page +
  • -

    Video

    +
  • Also, there's a menu for accessing I2P functionality while you're browsing. It lets you control a few settings in a granular way.
  • -
      -
    • Video of the plugin in action
    • -
    +
  • Menu +
  • -

    Documents

    +
  • You can re-enable WebRTC but force it to always use the proxy that is enforced by the tab.
  • -
      -
    • Browser Outline: This document is an outline of each of -the browser extension's feature panels in presentation form.
    • -
    • Smart Lander Design: This is the original outline of -the smart landing page which became the I2P home page within the browser and -the drop-down control panel.
    • -
    • Other extensions: and how they work with this one.
    • -
    +
  • You can either force the browser to delete all history for I2P sites immediately, or you can close all your I2P Browser tabs at once and delete the history for I2P browsing when you're done.
  • -

    Super Extra Important Background Info:

    +
  • That's all there is to it! Your browser is configured to safely use and administer I2P.
  • -

    This plugin's viability is directly related to the viability of Mozilla and -Tor's work on hardening Firefox itself and of particular interest are the -"Uplift" and "Fusion(Firefox Using Onions)" projects.

    +
  • Optionally, you can add I2PSnark-RPC and use Bittorrent-over-I2P via the transmission-rpc interface. To do this, have a look at the torrent guide: Torrent guide +
  • +
-

Links about Project Uplift

+

Features

-
    -
  • Tor Uplift is a project which -brings important features of the Tor Browser to the mainstream of Firefox -users by including patches from Tor Browser Bundle into Firefox where it is -appropriate.
  • -
  • First Party Isolation -is a feature in Firefox and other browsers which keeps information from -leaking across first-party domains.
  • -
  • Fingerprinting is a -technique where a tracker attempts to extract unique information about a user -from a side-channel in order to create an identifier that can be used to -correlate the user across many sites.
  • -
  • Fennec is Firefox -for Android and this link has some analysis of the privacy consequences of the -Android platform.
  • -
  • Tracking in Firefox -is surveyed here.
  • -
+
    +
  • [done] Provide a way to launch into an I2P-Specific contextual identity (container). Intercept requests to .i2p domains and automatically route them to the I2P container. Isolate the router console from other local applications by automatically intercepting requests to the router console to another container.
  • -

    Project uplift seems to have largely been accomplished?

    +
  • Visiting i2p-projekt.i2p +
  • -

    Links about Project Fusion

    +
  • [done] Indicate the I2P browser is in use visually. Find an acceptable way to indicate it on Android.
  • -
      -
    • Project Fusion or Firefox using -Onions is a joint Mozilla/Tor effort to create an enhanced Private Browsing -mode for Firefox which uses Tor.
    • -
    • Notes -from a meeting about Fusion.
    • -
    • Tor at the Heart: Firefox is -a blog about Tor and the relationship they have to Firefox re: TBB, Fusion.
    • -
    +
  • Visiting webmail +
  • -

    The Other Version

    +
  • [done] Set the http proxy to use the local I2P proxy automatically. Provide specific configuration for other types of I2P proxies(SOCKS, isolating HTTP)
  • -

    New versions of this extension create an I2P in Private Browsing mode instead, -using container tabs.

    +
  • [done] Disable risky webRTC features/offer the option to re-enable them with the proxy enforced.
  • -

    Since this is a drastic change to the behavior of the old plugin, and since there -is no UI a new entry -for the new plugin has been made at a new location on addons.mozilla.org.

    +
  • [done] Change the color of the browser window to indicate that I2P is in use
  • -
      -
    • This is the new version: [link]

    • -
    • This is the old version: [link]

    • -
    +
  • Visiting i2ptunnel +
  • -

    Android usage:

    +
  • [ready] Provide help in a variety of languages.
  • -

    Use the old version, on either an old version of Firefox(pre-68) or by enabling -this custom collection: [Recommended Plugins] https://addons.mozilla.org/en-US/firefox/collections/14614396/I2P-Browser-Fork/

    +
  • [done] Monitor the health and readiness of the I2P router it is instructed to use. Currently the plugin checks whether the HTTP Proxy is working by fetching an image from "http://proxy.i2p" and displaying a result. A work-in-progress binding to i2pcontrol is available in ./i2pcontrol, it is inert at this time.
  • + +
  • Visiting toopie.html +
  • + +
  • [Done] Handle router console applications under their own origins and within their own contextual identity. (1) The router console is automatically confined to it's own container tab. (2) Use a custom protocol handler to place each i2p application/plugin under it's own origin, shortening router console URL's and placing applications under their own origin.
  • + +
  • Visiting routerconsole +
  • + +
  • [Done] Handle Torrents by talking to i2psnark-rpc plugin and then adding them directly into the Firefox downloads drop-downs, menus, etc. Enable the use of I2PSnark as a peer-to-peer delivery mechanism for media files.
  • + +
  • Visiting i2psnark +
  • + +
  • Monitoring torrents +
  • + +
  • [Done] Enhance the I2P browsing experience by allowing site developers distribute some or all of their resources as torrents, allowing the torrents to be treated effectively as a CDN.
  • + +
  • Distribute your site as a torrent. +
  • + +
  • [Done] Indicate the level of authenticity provided by TLS. TLS is optional on I2P for now, but some sites offer it anyway. TLS support is experimental and in the works.
  • + +
  • Use HTTPS with your I2P Site. +
  • + +
  • [Done] Provide alternate, in-I2P destinations for web sites that want to mirror their content within I2P.
  • + +
  • [barely started] Isolate traffic by contextual identity to it's own HTTP Proxy tunnel, each reflecting it's own pseudonymous identity within I2P. The contextual identities. For now, the contextual identities used to manage browsing are "I2P Browsing" and "Web Browsing" where I2P Browsing is capable of using an outproxy but in the case of traffic destined for the clearnet does not do header rewriting, and Web Browsing falls back to the Proxy configured in Firefox. The I2P Browsing will be expanded to +
      +
    • I2P Amnesiac Browsing: Use for General Browsing, stores no history and uses an HTTP Proxy with a very short tunnel-close timeout and no key-reuse.
    • + +
    • I2P Social Networking: Use this for logging into social network accounts, forums, and other interactive asynchronous public communication platforms where your identity is behaviorally linkable. This has a very long tunnel-close timeout and key-reuse until specifically invoked.
    • + +
    • I2P Blogging: Use this for posting content to the web interface of your blog or to other similar websites that you create content on.
    • +
    +
  • + +
  • Visiting clearweb +
  • +
+ +

Video

+ +
    +
  • Video of the plugin in action +
  • +
+ +

Documents

+ +
    +
  • Browser Outline: This document is an outline of each of the browser extension's feature panels in presentation form.
  • + +
  • Smart Lander Design: This is the original outline of the smart landing page which became the I2P home page within the browser and the drop-down control panel.
  • + +
  • Other extensions: and how they work with this one.
  • +
+ +

Super Extra Important Background Info:

+ +

This plugin's viability is directly related to the viability of Mozilla and Tor's work on hardening Firefox itself and of particular interest are the "Uplift" and "Fusion(Firefox Using Onions)" projects.

+ +

Links about Project Uplift

+ +
    +
  • + Tor Uplift is a project which brings important features of the Tor Browser to the mainstream of Firefox users by including patches from Tor Browser Bundle into Firefox where it is appropriate. +
  • + +
  • + First Party Isolation is a feature in Firefox and other browsers which keeps information from leaking across first-party domains. +
  • + +
  • + Fingerprinting is a technique where a tracker attempts to extract unique information about a user from a side-channel in order to create an identifier that can be used to correlate the user across many sites. +
  • + +
  • + Fennec is Firefox for Android and this link has some analysis of the privacy consequences of the Android platform. +
  • + +
  • + Tracking in Firefox is surveyed here. +
  • +
+ +

Project uplift seems to have largely been accomplished?

+ +

Links about Project Fusion

+ +
    +
  • + Project Fusion or Firefox using Onions is a joint Mozilla/Tor effort to create an enhanced Private Browsing mode for Firefox which uses Tor. +
  • + +
  • + Notes from a meeting about Fusion. +
  • + +
  • + Tor at the Heart: Firefox is a blog about Tor and the relationship they have to Firefox re: TBB, Fusion. +
  • +
+ +

The Other Version

+ +

New versions of this extension create an I2P in Private Browsing mode instead, using container tabs.

+ +

Since this is a drastic change to the behavior of the old plugin, and since there is no UI a new entry for the new plugin has been made at a new location on addons.mozilla.org.

+ +
    +
  • +

    This is the new version: [link]

    +
  • + +
  • +

    This is the old version: [link]

    +
  • +
+ +

Android usage:

+ +

Use the old version, on either an old version of Firefox(pre-68) or by enabling this custom collection: [Recommended Plugins] https://addons.mozilla.org/en-US/firefox/collections/14614396/I2P-Browser-Fork/

diff --git a/info.js b/info.js index 7debffb..d18c211 100644 --- a/info.js +++ b/info.js @@ -381,4 +381,4 @@ fetch("http://127.0.0.1:7669").then((myJson) => { irc.classList.remove("hidden"); } } -}); \ No newline at end of file +}); diff --git a/proxy.js b/proxy.js index 7c9bc1c..c6c7639 100644 --- a/proxy.js +++ b/proxy.js @@ -1,17 +1,17 @@ -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 ircpref = chrome.i18n.getMessage("ircPreface"); -var extensionpref = chrome.i18n.getMessage("extensionPreface"); -var muwirepref = chrome.i18n.getMessage("muwirePreface"); -var botepref = chrome.i18n.getMessage("botePreface"); -var blogpref = chrome.i18n.getMessage("blogPreface"); -var blogprefpriv = chrome.i18n.getMessage("blogPrefacePrivate"); -var torpref = chrome.i18n.getMessage("torPreface"); -var torprefpriv = chrome.i18n.getMessage("torPreface"); +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 ircpref = chrome.i18n.getMessage('ircPreface'); +var extensionpref = chrome.i18n.getMessage('extensionPreface'); +var muwirepref = chrome.i18n.getMessage('muwirePreface'); +var botepref = chrome.i18n.getMessage('botePreface'); +var blogpref = chrome.i18n.getMessage('blogPreface'); +var blogprefpriv = chrome.i18n.getMessage('blogPrefacePrivate'); +var torpref = chrome.i18n.getMessage('torPreface'); +var torprefpriv = chrome.i18n.getMessage('torPreface'); browser.privacy.network.peerConnectionEnabled.set({ value: true @@ -21,9 +21,9 @@ chrome.privacy.network.networkPredictionEnabled.set({ value: false }); chrome.privacy.network.webRTCIPHandlingPolicy.set({ - value: "disable_non_proxied_udp" + value: 'disable_non_proxied_udp' }); -console.log("Disabled unproxied UDP."); +console.log('Disabled unproxied UDP.'); function shouldProxyRequest(requestInfo) { return requestInfo.parentFrameId != -1; @@ -31,7 +31,7 @@ function shouldProxyRequest(requestInfo) { var handleContextProxyRequest = async function(requestDetails) { function ircProxy() { - if (!requestDetails.url.includes("7669")) { + if (!requestDetails.url.includes('7669')) { proxy = { type: getScheme(), host: getHost(), @@ -39,7 +39,7 @@ var handleContextProxyRequest = async function(requestDetails) { }; return proxy; } - if (requestDetails.url.includes(":7669")) { + if (requestDetails.url.includes(':7669')) { proxy = null; return proxy; } @@ -48,7 +48,7 @@ var handleContextProxyRequest = async function(requestDetails) { These are the rules for visiting the SOCKS5 proxy manager. */ function torProxy() { - if (!requestDetails.url.includes("7695")) { + if (!requestDetails.url.includes('7695')) { proxy = { type: getScheme(), host: getHost(), @@ -56,14 +56,14 @@ var handleContextProxyRequest = async function(requestDetails) { }; return proxy; } - if (requestDetails.url.includes(":7695")) { + if (requestDetails.url.includes(':7695')) { proxy = null; return proxy; } } function blogProxy() { - if (!requestDetails.url.includes("8084")) { + if (!requestDetails.url.includes('8084')) { proxy = { type: getScheme(), host: getHost(), @@ -71,7 +71,7 @@ var handleContextProxyRequest = async function(requestDetails) { }; return proxy; } - if (requestDetails.url.includes(":8084")) { + if (requestDetails.url.includes(':8084')) { proxy = null; return proxy; } @@ -79,16 +79,16 @@ var handleContextProxyRequest = async function(requestDetails) { function btProxy() { proxy = routerProxy(); - if (requestDetails.url.includes(":7662")) { + if (requestDetails.url.includes(':7662')) { proxy = null; return proxy; } - console.log("(bt proxy)", proxy); + console.log('(bt proxy)', proxy); return proxy; } function mainProxy() { - console.log("(proxy) mainproxy 0"); + console.log('(proxy) mainproxy 0'); proxy = { type: getScheme(), host: getHost(), @@ -97,11 +97,11 @@ var handleContextProxyRequest = async function(requestDetails) { let url = new URL(requestDetails.url); if ( requestDetails.url.startsWith( - "http://" + getHost() + ":" + getConsolePort() + "/i2psnark/" + 'http://' + getHost() + ':' + getConsolePort() + '/i2psnark/' ) ) { //+url.host)) { - console.log("(proxy) mainproxy 2", url); + console.log('(proxy) mainproxy 2', url); proxy = null; } return proxy; @@ -128,14 +128,14 @@ var handleContextProxyRequest = async function(requestDetails) { port: getPort() }; - if (context == "firefox-default" || context == "firefox-private") { + if (context == 'firefox-default' || context == 'firefox-private') { proxy = null; return proxy; } // eslint-disable-next-line no-negated-condition if (context != undefined) { - console.log("(proxy), context", context); + console.log('(proxy), context', context); if (context.name == ircpref) { proxy = ircProxy(); return proxy; @@ -173,15 +173,15 @@ var handleContextProxyRequest = async function(requestDetails) { } else { if (!routerHost(requestDetails.url)) { if (localHost(requestDetails.url)) { - if (requestDetails.url.includes(":7669")) { + if (requestDetails.url.includes(':7669')) { proxy = null; - } else if (requestDetails.url.includes(":7662")) { + } else if (requestDetails.url.includes(':7662')) { proxy = null; - } else if (requestDetails.url.includes(":7695")) { + } else if (requestDetails.url.includes(':7695')) { proxy = null; } else { console.log( - "(proxy) non-routerconsole localhost url, will not interfere", + '(proxy) non-routerconsole localhost url, will not interfere', requestDetails.url ); } @@ -196,8 +196,8 @@ var handleContextProxyRequest = async function(requestDetails) { } else { proxy = null; } - if (requestDetails.url.includes("rpc")) { - console.log("(proxy for rpc url)", rpc); + if (requestDetails.url.includes('rpc')) { + console.log('(proxy for rpc url)', rpc); } /* var tab = tabGet(requestDetails.tabId); tab.then(handleTabRequest,) */ @@ -210,7 +210,7 @@ var handleContextProxyRequest = async function(requestDetails) { return context; } catch (error) { console.warn(error); - return "firefox-default"; + return 'firefox-default'; } }; var tabGet = async function(tabId) { @@ -218,7 +218,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)) { @@ -229,7 +229,7 @@ var handleContextProxyRequest = async function(requestDetails) { }; return proxy; } - if (requestDetails.originUrl == browser.runtime.getURL("security.html")) { + if (requestDetails.originUrl == browser.runtime.getURL('security.html')) { proxy = { type: getScheme(), host: getHost(), @@ -238,15 +238,15 @@ var handleContextProxyRequest = async function(requestDetails) { return proxy; } if ( - requestDetails.cookieStoreId == "firefox-default" || - requestDetails.cookieStoreId == "firefox-private" + requestDetails.cookieStoreId == 'firefox-default' || + requestDetails.cookieStoreId == 'firefox-private' ) { if (browser.windows != undefined) { return browser.proxy.settings.get({}); } } if (requestDetails.tabId > 0) { - if (requestDetails.url.includes("MuWire")) { + if (requestDetails.url.includes('MuWire')) { return; } if (proxyHost(requestDetails.url)) { @@ -285,71 +285,71 @@ 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"); + browser.storage.local.get('control_host'); gettingControlHostStoredSettings.then( checkControlHostStoredSettings, onSetupError @@ -358,16 +358,16 @@ 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"); + browser.storage.local.get('control_port'); gettingControlPortStoredSettings.then( checkControlPortStoredSettings, onSetupError @@ -382,36 +382,36 @@ function SetupSettings() { } console.log( - "Initialising Disabled History", + 'Initialising Disabled History', storedSettings.disable_history ); setupProxy(); } var gettingHistoryStoredSettings = - browser.storage.local.get("disable_history"); + browser.storage.local.get('disable_history'); gettingHistoryStoredSettings.then(checkHistoryStoredSettings, onSetupError); } function getScheme() { - if (proxy_scheme == "HTTP") { - return "http"; + if (proxy_scheme == 'HTTP') { + return 'http'; } - if (proxy_scheme == "SOCKS") { - return "socks"; + if (proxy_scheme == 'SOCKS') { + return 'socks'; } - if (proxy_scheme == "http") { - return "http"; + if (proxy_scheme == 'http') { + return 'http'; } - if (proxy_scheme == "socks") { - return "socks"; + if (proxy_scheme == 'socks') { + return 'socks'; } else { - return "http"; + return 'http'; } } function getHost() { if (proxy_host == undefined) { - proxy_host = "127.0.0.1"; + proxy_host = '127.0.0.1'; } return proxy_host; } @@ -419,10 +419,10 @@ function getHost() { function getPort() { if (proxy_port == undefined) { var scheme = getScheme(); - if (scheme == "socks") { - proxy_port = "4446"; + if (scheme == 'socks') { + proxy_port = '4446'; } else { - proxy_port = "4444"; + proxy_port = '4444'; } } return proxy_port; @@ -431,33 +431,33 @@ function getPort() { function getConsolePort() { if (control_port == undefined) { var scheme = getScheme(); - if (scheme == "socks") { - proxy_port = "7657"; + if (scheme == 'socks') { + proxy_port = '7657'; } else { - control_port = "7657"; + control_port = '7657'; } } return control_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(); @@ -479,4 +479,4 @@ gettingListenerInfo.then(got => { }); }); } -}); \ No newline at end of file +}); diff --git a/scrub.js b/scrub.js index 501745a..f848be6 100644 --- a/scrub.js +++ b/scrub.js @@ -10,8 +10,8 @@ var muwirepref = chrome.i18n.getMessage('muwirePreface'); var botepref = chrome.i18n.getMessage('botePreface'); var blogpref = chrome.i18n.getMessage('blogPreface'); var blogprefpriv = chrome.i18n.getMessage('blogPrefacePrivate'); -var torpref = chrome.i18n.getMessage("torPreface"); -var torprefpriv = chrome.i18n.getMessage("torPrefacePrivate"); +var torpref = chrome.i18n.getMessage('torPreface'); +var torprefpriv = chrome.i18n.getMessage('torPrefacePrivate'); var contextScrub = async function(requestDetails) { function onHeaderError() { @@ -781,4 +781,4 @@ browser.webRequest.onBeforeRequest.addListener(contextSetup, { browser.webRequest.onBeforeSendHeaders.addListener( contextScrub, { urls: ["*://*.i2p/*"] }, ["requestHeaders"] -); \ No newline at end of file +);