17 Commits
1.26 ... 0.31

Author SHA1 Message Date
idk
5b554df40a Merge pull request #7 from eyedeekay/debian
Debian
2019-09-25 01:32:10 -04:00
idk
48068f24fa use the better base image 2019-09-25 00:52:16 -04:00
idk
7dd7a43686 use the better base image 2019-09-25 00:21:16 -04:00
idk
9716fd793d fix some basic lintian stuff, leave some other stuff because later is probably better on these ones 2019-09-24 22:47:10 -04:00
idk
ae6a543df5 fix some basic lintian stuff, leave some other stuff because later is probably better on these ones 2019-09-24 22:44:56 -04:00
idk
608b344c45 build it as a debian package and then test circleci 2019-09-24 22:33:30 -04:00
idk
3bda43a77d Try and get a debian-style package started 2019-08-01 00:39:03 -04:00
idk
6a09985b26 more chromium stuff 2019-06-29 01:47:13 -04:00
idk
769f592973 more chromium stuff 2019-06-29 01:43:16 -04:00
idk
24bde39e49 chromium compatibility 2019-06-29 00:49:59 -04:00
idk
27ba4aee8b chromium compatibility 2019-06-29 00:44:15 -04:00
idk
1b7c8fc520 set up chromium polyfill 2019-06-29 00:32:03 -04:00
idk
8a5883ba65 release prep 2019-06-28 22:50:54 -04:00
idk
c271760715 improve fomatting, add better socks defaults and enforce them 2019-06-27 15:40:43 -04:00
idk
3922f992e7 Socks defaults sanity 2019-06-24 19:20:54 -04:00
idk
d4070b345f add experiments folder 2019-06-19 10:44:17 -04:00
idk
f209af2897 update readme 2019-06-19 10:44:03 -04:00
23 changed files with 1593 additions and 391 deletions

12
.circleci/config.yml Normal file
View File

@@ -0,0 +1,12 @@
version: 2
jobs:
build:
docker:
- image: eyedeekay/builders
steps:
- checkout
- run:
name: Build
command: make zip

View File

@@ -1,31 +1,33 @@
PREFIX:=/usr
default: zip
install: uninstall
mkdir -p /usr/share/webext/i2psetproxy.js@eyedeekay.github.io \
/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/
cp -rv options /usr/share/webext/i2psetproxy.js@eyedeekay.github.io/options
cp -rv icons /usr/share/webext/i2psetproxy.js@eyedeekay.github.io/icons
cp -rv _locales /usr/share/webext/i2psetproxy.js@eyedeekay.github.io/_locales
cp background.js /usr/share/webext/i2psetproxy.js@eyedeekay.github.io
cp proxy.js /usr/share/webext/i2psetproxy.js@eyedeekay.github.io
cp info.js /usr/share/webext/i2psetproxy.js@eyedeekay.github.io
cp content.js /usr/share/webext/i2psetproxy.js@eyedeekay.github.io
cp info.css /usr/share/webext/i2psetproxy.js@eyedeekay.github.io
cp window.html /usr/share/webext/i2psetproxy.js@eyedeekay.github.io
cp manifest.json /usr/share/webext/i2psetproxy.js@eyedeekay.github.io/
cp README.md /usr/share/webext/i2psetproxy.js@eyedeekay.github.io
cp LICENSE /usr/share/webext/i2psetproxy.js@eyedeekay.github.io
ln -sf /usr/share/webext/i2psetproxy.js@eyedeekay.github.io \
/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/i2psetproxy.js@eyedeekay.github.io
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
uninstall:
rm -rf /usr/share/webext/i2psetproxy.js@eyedeekay.github.io \
/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/i2psetproxy.js@eyedeekay.github.io
rm -rf $(PREFIX)/share/webext/i2psetproxy.js@eyedeekay.github.io \
$(PREFIX)/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/i2psetproxy.js@eyedeekay.github.io
clobber:
rm -f ../i2psetproxy.js.zip ../i2p_proxy*.xpi
VERSION=1.26
VERSION=1.27
xpi:
mv ~/Downloads/i2p_proxy-$(VERSION)-an+fx.xpi ../i2psetproxy.js@eyedeekay.github.io.xpi
@@ -45,7 +47,7 @@ profile-install:
cp ./i2psetproxy.js@eyedeekay.github.io.xpi $(HOME)/.mozilla/firefox/.firefox.profile.i2p.default/extensions
to-profile:
cp ./i2psetproxy.js@eyedeekay.github.io.xpi /usr/local/lib/firefox.profile.i2p/firefox.profile.i2p/extensions/
cp ./i2psetproxy.js@eyedeekay.github.io.xpi $(PREFIX)/local/lib/firefox.profile.i2p/firefox.profile.i2p/extensions/
pi: profile-install
@@ -56,3 +58,19 @@ release:
upload:
gothub upload -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js@eyedeekay.github.io.xpi" -f "../i2psetproxy.js@eyedeekay.github.io.xpi"
lib: libpolyfill
libpolyfill:
wget -O chromium/browser-polyfill.min.js https://unpkg.com/webextension-polyfill/dist/browser-polyfill.min.js
fmt:
find . -name '*.js' -exec jsfmt -w {} \;
deborig:
rm -rfv ../i2psetproxy.js-$(VERSION)
cp -rv . ../i2psetproxy.js-$(VERSION)
tar --exclude='./.git' -cvzf ../i2psetproxy.js-$(VERSION).tar.gz .
deb: deborig
cd ../i2psetproxy.js-$(VERSION) && debuild -us -uc -rfakeroot

View File

@@ -1,68 +1,42 @@
i2psetproxy.js
==============
WebExtension that does extended configuration of a dedicated i2p browser. It's
still not good enough to use on it's own, and should be combined with the Tor
Browser or the I2P Firefox Profile for now.
WebExtension that does extended configuration of a dedicated I2P browser. While
**experimental**, it's capable of enforcing the use of the I2P Proxy without
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.
Features
--------
Android usage:
--------------
* [done] **Indicate** the i2p browser is in use visually
* [done] **Set** the http proxy to use the local i2p proxy
Open the following link [Github Releases Version](https://github.com/eyedeekay/i2psetproxy.js/releases/download/1.26/i2psetproxy.js@eyedeekay.github.io.xpi)
in the browser you want to use for I2P. Firefox will warn you that it is about
to install an extension and indicate the permissions required. Read them over
and when you're ready, accept them. That's all it should take, your browser is
now configured to use I2P.
### addons.mozilla.org
If you would prefer to recieve automatic updates from AMO, the correct product
page for this plugin is [I2P-proxy](https://addons.mozilla.org/en-US/firefox/addon/I2P-proxy/).
This absolutely requires a working outproxy. If you want to avoid the use of AMO
for updates, you can download the identical plugin from this repository's
releases page. The latest AMO Plugin will always be identical to the latest
github release, except for the version number, which must be incremented for
submission to AMO.
### Features
* [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
* [done] **Change** the color of the browser window to indicate that i2p is in use
* [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.
Usage with standalone HTTP Proxy
--------------------------------
This functionality is currently disabled.
I developed a simple HTTP proxy that can be used with this extension to enable the
user to initiate a re-start of the HTTP proxy tunnel, with a new set of keys and a
new destination. This, combined with re-setting the browser settings back to the
original defaults(which is also done by the HTTP Proxy when re-initiated), amounts
to a "Fresh Identity" feature for the I2P browser.
Before you begin, get the [Standalone HTTP proxy from here](http://github.com/eyedeekay/httptunnel)
and run it like so:
httpproxy -littleboss=start
You can also use 'go get'
go get -u github.com/eyedeekay/httptunnel/httpproxy
If you change the default host and port, you will need to alter the following guide.
In order to use it with the custom HTTP proxy, open the "Add-On's" menu and select
the options for the i2psetproxy.js plugin. Change the "Proxy" configuration from
Host: 127.0.0.1
Port: 4444
to
Host: 127.0.0.1
Port: 7950
and change the "Control" configuration from:
Host: 127.0.0.1
Port: 4444
to
Host: 127.0.0.1
Port: 7951
Now, when you press the Toopie button in the toolbar, you will see in the output
of the HTTP proxy that it has been re-started.
Screenshot
----------
### Screenshot
![Visiting i2p-projekt.i2p](i2psetproxy.js.png)

View File

@@ -1,73 +1,83 @@
function getChrome() {
if (browser.runtime.getBrowserInfo == undefined) {
return true
}
return false
}
function isDroid() {
if (!getChrome()) {
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then((got) => {
if (got.os == "android") {
console.log("android detected")
return true
}else{
console.log("desktop detected")
return false
}
if (got.os == "android") {
console.log("android detected")
return true
} else {
console.log("desktop detected")
return false
}
});
}
return false
}
if (!isDroid()) {
chrome.windows.onCreated.addListener(themeWindow);
chrome.windows.onCreated.addListener(themeWindow);
}
var titlepref = chrome.i18n.getMessage("titlePreface");
var titleprefpriv = chrome.i18n.getMessage("titlePrefacePrivate");
function themeWindow(window) {
// Check if the window is in private browsing
if (window.incognito) {
chrome.theme.update(window.id, {
colors: {
frame: "#2D4470",
toolbar: "#2D4470",
}
});
chrome.windows.update(window.id, {
titlePreface: titleprefpriv
});
}
else {
chrome.theme.update(window.id, {
colors: {
frame: "#9DABD5",
toolbar: "#9DABD5",
}
});
chrome.windows.update(window.id, {
titlePreface: titlepref
});
}
// Check if the window is in private browsing
if (window.incognito) {
chrome.theme.update(window.id, {
colors: {
frame: "#2D4470",
toolbar: "#2D4470",
}
});
chrome.windows.update(window.id, {
titlePreface: titleprefpriv
});
} else {
chrome.theme.update(window.id, {
colors: {
frame: "#9DABD5",
toolbar: "#9DABD5",
}
});
chrome.windows.update(window.id, {
titlePreface: titlepref
});
}
}
function setTitle(window){
if (window.incognito) {
chrome.windows.update(window.id, {
titlePreface: titleprefpriv
});
}
else {
chrome.windows.update(window.id, {
titlePreface: titlepref
});
}
function setTitle(window) {
if (window.incognito) {
chrome.windows.update(window.id, {
titlePreface: titleprefpriv
});
} else {
chrome.windows.update(window.id, {
titlePreface: titlepref
});
}
}
function setTitleError(window){
alert("plugin error setting title on", window.id)
function setTitleError(window) {
alert("plugin error setting title on", window.id)
}
chrome.windows.onCreated.addListener(() => {
const gettingStoredSettings = chrome.storage.local.get();
gettingStoredSettings.then(setupProxy, onError);
const gettingStoredSettings = chrome.storage.local.get();
gettingStoredSettings.then(setupProxy, onError);
});
chrome.tabs.onCreated.addListener(() => {
const getting = browser.windows.getCurrent({populate: true});
getting.then(setTitle, setTitleError);
const getting = browser.windows.getCurrent({
populate: true
});
getting.then(setTitle, setTitleError);
});

903
chromium/browser-polyfill.min.js vendored Normal file
View File

@@ -0,0 +1,903 @@
(function(a, b) {
if ("function" == typeof define && define.amd) {
define("webextension-polyfill", ["module"], b);
} else if ("undefined" != typeof exports) {
b(module);
} else {
var c = {
exports: {}
};
b(c), a.browser = c.exports
}
})(this, function(a) {
"use strict";
if ("undefined" == typeof browser || Object.getPrototypeOf(browser) !== Object.prototype) {
a.exports = (e => {
const f = {
alarms: {
clear: {
minArgs: 0,
maxArgs: 1
},
clearAll: {
minArgs: 0,
maxArgs: 0
},
get: {
minArgs: 0,
maxArgs: 1
},
getAll: {
minArgs: 0,
maxArgs: 0
}
},
bookmarks: {
create: {
minArgs: 1,
maxArgs: 1
},
get: {
minArgs: 1,
maxArgs: 1
},
getChildren: {
minArgs: 1,
maxArgs: 1
},
getRecent: {
minArgs: 1,
maxArgs: 1
},
getSubTree: {
minArgs: 1,
maxArgs: 1
},
getTree: {
minArgs: 0,
maxArgs: 0
},
move: {
minArgs: 2,
maxArgs: 2
},
remove: {
minArgs: 1,
maxArgs: 1
},
removeTree: {
minArgs: 1,
maxArgs: 1
},
search: {
minArgs: 1,
maxArgs: 1
},
update: {
minArgs: 2,
maxArgs: 2
}
},
browserAction: {
disable: {
minArgs: 0,
maxArgs: 1,
fallbackToNoCallback: !0
},
enable: {
minArgs: 0,
maxArgs: 1,
fallbackToNoCallback: !0
},
getBadgeBackgroundColor: {
minArgs: 1,
maxArgs: 1
},
getBadgeText: {
minArgs: 1,
maxArgs: 1
},
getPopup: {
minArgs: 1,
maxArgs: 1
},
getTitle: {
minArgs: 1,
maxArgs: 1
},
openPopup: {
minArgs: 0,
maxArgs: 0
},
setBadgeBackgroundColor: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
},
setBadgeText: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
},
setIcon: {
minArgs: 1,
maxArgs: 1
},
setPopup: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
},
setTitle: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
}
},
browsingData: {
remove: {
minArgs: 2,
maxArgs: 2
},
removeCache: {
minArgs: 1,
maxArgs: 1
},
removeCookies: {
minArgs: 1,
maxArgs: 1
},
removeDownloads: {
minArgs: 1,
maxArgs: 1
},
removeFormData: {
minArgs: 1,
maxArgs: 1
},
removeHistory: {
minArgs: 1,
maxArgs: 1
},
removeLocalStorage: {
minArgs: 1,
maxArgs: 1
},
removePasswords: {
minArgs: 1,
maxArgs: 1
},
removePluginData: {
minArgs: 1,
maxArgs: 1
},
settings: {
minArgs: 0,
maxArgs: 0
}
},
commands: {
getAll: {
minArgs: 0,
maxArgs: 0
}
},
contextMenus: {
remove: {
minArgs: 1,
maxArgs: 1
},
removeAll: {
minArgs: 0,
maxArgs: 0
},
update: {
minArgs: 2,
maxArgs: 2
}
},
cookies: {
get: {
minArgs: 1,
maxArgs: 1
},
getAll: {
minArgs: 1,
maxArgs: 1
},
getAllCookieStores: {
minArgs: 0,
maxArgs: 0
},
remove: {
minArgs: 1,
maxArgs: 1
},
set: {
minArgs: 1,
maxArgs: 1
}
},
devtools: {
inspectedWindow: {
eval: {
minArgs: 1,
maxArgs: 2,
singleCallbackArg: !1
}
},
panels: {
create: {
minArgs: 3,
maxArgs: 3,
singleCallbackArg: !0
}
}
},
downloads: {
cancel: {
minArgs: 1,
maxArgs: 1
},
download: {
minArgs: 1,
maxArgs: 1
},
erase: {
minArgs: 1,
maxArgs: 1
},
getFileIcon: {
minArgs: 1,
maxArgs: 2
},
open: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
},
pause: {
minArgs: 1,
maxArgs: 1
},
removeFile: {
minArgs: 1,
maxArgs: 1
},
resume: {
minArgs: 1,
maxArgs: 1
},
search: {
minArgs: 1,
maxArgs: 1
},
show: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
}
},
extension: {
isAllowedFileSchemeAccess: {
minArgs: 0,
maxArgs: 0
},
isAllowedIncognitoAccess: {
minArgs: 0,
maxArgs: 0
}
},
history: {
addUrl: {
minArgs: 1,
maxArgs: 1
},
deleteAll: {
minArgs: 0,
maxArgs: 0
},
deleteRange: {
minArgs: 1,
maxArgs: 1
},
deleteUrl: {
minArgs: 1,
maxArgs: 1
},
getVisits: {
minArgs: 1,
maxArgs: 1
},
search: {
minArgs: 1,
maxArgs: 1
}
},
i18n: {
detectLanguage: {
minArgs: 1,
maxArgs: 1
},
getAcceptLanguages: {
minArgs: 0,
maxArgs: 0
}
},
identity: {
launchWebAuthFlow: {
minArgs: 1,
maxArgs: 1
}
},
idle: {
queryState: {
minArgs: 1,
maxArgs: 1
}
},
management: {
get: {
minArgs: 1,
maxArgs: 1
},
getAll: {
minArgs: 0,
maxArgs: 0
},
getSelf: {
minArgs: 0,
maxArgs: 0
},
setEnabled: {
minArgs: 2,
maxArgs: 2
},
uninstallSelf: {
minArgs: 0,
maxArgs: 1
}
},
notifications: {
clear: {
minArgs: 1,
maxArgs: 1
},
create: {
minArgs: 1,
maxArgs: 2
},
getAll: {
minArgs: 0,
maxArgs: 0
},
getPermissionLevel: {
minArgs: 0,
maxArgs: 0
},
update: {
minArgs: 2,
maxArgs: 2
}
},
pageAction: {
getPopup: {
minArgs: 1,
maxArgs: 1
},
getTitle: {
minArgs: 1,
maxArgs: 1
},
hide: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
},
setIcon: {
minArgs: 1,
maxArgs: 1
},
setPopup: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
},
setTitle: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
},
show: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
}
},
permissions: {
contains: {
minArgs: 1,
maxArgs: 1
},
getAll: {
minArgs: 0,
maxArgs: 0
},
remove: {
minArgs: 1,
maxArgs: 1
},
request: {
minArgs: 1,
maxArgs: 1
}
},
runtime: {
getBackgroundPage: {
minArgs: 0,
maxArgs: 0
},
getBrowserInfo: {
minArgs: 0,
maxArgs: 0
},
getPlatformInfo: {
minArgs: 0,
maxArgs: 0
},
openOptionsPage: {
minArgs: 0,
maxArgs: 0
},
requestUpdateCheck: {
minArgs: 0,
maxArgs: 0
},
sendMessage: {
minArgs: 1,
maxArgs: 3
},
sendNativeMessage: {
minArgs: 2,
maxArgs: 2
},
setUninstallURL: {
minArgs: 1,
maxArgs: 1
}
},
sessions: {
getDevices: {
minArgs: 0,
maxArgs: 1
},
getRecentlyClosed: {
minArgs: 0,
maxArgs: 1
},
restore: {
minArgs: 0,
maxArgs: 1
}
},
storage: {
local: {
clear: {
minArgs: 0,
maxArgs: 0
},
get: {
minArgs: 0,
maxArgs: 1
},
getBytesInUse: {
minArgs: 0,
maxArgs: 1
},
remove: {
minArgs: 1,
maxArgs: 1
},
set: {
minArgs: 1,
maxArgs: 1
}
},
managed: {
get: {
minArgs: 0,
maxArgs: 1
},
getBytesInUse: {
minArgs: 0,
maxArgs: 1
}
},
sync: {
clear: {
minArgs: 0,
maxArgs: 0
},
get: {
minArgs: 0,
maxArgs: 1
},
getBytesInUse: {
minArgs: 0,
maxArgs: 1
},
remove: {
minArgs: 1,
maxArgs: 1
},
set: {
minArgs: 1,
maxArgs: 1
}
}
},
tabs: {
captureVisibleTab: {
minArgs: 0,
maxArgs: 2
},
create: {
minArgs: 1,
maxArgs: 1
},
detectLanguage: {
minArgs: 0,
maxArgs: 1
},
discard: {
minArgs: 0,
maxArgs: 1
},
duplicate: {
minArgs: 1,
maxArgs: 1
},
executeScript: {
minArgs: 1,
maxArgs: 2
},
get: {
minArgs: 1,
maxArgs: 1
},
getCurrent: {
minArgs: 0,
maxArgs: 0
},
getZoom: {
minArgs: 0,
maxArgs: 1
},
getZoomSettings: {
minArgs: 0,
maxArgs: 1
},
highlight: {
minArgs: 1,
maxArgs: 1
},
insertCSS: {
minArgs: 1,
maxArgs: 2
},
move: {
minArgs: 2,
maxArgs: 2
},
query: {
minArgs: 1,
maxArgs: 1
},
reload: {
minArgs: 0,
maxArgs: 2
},
remove: {
minArgs: 1,
maxArgs: 1
},
removeCSS: {
minArgs: 1,
maxArgs: 2
},
sendMessage: {
minArgs: 2,
maxArgs: 3
},
setZoom: {
minArgs: 1,
maxArgs: 2
},
setZoomSettings: {
minArgs: 1,
maxArgs: 2
},
update: {
minArgs: 1,
maxArgs: 2
}
},
topSites: {
get: {
minArgs: 0,
maxArgs: 0
}
},
webNavigation: {
getAllFrames: {
minArgs: 1,
maxArgs: 1
},
getFrame: {
minArgs: 1,
maxArgs: 1
}
},
webRequest: {
handlerBehaviorChanged: {
minArgs: 0,
maxArgs: 0
}
},
windows: {
create: {
minArgs: 0,
maxArgs: 1
},
get: {
minArgs: 1,
maxArgs: 2
},
getAll: {
minArgs: 0,
maxArgs: 1
},
getCurrent: {
minArgs: 0,
maxArgs: 1
},
getLastFocused: {
minArgs: 0,
maxArgs: 1
},
remove: {
minArgs: 1,
maxArgs: 1
},
update: {
minArgs: 2,
maxArgs: 2
}
}
};
if (0 === Object.keys(f).length) {
throw new Error("api-metadata.json has not been included in browser-polyfill");
}
class g extends WeakMap {
constructor(v, w = void 0) {
super(w), this.createItem = v
}
get(v) {
return this.has(v) || this.set(v, this.createItem(v)), super.get(v)
}
}
const h = v => {
return v && "object" == typeof v && "function" == typeof v.then
};
const i = (v, w) => {
return (...x) => {
e.runtime.lastError ? v.reject(e.runtime.lastError) : w.singleCallbackArg || 1 >= x.length && !1 !== w.singleCallbackArg ? v.resolve(x[0]) : v.resolve(x)
}
};
const j = v => 1 == v ? "argument" : "arguments";
const k = (v, w) => {
return function(y, ...z) {
if (z.length < w.minArgs) {
throw new Error(`Expected at least ${w.minArgs} ${j(w.minArgs)} for ${v}(), got ${z.length}`);
}
if (z.length > w.maxArgs) {
throw new Error(`Expected at most ${w.maxArgs} ${j(w.maxArgs)} for ${v}(), got ${z.length}`);
}
return new Promise((A, B) => {
if (w.fallbackToNoCallback) {
try {
y[v](...z, i({
resolve: A,
reject: B
}, w))
} catch ( C ) {
console.warn(`${v} API method doesn't seem to support the callback parameter, ` + "falling back to call it without a callback: ", C), y[v](...z), w.fallbackToNoCallback = !1, w.noCallback = !0, A()
}
} else {
w.noCallback ? (y[v](...z), A()) : y[v](...z, i({
resolve: A,
reject: B
}, w))
}
})
}
};
const l = (v, w, x) => {
return new Proxy(w, {
apply(y, z, A) {
return x.call(z, v, ...A)
}
})
};
let m = Function.call.bind(Object.prototype.hasOwnProperty);
const n = (v, w = {}, x = {}) => {
let y = Object.create(null);
let z = {
has(B, C) {
return C in v || C in y
},
get(B, C) {
if (C in y) {
return y[C];
}
if (C in v) {
let E = v[C];
if ("function" == typeof E) {
if ("function" == typeof w[C]) {
E = l(v, v[C], w[C]);
} else if (m(x, C)) {
let F = k(C, x[C]);
E = l(v, v[C], F)
} else {
E = E.bind(v);
}
} else if ("object" == typeof E && null !== E && (m(w, C) || m(x, C))) {
E = n(E, w[C], x[C]);
} else {
return Object.defineProperty(y, C, {
configurable: !0,
enumerable: !0,
get() {
return v[C]
},
set(F) {
v[C] = F
}
}), E;
}
return y[C] = E, E
}
},
set(B, C, D) {
return C in y ? y[C] = D : v[C] = D, !0
},
defineProperty(B, C, D) {
return Reflect.defineProperty(y, C, D)
},
deleteProperty(B, C) {
return Reflect.deleteProperty(y, C)
}
};
let A = Object.create(v);
return new Proxy(A, z)
};
const o = v => ({
addListener(w, x, ...y) {
w.addListener(v.get(x), ...y)
},
hasListener(w, x) {
return w.hasListener(v.get(x))
},
removeListener(w, x) {
w.removeListener(v.get(x))
}
});
let p = !1;
const q = new g(v => {
return "function" == typeof v ? function(x, y, z) {
let B;
let D;
let A = !1;
let C = new Promise(G => {
B = function(H) {
p || (console.warn("Returning a Promise is the preferred way to send a reply from an onMessage/onMessageExternal listener, as the sendResponse will be removed from the specs (See https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessage)", new Error().stack), p = !0), A = !0, G(H)
}
});
try {
D = v(x, y, B)
} catch ( G ) {
D = Promise.reject(G)
}
const E = !0 !== D && h(D);
if (!0 !== D && !E && !A) {
return !1;
}
const F = G => {
G.then(H => {
z(H)
}, H => {
let I;
I = H && (H instanceof Error || "string" == typeof H.message) ? H.message : "An unexpected error occurred", z({
__mozWebExtensionPolyfillReject__: !0,
message: I
})
}).catch(H => {
console.error("Failed to send onMessage rejected reply", H)
})
};
return E ? F(D) : F(C), !0
} : v
});
const r = ({reject:v, resolve:w} ,x) => {
e.runtime.lastError ? e.runtime.lastError.message === "The message port closed before a response was received." ? w() : v(e.runtime.lastError) : x && x.__mozWebExtensionPolyfillReject__ ? v(new Error(x.message)) : w(x)
};
const s = (v, w, x, ...y) => {
if (y.length < w.minArgs) {
throw new Error(`Expected at least ${w.minArgs} ${j(w.minArgs)} for ${v}(), got ${y.length}`);
}
if (y.length > w.maxArgs) {
throw new Error(`Expected at most ${w.maxArgs} ${j(w.maxArgs)} for ${v}(), got ${y.length}`);
}
return new Promise((z, A) => {
const B = r.bind(null, {
resolve: z,
reject: A
});
y.push(B), x.sendMessage(...y)
})
};
const t = {
runtime: {
onMessage: o(q),
onMessageExternal: o(q),
sendMessage: s.bind(null, "sendMessage", {
minArgs: 1,
maxArgs: 3
})
},
tabs: {
sendMessage: s.bind(null, "sendMessage", {
minArgs: 2,
maxArgs: 3
})
}
};
const u = {
clear: {
minArgs: 1,
maxArgs: 1
},
get: {
minArgs: 1,
maxArgs: 1
},
set: {
minArgs: 1,
maxArgs: 1
}
};
return f.privacy = {
network: {
networkPredictionEnabled: u,
webRTCIPHandlingPolicy: u
},
services: {
passwordSavingEnabled: u
},
websites: {
hyperlinkAuditingEnabled: u,
referrersEnabled: u
}
}, n(e, t, f)
})(chrome)
} else {
a.exports = browser
}
});
//# sourceMappingURL=browser-polyfill.min.js.map
// webextension-polyfill v.0.4.0 (https://github.com/mozilla/webextension-polyfill)
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

View File

@@ -13,5 +13,5 @@ helpMessage.textContent = chrome.i18n.getMessage("helpMessage")
var newsMessage = document.getElementById('window-create-news-panel');
newsMessage.textContent = chrome.i18n.getMessage("newsMessage");
var clearData = documents.getElementByID("clear-browser-data")
cleardata.textContent = chrome.i18n.getMessage("clearData");
var clearData = document.getElementById("clear-browser-data")
clearData.textContent = chrome.i18n.getMessage("clearData");

8
debian/README.Debian vendored Normal file
View File

@@ -0,0 +1,8 @@
i2psetproxy.js for Debian
Please edit this to provide information specific to
this i2psetproxy.js Debian package.
(Automatically generated by debmake Version 4.3.1)
-- idk <hankhill19580@gmail.com> Thu, 01 Aug 2019 00:32:39 -0400

6
debian/changelog vendored Normal file
View File

@@ -0,0 +1,6 @@
i2psetproxy.js (1.27-1) UNRELEASED; urgency=low
* Initial release. Closes: #nnnn
<nnnn is the bug number of your ITP>
-- idk <hankhill19580@gmail.com> Thu, 01 Aug 2019 00:32:39 -0400

1
debian/compat vendored Normal file
View File

@@ -0,0 +1 @@
11

17
debian/control vendored Normal file
View File

@@ -0,0 +1,17 @@
Source: i2psetproxy.js
Section: unknown
Priority: optional
Maintainer: idk <hankhill19580@gmail.com>
Build-Depends: debhelper (>=11~)
Standards-Version: 4.1.4
Homepage: https://github.com/eyedeekay/i2psetproxy.js
Package: i2psetproxy.js
Architecture: any
Multi-Arch: foreign
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: Plugin for configuring i2p in Firefox and Chromium
This is a webextension which safely configures a Browser on the
Debian operating system to use I2P. i2psetproxy.js users form
their own anonymity set, like TAILS users or Brave users do on
the Tor network.

66
debian/copyright vendored Normal file
View File

@@ -0,0 +1,66 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: i2psetproxy.js
Source: https://github.com/eyedeekay/i2psetproxy.js
#
# Please double check copyright with the licensecheck(1) command.
Files: .gitignore
Makefile
README.md
_locales/en/messages.json
background.js
content.js
experiments/i2ptab.md
experiments/tunblink.md
i2psetproxy.js.png
i2psetproxy.js@eyedeekay.github.io.xpi
icons/toopie.png
info.css
info.js
manifest.json
options/options.css
options/options.js
privacy.js
proxy.js
Copyright: MIT
License: MIT
Files: chromium/browser-polyfill.min.js
Copyright: __NO_COPYRIGHT__ in: chromium/browser-polyfill.min.js
License: MPL-2.0
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
#----------------------------------------------------------------------------
# xml and html files (skipped):
# window.html
# options/options.html
#----------------------------------------------------------------------------
# Files marked as NO_LICENSE_TEXT_FOUND may be covered by the following
# license/copyright files.
#----------------------------------------------------------------------------
# License file: LICENSE
MIT License
.
Copyright (c) 2019 idk
.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

1
debian/patches/series vendored Normal file
View File

@@ -0,0 +1 @@
# You must remove unused comment lines for the released package.

22
debian/rules vendored Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/make -f
%:
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
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

1
debian/source/format vendored Normal file
View File

@@ -0,0 +1 @@
3.0 (quilt)

2
debian/source/local-options vendored Normal file
View File

@@ -0,0 +1,2 @@
#abort-on-upstream-changes
#unapply-patches

1
debian/watch vendored Normal file
View File

@@ -0,0 +1 @@
version=3

3
experiments/i2ptab.md Normal file
View File

@@ -0,0 +1,3 @@
Private Browsing with I2P Tab
=============================

45
experiments/tunblink.md Normal file
View File

@@ -0,0 +1,45 @@
Usage with standalone HTTP Proxy
--------------------------------
This functionality is currently disabled.
I developed a simple HTTP proxy that can be used with this extension to enable the
user to initiate a re-start of the HTTP proxy tunnel, with a new set of keys and a
new destination. This, combined with re-setting the browser settings back to the
original defaults(which is also done by the HTTP Proxy when re-initiated), amounts
to a "Fresh Identity" feature for the I2P browser.
Before you begin, get the [Standalone HTTP proxy from here](http://github.com/eyedeekay/httptunnel)
and run it like so:
httpproxy -littleboss=start
You can also use 'go get'
go get -u github.com/eyedeekay/httptunnel/httpproxy
If you change the default host and port, you will need to alter the following guide.
In order to use it with the custom HTTP proxy, open the "Add-On's" menu and select
the options for the i2psetproxy.js plugin. Change the "Proxy" configuration from
Host: 127.0.0.1
Port: 4444
to
Host: 127.0.0.1
Port: 7950
and change the "Control" configuration from:
Host: 127.0.0.1
Port: 4444
to
Host: 127.0.0.1
Port: 7951
Now, when you press the Toopie button in the toolbar, you will see in the output
of the HTTP proxy that it has been re-started.

22
info.js
View File

@@ -22,15 +22,15 @@ document.addEventListener("click", (e) => {
console.log("The news panel has been created");
});
} else if (e.target.id === "generate-fresh-tunnel") {
function RefreshIdentity(){
console.log("Generating new identity")
const Http = new XMLHttpRequest();
const url='http://' + controlHost + ":" + controlPort
Http.open("GET", url);
Http.send();
Http.onreadystatechange=(e)=>{
console.log(Http.responseText)
}
function RefreshIdentity() {
console.log("Generating new identity")
const Http = new XMLHttpRequest();
const url = 'http://' + controlHost + ":" + controlPort
Http.open("GET", url);
Http.send();
Http.onreadystatechange = (e) => {
console.log(Http.responseText)
}
}
RefreshIdentity();
} else if (e.target.id === "window-preface-title") {
@@ -40,8 +40,8 @@ document.addEventListener("click", (e) => {
}
chrome.windows.update(currentWindow.id, updateInfo);
});
}else if (e.target.id === "clear-browser-data") {
forgetBrowsingData()
} else if (e.target.id === "clear-browser-data") {
forgetBrowsingData()
}
e.preventDefault();

View File

@@ -18,7 +18,7 @@
],
"manifest_version": 2,
"name": "__MSG_extensionName__",
"version": "1.26",
"version": "1.27",
"description": "__MSG_extensionDescription__",
"homepage_url": "https://github.com/eyedeekay/i2psetproxy.js",
"icons": {
@@ -34,7 +34,7 @@
"page": "options/options.html"
},
"background": {
"scripts": ["background.js", "proxy.js", "info.js", "privacy.js" ]
"scripts": ["chromium/browser-polyfill.min.js", "background.js", "proxy.js", "info.js", "privacy.js" ]
},
"default_locale": "en"
}

View File

@@ -1,185 +1,210 @@
function isDroid() {
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then((got) => {
if (got.os == "android") {
return true
}else{
return false
}
});
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");
function SetHostText() {
var hostid = document.getElementById('hostText');
hostid.textContent = chrome.i18n.getMessage("hostText");
}
function SetPortText(){
var portid = document.getElementById('portText');
portid.textContent = chrome.i18n.getMessage("portText");
function SetPortText() {
var portid = document.getElementById('portText');
portid.textContent = chrome.i18n.getMessage("portText");
}
function SetControlHostText(){
var controlhostid = document.getElementById('controlHostText');
controlhostid.textContent = chrome.i18n.getMessage("controlHostText");
function SetControlHostText() {
var controlhostid = document.getElementById('controlHostText');
controlhostid.textContent = chrome.i18n.getMessage("controlHostText");
}
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()
if (!getChrome()) {
function handleProxyRequest(requestInfo) {
console.log("proxying request via listener")
console.log(" ", Scheme, Host, ":", Port,)
return {type: Scheme, host: Host, port: Port, proxyDns: true}
console.log("proxying request via listener")
console.log(" ", Scheme, Host, ":", Port,)
return {
type: Scheme,
host: Host,
port: Port,
proxyDns: true
}
}
console.log("Setting up Firefox WebExtension proxy")
browser.proxy.onRequest.addListener(handleProxyRequest, {urls: ["<all_urls>"]});
browser.proxy.onRequest.addListener(handleProxyRequest, {
urls: ["<all_urls>"]
});
console.log("i2p settings created for WebExtension Proxy")
} else {
var config = {
mode: "fixed_servers",
rules: {
singleProxy: {
scheme: Scheme,
host: Host,
port: parseInt(Port),
},
}
};
chrome.proxy.settings.set(
{
value: config,
scope: 'regular'
}, function() {});
}
}
function SetControlPortText(){
var controlportid = document.getElementById('controlPortText');
controlportid.textContent = chrome.i18n.getMessage("controlPortText");
function SetControlPortText() {
var controlportid = document.getElementById('controlPortText');
controlportid.textContent = chrome.i18n.getMessage("controlPortText");
}
function SetControlHelpText(){
var portid = document.getElementById('controlHelpText');
portid.textContent = chrome.i18n.getMessage("controlHelpText");
function SetControlHelpText() {
var portid = document.getElementById('controlHelpText');
portid.textContent = chrome.i18n.getMessage("controlHelpText");
}
function getScheme() {
const proxy_scheme = document.querySelector("#proxy_scheme");
console.log("Got i2p proxy scheme:", proxy_scheme.value);
if (proxy_scheme == "HTTP") {
return "http"
}
if (proxy_scheme == "SOCKS") {
return "socks"
}
return proxy_scheme.value;
const proxy_scheme = document.querySelector("#proxy_scheme");
console.log("Got i2p proxy scheme:", proxy_scheme.value);
if (proxy_scheme == "HTTP") {
return "http"
}
if (proxy_scheme == "SOCKS") {
return "socks"
}
return proxy_scheme.value;
}
function getHost() {
proxy_host = document.getElementById("host").value
console.log("Got i2p proxy host:", proxy_host);
if (proxy_host == undefined) {
return "127.0.0.1"
}
return proxy_host;
proxy_host = document.getElementById("host").value
console.log("Got i2p proxy host:", proxy_host);
if (proxy_host == undefined) {
return "127.0.0.1"
}
return proxy_host;
}
function getPort() {
proxy_port = document.getElementById("port").value
console.log("Got i2p proxy port:", proxy_port);
if (proxy_port == undefined) {
return "4444"
}
return proxy_port;
proxy_port = document.getElementById("port").value
console.log("Got i2p proxy port:", proxy_port);
if (proxy_port == undefined) {
return "4444"
}
return proxy_port;
}
function getControlHost() {
control_host = document.getElementById("controlhost").value
console.log("Got i2p control host:", control_host);
if (control_host == undefined) {
return "127.0.0.1"
}
return control_host;
control_host = document.getElementById("controlhost").value
console.log("Got i2p control host:", control_host);
if (control_host == undefined) {
return "127.0.0.1"
}
return control_host;
}
function getControlPort() {
control_port = document.getElementById("controlport").value
console.log("Got i2p control port:", control_port);
if (control_port == undefined) {
return "4444"
}
return control_port;
control_port = document.getElementById("controlport").value
console.log("Got i2p control port:", control_port);
if (control_port == undefined) {
return "4444"
}
return control_port;
}
function checkStoredSettings(storedSettings) {
let defaultSettings = {};
if (!storedSettings.proxy_scheme){
defaultSettings["proxy_scheme"] = "http"
}
if (!storedSettings.proxy_host) {
defaultSettings["proxy_host"] = "127.0.0.1"
}
if (!storedSettings.proxy_port) {
defaultSettings["proxy_port"] = 4444
}
if (!storedSettings.control_host) {
defaultSettings["control_host"] = "127.0.0.1"
}
if (!storedSettings.control_port) {
defaultSettings["control_port"] = 4444
}
chrome.storage.local.set(defaultSettings);
let defaultSettings = {};
if (!storedSettings.proxy_scheme) {
defaultSettings["proxy_scheme"] = "http"
}
if (!storedSettings.proxy_host) {
defaultSettings["proxy_host"] = "127.0.0.1"
}
if (!storedSettings.proxy_port) {
defaultSettings["proxy_port"] = 4444
}
if (!storedSettings.control_host) {
defaultSettings["control_host"] = "127.0.0.1"
}
if (!storedSettings.control_port) {
defaultSettings["control_port"] = 4444
}
chrome.storage.local.set(defaultSettings);
}
function onError(e) {
console.error(e);
console.error(e);
}
function storeSettings() {
let proxy_scheme = getScheme()
let proxy_host = getHost()
let proxy_port = getPort()
let control_host = getControlHost()
let control_port = getControlPort()
chrome.storage.local.set({
proxy_scheme,
proxy_host,
proxy_port,
control_host,
control_port,
});
console.log("storing proxy scheme:", proxy_scheme)
console.log("storing proxy host:", proxy_host)
console.log("storing proxy port:", proxy_port)
console.log("storing control host:", control_host)
console.log("storing control port:", control_port)
setupProxy()
let proxy_scheme = getScheme()
let proxy_host = getHost()
let proxy_port = getPort()
let control_host = getControlHost()
let control_port = getControlPort()
chrome.storage.local.set({
proxy_scheme,
proxy_host,
proxy_port,
control_host,
control_port,
});
console.log("storing proxy scheme:", proxy_scheme)
console.log("storing proxy host:", proxy_host)
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) {
const selectList = document.querySelector("#proxy_scheme")
selectList.value = restoredSettings.proxy_scheme
console.log("showing proxy scheme:", selectList.value)
const selectList = document.querySelector("#proxy_scheme")
selectList.value = restoredSettings.proxy_scheme
console.log("showing proxy scheme:", selectList.value)
const hostitem = document.getElementById("host")
hostitem.value = restoredSettings.proxy_host
console.log("showing proxy host:", hostitem.value)
const hostitem = document.getElementById("host")
hostitem.value = restoredSettings.proxy_host
console.log("showing proxy host:", hostitem.value)
const portitem = document.getElementById("port")
portitem.value = restoredSettings.proxy_port
console.log("showing proxy port:", portitem.value)
const portitem = document.getElementById("port")
portitem.value = restoredSettings.proxy_port
console.log("showing proxy port:", portitem.value)
const controlhostitem = document.getElementById("controlhost")
controlhostitem.value = restoredSettings.control_host
console.log("showing control host:", controlhostitem.value)
const controlhostitem = document.getElementById("controlhost")
controlhostitem.value = restoredSettings.control_host
console.log("showing control host:", controlhostitem.value)
const controlportitem = document.getElementById("controlport")
controlportitem.value = restoredSettings.control_port
console.log("showing control port:", controlportitem.value)
const controlportitem = document.getElementById("controlport")
controlportitem.value = restoredSettings.control_port
console.log("showing control port:", controlportitem.value)
SetHostText()
SetPortText()
SetControlHostText()
SetControlPortText()
SetControlHelpText()
setupProxy()
SetHostText()
SetPortText()
SetControlHostText()
SetControlPortText()
SetControlHelpText()
setupProxy()
}
function onError(e) {
console.error(e);
console.error(e);
}
chrome.storage.local.get(function(got){
checkStoredSettings(got)
updateUI(got)
chrome.storage.local.get(function(got) {
checkStoredSettings(got)
updateUI(got)
});
const saveButton = document.querySelector("#save-button");

View File

@@ -1,4 +1,11 @@
function getChrome() {
if (chrome.runtime.getBrowserInfo == undefined) {
return true
}
return false
}
function onSet(result) {
if (result) {
console.log("->: Value was updated");
@@ -10,40 +17,46 @@ function onSet(result) {
// This disables queries to centralized databases of bad URLs to screen for
// risky sites in your browser
function disableHyperlinkAuditing() {
var setting = browser.privacy.websites.hyperlinkAuditingEnabled.set({
value: false
});
console.log("Disabling hyperlink auditing/val=", {
value: false
})
setting.then(onSet);
if (!getChrome()){
var setting = browser.privacy.websites.hyperlinkAuditingEnabled.set({
value: false
});
console.log("Disabling hyperlink auditing/val=", {
value: false
})
setting.then(onSet);
}
}
// This enables first-party isolation
function enableFirstPartyIsolation() {
var setting = browser.privacy.websites.firstPartyIsolate.set({
value: true
});
console.log("Enabling first party isolation/val=", {
value: true
})
setting.then(onSet);
if (!getChrome()) {
var setting = browser.privacy.websites.firstPartyIsolate.set({
value: true
});
console.log("Enabling first party isolation/val=", {
value: true
})
setting.then(onSet);
}
}
// This rejects tracking cookies and third-party cookies but it
// LEAVES "Persistent" Cookies unmodified in favor of an option in the content
// interface for now
function disableEvilCookies() {
var getting = browser.privacy.websites.cookieConfig.get({});
getting.then((got) => {
var setting = browser.privacy.websites.cookieConfig.set(
{value: {behavior: "reject_third_party",
nonPersistentCookies: got.value.nonPersistentCookies}}
);
console.log("Setting cookie behavior/val=", {value: {behavior: "reject_third_party",
nonPersistentCookies: got.value.nonPersistentCookies}})
setting.then(onSet);
});
if (!getChrome()) {
var getting = browser.privacy.websites.cookieConfig.get({});
getting.then((got) => {
var setting = browser.privacy.websites.cookieConfig.set(
{value: {behavior: "reject_third_party",
nonPersistentCookies: got.value.nonPersistentCookies}}
);
console.log("Setting cookie behavior/val=", {value: {behavior: "reject_third_party",
nonPersistentCookies: got.value.nonPersistentCookies}})
setting.then(onSet);
});
}
}
// Make sure that they're gone
@@ -59,6 +72,7 @@ function disableEvilCookies() {
// this disables the use of referrer headers
function disableReferrers() {
if (!getChrome()){
var setting = browser.privacy.websites.referrersEnabled.set({
value: false
});
@@ -66,10 +80,12 @@ function disableReferrers() {
value: false
})
setting.then(onSet);
}
}
// enable fingerprinting resistent features(letterboxing and stuff)
function enableResistFingerprinting() {
if (!getChrome()){
var setting = browser.privacy.websites.referrersEnabled.set({
value: true
});
@@ -77,22 +93,26 @@ function enableResistFingerprinting() {
value: true
})
setting.then(onSet);
}
}
// This is essentially a blocklist of clearnet web-sites known to do bad tracking
function enableTrackingProtection() {
var setting = browser.privacy.websites.trackingProtectionMode.set({
value: "always"
});
console.log("Enabling tracking protection/val=", {
value: "always"
})
setting.then(onSet);
if (!getChrome()) {
var setting = browser.privacy.websites.trackingProtectionMode.set({
value: "always"
});
console.log("Enabling tracking protection/val=", {
value: "always"
})
setting.then(onSet);
}
}
// This disables protected content, which is a form of digital restrictions
// management dependent on identifying information
function disableDigitalRestrictionsManagement() {
if (!getChrome()){
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then((got) => {
if (got.os == "win") {
@@ -105,6 +125,7 @@ function disableDigitalRestrictionsManagement() {
setting.then(onSet);
}
});
}
}
function setAllPrivacy() {
@@ -120,16 +141,20 @@ function setAllPrivacy() {
setAllPrivacy()
function ResetPeerConnection(){
browser.privacy.network.peerConnectionEnabled.set({value: false});
browser.privacy.network.networkPredictionEnabled.set({value: false});
browser.privacy.network.webRTCIPHandlingPolicy.set({value: "disable_non_proxied_udp"});
if (!getChrome()) {
browser.privacy.network.peerConnectionEnabled.set({value: false});
browser.privacy.network.networkPredictionEnabled.set({value: false});
}
chrome.privacy.network.webRTCIPHandlingPolicy.set({value: "disable_non_proxied_udp"});
console.log("Re-disabled WebRTC")
}
function EnablePeerConnection(){
browser.privacy.network.peerConnectionEnabled.set({value: true});
browser.privacy.network.networkPredictionEnabled.set({value: false});
browser.privacy.network.webRTCIPHandlingPolicy.set({value: "disable_non_proxied_udp"});
if (!getChrome()) {
browser.privacy.network.peerConnectionEnabled.set({value: true});
browser.privacy.network.networkPredictionEnabled.set({value: false});
}
chrome.privacy.network.webRTCIPHandlingPolicy.set({value: "disable_non_proxied_udp"});
console.log("Enabled WebRTC")
}
@@ -163,11 +188,13 @@ function onError(e) {
}
function checkStoredSettings(storedSettings) {
browser.storage.local.set(appSettings);
chrome.storage.local.set(appSettings);
}
const gettingStoredSettings = browser.storage.local.get();
gettingStoredSettings.then(checkStoredSettings, onError);
if (!getChrome()){
const gettingStoredSettings = browser.storage.local.get();
gettingStoredSettings.then(checkStoredSettings, onError);
}
function forgetBrowsingData(storedSettings) {
@@ -211,4 +238,5 @@ function forgetBrowsingData(storedSettings) {
setAllPrivacy()
ResetPeerConnection()
}

231
proxy.js
View File

@@ -1,19 +1,39 @@
function isDroid() {
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then((got) => {
if (got.os == "android") {
return true
}else{
return false
}
});
function getChrome() {
if (browser.runtime.getBrowserInfo == undefined) {
return true
}
return false
}
browser.privacy.network.peerConnectionEnabled.set({value: false});
function isDroid() {
if (!getChrome()) {
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then((got) => {
if (got.os == "android") {
console.log("android detected")
return true
} else {
console.log("desktop detected")
return false
}
});
}
return false
}
chrome.privacy.network.networkPredictionEnabled.set({value: false});
chrome.privacy.network.webRTCIPHandlingPolicy.set({value: "disable_non_proxied_udp"});
if (!getChrome()) {
browser.privacy.network.peerConnectionEnabled.set({
value: false
});
}
chrome.privacy.network.networkPredictionEnabled.set({
value: false
});
chrome.privacy.network.webRTCIPHandlingPolicy.set({
value: "disable_non_proxied_udp"
});
console.log("Preliminarily disabled WebRTC.")
@@ -22,123 +42,162 @@ function shouldProxyRequest(requestInfo) {
}
function handleProxyRequest(requestInfo) {
console.log(`Proxying: ${requestInfo.url}`);
console.log(" ", getScheme(), getHost(), ":", getPort(),)
return {type: getScheme(), host: getHost(), port: getPort()};
console.log(`Proxying: ${requestInfo.url}`);
console.log(" ", getScheme(), getHost(), ":", getPort(),)
return {
type: getScheme(),
host: getHost(),
port: getPort()
};
}
var proxy_scheme = "HTTP"
function getScheme() {
if (proxy_scheme == undefined) {
proxy_scheme = "http"
}
if (proxy_scheme == "HTTP") {
proxy_scheme = "http"
}
if (proxy_scheme == "SOCKS") {
proxy_scheme = "socks"
}
console.log("Got i2p proxy scheme:", proxy_scheme);
return proxy_scheme;
if (proxy_scheme == undefined) {
proxy_scheme = "http"
}
if (proxy_scheme == "HTTP") {
proxy_scheme = "http"
}
if (proxy_scheme == "SOCKS") {
proxy_scheme = "socks"
}
if (proxy_scheme != "http" && proxy_scheme != "socks") {
proxy_scheme = "http"
}
console.log("Got i2p proxy scheme:", proxy_scheme);
return proxy_scheme;
}
var proxy_host = "127.0.0.1"
function getHost() {
if (proxy_host == undefined){
proxy_host = "127.0.0.1"
}
console.log("Got i2p proxy host:", proxy_host);
return proxy_host;
if (proxy_host == undefined) {
proxy_host = "127.0.0.1"
}
console.log("Got i2p proxy host:", proxy_host);
return proxy_host;
}
var proxy_port = "4444"
function getPort() {
if (proxy_port == undefined){
proxy_port = "4444"
if (proxy_port == undefined) {
var scheme = getScheme()
if (scheme == "socks") {
proxy_port = "4446"
} else {
proxy_port = "4444"
}
console.log("Got i2p proxy port:", proxy_port);
return proxy_port;
}
console.log("Got i2p proxy port:", proxy_port);
return proxy_port;
}
var control_host = "127.0.0.1"
function getControlHost() {
if (control_host == undefined){
return "127.0.0.1"
}
console.log("Got i2p control host:", control_host);
return control_host;
if (control_host == undefined) {
return "127.0.0.1"
}
console.log("Got i2p control host:", control_host);
return control_host;
}
var control_port = "4444"
function getControlPort() {
if (control_port == undefined){
return "4444"
}
console.log("Got i2p control port:", control_port);
return control_port;
if (control_port == undefined) {
return "4444"
}
console.log("Got i2p control port:", control_port);
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()
if (!getChrome()) {
function handleProxyRequest(requestInfo) {
console.log("proxying request via listener")
console.log(" ", Scheme, Host, ":", Port,)
return {type: Scheme, host: Host, port: Port, proxyDns: true}
console.log("proxying request via listener")
console.log(" ", Scheme, Host, ":", Port,)
return {
type: Scheme,
host: Host,
port: Port,
proxyDns: true
}
}
console.log("Setting up Firefox WebExtension proxy")
browser.proxy.onRequest.addListener(handleProxyRequest, {urls: ["<all_urls>"]});
browser.proxy.onRequest.addListener(handleProxyRequest, {
urls: ["<all_urls>"]
});
console.log("i2p settings created for WebExtension Proxy")
} else {
var config = {
mode: "fixed_servers",
rules: {
singleProxy: {
scheme: Scheme,
host: Host,
port: parseInt(Port),
},
}
};
chrome.proxy.settings.set(
{
value: config,
scope: 'regular'
}, function() {});
}
}
function checkStoredSettings(storedSettings) {
let defaultSettings = {};
if (!storedSettings.proxy_scheme){
defaultSettings["proxy_scheme"] = "http"
}
if (!storedSettings.proxy_host) {
defaultSettings["proxy_host"] = "127.0.0.1"
}
if (!storedSettings.proxy_port) {
defaultSettings["proxy_port"] = 4444
}
if (!storedSettings.control_host) {
defaultSettings["control_host"] = "127.0.0.1"
}
if (!storedSettings.control_port) {
defaultSettings["control_port"] = 4444
}
chrome.storage.local.set(defaultSettings);
let defaultSettings = {};
if (!storedSettings.proxy_scheme) {
defaultSettings["proxy_scheme"] = "http"
}
if (!storedSettings.proxy_host) {
defaultSettings["proxy_host"] = "127.0.0.1"
}
if (!storedSettings.proxy_port) {
defaultSettings["proxy_port"] = 4444
}
if (!storedSettings.control_host) {
defaultSettings["control_host"] = "127.0.0.1"
}
if (!storedSettings.control_port) {
defaultSettings["control_port"] = 4444
}
chrome.storage.local.set(defaultSettings);
}
function update(restoredSettings) {
proxy_scheme = restoredSettings.proxy_scheme
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)
proxy_scheme = restoredSettings.proxy_scheme
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()
chrome.storage.local.get(function(got) {
checkStoredSettings(got)
update(got)
setupProxy()
});
// Theme all currently open windows
if (!isDroid()) {
if (!getChrome()) {
if (!isDroid()) {
browser.windows.getAll().then(wins => wins.forEach(themeWindow));
}
}