60 Commits
0.47 ... 0.53

Author SHA1 Message Date
idk
e18eeaf934 hotfix 2019-11-28 19:24:53 -05:00
idk
ea92d4a5b8 Merge pull request #36 from eyedeekay/rhizome
Rhizome
2019-11-29 00:07:31 +00:00
idk
51cc8c96e1 rhizome variant 2019-11-28 18:45:34 -05:00
idk
12fff599f0 rhizome variant 2019-11-28 18:44:05 -05:00
idk
30231ab974 rhizome variant 2019-11-28 18:43:32 -05:00
idk
1362ca32d9 cleanup manifest 2019-11-28 17:55:19 -05:00
idk
0c64c301c9 cleanup manifest 2019-11-28 17:54:20 -05:00
idk
38147d45e1 cleanup manifest 2019-11-28 17:54:02 -05:00
idk
093db8443c cleanup manifest 2019-11-28 17:52:35 -05:00
idk
56a220136b OK this one might work 2019-11-27 00:58:53 -05:00
idk
e903349e4c OK this one might work 2019-11-27 00:45:25 -05:00
idk
175683a8ed OK this one might work 2019-11-27 00:38:21 -05:00
idk
d7449a5e8a OK this one might work 2019-11-27 00:34:48 -05:00
idk
3bcbfc1e58 OK this one might work 2019-11-27 00:31:10 -05:00
idk
13210031e6 another hack to deal with slightly different tag behavior 2019-11-27 00:03:44 -05:00
idk
5a2acc1c1c another hack to deal with slightly different tag behavior 2019-11-26 23:26:33 -05:00
idk
4aed7e0db4 another hack to deal with slightly different tag behavior 2019-11-26 23:22:24 -05:00
idk
f4d2334900 another hack to deal with slightly different tag behavior 2019-11-26 23:15:57 -05:00
idk
7902aded0a another hack to deal with slightly different tag behavior 2019-11-26 23:06:24 -05:00
idk
256a990ebc another hack to deal with slightly different tag behavior 2019-11-26 22:45:49 -05:00
idk
ff883a2a9a Merge pull request #35 from eyedeekay/droid-compat
Bugfixes, Code Cleanup, Android Fixes
2019-11-26 15:00:07 +00:00
idk
d1943b4262 In android extension menus have tab ids, try this way of identifying them 2019-11-26 01:07:48 -05:00
idk
c96ec6c3b7 force disconnect of webrtc sessions when webrtc with proxy enabled 2019-11-25 20:42:46 -05:00
idk
6467ea6f63 enable-disable history, don't try to kill undefined tabs 2019-11-25 20:20:53 -05:00
idk
352d71af26 enable-disable history, don't try to kill undefined tabs 2019-11-25 20:20:27 -05:00
idk
ab7774ea29 enable-disable history, don't try to kill undefined tabs 2019-11-25 20:19:44 -05:00
idk
4e00c72d5f remove tabfind. Never create a window, ever. 2019-11-24 23:44:33 -05:00
idk
acd7adc9c1 remove tabfind. Never create a window, ever. 2019-11-24 23:29:06 -05:00
idk
94f0124f0f no but closer 2019-11-24 23:16:48 -05:00
idk
89523390de no but closer 2019-11-24 23:14:01 -05:00
idk
77f57d7f1e no but closer 2019-11-24 23:04:49 -05:00
idk
a33afc52d3 no but closer 2019-11-24 22:59:50 -05:00
idk
b06facacb0 no but closer 2019-11-24 22:50:43 -05:00
idk
bd4c9c0658 no but closer 2019-11-24 22:43:50 -05:00
idk
b23b90baa1 no but closer 2019-11-24 22:32:12 -05:00
idk
5b6224f9ce no but closer 2019-11-24 22:23:13 -05:00
idk
232ada5ed3 no but closer 2019-11-24 22:18:27 -05:00
idk
2fab8e042f pretty sure that'll fix it 2019-11-24 20:57:41 -05:00
idk
749ff30b5b Bring some sanity to the settings section 2019-11-24 20:43:17 -05:00
idk
f0b4a0a849 try and figure out why it works on Desktop but not Android still 2019-11-24 19:49:47 -05:00
idk
870eaa6e3e try and figure out why it works on Desktop but not Android still 2019-11-24 19:47:33 -05:00
idk
c7af1a0d72 try and figure out why it works on Desktop but not Android still 2019-11-24 18:15:38 -05:00
idk
4c10cd2855 try and figure out why it works on Desktop but not Android still 2019-11-24 18:13:34 -05:00
idk
6f45363692 reuse less function names 2019-11-24 18:04:58 -05:00
idk
8d14c945f3 reuse less function names 2019-11-24 17:43:43 -05:00
idk
070955225d reuse less function names 2019-11-24 17:28:58 -05:00
idk
9987325f1a reuse less function names 2019-11-24 17:24:34 -05:00
idk
2bbeed8385 reuse less function names 2019-11-24 17:14:43 -05:00
idk
875fe8b86d fix android maybe 2019-11-24 05:50:06 -05:00
idk
b2184119f7 fix android maybe 2019-11-24 05:41:45 -05:00
idk
cb5fa75616 fix android maybe 2019-11-24 05:29:19 -05:00
idk
5c7a80997f fix android maybe 2019-11-24 05:21:56 -05:00
idk
32035348c1 Try some android stuff 2019-11-24 04:55:39 -05:00
idk
049b79753e Try some android stuff 2019-11-24 04:54:28 -05:00
idk
25c24757d4 Try some android stuff 2019-11-24 04:32:35 -05:00
idk
2d17f4fb0f Try some android stuff 2019-11-24 04:28:14 -05:00
idk
916ee81668 Try some android stuff 2019-11-24 04:25:06 -05:00
idk
1dd48e4344 Try some android stuff 2019-11-24 04:13:12 -05:00
idk
c93e16875f Merge pull request #34 from eyedeekay/droid-compat
fix tabs
2019-11-23 22:22:55 -05:00
idk
fbaf1dca30 fix tabs 2019-11-23 22:17:20 -05:00
26 changed files with 947 additions and 857 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
README.md.asc
node_modules/
web-ext-artifacts

View File

@@ -6,7 +6,6 @@ install: uninstall
mkdir -p $(PREFIX)/share/webext/i2ppb@eyedeekay.github.io \
$(PREFIX)/share/webext/i2ppb@eyedeekay.github.io/i2pcontrol \
$(PREFIX)/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}
cp -r ./chromium/ $(PREFIX)/share/webext/i2ppb@eyedeekay.github.io/
cp -r ./icons/ $(PREFIX)/share/webext/i2ppb@eyedeekay.github.io/
cp -r ./_locales/ $(PREFIX)/share/webext/i2ppb@eyedeekay.github.io/
cp -r ./options/ $(PREFIX)/share/webext/i2ppb@eyedeekay.github.io/
@@ -37,8 +36,8 @@ clean:
## EVEN RELEASES are AMO RELEASES
## ODD RELEASES are SELFHOSTED RELEASES
MOZ_VERSION=0.44
VERSION=0.45
MOZ_VERSION=0.52
VERSION=0.53
#VERSION=$(MOZ_VERSION)
#VERSION=1.27
@@ -70,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)1-rhizome\",|g' manifest.json
sed -i 's|7657|7647|g' *.js* */*.js*
zip: version
zip --exclude="./i2ppb@eyedeekay.github.io.xpi" \
@@ -106,14 +114,18 @@ WEB_EXT_API_SECRET=AMO_SECRET
tk:
echo $(WEB_EXT_API_KEY)
submit: moz-sign moz-submit
submit: moz-sign rhz-submit moz-submit
clean-artifacts:
rm web-ext-artifacts/*
##ODD NUMBERED, SELF-DISTRIBUTED VERSIONS HERE!
moz-sign: version
moz-sign: version clean-artifacts
@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 sign --channel unlisted --config-discovery false --api-key $(WEB_EXT_API_KEY) --api-secret $(WEB_EXT_API_SECRET); true
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
##EVEN NUMBERED, MOZILLA-DISTRIBUTED VERSIONS HERE!
moz-submit: moz-version
@@ -122,17 +134,29 @@ 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 -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2ppb@eyedeekay.github.io.xpi" -f "./i2ppb@eyedeekay.github.io.xpi"
gothub upload -R -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2ppb@eyedeekay.github.io.xpi" -f "./i2ppb@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"
gothub upload -R -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1_amd64.deb" -f "../i2psetproxy.js_$(VERSION)-1_amd64.deb"
gothub upload -R -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js_$(VERSION).orig.tar.gz" -f "../i2psetproxy.js_$(VERSION).orig.tar.gz"
gothub upload -R -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1.debian.tar.xz" -f "../i2psetproxy.js_$(VERSION)-1.debian.tar.xz"
gothub upload -R -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1.dsc" -f "../i2psetproxy.js_$(VERSION)-1.dsc"
gothub upload -R -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1_amd64.changes" -f "../i2psetproxy.js_$(VERSION)-1_amd64.changes"
gothub upload -R -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js_$(VERSION)-1_amd64.buildinfo" -f "../i2psetproxy.js_$(VERSION)-1_amd64.buildinfo"
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
@@ -140,11 +164,15 @@ lint:
deborig:
rm -rf ../i2psetproxy.js-$(VERSION)
cp -r . ../i2psetproxy.js-$(VERSION)
rm -rf *.xpi web-ext-artifacts
tar \
-cvz \
--exclude=.git \
--exclude=i2psetproxy.js.gif \
--exclude=node_modules \
--exclude=web-ext-artifacts \
--exclude=*.xpi \
--exclude=*/*.xpi \
-f ../i2psetproxy.js_$(VERSION).orig.tar.gz \
.
@@ -152,3 +180,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

View File

@@ -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
---------------
@@ -57,34 +59,45 @@ command:
to the I2P container. Isolate the router console from other local
applications by automatically intercepting requests to the router console to
another container.
* [done/wip] **Indicate** the I2P browser is in use visually. Find an
* [done] **Indicate** the I2P browser is in use visually. Find an
acceptable way to indicate it on Android.
* [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/wip] **Disable** risky webRTC features/offer the option to re-enable
* [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
* [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.
* [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.
A work-in-progress binding to i2pcontrol is available in ./i2pcontrol, it is
inert at this time.
* [1/2] **Handle** router console applications under their own origins and
* [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.
* [not started] **Handle Torrents** by talking to i2psnark-rpc plugin and then
* [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

View File

@@ -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://127.0.0.1:7657/i2psnark/?nofilter_newURL=%s&action=Add&foo=Add+torrent",
"description": "Value for the magnet protocol handler"
}
}

View File

@@ -11,7 +11,7 @@ var torrentprefpriv = chrome.i18n.getMessage("torrentPrefacePrivate");
var tunnelpref = chrome.i18n.getMessage("i2ptunnelPreface");
var tunnelprefpriv = chrome.i18n.getMessage("i2ptunnelPrefacePrivate");
function onGot(contexts) {
function onContextsGot(contexts) {
var ids = [];
for (let context of contexts) {
console.log(`Name: ${context.name}`);
@@ -78,25 +78,32 @@ function onCreated(context) {
console.log(`New identity's ID: ${context.cookieStoreId}.`);
}
function onError(e) {
console.error(e);
}
browser.contextualIdentities.query({}).then(onContextsGot, onError);
browser.contextualIdentities.query({}).then(onGot, onError);
if (!isDroid()) {
chrome.windows.onCreated.addListener(themeWindow);
chrome.windows.onFocusChanged.addListener(themeWindow);
chrome.windows.onRemoved.addListener(themeWindow);
chrome.tabs.onUpdated.addListener(themeWindowByTab);
chrome.tabs.onActivated.addListener(themeWindowByTab);
} else {
}
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
if (got.os == "android") {
} else {
browser.windows.onCreated.addListener(themeWindow);
browser.windows.onFocusChanged.addListener(themeWindow);
browser.windows.onRemoved.addListener(themeWindow);
browser.tabs.onUpdated.addListener(themeWindowByTab);
browser.tabs.onActivated.addListener(themeWindowByTab);
}
});
function themeWindowByTab(tabId) {
function tabWindow(tab) {
getwindow = browser.windows.get(tab.windowId);
getwindow.then(themeWindow);
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
if (got.os == "android") {
getwindow = browser.tabs.get(tab.tabId);
getwindow.then(themeWindow);
} else {
getwindow = browser.windows.get(tab.windowId);
getwindow.then(themeWindow);
}
});
}
if (typeof tabId === "number") {
tab = browser.tabs.get(tabId);
@@ -109,18 +116,18 @@ function themeWindowByTab(tabId) {
function themeWindow(window) {
// Check if the window is in private browsing
function logTabs(tabInfo) {
function onGot(context) {
function onContextGotTheme(context) {
if (context.name == titlepref) {
console.log("Active in I2P window");
if (window.incognito) {
chrome.theme.update(window.id, {
browser.theme.update(window.id, {
colors: {
frame: "#FFC56D",
toolbar: "#FFC56D"
}
});
} else {
chrome.theme.update(window.id, {
browser.theme.update(window.id, {
colors: {
frame: "#FFC56D",
toolbar: "#FFC56D"
@@ -130,14 +137,14 @@ function themeWindow(window) {
} else if (context.name == routerpref) {
console.log("Active in Router Console window");
if (window.incognito) {
chrome.theme.update(window.id, {
browser.theme.update(window.id, {
colors: {
frame: "#A4C8E1",
toolbar: "#A4C8E1"
}
});
} else {
chrome.theme.update(window.id, {
browser.theme.update(window.id, {
colors: {
frame: "#A4C8E1",
toolbar: "#A4C8E1"
@@ -147,14 +154,14 @@ function themeWindow(window) {
} else if (context.name == tunnelpref) {
console.log("Active in Hidden Services Manager window");
if (window.incognito) {
chrome.theme.update(window.id, {
browser.theme.update(window.id, {
colors: {
frame: "#D9D9D6",
toolbar: "#D9D9D6"
}
});
} else {
chrome.theme.update(window.id, {
browser.theme.update(window.id, {
colors: {
frame: "#D9D9D6",
toolbar: "#D9D9D6"
@@ -164,14 +171,14 @@ function themeWindow(window) {
} else if (context.name == mailpref) {
console.log("Active in Web Mail window");
if (window.incognito) {
chrome.theme.update(window.id, {
browser.theme.update(window.id, {
colors: {
frame: "#F7E59A",
toolbar: "#F7E59A"
}
});
} else {
chrome.theme.update(window.id, {
browser.theme.update(window.id, {
colors: {
frame: "#F7E59A",
toolbar: "#F7E59A"
@@ -181,14 +188,14 @@ function themeWindow(window) {
} else if (context.name == torrentpref) {
console.log("Active in Bittorrent window");
if (window.incognito) {
chrome.theme.update(window.id, {
browser.theme.update(window.id, {
colors: {
frame: "#A48FE1",
toolbar: "#A48FE1"
}
});
} else {
chrome.theme.update(window.id, {
browser.theme.update(window.id, {
colors: {
frame: "#A48FE1",
toolbar: "#A48FE1"
@@ -197,7 +204,7 @@ function themeWindow(window) {
}
} else {
console.log("Not active in I2P window");
chrome.theme.reset(window.id);
browser.theme.reset(window.id);
}
}
if (
@@ -206,9 +213,9 @@ function themeWindow(window) {
) {
browser.contextualIdentities
.get(tabInfo[0].cookieStoreId)
.then(onGot, onError);
.then(onContextGotTheme, onError);
} else {
chrome.theme.reset(window.id);
browser.theme.reset(window.id);
}
}
@@ -223,76 +230,75 @@ function setTitle(window) {
function logTabs(tabInfo) {
console.log(tabInfo);
function onGot(context) {
function onContextGotTitle(context) {
if (context.name == titlepref) {
console.log("Active in I2P window");
if (window.incognito) {
chrome.windows.update(window.id, {
titlePreface: titleprefpriv
browser.windows.update(window.id, {
titlePreface: titleprefpriv + ": "
});
} else {
chrome.windows.update(window.id, {
titlePreface: titlepref
browser.windows.update(window.id, {
titlePreface: titlepref + ": "
});
}
} else if (context.name == webpref) {
console.log("Active in Web window");
if (window.incognito) {
chrome.windows.update(window.id, {
browser.windows.update(window.id, {
titlePreface: ""
});
} else {
chrome.windows.update(window.id, {
browser.windows.update(window.id, {
titlePreface: ""
});
}
} else if (context.name == routerpref) {
console.log("Active in Router Console window");
if (window.incognito) {
chrome.windows.update(window.id, {
titlePreface: routerprefpriv
browser.windows.update(window.id, {
titlePreface: titleprefpriv + " - " + routerprefpriv + ": "
});
} else {
chrome.windows.update(window.id, {
titlePreface: routerpref
browser.windows.update(window.id, {
titlePreface: titlepref + " - " + routerpref + ": "
});
}
} else if (context.name == tunnelpref) {
console.log("Active in Hidden Services Manager window");
if (window.incognito) {
chrome.windows.update(window.id, {
titlePreface: tunnelprefpriv
browser.windows.update(window.id, {
titlePreface: titleprefpriv + " - " + tunnelprefpriv + ": "
});
} else {
chrome.windows.update(window.id, {
titlePreface: tunnelpref
browser.windows.update(window.id, {
titlePreface: titlepref + " - " + tunnelpref + ": "
});
}
} else if (context.name == mailpref) {
console.log("Active in Web Mail window");
if (window.incognito) {
chrome.windows.update(window.id, {
titlePreface: mailprefpriv
browser.windows.update(window.id, {
titlePreface: titleprefpriv + " - " + mailprefpriv + ": "
});
} else {
chrome.windows.update(window.id, {
titlePreface: mailpref
browser.windows.update(window.id, {
titlePreface: titlepref + " - " + mailpref + ": "
});
}
} else if (context.name == torrentpref) {
console.log("Active in I2P window");
if (window.incognito) {
chrome.windows.update(window.id, {
titlePreface: torrentprefpriv
browser.windows.update(window.id, {
titlePreface: titleprefpriv + " - " + torrentprefpriv + ": "
});
} else {
chrome.windows.update(window.id, {
titlePreface: torrentpref
browser.windows.update(window.id, {
titlePreface: titlepref + " - " + torrentpref + ": "
});
}
}
@@ -304,14 +310,14 @@ function setTitle(window) {
) {
browser.contextualIdentities
.get(tabInfo[0].cookieStoreId)
.then(onGot, onError);
.then(onContextGotTitle, onError);
} else {
if (window.incognito) {
chrome.windows.update(window.id, {
browser.windows.update(window.id, {
titlePreface: ""
});
} else {
chrome.windows.update(window.id, {
browser.windows.update(window.id, {
titlePreface: ""
});
}
@@ -325,26 +331,44 @@ function setTitle(window) {
querying.then(logTabs, onError);
}
chrome.windows.onCreated.addListener(() => {
/* var gettingStoredSettings = chrome.storage.local.get();
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
if (got.os == "android") {
} else {
browser.windows.onCreated.addListener(() => {
/* var gettingStoredSettings = chrome.storage.local.get();
gettingStoredSettings.then(setupProxy, onError); */
chrome.storage.local.get(function(got) {
setupProxy();
});
chrome.storage.local.get(function(got) {
setupProxy();
});
});
}
});
chrome.tabs.onCreated.addListener(() => {
var getting = browser.windows.getCurrent({
populate: true
});
getting.then(setTitle, onError);
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
if (got.os == "android") {
} else {
browser.tabs.onCreated.addListener(() => {
var getting = browser.windows.getCurrent({
populate: true
});
getting.then(setTitle, onError);
});
}
});
chrome.tabs.onActivated.addListener(() => {
var getting = browser.windows.getCurrent({
populate: true
});
getting.then(setTitle, onError);
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
if (got.os == "android") {
} else {
browser.tabs.onActivated.addListener(() => {
var getting = browser.windows.getCurrent({
populate: true
});
getting.then(setTitle, onError);
});
}
});
function handleUpdated(updateInfo) {

View File

@@ -1,153 +1,172 @@
function bookmarks(bookmarkToolbar) {
console.log("Setting up bookmark toolbar", bookmarkToolbar);
function bookHome(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let host = info.value.http.split(":")[0];
let port = info.value.http.split(":")[1];
if (port == "7644") {
var createBookmark = browser.bookmarks.create({
url: "about:I2p",
title: "I2P Home Page",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
} else {
var createBookmark = browser.bookmarks.create({
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) checking if we're running in an I2P Browser");
var gettingInfo = browser.proxy.settings.get({});
gettingInfo.then(gotProxyInfo);
}
}
function bookTorrent(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let host = info.value.http.split(":")[0];
let port = info.value.http.split(":")[1];
if (port == "7644") {
var createBookmark = browser.bookmarks.create({
url: "http://localhost:7647/i2psnark",
title: "Bittorrent",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
} else {
var createBookmark = browser.bookmarks.create({
url: "http://localhost:7657/i2psnark",
title: "Bittorrent",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
if (got.os != "android") {
function bookmarks(bookmarkToolbar) {
console.log("Setting up bookmark toolbar", bookmarkToolbar);
function bookHome(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let host = info.value.http.split(":")[0];
let port = info.value.http.split(":")[1];
if (port == "7644") {
var createBookmark = browser.bookmarks.create({
url: "about:I2p",
title: "I2P Home Page",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
} else {
var createBookmark = browser.bookmarks.create({
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) checking if we're running in an I2P Browser"
);
var gettingInfo = browser.proxy.settings.get({});
gettingInfo.then(gotProxyInfo);
}
}
console.log("(bookmarks) checking if we're running in an I2P Browser");
var gettingInfo = browser.proxy.settings.get({});
gettingInfo.then(gotProxyInfo);
}
}
function bookMail(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let host = info.value.http.split(":")[0];
let port = info.value.http.split(":")[1];
if (port == "7644") {
var createBookmark = browser.bookmarks.create({
url: "http://localhost:7647/webmail",
title: "Web Mail",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
} else {
var createBookmark = browser.bookmarks.create({
url: "http://localhost:7657/webmail",
title: "Web Mail",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
function bookTorrent(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let host = info.value.http.split(":")[0];
let port = info.value.http.split(":")[1];
if (port == "7644") {
var createBookmark = browser.bookmarks.create({
url: "http://localhost:7657/i2psnark",
title: "Bittorrent",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
} else {
var createBookmark = browser.bookmarks.create({
url:
"http://" + control_host + ":" + control_port + "/i2psnark",
title: "Bittorrent",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
}
}
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
var gettingInfo = browser.proxy.settings.get({});
gettingInfo.then(gotProxyInfo);
}
console.log("(bookmarks) adding webmail bookmark");
}
console.log("(bookmarks) checking if we're running in an I2P Browser");
var gettingInfo = browser.proxy.settings.get({});
gettingInfo.then(gotProxyInfo);
}
}
function bookI2PTunnel(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let host = info.value.http.split(":")[0];
let port = info.value.http.split(":")[1];
if (port == "7644") {
var createBookmark = browser.bookmarks.create({
url: "http://localhost:7647/i2ptunnelmgr",
title: "Hidden Services Manager",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
} else {
var createBookmark = browser.bookmarks.create({
url: "http://localhost:7657/i2ptunnelmgr",
title: "Hidden Services Manager",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
function bookMail(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let host = info.value.http.split(":")[0];
let port = info.value.http.split(":")[1];
if (port == "7644") {
var createBookmark = browser.bookmarks.create({
url: "http://localhost:7657/webmail",
title: "Web Mail",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
} else {
var createBookmark = browser.bookmarks.create({
url: "http://" + control_host + ":" + control_port + "/webmail",
title: "Web Mail",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
}
console.log("(bookmarks) adding webmail bookmark");
}
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
var gettingInfo = browser.proxy.settings.get({});
gettingInfo.then(gotProxyInfo);
}
console.log("(bookmarks) adding i2ptunnel bookmark");
}
console.log("(bookmarks) checking if we're running in an I2P Browser");
var gettingInfo = browser.proxy.settings.get({});
gettingInfo.then(gotProxyInfo);
function bookI2PTunnel(bookmarkItems) {
if (!bookmarkItems.length) {
function gotProxyInfo(info) {
let host = info.value.http.split(":")[0];
let port = info.value.http.split(":")[1];
if (port == "7644") {
var createBookmark = browser.bookmarks.create({
url: "http://localhost:7657/i2ptunnelmgr",
title: "Hidden Services Manager",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
} else {
var createBookmark = browser.bookmarks.create({
url:
"http://" +
control_host +
":" +
control_port +
"/i2ptunnelmgr",
title: "Hidden Services Manager",
parentId: bookmarkToolbar[0].id
});
createBookmark.then(onCreated);
}
console.log("(bookmarks) adding i2ptunnel bookmark");
}
console.log(
"(bookmarks) checking if we're running in an I2P Browser"
);
var gettingInfo = browser.proxy.settings.get({});
gettingInfo.then(gotProxyInfo);
}
}
function onRejected(error) {
console.log(`An error: ${error}`);
}
function onCreated(node) {
console.log("Bookmarked", node);
}
var b0 = browser.bookmarks.search({
title: "I2P Home Page"
});
b0.then(bookHome, onRejected);
var b1 = browser.bookmarks.search({
title: "Bittorrent"
});
b1.then(bookTorrent, onRejected);
var b2 = browser.bookmarks.search({
title: "Hidden Services Manager"
});
b2.then(bookI2PTunnel, onRejected);
var b3 = browser.bookmarks.search({
title: "Web Mail"
});
b3.then(bookMail, onRejected);
}
var bt = browser.bookmarks.search({
query: "Toolbar"
});
bt.then(bookmarks);
function handleCreated(id, bookmarkInfo) {
var propValue;
for (var propName in bookmarkInfo) {
propValue = bookmarkInfo[propName];
console.log(propName, propValue);
}
}
browser.bookmarks.onCreated.addListener(handleCreated);
}
function onRejected(error) {
console.log(`An error: ${error}`);
}
function onCreated(node) {
console.log("Bookmarked", node);
}
var b0 = browser.bookmarks.search({
title: "I2P Home Page"
});
b0.then(bookHome, onRejected);
var b1 = browser.bookmarks.search({
title: "Bittorrent"
});
b1.then(bookTorrent, onRejected);
var b2 = browser.bookmarks.search({
title: "Hidden Services Manager"
});
b2.then(bookI2PTunnel, onRejected);
var b3 = browser.bookmarks.search({
title: "Web Mail"
});
b3.then(bookMail, onRejected);
}
var bt = browser.bookmarks.search({
query: "Toolbar"
});
bt.then(bookmarks);
function handleCreated(id, bookmarkInfo) {
var propValue;
for (var propName in bookmarkInfo) {
propValue = bookmarkInfo[propName];
console.log(propName, propValue);
}
}
browser.bookmarks.onCreated.addListener(handleCreated);

View File

@@ -1,19 +1,19 @@
//var windowIds = []
function onCreated(windowInfo) {
console.log(`Created window: ${windowInfo.id}`);
browser.tabs.create({
windowId: windowInfo.id,
url: "about:blank",
cookieStoreId: event.target.dataset.identity
});
}
var titlepref = chrome.i18n.getMessage("titlePreface");
function onError(error) {
console.log(`Error: ${error}`);
}
function eventHandler(event) {
function onCreated(windowInfo) {
console.log(`Created window: ${windowInfo.id}`);
browser.tabs.create({
windowId: windowInfo.id,
url: "about:blank",
cookieStoreId: event.target.dataset.identity
});
}
if (event.target.dataset.action == "create") {
var creating = browser.tabs.create({
cookieStoreId: event.target.dataset.identity
@@ -52,7 +52,7 @@ if (browser.contextualIdentities === undefined) {
} else {
browser.contextualIdentities
.query({
name: "I2P Browser"
name: titlepref
})
.then(identities => {
if (!identities.length) {

14
debian/changelog vendored
View File

@@ -1,3 +1,17 @@
i2psetproxy.js (0.51-1) UNRELEASED; urgency=low
* Numerous code cleanups, compatibility fixes
* enable-disable history
* better homepage, better control panel, saner options
-- idk <hankhill19580@gmail.com> Sat, 23 NOV 2019 22:51:11 -0400
i2psetproxy.js (0.49-1) UNRELEASED; urgency=low
* fix tabs
-- idk <hankhill19580@gmail.com> Sat, 23 NOV 2019 22:51:11 -0400
i2psetproxy.js (0.47-1) UNRELEASED; urgency=low
* Improve android compatibility

1
debian/copyright vendored
View File

@@ -28,6 +28,7 @@ Files: .gitignore
scrub.js
window.html
debian/*
*
Copyright: MIT
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy

1
debian/rules vendored
View File

@@ -7,7 +7,6 @@ override_dh_auto_install:
mkdir -p $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2ppb@eyedeekay.github.io \
$$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2ppb@eyedeekay.github.io/i2pcontrol \
$$(pwd)/debian/i2psetproxy.js/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}
cp -r ./chromium/ $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2ppb@eyedeekay.github.io/
cp -r ./icons/ $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2ppb@eyedeekay.github.io/
cp -r ./options/ $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2ppb@eyedeekay.github.io/
cp -r ./_locales/ $$(pwd)/debian/i2psetproxy.js/usr/share/webext/i2ppb@eyedeekay.github.io/

View File

@@ -1 +1,4 @@
i2psetproxy.js.gif
i2psetproxy.js.gif
i2psetproxy.js@eyedeekay.github.io.xpi
i2pbb@eyedeekay.github.io.xpi
web-ext-artifacts/i2p_in_private_browsing-0.51-an+fx.xpi

1
geti2p.url Normal file
View File

@@ -0,0 +1 @@
0.9.43

View File

@@ -12,13 +12,28 @@ function identifyProtocolHandler(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];
} else {
hostname = url.split("/")[0];
}
let path = url.replace(prefix + hostname, "");
console.log("(handler) path", prefix + hostname, path);
return path;
}
var handlerSetup = async function(requestDetails) {
//console.log("checking protocol handler listener")
var 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 = rwurl;
requestDetails.url = trimHost(rwurl);
requestDetails.originUrl = trimHost(rwurl);
}
return requestDetails;
};

View File

@@ -76,8 +76,10 @@ p {
border: 1px solid #d9d9d6;
border-radius: 2px;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc;
background: #f8f8ff
background: #f8f8ff;
min-width: 95%
}
.application-info,
.extended-info {
min-height: 3rem;
padding: 1rem;
@@ -87,17 +89,7 @@ p {
border-radius: 2px;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc;
background: #f8f8ff;
min-width: 50%
}
.application-info {
min-height: 3rem;
padding: 1rem;
margin-top: 1.5rem;
display: inline-block;
border: 1px solid #d9d9d6;
border-radius: 2px;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc;
background: #f8f8ff
min-width: 95%
}
h1 {
margin-right: auto;
@@ -269,11 +261,15 @@ li {
}
.onboardingContent {
font-size: .8rem!important;
text-align: left
text-align: left;
display: none
}
#proxy-check {
visibility: hidden
}
#info-content {
display: none
}
.consoleOn:hover #proxy-check,
.proxyReady:hover #proxy-check {
visibility: visible;
@@ -283,7 +279,7 @@ img.readyness {
height: 100%;
width: auto
}
@media only screen and (max-width: 768px) {
@media only screen and (max-width: 399px) {
.application-info {
display: none
}

View File

@@ -32,15 +32,15 @@
</div>
<div id="onboarding" class="hideIfI2PConsoleOff">
<h3 id="onboardingTitle">New to I2P? Learn more here.</h3>
<h4 id="onboardingZero"><button class="showhider" onclick="flipVisibility('onboardingContentZero')">Protect your Privacy</button></h4>
<h4 id="onboardingZero"><button id="onboardingButtonZero" class="showhider" onclick="flipVisibility('onboardingContentZero')">Protect your Privacy</button></h4>
<p id="onboardingContentZero" class="onboardingContent">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.</p>
<h4 id="onboardingOne"><button class="showhider" onclick="flipVisibility('onboardingContentOne')">Configure your Experience</button></h4>
<h4 id="onboardingOne"><button id="onboardingButtonOne" class="showhider" onclick="flipVisibility('onboardingContentOne')">Configure your Experience</button></h4>
<p id="onboardingContentOne" class="onboardingContent">We also provide you with additional settings for bumping up your browser security. Our Security Settings allow you to block elements that could be used to attack your computer. Click below to see what the different options do. Note: By default, NoScript and HTTPS Everywhere are not included on the toolbar, but you can customize your toolbar to add them. With all the security and privacy features provided by I2P, your experience while browsing the internet may be a little different. Things may be a bit slower, and depending on your security level, some elements may not work or load. You may also be asked to prove you are a human and not a robot.</p>
<h4 id="onboardingTwo"><button class="showhider" onclick="flipVisibility('onboardingContentTwo')">Share Files</button></h4>
<h4 id="onboardingTwo"><button id="onboardingButtonTwo" class="showhider" onclick="flipVisibility('onboardingContentTwo')">Share Files</button></h4>
<p id="onboardingContentTwo" class="onboardingContent">I2P is capable of using peer-to-peer applications like BitTorrent, protecting your identity when you share files. Our anonymous bittorrent client is available in the browser.</p>
<h4 id="onboardingThree"><button class="showhider" onclick="flipVisibility('onboardingContentThree')">Hidden e-mail</button></h4>
<h4 id="onboardingThree"><button id="onboardingButtonThree" class="showhider" onclick="flipVisibility('onboardingContentThree')">Hidden e-mail</button></h4>
<p id="onboardingContentThree" class="onboardingContent">There is also an anonymous e-mail service available inside of I2P, which is accessible from our browser via the menu directly below.</p>
<h4 id="onboardingFour"><button class="showhider" onclick="flipVisibility('onboardingContentFour')">Experience Tips</button></h4>
<h4 id="onboardingFour"><button id="onboardingButtonFour" class="showhider" onclick="flipVisibility('onboardingContentFour')">Experience Tips</button></h4>
<p id="onboardingContentFour" class="onboardingContent">With all the security and privacy features provided by I2P, your experience while browsing the internet may be a little different. Things may be a bit slower, and depending on your security level, some elements may not work or load. You may also be asked to prove you are a human and not a robot.</p>
</div>
<!--<p class="hideIfI2POn">&aboutI2p.warn_not_running; <a href="about:i2p">&aboutI2p.refresh_text;</a> &aboutI2p.reccommend_not_running;</p>-->
@@ -49,17 +49,17 @@
<h3>Applications</h3>
<p id="applicationExplain">These applications use I2P to provide them with security and privacy.</p>
<ul>
<a class="applicationName" href="http://127.0.0.1:7657/i2ptunnel">
<a class="applicationName" target="_blank" href="http://127.0.0.1:7657/i2ptunnel">
<li class="application">
Hidden Services Manager <span class="applicationDesc">I2P has a web-based interface for configuring .i2p services like web sites, to set up your own web sites, go here:</span>
</li>
</a>
<a class="applicationName" href="http://127.0.0.1:7657/susimail">
<a class="applicationName" target="_blank" href="http://127.0.0.1:7657/susimail">
<li class="application">
E-Mail <span class="applicationDesc">I2P also bundles a webmail client which can be used to access in-I2P e-mail. To use it, go here:</span>
</li>
</a>
<a class="applicationName" href="http://127.0.0.1:7657/i2psnark">
<a class="applicationName" target="_blank" href="http://127.0.0.1:7657/i2psnark">
<li class="application">
BitTorrent <span class="applicationDesc">I2P is capable of anonymous Peer-to-Peer file sharing, to use the built-in bittorrent client go here:</span>
</li>
@@ -68,7 +68,7 @@
</p>
</div>
<div class="extended-info">
<h3 id="links"><button class="showhider" onclick="flipVisibility('info-content')">Links</button></h3>
<h3 id="links"><button id="fliplinks" class="showhider">Links</button></h3>
<div id="info-content">
<p id="linksExplain">If you want to get more information about I2P, you can visit these links.</p>
<p>

16
home.js
View File

@@ -1,3 +1,19 @@
document.addEventListener("click", e => {
if (e.target.id === "onboardingButtonZero") {
flipVisibility("onboardingContentZero");
} else if (e.target.id === "onboardingButtonOne") {
flipVisibility("onboardingContentOne");
} else if (e.target.id === "onboardingButtonTwo") {
flipVisibility("onboardingContentTwo");
} else if (e.target.id === "onboardingButtonThree") {
flipVisibility("onboardingContentThree");
} else if (e.target.id === "onboardingButtonFour") {
flipVisibility("onboardingContentFour");
} else if (e.target.id === "fliplinks") {
flipVisibility("info-content");
}
});
function flipVisibility(div) {
var x = document.getElementById(div);
if (x.style.display === "none") {

15
host.js
View File

@@ -28,6 +28,12 @@ function localHost(url) {
return false;
}
function extensionHost(url) {
var res = url.startsWith(browser.runtime.getURL(""));
console.log("Extension URL?", res, url, browser.runtime.getURL(""));
return res;
}
function i2pHostName(url) {
let hostname = "";
if (url.indexOf("://") > -1) {
@@ -80,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);
}

115
info.js
View File

@@ -1,8 +1,27 @@
document.addEventListener("click", e => {
function getCurrentWindow() {
return chrome.windows.getCurrent();
}
function checkPeerConnection() {
var getting = browser.privacy.network.peerConnectionEnabled.get({});
getting.then(got => {
webrtc = got.value;
console.log("checking webrtc", webrtc);
document.getElementById("enable-web-rtc").checked = webrtc;
});
}
checkPeerConnection();
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;
});
}
checkHistory();
document.addEventListener("click", e => {
if (e.target.id === "window-create-help-panel") {
let createData = {
type: "panel",
@@ -34,12 +53,6 @@ document.addEventListener("click", e => {
}
RefreshIdentity();
} else if (e.target.id === "window-preface-title") {
getCurrentWindow().then(currentWindow => {
let updateInfo = {
titlePreface: "I2P Help | "
};
chrome.windows.update(currentWindow.id, updateInfo);
});
} else if (e.target.id === "window-visit-homepage") {
console.log("attempting to create homepage tab");
goHome();
@@ -62,6 +75,15 @@ document.addEventListener("click", e => {
} else {
browser.runtime.sendMessage({ rtc: "disableWebRTC" });
}
//checkPeerConnection()
return;
} else if (e.target.id === "disable-history") {
if (e.target.checked) {
browser.runtime.sendMessage({ history: "disableHistory" });
} else {
browser.runtime.sendMessage({ history: "enableHistory" });
}
//checkHistory()
return;
}
@@ -72,6 +94,13 @@ function proxyReadiness() {
console.log(this.responseText);
}
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
if (got.os != "android") {
browser.history.onVisited.addListener(onVisited);
}
});
function goHome() {
function gotProxyInfo(info) {
let host = info.value.http.split(":")[0];
@@ -98,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);
@@ -106,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);
@@ -114,49 +143,31 @@ 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);
}
/*
//document.addEventListener("onpageshow", e => {
console.log("(Check) Checking Proxy Readiness");
const Http = new XMLHttpRequest();
Http.addEventListener("load", proxyReadiness);
const url = "http://proxy.i2p"; ///themes/console/images/favicon.ico";
Http.open("GET", url);
Http.send();
//});
function transferComplete(evt) {
console.log(
"The transfer is complete.",
this.status,
this.statusText,
this.responseText
);
function onVisited(historyItem) {
function onCleaned(results) {
if (!results.length) {
console.log(" was removed");
} else {
console.log(" was not removed");
}
}
function onRemoved() {
var searching = browser.history.search({
text: historyItem.url,
startTime: 0
});
searching.then(onCleaned);
}
if (!history) {
if (i2pHost(historyItem.url))
var deletingUrl = browser.history.deleteUrl(historyItem.url);
deletingUrl.then(onRemoved);
}
}
function transferFailed(evt) {
console.log(
"An error occurred while transferring the file.",
this.status,
this.statusText,
this.responseText
);
}
function transferCanceled(evt) {
console.log(
"The transfer has been canceled by the user.",
this.status,
this.statusText,
this.responseText
);
}
Http.addEventListener("load", transferComplete);
Http.addEventListener("error", transferFailed);
Http.addEventListener("abort", transferCanceled);
*/

View File

@@ -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.47",
"version": "0.51",
"version_name": "0.51",
"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": "http://127.0.0.1:7657/i2psnark/?nofilter_newURL=%s&action=Add&foo=Add+torrent"
}
],
"default_locale": "en"
}

View File

@@ -1,14 +1,3 @@
function isDroid() {
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
if (got.os == "android") {
return true;
} else {
return false;
}
});
}
function SetHostText() {
var hostid = document.getElementById("hostText");
hostid.textContent = chrome.i18n.getMessage("hostText");
@@ -24,174 +13,6 @@ function SetControlHostText() {
controlhostid.textContent = chrome.i18n.getMessage("controlHostText");
}
var handleContextProxyRequest = async function(requestDetails) {
console.log("(proxy)Searching for proxy by context");
try {
var handleProxyRequest = function(context) {
proxy = {
failoverTimeout: 0,
proxyDns: false
};
if (context != undefined) {
if (context.name == "i2pbrowser") {
proxy = {
type: getScheme(),
host: getHost(),
port: getPort()
};
console.log(
"(proxy)",
context.name,
"Using",
proxy.type,
"proxy ",
proxy.host + ":" + proxy.port
);
return proxy;
} else if (context.name == "routerconsole") {
if (routerHost(requestDetails.url)) {
return proxy;
} else if (!routerHost(requestDetails.url)) {
proxy = {
type: "http",
host: "localhost",
port: "65535"
};
}
proxy = {
type: getScheme(),
host: getHost(),
port: getPort()
};
console.log(
"(proxy)",
context.name,
"Using",
proxy.type,
"proxy ",
proxy.host + ":" + proxy.port
);
return proxy;
} else if (context.name == "fenced-default") {
if (localHost(requestDetails.url)) {
if (!routerHost(requestDetails.url)) {
proxy = {
type: "http",
host: "localhost",
port: "65535"
};
}
}
console.log(
"(proxy)",
context.name,
"Using",
proxy.type,
"proxy ",
proxy.host + ":" + proxy.port
);
return proxy;
}
}
if (!routerHost(requestDetails.url)) {
proxy = {
type: "http",
host: "localhost",
port: "65535"
};
} else if (i2pHost(requestDetails.url)) {
proxy = {
type: getScheme(),
host: getHost(),
port: getPort()
};
}
return proxy;
};
var contextGet = async function(tabInfo) {
try {
console.log("(proxy)Tab info from Function", tabInfo);
context = await browser.contextualIdentities.get(tabInfo.cookieStoreId);
return context;
} catch (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) {
try {
console.log("(proxy)Tab ID from Request", tabId);
let tabInfo = await browser.tabs.get(tabId);
return tabInfo;
} catch (error) {
console.log("(proxy)Tab error", error);
}
};
if (requestDetails.tabId > 0) {
if (proxyHost(requestDetails.url)) {
console.log("(Proxy)I2P Proxy test URL detected, ", requestDetails.url);
return {
type: getScheme(),
host: getHost(),
port: getPort()
};
} else if (i2pHost(requestDetails.url)) {
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;
}
proxy = {
type: getScheme(),
host: getHost(),
port: getPort()
};
console.log("(proxy)Returning I2P Proxy", proxy);
return proxy;
}
} catch (error) {
console.log("(proxy)Not using I2P Proxy.", error);
}
};
function setupProxy() {
var controlHost = getControlHost();
var controlPort = getControlPort();
var Host = getHost();
var Port = getPort();
var Scheme = getScheme();
/**/
console.log("Setting up Firefox WebExtension proxy");
browser.proxy.onRequest.addListener(handleContextProxyRequest, {
urls: ["<all_urls>"]
});
console.log("i2p settings created for WebExtension Proxy");
/**/
}
function SetControlPortText() {
var controlportid = document.getElementById("controlPortText");
controlportid.textContent = chrome.i18n.getMessage("controlPortText");
@@ -324,6 +145,75 @@ function checkStoredSettings(storedSettings) {
gettingInfo.then(gotProxyInfo);
}
function checkAndroidStoredSettings(storedSettings) {
let defaultSettings = {};
let host = "";
let port = "";
console.log("proxy", "'" + host + "'", ":", port);
if (!storedSettings.proxy_scheme) {
defaultSettings["proxy_scheme"] = "http";
}
if (!storedSettings.proxy_host) {
if (host == "") {
defaultSettings["proxy_host"] = "127.0.0.1";
} else {
defaultSettings["proxy_host"] = host;
}
} else {
if (host != "") {
defaultSettings["proxy_host"] = host;
} else {
defaultSettings["proxy_host"] = storedSettings.proxy_host;
}
}
if (!storedSettings.proxy_port) {
if (port == undefined) {
defaultSettings["proxy_port"] = 4444;
} else {
defaultSettings["proxy_port"] = port;
}
} else {
if (port != undefined) {
defaultSettings["proxy_port"] = port;
} else {
defaultSettings["proxy_port"] = storedSettings.proxy_port;
}
}
if (!storedSettings.control_host) {
if (host == "") {
defaultSettings["control_host"] = "127.0.0.1";
} else {
defaultSettings["control_host"] = host;
}
} else {
if (host != "") {
defaultSettings["control_host"] = host;
} else {
defaultSettings["control_host"] = storedSettings.control_host;
}
}
if (!storedSettings.control_port) {
if (port == undefined) {
defaultSettings["control_port"] = 4444;
} else {
defaultSettings["control_port"] = port;
}
} else {
if (port != undefined) {
defaultSettings["control_port"] = port;
} else {
defaultSettings["control_port"] = storedSettings.control_port;
}
}
console.log(
defaultSettings["proxy_host"],
defaultSettings["proxy_port"],
defaultSettings["control_host"],
defaultSettings["control_port"]
);
chrome.storage.local.set(defaultSettings);
}
function onError(e) {
console.error(e);
}
@@ -346,7 +236,6 @@ function storeSettings() {
console.log("storing proxy port:", proxy_port);
console.log("storing control host:", control_host);
console.log("storing control port:", control_port);
setupProxy();
}
function updateUI(restoredSettings) {
@@ -375,15 +264,25 @@ function updateUI(restoredSettings) {
SetControlHostText();
SetControlPortText();
SetControlHelpText();
setupProxy();
}
function onError(e) {
console.error(e);
}
chrome.storage.local.get(function(got) {
checkStoredSettings(got);
updateUI(got);
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
if (got.os != "android") {
chrome.storage.local.get(function(got) {
checkStoredSettings(got);
updateUI(got);
});
} else {
chrome.storage.local.get(function(got) {
checkAndroidStoredSettings(got);
updateUI(got);
});
}
});
const saveButton = document.querySelector("#save-button");

View File

@@ -1,13 +1,30 @@
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 android = false;
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
if (got.os == "android") {
console.log("Running in Android detected");
android = true;
return true;
} else {
console.log("Running in Desktop detected");
return false;
}
});
function isDroid() {
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
if (got.os == "android") {
console.log("Running in Android detected");
return true;
} else {
console.log("Running in Desktop detected");
return false;
}
});
return false;
return android;
}

View File

@@ -86,7 +86,7 @@ function disableReferrers() {
// enable fingerprinting resistent features(letterboxing and stuff)
function enableResistFingerprinting() {
var setting = browser.privacy.websites.referrersEnabled.set({
var setting = browser.privacy.websites.resistFingerprinting.set({
value: true
});
console.log("Enabling resist fingerprinting/val=", {
@@ -139,32 +139,56 @@ function setAllPrivacy() {
setAllPrivacy();
function ResetPeerConnection() {
browser.privacy.network.peerConnectionEnabled.set({
value: false
var webrtc = false;
var rtc = browser.privacy.network.peerConnectionEnabled.set({
value: webrtc
});
browser.privacy.network.networkPredictionEnabled.set({
value: false
});
chrome.privacy.network.webRTCIPHandlingPolicy.set({
value: "disable_non_proxied_udp"
});
console.log("Re-disabled WebRTC");
rtc.then(AssurePeerConnection);
}
function EnablePeerConnection() {
browser.privacy.network.peerConnectionEnabled.set({
value: true
});
browser.privacy.network.networkPredictionEnabled.set({
value: false
});
chrome.privacy.network.webRTCIPHandlingPolicy.set({
value: "disable_non_proxied_udp"
var webrtc = false;
var rtc = browser.privacy.network.peerConnectionEnabled.set({
value: webrtc
});
rtc.then(SetupPeerConnection);
console.log("Enabled WebRTC");
}
ResetPeerConnection();
function SetupPeerConnection() {
var webrtc = true;
console.log("Pre-disabled WebRTC");
rtc = browser.privacy.network.peerConnectionEnabled.set({
value: webrtc
});
rtc.then(AssurePeerConnection);
}
function AssurePeerConnection() {
function assure(webrtc) {
browser.privacy.network.peerConnectionEnabled.set({
value: webrtc.value
});
browser.privacy.network.networkPredictionEnabled.set({
value: false
});
chrome.privacy.network.webRTCIPHandlingPolicy.set({
value: "proxy_only"
});
}
rtc = browser.privacy.network.peerConnectionEnabled.get({});
rtc.then(assure);
}
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({
@@ -196,13 +220,6 @@ function onError(e) {
console.error(e);
}
function checkStoredSettings(storedSettings) {
chrome.storage.local.set(appSettings);
}
const gettingStoredSettings = browser.storage.local.get();
gettingStoredSettings.then(checkStoredSettings, onError);
function clearCookiesContext(cookieStoreId) {}
function forgetBrowsingData(storedSettings) {
@@ -256,28 +273,28 @@ function forgetBrowsingData(storedSettings) {
hostnames: [i2pHostName(item.url)],
since
})
.then(onGot);
.then(onContextGotLog);
console.log("cleared Passwords");
browser.browsingData
.removeDownloads({
hostnames: [i2pHostName(item.url)],
since
})
.then(onGot);
.then(onContextGotLog);
console.log("cleared Downloads");
browser.browsingData
.removeFormData({
hostnames: [i2pHostName(item.url)],
since
})
.then(onGot);
.then(onContextGotLog);
console.log("cleared Form Data");
browser.browsingData
.removeLocalStorage({
hostnames: [i2pHostName(item.url)],
since
})
.then(onGot);
.then(onContextGotLog);
console.log("cleared Local Storage");
contexts = browser.contextualIdentities.query({
@@ -291,7 +308,7 @@ function forgetBrowsingData(storedSettings) {
name: cookie.name,
url: item.url
});
removing.then(onGot, onError);
removing.then(onContextGotLog, onError);
}
console.log("Cleared cookies");
}
@@ -338,7 +355,7 @@ function i2pHost(url) {
return hostname.endsWith(".i2p");
}
function onGot(contexts) {
function onContextGotLog(contexts) {
if (contexts != null) {
for (let context of contexts) {
console.log(context);
@@ -348,13 +365,48 @@ function onGot(contexts) {
browser.runtime.onMessage.addListener(message);
function enableHistory() {
function checkStoredSettings(storedSettings) {
storedSettings["disable_history"] = false;
console.log(storedSettings);
function enablehistory(settings) {
console.log("Store History:", storedSettings);
}
var setting = browser.storage.local.set(storedSettings);
setting.then(enablehistory);
}
const gettingStoredSettings = browser.storage.local.get();
gettingStoredSettings.then(checkStoredSettings, onError);
}
function disableHistory() {
function checkStoredSettings(storedSettings) {
storedSettings["disable_history"] = true;
console.log(storedSettings);
function enablehistory(settings) {
console.log("Store History:", storedSettings);
}
var setting = browser.storage.local.set(storedSettings);
setting.then(enablehistory);
}
const gettingStoredSettings = browser.storage.local.get();
gettingStoredSettings.then(checkStoredSettings, onError);
}
function message(message) {
console.log(message);
if (message.rtc === "enableWebRTC") {
console.log("enableWebRTC");
EnablePeerConnection();
} else {
} else if (message.rtc === "disableWebRTC") {
console.log("disableWebRTC");
ResetPeerConnection();
}
if (message.history === "enableHistory") {
console.log("enableHistory");
enableHistory();
} else if (message.history === "disableHistory") {
console.log("disableHistory");
disableHistory();
}
}

267
proxy.js
View File

@@ -1,3 +1,5 @@
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");
@@ -33,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 = {
@@ -121,15 +127,7 @@ var handleContextProxyRequest = async function(requestDetails) {
context = await browser.contextualIdentities.get(tabInfo.cookieStoreId);
return context;
} catch (error) {
console.log("(proxy)Context Error", error);
}
};
var tabFind = async function(tabId) {
try {
console.log("(proxy) forcing context", tabId.cookieStoreId);
return tabId;
} catch (error) {
console.log("(proxy)Context Error", error);
return "firefox-default";
}
};
var tabGet = async function(tabId) {
@@ -154,9 +152,8 @@ var handleContextProxyRequest = async function(requestDetails) {
} else if (i2pHost(requestDetails.url)) {
console.log("(Proxy)I2P URL detected, ");
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(tabFind);
requestDetails.tabId = mtab;
var context = mtab.then(contextGet);
requestDetails.tabId = tab;
var context = tab.then(contextGet);
var proxy = await context.then(handleProxyRequest);
console.log("(proxy)Returning I2P Proxy", proxy);
return proxy;
@@ -177,6 +174,113 @@ var handleContextProxyRequest = async function(requestDetails) {
};
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 = "4444";
var disable_history = false;
function SetupSettings() {
console.log("Initialising Settings");
//
function checkSchemeStoredSettings(storedSettings) {
if (storedSettings.proxy_scheme != undefined) {
proxy_scheme = storedSettings.proxy_scheme;
} else {
proxy_scheme = "http";
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);
//
function checkHostStoredSettings(storedSettings) {
if (storedSettings.proxy_host != undefined) {
proxy_host = storedSettings.proxy_host;
} else {
proxy_host = "127.0.0.1";
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);
//
function checkPortStoredSettings(storedSettings) {
if (storedSettings.proxy_port != undefined) {
proxy_port = storedSettings.proxy_port;
} else {
proxy_port = "4444";
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);
//
function checkControlHostStoredSettings(storedSettings) {
if (storedSettings.control_host != undefined) {
control_host = storedSettings.control_host;
} else {
control_host = "127.0.0.1";
storedSettings.control_host = control_host;
}
console.log("Initialising Control Host", storedSettings.control_host);
setupProxy();
}
var gettingControlHostStoredSettings = browser.storage.local.get(
"control_host"
);
gettingControlHostStoredSettings.then(
checkControlHostStoredSettings,
onError
);
//
function checkControlPortStoredSettings(storedSettings) {
if (storedSettings.control_port != undefined) {
contro_port = storedSettings.control_port;
} else {
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"
);
gettingControlPortStoredSettings.then(
checkControlPortStoredSettings,
onError
);
//
function checkHistoryStoredSettings(storedSettings) {
if (storedSettings.disable_history != undefined) {
disable_history = storedSettings.disable_history;
} else {
disable_history = false;
storedSettings.disable_history = disable_history;
}
console.log(
"Initialising Disabled History",
storedSettings.disable_history
);
setupProxy();
}
var gettingHistoryStoredSettings = browser.storage.local.get(
"disable_history"
);
gettingHistoryStoredSettings.then(checkHistoryStoredSettings, onError);
}
function getScheme() {
if (proxy_scheme == undefined) {
@@ -195,13 +299,6 @@ function getScheme() {
return proxy_scheme;
}
/*
var proxy_host = "127.0.0.1";
var proxy_port = "4444";
var control_host = "127.0.0.1";
var control_port = "4444";
*/
function getHost() {
if (proxy_host == undefined) {
proxy_host = "127.0.0.1";
@@ -230,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");
@@ -251,107 +348,35 @@ function setupProxy() {
/**/
}
function checkStoredSettings(storedSettings) {
function gotProxyInfo(info) {
let defaultSettings = {};
let host = info.value.http.split(":")[0];
let port = info.value.http.split(":")[1];
console.log("proxy", "'" + host + "'", ":", port);
if (!storedSettings.proxy_scheme) {
defaultSettings["proxy_scheme"] = "http";
}
if (!storedSettings.proxy_host) {
if (host == "") {
defaultSettings["proxy_host"] = "127.0.0.1";
} else {
defaultSettings["proxy_host"] = host;
}
} else {
if (host != "") {
defaultSettings["proxy_host"] = host;
} else {
defaultSettings["proxy_host"] = storedSettings.proxy_host;
}
}
if (!storedSettings.proxy_port) {
if (port == undefined) {
defaultSettings["proxy_port"] = 4444;
} else {
defaultSettings["proxy_port"] = port;
}
} else {
if (port != undefined) {
defaultSettings["proxy_port"] = port;
} else {
defaultSettings["proxy_port"] = storedSettings.proxy_port;
}
}
if (!storedSettings.control_host) {
if (host == "") {
defaultSettings["control_host"] = "127.0.0.1";
} else {
defaultSettings["control_host"] = host;
}
} else {
if (host != "") {
defaultSettings["control_host"] = host;
} else {
defaultSettings["control_host"] = storedSettings.control_host;
}
}
if (!storedSettings.control_port) {
if (port == undefined) {
defaultSettings["control_port"] = 4444;
} else {
defaultSettings["control_port"] = port;
}
} else {
if (port != undefined) {
defaultSettings["control_port"] = port;
} else {
defaultSettings["control_port"] = storedSettings.control_port;
}
}
console.log("(browserinfo) NATIVE PROXYSETTINGS", info.value);
console.log(
defaultSettings["proxy_host"],
defaultSettings["proxy_port"],
defaultSettings["control_host"],
defaultSettings["control_port"]
);
chrome.storage.local.set(defaultSettings);
}
var gettingInfo = browser.proxy.settings.get({});
gettingInfo.then(gotProxyInfo);
}
//function gotProxyInfo(info) {
//console.log("(browserinfo)", info.value);
//}
//var gettingInfo = browser.proxy.settings.get({});
//gettingInfo.then(gotProxyInfo);
function update(restoredSettings) {
proxy_scheme = restoredSettings.proxy_scheme;
function update() {
console.log("restoring proxy scheme:", proxy_scheme);
proxy_host = restoredSettings.proxy_host;
console.log("restoring proxy host:", proxy_host);
proxy_port = restoredSettings.proxy_port;
console.log("restoring proxy port:", proxy_port);
control_host = restoredSettings.control_host;
console.log("restoring control host:", control_host);
control_port = restoredSettings.control_port;
console.log("restoring control port:", control_port);
}
chrome.storage.local.get(function(got) {
checkStoredSettings(got);
update(got);
setupProxy();
});
// Theme all currently open windows
if (!isDroid()) {
browser.windows.getAll().then(wins => wins.forEach(themeWindow));
function updateFromStorage() {
console.log("updating settings from storage");
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
if (got.os != "android") {
browser.windows.getAll().then(wins => wins.forEach(themeWindow));
chrome.storage.local.get(function(got) {
SetupSettings();
update();
setupProxy();
});
} else {
chrome.storage.local.get(function(got) {
SetupSettings();
update();
setupProxy();
});
}
});
}
browser.storage.onChanged.addListener(updateFromStorage);
SetupSettings();
setupProxy();

237
scrub.js
View File

@@ -16,7 +16,7 @@ var contextScrub = async function(requestDetails) {
try {
var headerScrub = function(context) {
if (!context) {
console.error("Context not found");
console.error("Context not found", context);
} else if (context.name == titlepref) {
var ua = "MYOB/6.66 (AN/ON)";
if (i2pHost(requestDetails.url)) {
@@ -52,28 +52,19 @@ var contextScrub = async function(requestDetails) {
context = await browser.contextualIdentities.get(tabInfo.cookieStoreId);
return context;
} catch (error) {
console.log("(scrub)Conext Error", error);
}
};
var tabFind = async function(tabId) {
try {
context = await browser.contextualIdentities.query({
name: titlepref
});
tabId.cookieStoreId = context[0].cookieStoreId;
console.log("(scrub) forcing context", tabId.cookieStoreId);
return tabId;
} 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)Tab error", error);
let tabInfo = await browser.tabs.getCurrent();
return tabInfo;
}
};
if (requestDetails.tabId > 0) {
@@ -81,18 +72,16 @@ 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);
var mtab = tab.then(tabFind);
requestDetails.tabId = mtab;
context = mtab.then(contextGet);
req = await context.then(headerScrub);
context = tab.then(contextGet, onError);
req = await context.then(headerScrub, onError);
console.log("(scrub)Scrubbing I2P Request", req);
return req;
} else if (routerHost(requestDetails.url)) {
tab = tabGet(requestDetails.tabId);
context = tab.then(contextGet);
req = await context.then(headerScrub);
context = tab.then(contextGet, onError);
req = await context.then(headerScrub, onError);
console.log("(scrub)Scrubbing non-I2P Request", req);
return req;
}
@@ -106,38 +95,28 @@ var contextScrub = async function(requestDetails) {
var contextSetup = async function(requestDetails) {
console.log("(isolate)Forcing I2P requests into context");
try {
var tabFind = async function(tabId) {
var i2pTabFind = async function(tabId) {
try {
var context = await browser.contextualIdentities.query({
name: titlepref
});
if (tabId.cookieStoreId != context[0].cookieStoreId) {
console.log(
"(isolate) forcing I2P Browsing",
requestDetails.url,
" context",
tabId.cookieStoreId,
context[0].cookieStoreId
);
function Create(window) {
function onCreated(tab) {
console.log("(isolate) Closing old, un-isolated tab", window);
browser.tabs.remove(tabId.id);
browser.tabs.remove(window.tabs[0].id);
}
function onError(error) {
console.log(`Error: ${error}`);
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
url: requestDetails.url
});
created.then(onCreated, onError);
}
var getting = browser.windows.getCurrent();
getting.then(Create);
var getting = browser.tabs.getCurrent();
getting.then(Create, onError);
return tabId;
}
} catch (error) {
@@ -150,32 +129,22 @@ var contextSetup = async function(requestDetails) {
name: routerpref
});
if (tabId.cookieStoreId != context[0].cookieStoreId) {
console.log(
"(isolate) forcing Router Console",
requestDetails.url,
" context",
tabId.cookieStoreId,
context[0].cookieStoreId
);
function Create(window) {
function onCreated(tab) {
console.log("(isolate) Closing old, un-isolated tab");
browser.tabs.remove(tabId.id);
browser.tabs.remove(window.tabs[0].id);
}
function onError(error) {
console.log(`Error: ${error}`);
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
url: requestDetails.url
});
created.then(onCreated, onError);
}
var getting = browser.windows.getCurrent();
getting.then(Create);
var getting = browser.tabs.getCurrent();
getting.then(Create, onError);
return tabId;
}
} catch (error) {
@@ -188,34 +157,22 @@ var contextSetup = async function(requestDetails) {
name: tunnelpref
});
if (tabId.cookieStoreId != context[0].cookieStoreId) {
console.log(
"(isolate) forcing HSM context",
requestDetails.url,
" context",
tabId.cookieStoreId,
context[0].cookieStoreId
);
function Create(window) {
function onCreated(tab) {
console.log("(isolate) Closing old, un-isolated tab");
browser.tabs.remove(tabId.id);
if (window != undefined) {
browser.tabs.remove(window.tabs[0].id);
if (tabId != undefined) {
console.log("(isolate) Closing old, un-isolated tab");
browser.tabs.remove(tabId.id);
}
}
function onError(error) {
console.log(`Error: ${error}`);
}
var created = browser.tabs.create({
active: true,
cookieStoreId: context[0].cookieStoreId,
url: requestDetails.url,
windowId: window.id
url: requestDetails.url
});
created.then(onCreated, onError);
}
var getting = browser.windows.getCurrent();
getting.then(Create);
var getting = browser.tabs.getCurrent();
getting.then(Create, onError);
return tabId;
}
} catch (error) {
@@ -228,32 +185,22 @@ var contextSetup = async function(requestDetails) {
name: torrentpref
});
if (tabId.cookieStoreId != context[0].cookieStoreId) {
console.log(
"(isolate) forcing Bittorrent",
requestDetails.url,
" context",
tabId.cookieStoreId,
context[0].cookieStoreId
);
function Create(window) {
function onCreated(tab) {
console.log("(isolate) Closing old, un-isolated tab");
browser.tabs.remove(tabId.id);
browser.tabs.remove(window.tabs[0].id);
}
function onError(error) {
console.log(`Error: ${error}`);
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
url: requestDetails.url
});
created.then(onCreated, onError);
}
var getting = browser.windows.getCurrent();
getting.then(Create);
var getting = browser.tabs.getCurrent();
getting.then(Create, onError);
return tabId;
}
} catch (error) {
@@ -266,32 +213,22 @@ var contextSetup = async function(requestDetails) {
name: mailpref
});
if (tabId.cookieStoreId != context[0].cookieStoreId) {
console.log(
"(isolate) forcing Web Mail",
requestDetails.url,
" context",
tabId.cookieStoreId,
context[0].cookieStoreId
);
function Create(window) {
function onCreated(tab) {
console.log("(isolate) Closing old, un-isolated tab");
browser.tabs.remove(tabId.id);
browser.tabs.remove(window.tabs[0].id);
}
function onError(error) {
console.log(`Error: ${error}`);
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
url: requestDetails.url
});
created.then(onCreated, onError);
}
var getting = browser.windows.getCurrent();
getting.then(Create);
var getting = browser.tabs.getCurrent();
getting.then(Create, onError);
return tabId;
}
} catch (error) {
@@ -309,32 +246,22 @@ var contextSetup = async function(requestDetails) {
tabId.cookieStoreId == "firefox-private"
) {
if (tabId.cookieStoreId != context[0].cookieStoreId) {
console.log(
"(isolate) forcing Web Browsing",
requestDetails.url,
" context",
tabId.cookieStoreId,
context[0].cookieStoreId
);
function Create(window) {
function onCreated(tab) {
console.log("(isolate) Closing old, un-isolated tab");
browser.tabs.remove(tabId.id);
browser.tabs.remove(window.tabs[0].id);
}
function onError(error) {
console.log(`Error: ${error}`);
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
url: requestDetails.url
});
created.then(onCreated, onError);
}
var getting = browser.windows.getCurrent();
getting.then(Create);
var getting = browser.tabs.getCurrent();
getting.then(Create, onError);
return tabId;
}
}
@@ -351,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({
@@ -358,7 +288,13 @@ var contextSetup = async function(requestDetails) {
url: requestDetails.url,
secure: true
});
setcookie.then(onGot, onError);
setcookie.then(onContextGotLog, onError);
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 (i2pHost(requestDetails.url)) {
@@ -367,38 +303,45 @@ var contextSetup = async function(requestDetails) {
url: requestDetails.url,
secure: true
});
setcookie.then(onGot, onError);
setcookie.then(onContextGotLog, onError);
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(tabFind);
var mtab = tab.then(i2pTabFind, onError);
return requestDetails;
}
let routerhost = routerHost(requestDetails.url);
if (routerhost) {
if (routerhost === "i2ptunnelmgr") {
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(i2ptunnelTabFind);
var mtab = tab.then(i2ptunnelTabFind, onError);
return requestDetails;
} else if (routerhost === "i2psnark") {
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(snarkTabFind);
var mtab = tab.then(snarkTabFind, onError);
return requestDetails;
} else if (routerhost === "webmail") {
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(mailTabFind);
var mtab = tab.then(mailTabFind, onError);
return requestDetails;
} else if (routerhost === "routerconsole") {
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(routerTabFind);
var mtab = tab.then(routerTabFind, onError);
return requestDetails;
}
} else {
var tab = tabGet(requestDetails.tabId);
var mtab = tab.then(routerTabFind);
var mtab = tab.then(anyTabFind, onError);
return requestDetails;
}
}
//var tab = tabGet(requestDetails.tabId);
//var mtab = tab.then(anyTabFind);
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);
}
}
return requestDetails;
} catch (error) {
console.log("(isolate)Not an I2P request, blackholing", error);
@@ -416,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);
};
}
*/

View File

@@ -39,13 +39,18 @@
<li class="application">
<input type="checkbox" id="enable-web-rtc" name="enablewebrtc" value="webrtc">
<label for="enable-web-rtc">Enable WebRTC <strong>with Proxy?</strong></label>
<span class="applicationDesc">For more information about this extension, go here:</span>
<span class="applicationDesc">WebRTC is disabled by default, but can be enabled by checking this box.</span>
</li>
<li class="application">
<div class="panel-section-separator"></div>
<div class="panel-section-identity">
<div id="identity-list"></div>
</li>
<li class="application">
<input type="checkbox" id="disable-history" name="disablehistory" value="history">
<label for="disable-history">Disable History in I2P Tabs</label>
<span class="applicationDesc">History is automatically cleared when your I2P tabs are closed. If you want to clear history as you go, check this box.</span>
</li>
</ul>
</p>
</p>
@@ -56,16 +61,16 @@
<h3>Applications</h3>
<p id="applicationExplain">These applications use I2P to provide them with security and privacy.</p>
<ul>
<li class="application"><button id="window-visit-homepage" class="applicationName window-visit-homepage" href="#">
<li class="application"><button id="window-visit-homepage" target="_blank" class="applicationName window-visit-homepage" href="#">
Home Page <span class="applicationDesc">For more information about this extension, go here:</span>
</button></li>
<li class="application"><button id="window-visit-i2ptunnel" class="applicationName">
<li class="application"><button id="window-visit-i2ptunnel" target="_blank" class="applicationName">
Hidden Services Manager <span class="applicationDesc">I2P has a web-based interface for configuring .i2p services like web sites, to set up your own web sites, go here:</span>
</button></li>
<li class="application"><button id="window-visit-susimail" class="applicationName">
<li class="application"><button id="window-visit-susimail" target="_blank" class="applicationName">
E-Mail <span class="applicationDesc">I2P also bundles a webmail client which can be used to access in-I2P e-mail. To use it, go here:</span>
</button></li>
<li class="application"><button id="window-visit-snark" class="applicationName">
<li class="application"><button id="window-visit-snark" target="_blank" class="applicationName">
BitTorrent <span class="applicationDesc">I2P is capable of anonymous Peer-to-Peer file sharing, to use the built-in bittorrent client go here:</span>
</button></li>
</ul>