force .i2p domains into i2p browsing context

This commit is contained in:
idk
2019-10-07 18:45:52 -04:00
parent e6f1fbbe8b
commit af08c3d800
11 changed files with 761 additions and 7563 deletions

View File

@@ -3,36 +3,39 @@ PREFIX:=/usr
default: zip
install: uninstall
install -d $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io \
$(PREFIX)/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/
install -d options $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io/options
install -d icons $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io/icons
install -d _locales $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io/_locales
install background.js $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io
install proxy.js $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io
install info.js $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io
install content.js $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io
install info.css $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io
install window.html $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io
install manifest.json $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io/
install README.md $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io
install LICENSE $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io
ln -sf $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io \
$(PREFIX)/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/i2psetproxy.js@eyedeekay.github.io
mkdir -p $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io \
$(PREFIX)/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}
cp -r ./chromium/ $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp -r ./icons/ $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp -r ./_locales/ $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp -r ./options/ $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp ./*.js $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp ./*.html $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp ./*.css $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp ./*.md $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp ./*.xpi $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp ./manifest.json $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp ./LICENSE $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io/
ln -s $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io \
$(PREFIX)/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}
uninstall:
rm -rf $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io \
$(PREFIX)/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/i2psetproxy.js@eyedeekay.github.io
$(PREFIX)/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}
clobber:
ls:
ls -lah $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io; \
ls -lah $(PREFIX)/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}
clean:
rm -f ../i2psetproxy.js.zip ../i2p_proxy*.xpi
#VERSION=0.30
VERSION=1.27
xpi:
mv ~/Downloads/i2p_proxy-$(VERSION)-an+fx.xpi ../i2psetproxy.js@eyedeekay.github.io.xpi
cp:
wget -O i2psetproxy.js@eyedeekay.github.io.xpi \
https://addons.mozilla.org/firefox/downloads/file/3034041/i2p_proxy-$(VERSION)-an+fx.xpi?src=devhub
cp ../i2psetproxy.js@eyedeekay.github.io.xpi ./i2psetproxy.js@eyedeekay.github.io.xpi
version:
@@ -40,24 +43,31 @@ version:
zip: version
zip --exclude="./i2psetproxy.js@eyedeekay.github.io.xpi" \
--exclude="i2psetproxy.js.png" -r -FS ../i2psetproxy.js.zip *
--exclude="./i2psetproxy.js.png" \
--exclude="./.git" -r -FS ../i2psetproxy.js.zip *
profile-install:
cp ./i2psetproxy.js@eyedeekay.github.io.xpi $(HOME)/.mozilla/firefox/firefox.profile.i2p/firefox.profile.i2p/extensions
cp ./i2psetproxy.js@eyedeekay.github.io.xpi $(HOME)/.mozilla/firefox/.firefox.profile.i2p.default/extensions
to-profile:
cp ./i2psetproxy.js@eyedeekay.github.io.xpi $(PREFIX)/local/lib/firefox.profile.i2p/firefox.profile.i2p/extensions/
define DESC
I2P in Private Browsing Mode
============================
pi: profile-install
A simple plugin for configuring a Firefox based web browser to isolate I2P
Browsing to a single contextual identity, thus creating an I2P in Private
Browsing mode. It requires the use of a pre-installed I2P Router.
DESC="A simple plugin for configuring an i2p browser."
endef
export DESC
release:
gothub release -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n $(VERSION) -d $(DESC)
upload:
upload: upload-xpi upload-deb
upload-xpi:
gothub upload -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js@eyedeekay.github.io.xpi" -f "../i2psetproxy.js@eyedeekay.github.io.xpi"
upload-deb:
gothub upload -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1_amd64.deb" -f "../i2psetproxy.js_$(VERSION)-1_amd64.deb"
lib: libpolyfill

View File

@@ -8,6 +8,13 @@ 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.
The Old Version
---------------
New versions of this extension create an I2P in Private Browsing mode instead.
Since this is a drastic change to the behavior of the old plugin, a new entry
for the new plugin has been made at a new location on addons.mozilla.org.
Android usage:
--------------
@@ -29,6 +36,7 @@ submission to AMO.
### Features
* [done] **Provide** a way to launch into an I2P-Specific contextual identity/profile
* [done] **Indicate** the I2P browser is in use visually
* [done] **Set** the http proxy to use the local I2P proxy
* [done] **Disable** risky webRTC features
@@ -36,6 +44,11 @@ submission to AMO.
* [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] **Provide** help in a variety of languages.
* [wip] **Monitor** the health and readiness of the I2P router it is
instructed to use.
* [wip] **Handle** router console applications under their own origins and
within their own contextual identity.
### Screenshot

View File

@@ -4,7 +4,7 @@ function onGot(contexts) {
console.log(`Name: ${context.name}`);
ids.push(context.name);
}
console.log("Checking new contexts")
console.log("Checking new contexts");
if (ids.indexOf("i2pbrowser") == -1) {
function onCreated(context) {
console.log(`New identity's ID: ${context.cookieStoreId}.`);
@@ -47,6 +47,7 @@ browser.contextualIdentities.query({}).then(onGot, onError);
if (!isDroid()) {
chrome.windows.onCreated.addListener(themeWindow);
chrome.tabs.onUpdated.addListener(themeWindow);
}
var titlepref = chrome.i18n.getMessage("titlePreface");

File diff suppressed because it is too large Load Diff

28
debian/rules vendored
View File

@@ -4,19 +4,17 @@
dh $@
override_dh_auto_install:
install -d $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io \
$$(pwd)/debian/i2psetproxy.js/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/
install -d options $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io/options
install -d icons $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io/icons
install -d _locales $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io/_locales
install background.js $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io
install proxy.js $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io
install info.js $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io
install content.js $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io
install info.css $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io
install window.html $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io
install manifest.json $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io/
install README.md $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io
install LICENSE $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io
mkdir -p $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io \
$$(pwd)/debian/i2psetproxy.js/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}
cp -r ./chromium/ $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp -r ./icons/ $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp -r ./options/ $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp -r ./_locales/ $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp ./*.js $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp ./*.html $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp ./*.css $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp ./*.md $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp ./manifest.json $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp ./LICENSE $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io/
ln -sf $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2psetproxy.js@eyedeekay.github.io \
$$(pwd)/debian/i2psetproxy.js/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/i2psetproxy.js@eyedeekay.github.io
$$(pwd)/debian/i2psetproxy.js/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}

View File

@@ -1,7 +1,7 @@
{
"applications": {
"gecko": {
"id": "i2psetproxy.js@eyedeekay.github.io",
"id": "i2ppb@eyedeekay.github.io",
"strict_min_version": "60.0"
}
},
@@ -21,7 +21,7 @@
],
"manifest_version": 2,
"name": "__MSG_extensionName__",
"version": "1.27",
"version": "0.30",
"description": "__MSG_extensionDescription__",
"homepage_url": "https://github.com/eyedeekay/i2psetproxy.js",
"icons": {

6978
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -228,6 +228,8 @@ if (!getChrome()) {
gettingStoredSettings.then(checkStoredSettings, onError);
}
function clearCookiesContext(cookieStoreId) {}
function forgetBrowsingData(storedSettings) {
function getSince(selectedSince) {
if (selectedSince === "forever") {
@@ -294,4 +296,4 @@ function onError(e) {
console.error(e);
}
browser.contextualIdentities.query({}).then(onGot, onError);
//browser.contextualIdentities.query("i2pbrowser").then(clearCookiesContext, onError);

View File

@@ -47,7 +47,17 @@ var handleContextProxyRequest = async function(requestDetails) {
context = await browser.contextualIdentities.get(tabInfo.cookieStoreId);
return context;
} catch (error) {
console.log("(proxy)Conext Error", error);
console.log("(proxy)Context Error", error);
}
};
var tabFind = async function(tabId) {
try {
context = await browser.contextualIdentities.query({name:"i2pbrowser"});
tabId.cookieStoreId = context[0].cookieStoreId
console.log("(proxy) forcing context", tabId.cookieStoreId);
return tabId;
} catch (error) {
console.log("(proxy)Context Error", error);
}
};
var tabGet = async function(tabId) {
@@ -59,12 +69,42 @@ var handleContextProxyRequest = async function(requestDetails) {
console.log("(proxy)Tab error", error);
}
};
if (requestDetails.tabId > 0) {
var tab = tabGet(requestDetails.tabId);
var context = tab.then(contextGet);
var proxy = await context.then(handleProxyRequest);
console.log("(proxy)Returning I2P Proxy", proxy);
return proxy;
if (requestDetails.url.endsWith(".i2p")) {
console.log("(Proxy)I2P URL detected, ");
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(tabFind);
requestDetails.tabId = mtab;
var context = mtab.then(contextGet);
var proxy = await context.then(handleProxyRequest);
console.log("(proxy)Returning I2P Proxy", proxy);
return proxy;
} else if (requestDetails.url.endsWith(".b32.i2p")) {
console.log("(Proxy)I2P URL detected, ");
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(tabFind);
requestDetails.tabId = mtab;
var context = mtab.then(contextGet);
var proxy = await context.then(handleProxyRequest);
console.log("(proxy)Returning I2P Proxy", proxy);
return proxy;
} else if (requestDetails.url.includes(".i2p/")) {
console.log("(Proxy)I2P URL detected, ");
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(tabFind);
requestDetails.tabId = mtab;
var context = mtab.then(contextGet);
var proxy = await context.then(handleProxyRequest);
console.log("(proxy)Returning I2P Proxy", proxy);
return proxy;
} else {
var tab = tabGet(requestDetails.tabId);
var context = tab.then(contextGet);
var proxy = await context.then(handleProxyRequest);
console.log("(proxy)Returning I2P Proxy", proxy);
return proxy;
}
}
} catch (error) {
console.log("(proxy)Not using I2P Proxy.", error);
@@ -97,7 +137,6 @@ var control_host = "127.0.0.1";
var control_port = "4444";
*/
function getHost() {
if (proxy_host == undefined) {
proxy_host = "127.0.0.1";

View File

@@ -28,6 +28,16 @@ var contextScrub = async function(requestDetails) {
console.log("(scrub)Conext Error", error);
}
};
var tabFind = async function(tabId) {
try {
context = await browser.contextualIdentities.query({name:"i2pbrowser"});
tabId.cookieStoreId = context[0].cookieStoreId
console.log("(proxy) forcing context", tabId.cookieStoreId);
return tabId;
} catch (error) {
console.log("(proxy)Context Error", error);
}
};
var tabGet = async function(tabId) {
try {
console.log("(scrub)Tab ID from Request", tabId);
@@ -38,11 +48,40 @@ var contextScrub = async function(requestDetails) {
}
};
if (requestDetails.tabId > 0) {
var tab = tabGet(requestDetails.tabId);
var context = tab.then(contextGet);
var req = await context.then(headerScrub);
console.log("(scrub)Returning I2P Proxy", req);
return req;
if (requestDetails.url.endsWith(".i2p")) {
console.log("(Proxy)I2P URL detected, ");
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(tabFind);
requestDetails.tabId = mtab
var context = mtab.then(contextGet);
var proxy = await context.then(handleProxyRequest);
console.log("(proxy)Returning I2P Proxy", proxy);
return proxy;
} else if (requestDetails.url.endsWith(".b32.i2p")) {
console.log("(Proxy)I2P URL detected, ");
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(tabFind);
requestDetails.tabId = mtab
var context = mtab.then(contextGet);
var proxy = await context.then(handleProxyRequest);
console.log("(proxy)Returning I2P Proxy", proxy);
return proxy;
} else if (requestDetails.url.includes(".i2p/")) {
console.log("(Proxy)I2P URL detected, ");
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(tabFind);
requestDetails.tabId = mtab
var context = mtab.then(contextGet);
var proxy = await context.then(handleProxyRequest);
console.log("(proxy)Returning I2P Proxy", proxy);
return proxy;
} else {
var tab = tabGet(requestDetails.tabId);
var context = tab.then(contextGet);
var req = await context.then(headerScrub);
console.log("(scrub)Returning I2P Proxy", req);
return req;
}
}
} catch (error) {
console.log("(scrub)Not using I2P Proxy.", error);