major update

This commit is contained in:
idk
2019-05-02 17:31:04 -04:00
parent f26732903a
commit 26efc5f97e
12 changed files with 466 additions and 148 deletions

View File

@@ -1,3 +1,4 @@
default: zip
install: uninstall
mkdir -p /usr/share/webext/i2psetproxy.js@eyedeekay.github.io \
@@ -24,7 +25,7 @@ uninstall:
clobber:
rm -f ../i2psetproxy.js.zip ../i2p_proxy*.xpi
VERSION=1.21
VERSION=1.23
xpi:
mv ~/Downloads/i2p_proxy-$(VERSION)-an+fx.xpi ../i2psetproxy.js@eyedeekay.github.io.xpi

View File

@@ -8,7 +8,7 @@ Browser or the I2P Firefox Profile for now.
Features
--------
* [done] **Indicate** the i2p browser is in use verbally and symbolically.
* [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

View File

@@ -32,7 +32,15 @@
"description": "Help Message"
},
"newsMessage": {
"message": "Visit the I2P News to learn the latest about i2p.",
"message": "Visit the I2P Blog to learn the latest about i2p.",
"description": "Help Message"
},
"forumMessage": {
"message": "Visit the I2P Forum to learn more or ask for assistance",
"description": "Help Message"
},
"clearData": {
"message": "Clear all browsing data",
"description": "Help Message"
},
"hostText": {

View File

@@ -1,3 +1,180 @@
function FindProxyForURL(url, host) {
return "PROXY 127.0.0.1:7950";
/*******************************************************
** Proxy Auto Configure Script with I2P Host Detection.
**
** Author: Cervantes
** License: Public Domain
** Date: 11 May 2004
**
** Revised: 07 Sep 2004
** Changes:
** Proxy recursion disabled by default (strict)
** Password Authentication for session commands
** Support for http://path?i2paddresshelper=BASE64
** Support for http://i2p/BASE64/path syntax
** Revised: 17 May 2004
** Changes:
** Ability for the user to control the proxy
** status on a per browser-session basis.
********************************************************/
/* C O N F I G U R A T I O N
*/
/* Replace normal with "PROXY yourproxy:port" if you run
** behind a Proxy Server by default.
*/
var normal = "DIRECT";
/* Specify the I2P proxy connection details here.
*/
var i2pProxy = "PROXY 127.0.0.1:7950";
/* Set the default status of proxy detection here:
**
**
** [1] "auto" => Proxy will be used automatically if
** '-> an ".i2p" url is detected.
** '-> You will only be anonymous for ".i2p" domains.
**
** [2] "on" => Proxy is enabled all the time. (safest)
** '-> NB. Normal web available only via
** '-> i2p outproxies.
** '-> You can be fairly confident of anonymity.
**
** [3] "off" => Completely Bypass the proxy and therefore i2p.
** '-> no i2p sites will be accessible...
** '-> ...your browsing habits can potentially
** '-> be traced back to you!
**
*/
var proxyStatus = "on";
/* By setting statusKeyword to "all" you can set these options at runtime
** for the duration of the browser session by entering special commands
** into your browser address bar.
**
** Due to limitations in the way proxy scripting works, a malicious site
** could change your status mode by linking to command keywords...
** eg. <img src="i2p.off" ...
** This is why the default setting for statusKeyword is "limited", which only
** allows you to set the proxy status to "on". See also keywordAuthPassword.
**
** [1] "all" => All proxy status urls are available.
** '-> i2p.on, i2p.off, i2p.auto (respective to proxyStatus settings)
** '-> WARNING: Setting "all" is a big risk to your anonymity!
** '-> In this mode it is highly recommended you set an AuthPassword too!
**
** [2] "limited" => Only i2p.on is available..
** '-> This setting lasts for the duration of the browser setting.
** '-> You have to close your browser in order to revert to
** '-> your default proxyStatus configuration.
**
** [3] "off" => No command urls available.
** '-> The status mode can only be altered by editing the above
** '-> proxyStatus setting. (safest)
**
*/
var statusKeyword = "on";
/*
** By default if proxyStatus is set to "auto" the config script
** will fall back to your normal connection settings if the
** i2p proxy is offline. This is handy for browsing your locally
** hosted eepsites when your router is not running (for instance).
** However this can mean that requests to external eepsites could
** be forwarded to the outweb and potentially compromise some of
** your rights to anonymity.
** Setting "true" here enables strict mode where all requests to ".i2p"
** sites will be rejected if the i2p proxy is offline. (safest)
*/
var strict = true;
/*
** By setting an authentication password, all activated session keywords
** will require the addition of a password to prevent malicious sites from
** hijacking your proxy settings. ie. <img src="i2p.off" ...
** Users should append whatever they set here to any command keywords
** they use.
** eg. i2p.on.passw0rd
** If left blank, authentication is ignored - it is recommended that
** you use "limited" statusKeyword mode if you choose not to require a password.
** If you do require this feature then you should replace the default "passw0rd" with
** one of your own (recommend at least 8 letters with a case-sensitive alpha-numeric
** mix of characters).
**
*/
var keywordAuthPassword = "passw0rd";
/* E N D C O N F I G U R A T I O N
*/
/* Allows the proxy to fallback on "normal" settings
** '-> if the i2p router is offline.
*/
if (strict == false) {
i2pProxy = i2pProxy + "; " + normal;
}
/*Check for User Authentication Password.
*/
if (keywordAuthPassword != "") {
keywordAuthPassword = "." + keywordAuthPassword;
}
/* This function gets called every time a url is submitted
*/
function FindProxyForURL(url, host) {
/* checks for a special command url that
** '-> changes the status of the proxy script.
*/
if (statusKeyword != "off") {
if (host == "i2p.off" + keywordAuthPassword && statusKeyword == "all") {
/*Proxy is bypassed - outweb available only
*/
proxyStatus = "off";
} else if (host == "i2p.auto" + keywordAuthPassword && statusKeyword == "all") {
/* Proxy is used only for .i2p hosts otherwise
** '-> browse as normal.
*/
proxyStatus = "auto";
} else if (host == "i2p.on" + keywordAuthPassword && (statusKeyword == "limited" ||
statusKeyword == "all" )) {
/* Only I2P traffic is accepted.
*/
proxyStatus = "on";
}
}
if (proxyStatus == "off") {
/* Proxy is completely bypassed.
*/
return normal;
} else if (proxyStatus == "on") {
/* All requests are forward to the proxy.
*/
return i2pProxy;
}
host = host.toLowerCase();
/* check tld for "i2p" or oOo's new "i2paddresshelper" syntax - if found then redirect
** '-> request to the i2p proxy
*/
if (url.match(/^http:\/\/i2p\/[a-zA-Z0-9\-\~]{516}|i2paddresshelper=/i) ||
shExpMatch(host, "*.i2p")) { // seems more reliable than:
return i2pProxy; // dnsDomainIs(host, ".i2p") ||
} else { // i2pRegex.test(host)
return normal;
}
}

View File

@@ -1,3 +1,180 @@
function FindProxyForURL(url, host) {
return "PROXY 127.0.0.1:4444";
/*******************************************************
** Proxy Auto Configure Script with I2P Host Detection.
**
** Author: Cervantes
** License: Public Domain
** Date: 11 May 2004
**
** Revised: 07 Sep 2004
** Changes:
** Proxy recursion disabled by default (strict)
** Password Authentication for session commands
** Support for http://path?i2paddresshelper=BASE64
** Support for http://i2p/BASE64/path syntax
** Revised: 17 May 2004
** Changes:
** Ability for the user to control the proxy
** status on a per browser-session basis.
********************************************************/
/* C O N F I G U R A T I O N
*/
/* Replace normal with "PROXY yourproxy:port" if you run
** behind a Proxy Server by default.
*/
var normal = "DIRECT";
/* Specify the I2P proxy connection details here.
*/
var i2pProxy = "PROXY 127.0.0.1:4444";
/* Set the default status of proxy detection here:
**
**
** [1] "auto" => Proxy will be used automatically if
** '-> an ".i2p" url is detected.
** '-> You will only be anonymous for ".i2p" domains.
**
** [2] "on" => Proxy is enabled all the time. (safest)
** '-> NB. Normal web available only via
** '-> i2p outproxies.
** '-> You can be fairly confident of anonymity.
**
** [3] "off" => Completely Bypass the proxy and therefore i2p.
** '-> no i2p sites will be accessible...
** '-> ...your browsing habits can potentially
** '-> be traced back to you!
**
*/
var proxyStatus = "on";
/* By setting statusKeyword to "all" you can set these options at runtime
** for the duration of the browser session by entering special commands
** into your browser address bar.
**
** Due to limitations in the way proxy scripting works, a malicious site
** could change your status mode by linking to command keywords...
** eg. <img src="i2p.off" ...
** This is why the default setting for statusKeyword is "limited", which only
** allows you to set the proxy status to "on". See also keywordAuthPassword.
**
** [1] "all" => All proxy status urls are available.
** '-> i2p.on, i2p.off, i2p.auto (respective to proxyStatus settings)
** '-> WARNING: Setting "all" is a big risk to your anonymity!
** '-> In this mode it is highly recommended you set an AuthPassword too!
**
** [2] "limited" => Only i2p.on is available..
** '-> This setting lasts for the duration of the browser setting.
** '-> You have to close your browser in order to revert to
** '-> your default proxyStatus configuration.
**
** [3] "off" => No command urls available.
** '-> The status mode can only be altered by editing the above
** '-> proxyStatus setting. (safest)
**
*/
var statusKeyword = "off";
/*
** By default if proxyStatus is set to "auto" the config script
** will fall back to your normal connection settings if the
** i2p proxy is offline. This is handy for browsing your locally
** hosted eepsites when your router is not running (for instance).
** However this can mean that requests to external eepsites could
** be forwarded to the outweb and potentially compromise some of
** your rights to anonymity.
** Setting "true" here enables strict mode where all requests to ".i2p"
** sites will be rejected if the i2p proxy is offline. (safest)
*/
var strict = true;
/*
** By setting an authentication password, all activated session keywords
** will require the addition of a password to prevent malicious sites from
** hijacking your proxy settings. ie. <img src="i2p.off" ...
** Users should append whatever they set here to any command keywords
** they use.
** eg. i2p.on.passw0rd
** If left blank, authentication is ignored - it is recommended that
** you use "limited" statusKeyword mode if you choose not to require a password.
** If you do require this feature then you should replace the default "passw0rd" with
** one of your own (recommend at least 8 letters with a case-sensitive alpha-numeric
** mix of characters).
**
*/
var keywordAuthPassword = "passw0rd";
/* E N D C O N F I G U R A T I O N
*/
/* Allows the proxy to fallback on "normal" settings
** '-> if the i2p router is offline.
*/
if (strict == false) {
i2pProxy = i2pProxy + "; " + normal;
}
/*Check for User Authentication Password.
*/
if (keywordAuthPassword != "") {
keywordAuthPassword = "." + keywordAuthPassword;
}
/* This function gets called every time a url is submitted
*/
function FindProxyForURL(url, host) {
/* checks for a special command url that
** '-> changes the status of the proxy script.
*/
if (statusKeyword != "off") {
if (host == "i2p.off" + keywordAuthPassword && statusKeyword == "all") {
/*Proxy is bypassed - outweb available only
*/
proxyStatus = "off";
} else if (host == "i2p.auto" + keywordAuthPassword && statusKeyword == "all") {
/* Proxy is used only for .i2p hosts otherwise
** '-> browse as normal.
*/
proxyStatus = "auto";
} else if (host == "i2p.on" + keywordAuthPassword && (statusKeyword == "limited" ||
statusKeyword == "all" )) {
/* Only I2P traffic is accepted.
*/
proxyStatus = "on";
}
}
if (proxyStatus == "off") {
/* Proxy is completely bypassed.
*/
return normal;
} else if (proxyStatus == "on") {
/* All requests are forward to the proxy.
*/
return i2pProxy;
}
host = host.toLowerCase();
/* check tld for "i2p" or oOo's new "i2paddresshelper" syntax - if found then redirect
** '-> request to the i2p proxy
*/
if (url.match(/^http:\/\/i2p\/[a-zA-Z0-9\-\~]{516}|i2paddresshelper=/i) ||
shExpMatch(host, "*.i2p")) { // seems more reliable than:
return i2pProxy; // dnsDomainIs(host, ".i2p") ||
} else { // i2pRegex.test(host)
return normal;
}
}

View File

@@ -7,14 +7,9 @@ function themeWindow(window) {
// Check if the window is in private browsing
if (window.incognito) {
chrome.theme.update(window.id, {
images: {
theme_frame: "icons/toopie.png",
},
colors: {
frame: "#A0A0DE",
textcolor: "white",
toolbar: "#A0A0DE",
toolbar_text: "white"
}
});
chrome.windows.update(window.id, {
@@ -23,14 +18,9 @@ function themeWindow(window) {
}
else {
chrome.theme.update(window.id, {
images: {
theme_frame: "icons/toopie.png",
},
colors: {
frame: "#BFA0DE",
textcolor: "white",
toolbar: "#BFA0DE",
toolbar_text: "white"
}
});
chrome.windows.update(window.id, {
@@ -62,6 +52,6 @@ chrome.windows.onCreated.addListener(() => {
});
chrome.tabs.onCreated.addListener(() => {
const getting = chrome.windows.getCurrent({populate: true});
const getting = browser.windows.getCurrent({populate: true});
getting.then(setTitle, setTitleError);
});

View File

@@ -1,11 +1,17 @@
var infoTitle = document.getElementById('text-section-header');
infoTitle.textContent = chrome.i18n.getMessage("infoTitle");
var infoTitle = document.getElementById('text-section-header');
infoTitle.textContent = chrome.i18n.getMessage("infoTitle");
var infoMessage = document.getElementById('text-section-helptext');
infoMessage.textContent = chrome.i18n.getMessage("infoMessage");
var infoMessage = document.getElementById('text-section-helptext');
infoMessage.textContent = chrome.i18n.getMessage("infoMessage");
var helpMessage = document.getElementById('window-create-help-panel');
helpMessage.textContent = chrome.i18n.getMessage("helpMessage");
var helpMessage = document.getElementById('window-create-forum-panel');
helpMessage.textContent = chrome.i18n.getMessage("forumMessage");
/*
var helpMessage = document.getElementById('window-create-help-panel');
helpMessage.textContent = chrome.i18n.getMessage("helpMessage")
*/
var newsMessage = document.getElementById('window-create-news-panel');
newsMessage.textContent = chrome.i18n.getMessage("newsMessage");
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");

View File

@@ -40,6 +40,8 @@ document.addEventListener("click", (e) => {
}
chrome.windows.update(currentWindow.id, updateInfo);
});
}else if (e.target.id === "clear-browser-data") {
forgetBrowsingData()
}
e.preventDefault();

View File

@@ -5,10 +5,10 @@
"strict_min_version": "60.0"
}
},
"permissions": ["theme", "proxy", "privacy", "storage"],
"permissions": ["theme", "browsingData", "notifications", "proxy", "privacy", "storage"],
"manifest_version": 2,
"name": "__MSG_extensionName__",
"version": "1.21",
"version": "1.23",
"description": "__MSG_extensionDescription__",
"homepage_url": "https://github.com/eyedeekay/i2psetproxy.js",
"icons": {
@@ -24,7 +24,7 @@
"page": "options/options.html"
},
"background": {
"scripts": ["background.js", "proxy.js", "info.js" ]
"scripts": ["background.js", "proxy.js", "info.js", "privacy.js" ]
},
"default_locale": "en"
}

View File

@@ -1,4 +1,13 @@
function isDroid() {
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then((got) => {
if (got.os == "android") {
return true
}
});
}
function SetHostText(){
var hostid = document.getElementById('hostText');
hostid.textContent = chrome.i18n.getMessage("hostText");
@@ -47,7 +56,7 @@ function getPort() {
}
return proxy_port;
}
/*
function getControlHost() {
control_host = document.getElementById("controlhost").value
console.log("Got i2p control host:", control_host);
@@ -65,7 +74,7 @@ function getControlPort() {
}
return control_port;
}
*/
function isFirefox() {
testPlain = navigator.userAgent.indexOf('Firefox') !== -1;
if (testPlain) {
@@ -106,49 +115,27 @@ function onError(e) {
//var controlPort = "7951" //getControlPort();
function setupProxy() {
//var controlHost = getControlHost();
//var controlPort = getControlPort();
if (isFirefox()) {
if (getScheme() == "http") {
var proxySettings = {
proxyType: "manual",
http: getHost()+":"+getPort(),
passthrough: "",
httpProxyAll: true
};
chrome.proxy.settings.set({value:proxySettings});
console.log("i2p settings created for Firefox")
//var controlHost = getControlHost()
//var controlPort = getControlPort()
var Host = getHost()
var Port = getPort()
console.log("Setting up Firefox Desktop proxy")
var proxySettings = {
proxyType: "manual",
http: Host+":"+Port,
passthrough: "",
httpProxyAll: true
};
browser.proxy.settings.set({value:proxySettings});
console.log("i2p settings created for Firefox Desktop")
if (isDroid()) {
console.log("Setting up Firefox Android proxy")
if (Port == "7950") {
browser.proxy.register("android-ext.pac");
}else{
browser.proxy.register("android.pac");
}
}else{
var config = {
mode: "fixed_servers",
rules: {
proxyForHttp: {
scheme: getScheme(),
host: getHost(),
port: getPort()
},
proxyForFtp: {
scheme: getScheme(),
host: getHost(),
port: getPort()
},
proxyForHttps: {
scheme: getScheme(),
host: getHost(),
port: getPort()
},
fallbackProxy: {
scheme: getScheme(),
host: getHost(),
port: getPort()
}
}
};
chrome.proxy.settings.set(
{value: config, scope: 'regular'},
function() {});
console.log("i2p settings created for Chromium")
console.log("i2p settings created for Firefox Android")
}
}
@@ -205,12 +192,10 @@ function updateUI(restoredSettings) {
function onError(e) {
console.error(e);
}
const assureStoredSettings = chrome.storage.local.get();
assureStoredSettings.then(checkStoredSettings, onError);
const gettingStoredSettings = chrome.storage.local.get();
gettingStoredSettings.then(updateUI, onError);
chrome.storage.local.get(function(got){
checkStoredSettings(got)
updateUI(got)
});
const saveButton = document.querySelector("#save-button");
saveButton.addEventListener("click", storeSettings);

View File

@@ -1,20 +1,19 @@
function isFirefox() {
testPlain = navigator.userAgent.indexOf('Firefox') !== -1;
if (testPlain) {
console.log("firefox")
return testPlain
}
testTorBrowser = navigator.userAgent.indexOf('Tor') !== -1;
if (testTorBrowser) {
return testTorBrowser
}
return false
}
function isDroid() {
testPlain = navigator.userAgent.indexOf('Android') !== -1;
if (testPlain) {
return testPlain
}
return false
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then((got) => {
if (got.os == "android") {
return true
}
});
}
if (isFirefox()) {
@@ -25,67 +24,37 @@ chrome.privacy.network.webRTCIPHandlingPolicy.set({value: "disable_non_proxied_u
console.log("Preliminarily disabled WebRTC.")
var controlHost = "127.0.0.1" //getControlHost()
var controlPort = "7951" //getControlPort();
function setupProxy() {
var controlHost = getControlHost();
var controlPort = getControlPort();
if (isFirefox()) {
if (isDroid()) {
if (getPort() == "7950") {
browser.proxy.register("android-ext.pac");
}else{
browser.proxy.register("android.pac");
}
var controlHost = "127.0.0.1" //getControlHost()
var controlPort = "7951" //getControlPort();
var Host = getHost()
var Port = getPort()
console.log("Setting up Firefox Desktop proxy")
var proxySettings = {
proxyType: "manual",
http: Host+":"+Port,
passthrough: "",
httpProxyAll: true
};
browser.proxy.settings.set({value:proxySettings});
console.log("i2p settings created for Firefox Desktop")
if (isDroid()) {
console.log("Setting up Firefox Android proxy")
if (Port == "7950") {
browser.proxy.register("android-ext.pac");
}else{
if (getScheme() == "http") {
var proxySettings = {
proxyType: "manual",
http: getHost()+":"+getPort(),
passthrough: "",
httpProxyAll: true
};
chrome.proxy.settings.set({value:proxySettings});
console.log("i2p settings created for Firefox")
}
browser.proxy.register("android.pac");
}
}else{
var config = {
mode: "fixed_servers",
rules: {
proxyForHttp: {
scheme: getScheme(),
host: getHost(),
port: getPort()
},
proxyForFtp: {
scheme: getScheme(),
host: getHost(),
port: getPort()
},
proxyForHttps: {
scheme: getScheme(),
host: getHost(),
port: getPort()
},
fallbackProxy: {
scheme: getScheme(),
host: getHost(),
port: getPort()
}
}
};
chrome.proxy.settings.set(
{value: config, scope: 'regular'},
function() {});
console.log("i2p settings created for Chromium")
console.log("i2p settings created for Firefox Android")
}
}
if (isFirefox()){
// Theme all currently open windows
browser.windows.getAll().then(wins => wins.forEach(themeWindow));
}
if (isFirefox()) {
setAllPrivacy()
setupProxy()
}

View File

@@ -23,16 +23,19 @@
</div>
<div class="panel-section-separator"></div>
<!-- This is where I'll eventually put the tunnel control panel -->
<!-- <a href="#" id="generate-fresh-tunnel> Generate a Fresh Tunnel</a>"-->
<!-- -->
<a href="#" id="window-create-help-panel">Open the Help</a><br>
<a href="#" id="window-create-news-panel">Visit the I2P News</a><br>
<!-- This is where I'll eventually put the tunnel control panel -->
<!-- <a href="#" id="generate-fresh-tunnel> Generate a Fresh Tunnel</a>"-->
<!-- -->
<strong><a href="#" id="clear-browser-data">Clear all browsing data</a></strong><br>
<!--<strong><a href="#" id="temp-enable-webrtc">Temporarily enable WebRTC</a></strong><br>-->
<div class="panel-section-separator"></div>
<a href="http://i2pforum.i2p" id="window-create-forum-panel">Visit the I2P Forums</a><br>
<a href="http://i2p-projekt.i2p/blog" id="window-create-news-panel">Get the latest I2P News</a><br>
<div class="panel-section-separator"></div>
</div>
<script src="privacy.js"></script>
<script src="info.js"></script>
<script src="content.js"></script>