diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3a75765 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +README.md.asc + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index d99722e..940767d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,14 @@ -# i2psetproxy.js -WebExtension that automatically sets up a browser to use the proxy into i2p +i2psetproxy.js +============== + +WebExtension that automatically sets up a browser to use the proxy into i2p. +This extension shouldn't be used on it's own, and the extension it should be +used with aren't quite done yet. In conjunction with a hardened user.js or +installed in a TBB, it's probably pretty safe. It doesn't contain any +fingerprintable resources. + +Features +-------- + + * [done] **Set** the http proxy to use the local i2p proxy + * [done] **Change** the color of the browser window to indicate that i2p is in use diff --git a/background.js b/background.js new file mode 100644 index 0000000..9bf2659 --- /dev/null +++ b/background.js @@ -0,0 +1,35 @@ +browser.windows.onCreated.addListener(themeWindow); + +// Theme all currently open windows +browser.windows.getAll().then(wins => wins.forEach(themeWindow)); + +function themeWindow(window) { + // Check if the window is in private browsing + if (window.incognito) { + browser.theme.update(window.id, { + images: { + headerURL: "", + }, + colors: { + accentcolor: "#A0A0DE", + textcolor: "white", + toolbar: "#A0A0DE", + toolbar_text: "white" + } + }); + } + // Reset to the default theme otherwise + else { + browser.theme.update(window.id, { + images: { + headerURL: "", + }, + colors: { + accentcolor: "#BFA0DE", + textcolor: "white", + toolbar: "#BFA0DE", + toolbar_text: "white" + } + }); + } +} diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..cee63d9 --- /dev/null +++ b/manifest.json @@ -0,0 +1,16 @@ +{ + "manifest_version": 2, + "name": "I2P Proxy", + "version": "2.0", + "description": "Set up a browser to use the i2p http proxy automatically", + "background": { + "scripts": ["background.js", "proxy.js"] + }, + "permissions": ["theme", "proxy"], + "applications": { + "gecko": { + "id": "i2psetproxy.js@eyedeekay.github.io", + "strict_min_version": "60.0" + } + } +} diff --git a/proxy.js b/proxy.js new file mode 100644 index 0000000..eb689b6 --- /dev/null +++ b/proxy.js @@ -0,0 +1,9 @@ + +var proxySettings = { + proxyType: "manual", + http: "http://127.0.0.1:4444" + passthrough: "" + httpProxyAll: true +}; + +browser.proxy.settings.set({value:proxySettings});