diff --git a/Makefile b/Makefile index e69de29..69ec99b 100644 --- a/Makefile +++ b/Makefile @@ -0,0 +1,22 @@ + +install: + mkdir -p /usr/share/webext/i2psetproxy.js \ + /usr/share/mozilla/extensions/i2psetproxy.js/ \ + /usr/share/chromium/extensions/ + install background.js /usr/share/webext/i2psetproxy.js + install proxy.js /usr/share/webext/i2psetproxy.js + install manifest.json /usr/share/webext/i2psetproxy.js/ + install README.md /usr/share/webext/i2psetproxy.js + install LICENSE /usr/share/webext/i2psetproxy.js + ln -sf /usr/share/webext/i2psetproxy.js \ + /usr/share/chromium/extensions/i2psetproxy.js + ln -sf /usr/share/webext/i2psetproxy.js \ + /usr/share/mozilla/extensions/i2psetproxy.js/i2psetproxy.js + +uninstall: + rm -rf /usr/share/webext/i2psetproxy.js \ + /usr/share/mozilla/extensions/i2psetproxy.js/i2psetproxy.js \ + /usr/share/chromium/extensions/i2psetproxy.js + +zip: + zip -r -FS ../i2psetproxy.js.zip * diff --git a/README.md b/README.md index 940767d..2919202 100644 --- a/README.md +++ b/README.md @@ -10,5 +10,5 @@ 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 + * [Firefox] **Set** the http proxy to use the local i2p proxy + * [Firefox] **Change** the color of the browser window to indicate that i2p is in use diff --git a/i2p_proxy-2.0-an+fx.xpi b/i2p_proxy-2.0-an+fx.xpi new file mode 100644 index 0000000..c90ebb8 Binary files /dev/null and b/i2p_proxy-2.0-an+fx.xpi differ diff --git a/manifest.json b/manifest.json index cee63d9..e082362 100644 --- a/manifest.json +++ b/manifest.json @@ -1,16 +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" } + }, + "permissions": ["theme", "proxy"], + "manifest_version": 2, + "name": "I2P Proxy", + "version": "1.0", + "description": "Set up a browser to use the i2p http proxy automatically", + "background": { + "scripts": ["background.js", "proxy.js"] } } diff --git a/proxy.js b/proxy.js index 6e4a938..102ca2f 100644 --- a/proxy.js +++ b/proxy.js @@ -1,9 +1,50 @@ +function isFirefox() { + testPlain = navigator.userAgent.indexOf('Firefox') !== -1; + if (testPlain) { + return testPlain + } + testTorBrowser = navigator.userAgent.indexOf('Tor') !== -1; + if (testTorBrowser) { + return testTorBrowser + } + return false +} -var proxySettings = { - proxyType: "manual", - http: "http://127.0.0.1:4444", - passthrough: "", - httpProxyAll: true -}; - -browser.proxy.settings.set({value:proxySettings}); +if (isFirefox()) { + var proxySettings = { + proxyType: "manual", + http: "http://127.0.0.1:4444", + passthrough: "", + httpProxyAll: true + }; + browser.proxy.settings.set({value:proxySettings}); +}else{ + var config = { + mode: "fixed_servers", + rules: { + proxyForHttp: { + scheme: "http", + host: "127.0.0.1", + port: 4444 + }, + proxyForFtp: { + scheme: "http", + host: "127.0.0.1", + port: 4444 + }, + proxyForHttps: { + scheme: "http", + host: "127.0.0.1", + port: 4444 + }, + fallbackProxy: { + scheme: "http", + host: "127.0.0.1", + port: 4444 + } + } + }; + chrome.proxy.settings.set( + {value: config, scope: 'regular'}, + function() {}); +}