23
Makefile
23
Makefile
@@ -69,10 +69,19 @@ xpi:
|
||||
cp ~/Downloads/i2p_in_private_browsing-$(VERSION)-an+fx.xpi ./i2ppb@eyedeekay.github.io.xpi
|
||||
|
||||
version:
|
||||
sed -i 's|7647|7657|g' *.js* */*.js*
|
||||
sed -i 's|$(shell grep "\"version\": " manifest.json)| \"version\": \"$(VERSION)\",|g' manifest.json
|
||||
sed -i 's|$(shell grep "\"version_name\": " manifest.json)| \"version_name\": \"$(VERSION)\",|g' manifest.json
|
||||
|
||||
moz-version:
|
||||
sed -i 's|7647|7657|g' *.js* */*.js*
|
||||
sed -i 's|$(shell grep "\"version\": " manifest.json)| \"version\": \"$(MOZ_VERSION)\",|g' manifest.json
|
||||
sed -i 's|$(shell grep "\"version_name\": " manifest.json)| \"version_name\": \"$(MOZ_VERSION)\",|g' manifest.json
|
||||
|
||||
rhz-version:
|
||||
sed -i 's|$(shell grep "\"version\": " manifest.json)| \"version\": \"$(VERSION)\",|g' manifest.json
|
||||
sed -i 's|$(shell grep "\"version_name\": " manifest.json)| \"version_name\": \"$(VERSION)-rhizome\",|g' manifest.json
|
||||
sed -i 's|7657|7647|g' *.js* */*.js*
|
||||
|
||||
zip: version
|
||||
zip --exclude="./i2ppb@eyedeekay.github.io.xpi" \
|
||||
@@ -105,7 +114,7 @@ WEB_EXT_API_SECRET=AMO_SECRET
|
||||
tk:
|
||||
echo $(WEB_EXT_API_KEY)
|
||||
|
||||
submit: moz-sign moz-submit
|
||||
submit: moz-sign rhz-submit moz-submit
|
||||
|
||||
##ODD NUMBERED, SELF-DISTRIBUTED VERSIONS HERE!
|
||||
moz-sign: version
|
||||
@@ -122,6 +131,13 @@ moz-submit: moz-version
|
||||
@echo "to the Makefile under the variables WEB_EXT_API_KEY and WEB_EXT_API_SECRET."
|
||||
web-ext sign --channel listed --config-discovery false --api-key $(WEB_EXT_API_KEY) --api-secret $(WEB_EXT_API_SECRET); true
|
||||
|
||||
rhz-submit: rhz-version
|
||||
@echo "Using the 'sign' target to instantly sign an extension for self-distribution"
|
||||
@echo "requires a JWT API Key and Secret from addons.mozilla.org to be made available"
|
||||
@echo "to the Makefile under the variables WEB_EXT_API_KEY and WEB_EXT_API_SECRET."
|
||||
web-ext-submit --channel unlisted --config-discovery false --api-key $(WEB_EXT_API_KEY) --api-secret $(WEB_EXT_API_SECRET); true
|
||||
#cp web-ext-artifacts/*.xpi ./i2ppb@eyedeekay.github.io.xpi
|
||||
|
||||
upload-xpi:
|
||||
gothub upload -R -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2ppb@eyedeekay.github.io.xpi" -f "./i2ppb@eyedeekay.github.io.xpi"
|
||||
|
||||
@@ -137,7 +153,7 @@ fmt:
|
||||
cleancss -O1 all -O2 all --format beautify home.css -o .home.css && mv .home.css home.css
|
||||
cleancss -O1 all -O2 all --format beautify info.css -o .info.css && mv .info.css info.css
|
||||
#find . -path ./node_modules -prune -o -name '*.css' -exec cleancss -O1 --format beautify {} \;
|
||||
find . -path ./node_modules -prune -o -name '*.js' -exec prettier --write {} \;
|
||||
find . -path ./node_modules -prune -o -name '*.js*' -exec prettier --write {} \;
|
||||
|
||||
lint:
|
||||
eslint --fix *.js
|
||||
@@ -157,3 +173,6 @@ deb: deborig
|
||||
cd ../i2psetproxy.js-$(VERSION) && debuild -us -uc -rfakeroot
|
||||
|
||||
-include mirrors.mk
|
||||
|
||||
dat:
|
||||
wget -c -O dat.js https://bundle.run/dat-js
|
31
README.md
31
README.md
@@ -6,8 +6,10 @@ WebExtension that does extended configuration of a dedicated I2P browser. While
|
||||
needing to touch about:config and disables several
|
||||
fingerprinting/de-anonymization vectors on it's own. It is also the easiest way
|
||||
to configure an I2P browser on Android without requiring the user to root their
|
||||
device. It aims to be as similar to a fully-fledged I2P browser as possible and
|
||||
borrows some code from I2P Rhizome(Which it is also compatible with).
|
||||
device, although this support may be somewhat spotty in recent versions it it
|
||||
beginning to improve again. It aims to be as similar to a fully-fledged I2P
|
||||
Rhizome as possible and borrows some code from I2P Rhizome(Which it is also
|
||||
compatible with).
|
||||
|
||||
The Old Version
|
||||
---------------
|
||||
@@ -66,12 +68,7 @@ command:
|
||||
them with the proxy enforced.
|
||||
* [done] **Change** the color of the browser window to indicate that I2P is in
|
||||
use
|
||||
* [done-ish] **Reset** the HTTP Proxy tunnel to generate a new destination
|
||||
on-demand
|
||||
* it does this by working in conjunction with this
|
||||
[standalone HTTP proxy](https://github.com/eyedeekay/httptunnel), currently
|
||||
disabled*.
|
||||
* [ready/broken/wip] **Provide** help in a variety of languages.
|
||||
* [ready/broken/wip] **Provide** help in a variety sof languages.
|
||||
* [wip] **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.
|
||||
@@ -84,7 +81,23 @@ command:
|
||||
console URL's and placing applications under their own origin.
|
||||
* [wip] **Handle Torrents** by talking to i2psnark-rpc plugin and then
|
||||
adding them directly into the Firefox downloads drop-downs, menus, etc. If I
|
||||
can.
|
||||
can. Right now instead of talking to snark-rpc, it uses a web-based protocl
|
||||
handler that simply auto-fills the torrent into i2psnark.
|
||||
* [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.
|
||||
|
||||
### Screenshot
|
||||
|
||||
|
@@ -97,10 +97,22 @@
|
||||
},
|
||||
"controlHostText": {
|
||||
"message": "Control Host: ",
|
||||
"description": "Host for the Reset Tunnel button"
|
||||
"description": "Host for the Router Console"
|
||||
},
|
||||
"controlPortText": {
|
||||
"message": "Control Port: ",
|
||||
"description": "Port for the Reset Tunnel button"
|
||||
"description": "Port for the Router Console"
|
||||
},
|
||||
"controlHostValue": {
|
||||
"message": "127.0.0.1",
|
||||
"description": "Host for the Router Console"
|
||||
},
|
||||
"controlPortValue": {
|
||||
"message": "7657",
|
||||
"description": "Port for the Router Console"
|
||||
},
|
||||
"protocolHandlerValue": {
|
||||
"message": "http://__MSG_controlHostValue__:__MSG_controlPortValue__/i2psnark/?nofilter_newURL=%s&action=Add&foo=Add+torrent",
|
||||
"description": "Value for the magnet protocol handler"
|
||||
}
|
||||
}
|
||||
|
@@ -78,16 +78,7 @@ function onCreated(context) {
|
||||
console.log(`New identity's ID: ${context.cookieStoreId}.`);
|
||||
}
|
||||
|
||||
var gettingInfo = browser.runtime.getPlatformInfo();
|
||||
gettingInfo.then(got => {
|
||||
if (got.os == "android") {
|
||||
browser.contextualIdentities.query({}).then(onContextsGot, onError);
|
||||
} else {
|
||||
browser.windows.onCreated.addListener(() => {
|
||||
browser.contextualIdentities.query({}).then(onContextsGot, onError);
|
||||
});
|
||||
}
|
||||
});
|
||||
browser.contextualIdentities.query({}).then(onContextsGot, onError);
|
||||
|
||||
var gettingInfo = browser.runtime.getPlatformInfo();
|
||||
gettingInfo.then(got => {
|
||||
@@ -245,16 +236,15 @@ function setTitle(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");
|
||||
|
||||
if (window.incognito) {
|
||||
browser.windows.update(window.id, {
|
||||
titlePreface: ""
|
||||
@@ -268,11 +258,11 @@ function setTitle(window) {
|
||||
console.log("Active in Router Console window");
|
||||
if (window.incognito) {
|
||||
browser.windows.update(window.id, {
|
||||
titlePreface: routerprefpriv
|
||||
titlePreface: titleprefpriv + " - " + routerprefpriv + ": "
|
||||
});
|
||||
} else {
|
||||
browser.windows.update(window.id, {
|
||||
titlePreface: routerpref
|
||||
titlePreface: titlepref + " - " + routerpref + ": "
|
||||
});
|
||||
}
|
||||
} else if (context.name == tunnelpref) {
|
||||
@@ -280,11 +270,11 @@ function setTitle(window) {
|
||||
|
||||
if (window.incognito) {
|
||||
browser.windows.update(window.id, {
|
||||
titlePreface: tunnelprefpriv
|
||||
titlePreface: titleprefpriv + " - " + tunnelprefpriv + ": "
|
||||
});
|
||||
} else {
|
||||
browser.windows.update(window.id, {
|
||||
titlePreface: tunnelpref
|
||||
titlePreface: titlepref + " - " + tunnelpref + ": "
|
||||
});
|
||||
}
|
||||
} else if (context.name == mailpref) {
|
||||
@@ -292,11 +282,11 @@ function setTitle(window) {
|
||||
|
||||
if (window.incognito) {
|
||||
browser.windows.update(window.id, {
|
||||
titlePreface: mailprefpriv
|
||||
titlePreface: titleprefpriv + " - " + mailprefpriv + ": "
|
||||
});
|
||||
} else {
|
||||
browser.windows.update(window.id, {
|
||||
titlePreface: mailpref
|
||||
titlePreface: titlepref + " - " + mailpref + ": "
|
||||
});
|
||||
}
|
||||
} else if (context.name == torrentpref) {
|
||||
@@ -304,11 +294,11 @@ function setTitle(window) {
|
||||
|
||||
if (window.incognito) {
|
||||
browser.windows.update(window.id, {
|
||||
titlePreface: torrentprefpriv
|
||||
titlePreface: titleprefpriv + " - " + torrentprefpriv + ": "
|
||||
});
|
||||
} else {
|
||||
browser.windows.update(window.id, {
|
||||
titlePreface: torrentpref
|
||||
titlePreface: titlepref + " - " + torrentpref + ": "
|
||||
});
|
||||
}
|
||||
}
|
||||
|
18
bookmarks.js
18
bookmarks.js
@@ -39,14 +39,15 @@ gettingInfo.then(got => {
|
||||
let port = info.value.http.split(":")[1];
|
||||
if (port == "7644") {
|
||||
var createBookmark = browser.bookmarks.create({
|
||||
url: "http://localhost:7647/i2psnark",
|
||||
url: "http://localhost:7657/i2psnark",
|
||||
title: "Bittorrent",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
});
|
||||
createBookmark.then(onCreated);
|
||||
} else {
|
||||
var createBookmark = browser.bookmarks.create({
|
||||
url: "http://localhost:7657/i2psnark",
|
||||
url:
|
||||
"http://" + control_host + ":" + control_port + "/i2psnark",
|
||||
title: "Bittorrent",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
});
|
||||
@@ -67,14 +68,14 @@ gettingInfo.then(got => {
|
||||
let port = info.value.http.split(":")[1];
|
||||
if (port == "7644") {
|
||||
var createBookmark = browser.bookmarks.create({
|
||||
url: "http://localhost:7647/webmail",
|
||||
url: "http://localhost:7657/webmail",
|
||||
title: "Web Mail",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
});
|
||||
createBookmark.then(onCreated);
|
||||
} else {
|
||||
var createBookmark = browser.bookmarks.create({
|
||||
url: "http://localhost:7657/webmail",
|
||||
url: "http://" + control_host + ":" + control_port + "/webmail",
|
||||
title: "Web Mail",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
});
|
||||
@@ -96,14 +97,19 @@ gettingInfo.then(got => {
|
||||
let port = info.value.http.split(":")[1];
|
||||
if (port == "7644") {
|
||||
var createBookmark = browser.bookmarks.create({
|
||||
url: "http://localhost:7647/i2ptunnelmgr",
|
||||
url: "http://localhost:7657/i2ptunnelmgr",
|
||||
title: "Hidden Services Manager",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
});
|
||||
createBookmark.then(onCreated);
|
||||
} else {
|
||||
var createBookmark = browser.bookmarks.create({
|
||||
url: "http://localhost:7657/i2ptunnelmgr",
|
||||
url:
|
||||
"http://" +
|
||||
control_host +
|
||||
":" +
|
||||
control_port +
|
||||
"/i2ptunnelmgr",
|
||||
title: "Hidden Services Manager",
|
||||
parentId: bookmarkToolbar[0].id
|
||||
});
|
||||
|
9
host.js
9
host.js
@@ -86,15 +86,18 @@ function routerHost(url) {
|
||||
hostname = url.split("/")[0];
|
||||
path = url.replace(hostname + "/", "");
|
||||
}
|
||||
if (hostname === "127.0.0.1:7657") {
|
||||
if (hostname === control_host + ":" + control_port) {
|
||||
console.log("(hostcheck) router console found on configured ports");
|
||||
return pathcheck(path);
|
||||
} else if (hostname === "127.0.0.1:7657") {
|
||||
return pathcheck(path);
|
||||
} else if (hostname === "localhost:7657") {
|
||||
return pathcheck(path);
|
||||
}
|
||||
|
||||
if (hostname === "127.0.0.1:7647") {
|
||||
if (hostname === "127.0.0.1:7657") {
|
||||
return pathcheck(path);
|
||||
} else if (hostname === "localhost:7647") {
|
||||
} else if (hostname === "localhost:7657") {
|
||||
return pathcheck(path);
|
||||
}
|
||||
|
||||
|
14
info.js
14
info.js
@@ -13,6 +13,7 @@ function checkHistory() {
|
||||
var getting = browser.storage.local.get("disable_history");
|
||||
getting.then(got => {
|
||||
disable_history = got.disable_history;
|
||||
if (disable_history == undefined) disable_history = false;
|
||||
console.log("checking history", disable_history);
|
||||
document.getElementById("disable-history").checked = disable_history;
|
||||
});
|
||||
@@ -93,7 +94,12 @@ function proxyReadiness() {
|
||||
console.log(this.responseText);
|
||||
}
|
||||
|
||||
browser.history.onVisited.addListener(onVisited);
|
||||
var gettingInfo = browser.runtime.getPlatformInfo();
|
||||
gettingInfo.then(got => {
|
||||
if (got.os != "android") {
|
||||
browser.history.onVisited.addListener(onVisited);
|
||||
}
|
||||
});
|
||||
|
||||
function goHome() {
|
||||
function gotProxyInfo(info) {
|
||||
@@ -121,7 +127,7 @@ function goHome() {
|
||||
|
||||
function goTunnel() {
|
||||
let createData = {
|
||||
url: "http://127.0.0.1:7657/i2ptunnel"
|
||||
url: "http://" + control_host + ":" + control_port + "/i2ptunnel"
|
||||
};
|
||||
console.log("visiting homepage");
|
||||
let creating = browser.tabs.create(createData);
|
||||
@@ -129,7 +135,7 @@ function goTunnel() {
|
||||
|
||||
function goMail() {
|
||||
let createData = {
|
||||
url: "http://127.0.0.1:7657/susimail"
|
||||
url: "http://" + control_host + ":" + control_port + "/susimail"
|
||||
};
|
||||
console.log("visiting homepage");
|
||||
let creating = browser.tabs.create(createData);
|
||||
@@ -137,7 +143,7 @@ function goMail() {
|
||||
|
||||
function goSnark() {
|
||||
let createData = {
|
||||
url: "http://127.0.0.1:7657/i2psnark"
|
||||
url: "http://" + control_host + ":" + control_port + "/i2psnark"
|
||||
};
|
||||
console.log("visiting homepage");
|
||||
let creating = browser.tabs.create(createData);
|
||||
|
@@ -5,7 +5,6 @@
|
||||
"strict_min_version": "60.0"
|
||||
}
|
||||
},
|
||||
"content_security_policy": "script-src 'self' 'sha256-AT9pbzcnD9T9Agf3fMgPh55nsx/xONoULxPFvOb93Uo='; object-src 'self'",
|
||||
"permissions": [
|
||||
"theme",
|
||||
"browsingData",
|
||||
@@ -24,7 +23,8 @@
|
||||
],
|
||||
"manifest_version": 2,
|
||||
"name": "__MSG_extensionName__",
|
||||
"version": "0.48",
|
||||
"version": "0.49",
|
||||
"version_name": "0.49",
|
||||
"description": "__MSG_extensionDescription__",
|
||||
"homepage_url": "https://github.com/eyedeekay/i2psetproxy.js",
|
||||
"icons": {
|
||||
@@ -54,16 +54,22 @@
|
||||
"bookmarks.js"
|
||||
]
|
||||
},
|
||||
"protocol_handlers": [{
|
||||
"protocol": "ext+rc",
|
||||
"name": "RouterConsole",
|
||||
"uriTemplate": "http://127.0.0.1:7657/%s"
|
||||
},
|
||||
{
|
||||
"protocol": "magnet",
|
||||
"name": "I2PTorrent",
|
||||
"uriTemplate": "http://127.0.0.1:7657/i2psnark/?nofilter_newURL=%s&action=Add&foo=Add+torrent"
|
||||
}],
|
||||
"protocol_handlers": [
|
||||
{
|
||||
"protocol": "ext+rc",
|
||||
"name": "RouterConsole",
|
||||
"uriTemplate": "http://127.0.0.1:7657/%s"
|
||||
},
|
||||
{
|
||||
"protocol": "ext+dati2p",
|
||||
"name": "Dat over I2P",
|
||||
"uriTemplate": "/dat.html#!/%s"
|
||||
},
|
||||
{
|
||||
"protocol": "magnet",
|
||||
"name": "I2PTorrent",
|
||||
"uriTemplate": "__MSG_protocolHandlerValue__"
|
||||
}
|
||||
],
|
||||
"default_locale": "en"
|
||||
}
|
||||
|
||||
|
10
privacy.js
10
privacy.js
@@ -180,7 +180,15 @@ function AssurePeerConnection() {
|
||||
rtc.then(assure);
|
||||
}
|
||||
|
||||
AssurePeerConnection();
|
||||
var gettingInfo = browser.runtime.getPlatformInfo();
|
||||
gettingInfo.then(got => {
|
||||
if (got.os == "android") {
|
||||
browser.tabs.onCreated.addListener(ResetPeerConnection);
|
||||
} else {
|
||||
browser.windows.onCreated.addListener(ResetPeerConnection);
|
||||
}
|
||||
});
|
||||
//AssurePeerConnection();
|
||||
|
||||
function ResetDisableSavePasswords() {
|
||||
browser.privacy.services.passwordSavingEnabled.set({
|
||||
|
27
proxy.js
27
proxy.js
@@ -35,6 +35,10 @@ var handleContextProxyRequest = async function(requestDetails) {
|
||||
failoverTimeout: 0,
|
||||
proxyDns: false
|
||||
};
|
||||
if (context == "firefox-default" || context == "firefox-private") {
|
||||
proxy = null;
|
||||
return proxy;
|
||||
}
|
||||
if (context != undefined) {
|
||||
if (context.name == titlepref) {
|
||||
proxy = {
|
||||
@@ -123,7 +127,7 @@ var handleContextProxyRequest = async function(requestDetails) {
|
||||
context = await browser.contextualIdentities.get(tabInfo.cookieStoreId);
|
||||
return context;
|
||||
} catch (error) {
|
||||
console.log("(proxy)Context Error", error);
|
||||
return "firefox-default";
|
||||
}
|
||||
};
|
||||
var tabGet = async function(tabId) {
|
||||
@@ -187,6 +191,7 @@ function SetupSettings() {
|
||||
storedSettings.proxy_scheme = proxy_scheme;
|
||||
}
|
||||
console.log("Initialising Proxy Scheme", storedSettings.proxy_scheme);
|
||||
setupProxy();
|
||||
}
|
||||
var gettingSchemeStoredSettings = browser.storage.local.get("proxy_scheme");
|
||||
gettingSchemeStoredSettings.then(checkSchemeStoredSettings, onError);
|
||||
@@ -200,6 +205,7 @@ function SetupSettings() {
|
||||
storedSettings.proxy_host = proxy_host;
|
||||
}
|
||||
console.log("Initialising Host", storedSettings.proxy_host);
|
||||
setupProxy();
|
||||
}
|
||||
var gettingHostStoredSettings = browser.storage.local.get("proxy_host");
|
||||
gettingHostStoredSettings.then(checkHostStoredSettings, onError);
|
||||
@@ -213,6 +219,7 @@ function SetupSettings() {
|
||||
storedSettings.proxy_port = proxy_port;
|
||||
}
|
||||
console.log("Initialising Port", storedSettings.proxy_port);
|
||||
setupProxy();
|
||||
}
|
||||
var gettingPortStoredSettings = browser.storage.local.get("proxy_port");
|
||||
gettingPortStoredSettings.then(checkPortStoredSettings, onError);
|
||||
@@ -226,6 +233,7 @@ function SetupSettings() {
|
||||
storedSettings.control_host = control_host;
|
||||
}
|
||||
console.log("Initialising Control Host", storedSettings.control_host);
|
||||
setupProxy();
|
||||
}
|
||||
var gettingControlHostStoredSettings = browser.storage.local.get(
|
||||
"control_host"
|
||||
@@ -240,10 +248,11 @@ function SetupSettings() {
|
||||
if (storedSettings.control_port != undefined) {
|
||||
contro_port = storedSettings.control_port;
|
||||
} else {
|
||||
control_port = "4445";
|
||||
control_port = "7657";
|
||||
storedSettings.control_port = control_port;
|
||||
}
|
||||
console.log("Initialising Control Port", storedSettings.control_port);
|
||||
setupProxy();
|
||||
}
|
||||
var gettingControlPortStoredSettings = browser.storage.local.get(
|
||||
"control_port"
|
||||
@@ -265,6 +274,7 @@ function SetupSettings() {
|
||||
"Initialising Disabled History",
|
||||
storedSettings.disable_history
|
||||
);
|
||||
setupProxy();
|
||||
}
|
||||
var gettingHistoryStoredSettings = browser.storage.local.get(
|
||||
"disable_history"
|
||||
@@ -317,17 +327,17 @@ function getControlHost() {
|
||||
|
||||
function getControlPort() {
|
||||
if (control_port == undefined) {
|
||||
return "4444";
|
||||
return "7657";
|
||||
}
|
||||
return control_port;
|
||||
}
|
||||
|
||||
function setupProxy() {
|
||||
var controlHost = getControlHost();
|
||||
var controlPort = getControlPort();
|
||||
var Host = getHost();
|
||||
var Port = getPort();
|
||||
var Scheme = getScheme();
|
||||
//var controlHost = getControlHost();
|
||||
//var controlPort = getControlPort();
|
||||
//var Host = getHost();
|
||||
//var Port = getPort();
|
||||
//var Scheme = getScheme();
|
||||
|
||||
/**/
|
||||
console.log("Setting up Firefox WebExtension proxy");
|
||||
@@ -369,3 +379,4 @@ function updateFromStorage() {
|
||||
|
||||
browser.storage.onChanged.addListener(updateFromStorage);
|
||||
SetupSettings();
|
||||
setupProxy();
|
||||
|
128
scrub.js
128
scrub.js
@@ -52,18 +52,19 @@ var contextScrub = async function(requestDetails) {
|
||||
context = await browser.contextualIdentities.get(tabInfo.cookieStoreId);
|
||||
return context;
|
||||
} catch (error) {
|
||||
console.log("(scrub)Context Error", error);
|
||||
return "firefox-default";
|
||||
}
|
||||
};
|
||||
var tabGet = async function(tabId) {
|
||||
try {
|
||||
console.log("(scrub)Tab ID from Request", tabId);
|
||||
let ostype = await browser.runtime.getPlatformInfo();
|
||||
if (ostype == android) tabId += 1;
|
||||
let tabInfo = await browser.tabs.get(tabId);
|
||||
return tabInfo;
|
||||
} catch (error) {
|
||||
console.log("(scrub)Context Error", error);
|
||||
//let tabInfo = await browser.tabs.getCurrent();
|
||||
//return tabInfo;
|
||||
let tabInfo = await browser.tabs.getCurrent();
|
||||
return tabInfo;
|
||||
}
|
||||
};
|
||||
if (requestDetails.tabId > 0) {
|
||||
@@ -71,7 +72,7 @@ var contextScrub = async function(requestDetails) {
|
||||
var context = {};
|
||||
var req = {};
|
||||
if (i2pHost(requestDetails.url)) {
|
||||
console.log("(Proxy)I2P URL detected, ");
|
||||
console.log("(scrub)I2P URL detected, ");
|
||||
tab = tabGet(requestDetails.tabId);
|
||||
context = tab.then(contextGet, onError);
|
||||
req = await context.then(headerScrub, onError);
|
||||
@@ -100,16 +101,12 @@ var contextSetup = async function(requestDetails) {
|
||||
name: titlepref
|
||||
});
|
||||
if (tabId.cookieStoreId != context[0].cookieStoreId) {
|
||||
console.log(
|
||||
"(isolate) forcing I2P Browsing",
|
||||
requestDetails.url,
|
||||
" context",
|
||||
context[0].cookieStoreId
|
||||
);
|
||||
function Create(window) {
|
||||
function onCreated(tab) {
|
||||
console.log("(isolate) Closing old, un-isolated tab", window);
|
||||
if (tabId != undefined) browser.tabs.remove(tabId.id);
|
||||
if (tabId != undefined) {
|
||||
console.log("(isolate) Closing old, un-isolated tab");
|
||||
browser.tabs.remove(tabId.id);
|
||||
}
|
||||
}
|
||||
var created = browser.tabs.create({
|
||||
active: true,
|
||||
@@ -132,22 +129,17 @@ var contextSetup = async function(requestDetails) {
|
||||
name: routerpref
|
||||
});
|
||||
if (tabId.cookieStoreId != context[0].cookieStoreId) {
|
||||
console.log(
|
||||
"(isolate) forcing Router Console",
|
||||
requestDetails.url,
|
||||
" context",
|
||||
context[0].cookieStoreId
|
||||
);
|
||||
function Create(window) {
|
||||
function onCreated(tab) {
|
||||
console.log("(isolate) Closing old, un-isolated tab");
|
||||
if (tabId != undefined) browser.tabs.remove(tabId.id);
|
||||
if (tabId != undefined) {
|
||||
console.log("(isolate) Closing old, un-isolated tab");
|
||||
browser.tabs.remove(tabId.id);
|
||||
}
|
||||
}
|
||||
var created = browser.tabs.create({
|
||||
active: true,
|
||||
cookieStoreId: context[0].cookieStoreId,
|
||||
url: requestDetails.url
|
||||
//windowId: window.id
|
||||
});
|
||||
created.then(onCreated, onError);
|
||||
}
|
||||
@@ -165,22 +157,17 @@ var contextSetup = async function(requestDetails) {
|
||||
name: tunnelpref
|
||||
});
|
||||
if (tabId.cookieStoreId != context[0].cookieStoreId) {
|
||||
console.log(
|
||||
"(isolate) forcing HSM context",
|
||||
requestDetails.url,
|
||||
" context",
|
||||
context[0].cookieStoreId
|
||||
);
|
||||
function Create(window) {
|
||||
function onCreated(tab) {
|
||||
console.log("(isolate) Closing old, un-isolated tab");
|
||||
if (tabId != undefined) browser.tabs.remove(tabId.id);
|
||||
if (tabId != undefined) {
|
||||
console.log("(isolate) Closing old, un-isolated tab");
|
||||
browser.tabs.remove(tabId.id);
|
||||
}
|
||||
}
|
||||
var created = browser.tabs.create({
|
||||
active: true,
|
||||
cookieStoreId: context[0].cookieStoreId,
|
||||
url: requestDetails.url
|
||||
//windowId: window.id
|
||||
});
|
||||
created.then(onCreated, onError);
|
||||
}
|
||||
@@ -198,16 +185,12 @@ var contextSetup = async function(requestDetails) {
|
||||
name: torrentpref
|
||||
});
|
||||
if (tabId.cookieStoreId != context[0].cookieStoreId) {
|
||||
console.log(
|
||||
"(isolate) forcing Bittorrent",
|
||||
requestDetails.url,
|
||||
" context",
|
||||
context[0].cookieStoreId
|
||||
);
|
||||
function Create(window) {
|
||||
function onCreated(tab) {
|
||||
console.log("(isolate) Closing old, un-isolated tab");
|
||||
if (tabId != undefined) browser.tabs.remove(tabId.id);
|
||||
if (tabId != undefined) {
|
||||
console.log("(isolate) Closing old, un-isolated tab");
|
||||
browser.tabs.remove(tabId.id);
|
||||
}
|
||||
}
|
||||
var created = browser.tabs.create({
|
||||
active: true,
|
||||
@@ -230,16 +213,12 @@ var contextSetup = async function(requestDetails) {
|
||||
name: mailpref
|
||||
});
|
||||
if (tabId.cookieStoreId != context[0].cookieStoreId) {
|
||||
console.log(
|
||||
"(isolate) forcing Web Mail",
|
||||
requestDetails.url,
|
||||
" context",
|
||||
context[0].cookieStoreId
|
||||
);
|
||||
function Create(window) {
|
||||
function onCreated(tab) {
|
||||
console.log("(isolate) Closing old, un-isolated tab");
|
||||
if (tabId != undefined) browser.tabs.remove(tabId.id);
|
||||
if (tabId != undefined) {
|
||||
console.log("(isolate) Closing old, un-isolated tab");
|
||||
browser.tabs.remove(tabId.id);
|
||||
}
|
||||
}
|
||||
var created = browser.tabs.create({
|
||||
active: true,
|
||||
@@ -267,16 +246,12 @@ var contextSetup = async function(requestDetails) {
|
||||
tabId.cookieStoreId == "firefox-private"
|
||||
) {
|
||||
if (tabId.cookieStoreId != context[0].cookieStoreId) {
|
||||
console.log(
|
||||
"(isolate) forcing Web Browsing",
|
||||
requestDetails.url,
|
||||
" context",
|
||||
context[0].cookieStoreId
|
||||
);
|
||||
function Create(window) {
|
||||
function onCreated(tab) {
|
||||
console.log("(isolate) Closing old, un-isolated tab");
|
||||
if (tabId != undefined) browser.tabs.remove(tabId.id);
|
||||
if (tabId != undefined) {
|
||||
console.log("(isolate) Closing old, un-isolated tab");
|
||||
browser.tabs.remove(tabId.id);
|
||||
}
|
||||
}
|
||||
var created = browser.tabs.create({
|
||||
active: true,
|
||||
@@ -303,6 +278,9 @@ var contextSetup = async function(requestDetails) {
|
||||
console.log("(isolate)Tab error", error);
|
||||
}
|
||||
};
|
||||
if (requestDetails == undefined) {
|
||||
return requestDetails;
|
||||
}
|
||||
if (requestDetails.tabId > 0) {
|
||||
if (proxyHost(requestDetails.url)) {
|
||||
setcookie = browser.cookies.set({
|
||||
@@ -313,7 +291,7 @@ var contextSetup = async function(requestDetails) {
|
||||
setcookie.then(onContextGotLog, onError);
|
||||
return requestDetails;
|
||||
}
|
||||
console.log("(isolate)Request Details)", requestDetails);
|
||||
console.log("(isolate)Request Details", requestDetails);
|
||||
if (extensionHost(requestDetails.url)) {
|
||||
var tab = tabGet(requestDetails.tabId);
|
||||
var mtab = tab.then(anyTabFind, onError);
|
||||
@@ -355,15 +333,15 @@ var contextSetup = async function(requestDetails) {
|
||||
return requestDetails;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("(isolate)Request Details)", requestDetails);
|
||||
if (extensionHost(requestDetails.url)) {
|
||||
var tab = tabGet(requestDetails.tabId);
|
||||
var mtab = tab.then(anyTabFind, onError);
|
||||
return requestDetails;
|
||||
if (typeof requestDetails == "number") {
|
||||
tab = tabGet(requestDetails);
|
||||
var mtab = tab.then(anyTabFind);
|
||||
} else if (typeof requestDetails != undefined) {
|
||||
if (typeof requestDetails.tabId > 0) {
|
||||
tab = tabGet(requestDetails.tabId);
|
||||
var mtab = tab.then(anyTabFind);
|
||||
}
|
||||
}
|
||||
//var tab = tabGet(requestDetails.tabId);
|
||||
//var mtab = tab.then(anyTabFind);
|
||||
return requestDetails;
|
||||
} catch (error) {
|
||||
console.log("(isolate)Not an I2P request, blackholing", error);
|
||||
@@ -381,25 +359,3 @@ browser.webRequest.onBeforeSendHeaders.addListener(
|
||||
{ urls: ["<all_urls>"] },
|
||||
["blocking", "requestHeaders"]
|
||||
);
|
||||
|
||||
/*
|
||||
function notify(message) {
|
||||
var response = await fetch('https://proxy.i2p', {
|
||||
credentials: 'include'
|
||||
});
|
||||
const myJson = await response.json();
|
||||
console.log(JSON.stringify(myJson));
|
||||
|
||||
console.log(message);
|
||||
const Http = new XMLHttpRequest();
|
||||
Http.mozAnon = true;
|
||||
Http.withCredentials = true;
|
||||
const url = "http://proxy.i2p";
|
||||
Http.open("GET", url);
|
||||
Http.send();
|
||||
Http.onreadystatechange = e => {
|
||||
console.log(Http.responseText);
|
||||
browser.runtime.sendMessage(Http.responseText);
|
||||
};
|
||||
}
|
||||
*/
|
||||
|
Reference in New Issue
Block a user