start a basic chrome plugin
This commit is contained in:
BIN
1.26.tar.gz
Normal file
BIN
1.26.tar.gz
Normal file
Binary file not shown.
@ -34,7 +34,10 @@ Step 1: Create an I2P Browsing Profile
|
||||
* 1D: Awwwwwww...
|
||||
* 
|
||||
|
||||
Step 2: Install plugin on profile
|
||||
Step 2: Install Extension on profile
|
||||
|
||||
* A work-in-progress I2P extension is part of this repository. Please be
|
||||
patient, a prototype will be available soon.
|
||||
|
||||
Pure Terminal Solution, Unix-Only
|
||||
---------------------------------
|
||||
|
2
i2pchrome.js/.gitignore
vendored
Normal file
2
i2pchrome.js/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
README.md.asc
|
||||
|
21
i2pchrome.js/LICENSE
Normal file
21
i2pchrome.js/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
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.
|
64
i2pchrome.js/Makefile
Normal file
64
i2pchrome.js/Makefile
Normal file
@ -0,0 +1,64 @@
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
clobber:
|
||||
rm -f ../i2psetproxy.js.zip ../i2p_proxy*.xpi
|
||||
|
||||
VERSION=1.26
|
||||
|
||||
xpi:
|
||||
mv ~/Downloads/i2p_proxy-$(VERSION)-an+fx.xpi ../i2psetproxy.js@eyedeekay.github.io.xpi
|
||||
|
||||
cp:
|
||||
cp ../i2psetproxy.js@eyedeekay.github.io.xpi ./i2psetproxy.js@eyedeekay.github.io.xpi
|
||||
|
||||
version:
|
||||
sed -i 's|$(shell grep "\"version\": " manifest.json)| \"version\": \"$(VERSION)\",|g' manifest.json
|
||||
|
||||
zip: version
|
||||
zip --exclude="./i2psetproxy.js@eyedeekay.github.io.xpi" \
|
||||
--exclude="i2psetproxy.js.png" -r -FS ../i2psetproxy.js.zip *
|
||||
|
||||
profile-install:
|
||||
cp ./i2psetproxy.js@eyedeekay.github.io.xpi $(HOME)/.mozilla/firefox/firefox.profile.i2p/firefox.profile.i2p/extensions
|
||||
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/
|
||||
|
||||
pi: profile-install
|
||||
|
||||
DESC="A simple plugin for configuring an i2p browser."
|
||||
|
||||
release:
|
||||
gothub release -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n $(VERSION) -d $(DESC)
|
||||
|
||||
upload:
|
||||
gothub upload -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js@eyedeekay.github.io.xpi" -f "../i2psetproxy.js@eyedeekay.github.io.xpi"
|
||||
|
||||
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 '*.js' -exec prettier --write {} \;
|
||||
find . -path ./node_modules -prune -o -name '*.json' -exec prettier --write {} \;
|
2
i2pchrome.js/README.md
Normal file
2
i2pchrome.js/README.md
Normal file
@ -0,0 +1,2 @@
|
||||
I2P Plugin For Chromium Persona
|
||||
===============================
|
66
i2pchrome.js/_locales/en/messages.json
Normal file
66
i2pchrome.js/_locales/en/messages.json
Normal file
@ -0,0 +1,66 @@
|
||||
{
|
||||
"extensionName": {
|
||||
"message": "i2psetproxy.js",
|
||||
"description": "Name of the extension."
|
||||
},
|
||||
"extensionDescription": {
|
||||
"message": "Set up a browser to use the i2p http proxy automatically",
|
||||
"description": "Description of the extension."
|
||||
},
|
||||
"titlePreface": {
|
||||
"message": "I2P Browser - ",
|
||||
"description": "Preface for the browser titlebar"
|
||||
},
|
||||
"titlePrefacePrivate": {
|
||||
"message": "I2P Browser (Private) - ",
|
||||
"description": "Preface for the browser titlebar"
|
||||
},
|
||||
"resetMessage": {
|
||||
"message": "Reset Tunnel",
|
||||
"description": "Message for the Reset Tunnel button"
|
||||
},
|
||||
"infoTitle": {
|
||||
"message": "I2P Help",
|
||||
"description": "Title for the help menu"
|
||||
},
|
||||
"infoMessage": {
|
||||
"message": "You are now free to browse the eepWeb! Your browser is now configured to browse anonymously on the I2P network. As you browse, your traffic will be routed through other network nodes to disguise it's origin, both from the server and from the nodes themselves.",
|
||||
"description": "Help Message"
|
||||
},
|
||||
"helpMessage": {
|
||||
"message": "Get additional help",
|
||||
"description": "Help Message"
|
||||
},
|
||||
"newsMessage": {
|
||||
"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": {
|
||||
"message": "Host: ",
|
||||
"description": "Host for the HTTP or SOCKS5 Proxy"
|
||||
},
|
||||
"portText": {
|
||||
"message": "Port: ",
|
||||
"description": "Port for the HTTP or SOCKS5 Proxy"
|
||||
},
|
||||
"controlHelpText": {
|
||||
"message": "These options will be inert if used with the default i2p HTTP or SOCKS proxy.",
|
||||
"description": "Help for configuring the options for the Reset Tunnel button"
|
||||
},
|
||||
"controlHostText": {
|
||||
"message": "Control Host: ",
|
||||
"description": "Host for the Reset Tunnel button"
|
||||
},
|
||||
"controlPortText": {
|
||||
"message": "Control Port: ",
|
||||
"description": "Port for the Reset Tunnel button"
|
||||
}
|
||||
}
|
13
i2pchrome.js/background.js
Normal file
13
i2pchrome.js/background.js
Normal file
@ -0,0 +1,13 @@
|
||||
function platformCallback(platformInfo) {
|
||||
if (platformInfo.PlatformOs == "android") {
|
||||
console.log("android detected");
|
||||
return true;
|
||||
} else {
|
||||
console.log("desktop detected");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isDroid() {
|
||||
return chrome.runtime.getPlatformInfo(platformCallback);
|
||||
}
|
1292
i2pchrome.js/browser-polyfill.js
Normal file
1292
i2pchrome.js/browser-polyfill.js
Normal file
File diff suppressed because it is too large
Load Diff
17
i2pchrome.js/content.js
Normal file
17
i2pchrome.js/content.js
Normal file
@ -0,0 +1,17 @@
|
||||
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 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 clearData = document.getElementByID("clear-chrome-data");
|
||||
cleardata.textContent = chrome.i18n.getMessage("clearData");
|
BIN
i2pchrome.js/i2psetproxy.js.png
Normal file
BIN
i2pchrome.js/i2psetproxy.js.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 357 KiB |
BIN
i2pchrome.js/i2psetproxy.js@eyedeekay.github.io.xpi
Normal file
BIN
i2pchrome.js/i2psetproxy.js@eyedeekay.github.io.xpi
Normal file
Binary file not shown.
BIN
i2pchrome.js/icons/toopie.png
Normal file
BIN
i2pchrome.js/icons/toopie.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
12
i2pchrome.js/info.css
Normal file
12
i2pchrome.js/info.css
Normal file
@ -0,0 +1,12 @@
|
||||
html, body {
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
a {
|
||||
margin: 10px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.panel {
|
||||
margin: 5px;
|
||||
}
|
48
i2pchrome.js/info.js
Normal file
48
i2pchrome.js/info.js
Normal file
@ -0,0 +1,48 @@
|
||||
document.addEventListener("click", e => {
|
||||
function getCurrentWindow() {
|
||||
return chrome.windows.getCurrent();
|
||||
}
|
||||
|
||||
if (e.target.id === "window-create-help-panel") {
|
||||
let createData = {
|
||||
type: "panel",
|
||||
incognito: true
|
||||
};
|
||||
let creating = chrome.windows.create(createData);
|
||||
creating.then(() => {
|
||||
console.log("The help panel has been created");
|
||||
});
|
||||
} else if (e.target.id === "window-create-news-panel") {
|
||||
let createData = {
|
||||
type: "panel",
|
||||
incognito: true
|
||||
};
|
||||
let creating = chrome.windows.create(createData);
|
||||
creating.then(() => {
|
||||
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);
|
||||
};
|
||||
}
|
||||
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 === "clear-chrome-data") {
|
||||
forgetBrowsingData();
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
});
|
38
i2pchrome.js/manifest.json
Normal file
38
i2pchrome.js/manifest.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"permissions": [
|
||||
"browsingData",
|
||||
"notifications",
|
||||
"proxy",
|
||||
"privacy",
|
||||
"storage",
|
||||
"webRequest",
|
||||
"<all_urls>"
|
||||
],
|
||||
"manifest_version": 2,
|
||||
"name": "__MSG_extensionName__",
|
||||
"version": "1.26",
|
||||
"description": "__MSG_extensionDescription__",
|
||||
"homepage_url": "https://github.com/eyedeekay/i2psetproxy.js",
|
||||
"icons": {
|
||||
"48": "icons/toopie.png"
|
||||
},
|
||||
"browser_action": {
|
||||
"browser_style": true,
|
||||
"default_icon": "icons/toopie.png",
|
||||
"default_title": "__MSG_extensionName__",
|
||||
"default_popup": "window.html"
|
||||
},
|
||||
"options_ui": {
|
||||
"page": "options/options.html"
|
||||
},
|
||||
"background": {
|
||||
"scripts": [
|
||||
"browser-polyfill.js",
|
||||
"background.js",
|
||||
"proxy.js",
|
||||
"info.js",
|
||||
"privacy.js"
|
||||
]
|
||||
},
|
||||
"default_locale": "en"
|
||||
}
|
62
i2pchrome.js/options/options.css
Normal file
62
i2pchrome.js/options/options.css
Normal file
@ -0,0 +1,62 @@
|
||||
body {
|
||||
width: 25em;
|
||||
font-family: "Open Sans Light", sans-serif;
|
||||
font-size: 0.9em;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
section.scheme-options {
|
||||
padding: 0.5em 0;
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
#clear-button {
|
||||
margin: 0 1.3em 1em 0;
|
||||
}
|
||||
|
||||
section.scheme-options input,
|
||||
section.scheme-options>select,
|
||||
#clear-button {
|
||||
float: right;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
padding: 0.2em 0;
|
||||
}
|
||||
|
||||
label:hover {
|
||||
background-color: #EAEFF2;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 1.2em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
html, body {
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
a {
|
||||
margin: 10px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.panel {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
span.identity {
|
||||
width: 100px;
|
||||
display: inline-block;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.control-options {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.identity-options {
|
||||
display: none;
|
||||
}
|
51
i2pchrome.js/options/options.html
Normal file
51
i2pchrome.js/options/options.html
Normal file
@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="options.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<section class="scheme-options">
|
||||
<span class="title">Proxy Scheme:</span>
|
||||
<select id="proxy_scheme">
|
||||
<option value="http" selected="selected">HTTP</option>
|
||||
<option value="socks5">SOCKS5</option>
|
||||
</select>
|
||||
</section>
|
||||
|
||||
<section class="scheme-options proxy-options">
|
||||
<div class="title" >Proxy Options</div>
|
||||
|
||||
<label id="portText">Host: </label>
|
||||
<input type="text" data="host" id="host" value="127.0.0.1"/>
|
||||
<br>
|
||||
<label id="hostText">Port: </label>
|
||||
<input type="text" data="port" id="port" value="4444"/>
|
||||
|
||||
</section>
|
||||
<section class="scheme-options identity-options">
|
||||
<div class="panel">
|
||||
<div id="identity-list">Identity list?</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="scheme-options control-options">
|
||||
<div class="title" >Controller Options</div>
|
||||
<p id="controlHelpText"> These options will be inert if used with the default i2p HTTP or SOCKS
|
||||
proxy. </p>
|
||||
<label id="controlPortText">Control Host: </label>
|
||||
<input type="text" data="controlhost" id="controlhost" value="127.0.0.1"/>
|
||||
<br>
|
||||
<label id="controlHostText">Control Port: </label>
|
||||
<input type="text" data="controlport" id="controlport" value="4444"/>
|
||||
|
||||
</section>
|
||||
|
||||
<input type="button" value="Save preferences" id="save-button"/>
|
||||
|
||||
<script src="options.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
188
i2pchrome.js/options/options.js
Normal file
188
i2pchrome.js/options/options.js
Normal file
@ -0,0 +1,188 @@
|
||||
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");
|
||||
}
|
||||
|
||||
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 setupProxy() {
|
||||
var controlHost = getControlHost();
|
||||
var controlPort = getControlPort();
|
||||
var Host = getHost();
|
||||
var Port = getPort();
|
||||
var Scheme = getScheme();
|
||||
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("Setting up Firefox WebExtension proxy");
|
||||
browser.proxy.onRequest.addListener(handleProxyRequest, {
|
||||
urls: ["<all_urls>"]
|
||||
});
|
||||
console.log("i2p settings created for WebExtension Proxy");
|
||||
}
|
||||
|
||||
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 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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
function onError(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();
|
||||
}
|
||||
|
||||
function updateUI(restoredSettings) {
|
||||
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 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 controlportitem = document.getElementById("controlport");
|
||||
controlportitem.value = restoredSettings.control_port;
|
||||
console.log("showing control port:", controlportitem.value);
|
||||
|
||||
SetHostText();
|
||||
SetPortText();
|
||||
SetControlHostText();
|
||||
SetControlPortText();
|
||||
SetControlHelpText();
|
||||
setupProxy();
|
||||
}
|
||||
|
||||
function onError(e) {
|
||||
console.error(e);
|
||||
}
|
||||
chrome.storage.local.get(function(got) {
|
||||
checkStoredSettings(got);
|
||||
updateUI(got);
|
||||
});
|
||||
|
||||
const saveButton = document.querySelector("#save-button");
|
||||
saveButton.addEventListener("click", storeSettings);
|
||||
|
||||
//EXPERIMENTAL: Open in I2P Tab
|
230
i2pchrome.js/privacy.js
Normal file
230
i2pchrome.js/privacy.js
Normal file
@ -0,0 +1,230 @@
|
||||
function onSet(result) {
|
||||
if (result) {
|
||||
console.log("->: Value was updated");
|
||||
} else {
|
||||
console.log("-X: Value was not updated");
|
||||
}
|
||||
}
|
||||
|
||||
// This disables queries to centralized databases of bad URLs to screen for
|
||||
// risky sites in your chrome
|
||||
function disableHyperlinkAuditing() {
|
||||
/* var setting = chrome.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 = chrome.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 = chrome.privacy.websites.cookieConfig.get({});
|
||||
getting.then((got) => {
|
||||
var setting = chrome.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
|
||||
/*function disableBadCookies(){
|
||||
var setting = chrome.privacy.websites.thirdPartyCookiesAllowed.set({
|
||||
value: false
|
||||
});
|
||||
console.log("Disabling third party cookies/val=", {
|
||||
value: false
|
||||
})
|
||||
setting.then(onSet);
|
||||
}*/
|
||||
|
||||
// this disables the use of referrer headers
|
||||
function disableReferrers() {
|
||||
/*var setting = chrome.privacy.websites.referrersEnabled.set({
|
||||
value: false
|
||||
});
|
||||
console.log("Disabling referrer headers/val=", {
|
||||
value: false
|
||||
})
|
||||
setting.then(onSet);*/
|
||||
}
|
||||
|
||||
// enable fingerprinting resistent features(letterboxing and stuff)
|
||||
function enableResistFingerprinting() {
|
||||
/*var setting = chrome.privacy.websites.referrersEnabled.set({
|
||||
value: true
|
||||
});
|
||||
console.log("Enabling resist fingerprinting/val=", {
|
||||
value: true
|
||||
})
|
||||
setting.then(onSet);*/
|
||||
}
|
||||
|
||||
// This is essentially a blocklist of clearnet web-sites known to do bad tracking
|
||||
function enableTrackingProtection() {
|
||||
/*var setting = chrome.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() {
|
||||
/*var gettingInfo = chrome.runtime.getPlatformInfo();
|
||||
gettingInfo.then((got) => {
|
||||
if (got.os == "win") {
|
||||
var setting = chrome.privacy.websites.protectedContentEnabled.set({
|
||||
value: false
|
||||
});
|
||||
console.log("Setting Protected Content(Digital Restrictions Management) false/val=", {
|
||||
value: false
|
||||
})
|
||||
setting.then(onSet);
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
function setAllPrivacy() {
|
||||
disableHyperlinkAuditing();
|
||||
enableFirstPartyIsolation();
|
||||
disableEvilCookies();
|
||||
disableReferrers();
|
||||
enableTrackingProtection();
|
||||
enableResistFingerprinting();
|
||||
disableDigitalRestrictionsManagement();
|
||||
}
|
||||
|
||||
setAllPrivacy();
|
||||
|
||||
function ResetPeerConnection() {
|
||||
//chrome.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("Re-disabled WebRTC");
|
||||
}
|
||||
|
||||
function EnablePeerConnection() {
|
||||
//chrome.privacy.network.peerConnectionEnabled.set({value: true});
|
||||
//chrome.privacy.network.networkPredictionEnabled.set({value: false});
|
||||
chrome.privacy.network.webRTCIPHandlingPolicy.set({
|
||||
value: "disable_non_proxied_udp"
|
||||
});
|
||||
console.log("Enabled WebRTC");
|
||||
}
|
||||
|
||||
ResetPeerConnection();
|
||||
|
||||
function ResetDisableSavePasswords() {
|
||||
//chrome.privacy.services.passwordSavingEnabled.set({value: false});
|
||||
//console.log("Re-disabled saved passwords")
|
||||
}
|
||||
|
||||
function EnableSavePasswords() {
|
||||
//chrome.privacy.services.passwordSavingEnabled.set({value: true});
|
||||
//console.log("Enabled saved passwords")
|
||||
}
|
||||
|
||||
//ResetDisableSavePasswords()
|
||||
|
||||
var defaultSettings = {
|
||||
since: "forever",
|
||||
dataTypes: [
|
||||
"history",
|
||||
"downloads",
|
||||
"cache",
|
||||
"cookies",
|
||||
"passwords",
|
||||
"pluginData",
|
||||
"formData",
|
||||
"serviceWorkers"
|
||||
]
|
||||
};
|
||||
|
||||
var appSettings = {
|
||||
since: "forever",
|
||||
dataTypes: [""]
|
||||
};
|
||||
|
||||
function onError(e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
function checkStoredSettings(storedSettings) {
|
||||
//chrome.storage.local.set(appSettings);
|
||||
}
|
||||
|
||||
//const gettingStoredSettings = chrome.storage.local.get();
|
||||
//gettingStoredSettings.then(checkStoredSettings, onError);
|
||||
|
||||
function forgetBrowsingData(storedSettings) {
|
||||
function getSince(selectedSince) {
|
||||
if (selectedSince === "forever") {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const times = {
|
||||
hour: () => {
|
||||
return 1000 * 60 * 60;
|
||||
},
|
||||
day: () => {
|
||||
return 1000 * 60 * 60 * 24;
|
||||
},
|
||||
week: () => {
|
||||
return 1000 * 60 * 60 * 24 * 7;
|
||||
}
|
||||
};
|
||||
|
||||
const sinceMilliseconds = times[selectedSince].call();
|
||||
return Date.now() - sinceMilliseconds;
|
||||
}
|
||||
|
||||
function getTypes(selectedTypes) {
|
||||
let dataTypes = {};
|
||||
for (let item of selectedTypes) {
|
||||
dataTypes[item] = true;
|
||||
}
|
||||
return dataTypes;
|
||||
}
|
||||
|
||||
const since = getSince(defaultSettings.since);
|
||||
const dataTypes = getTypes(defaultSettings.dataTypes);
|
||||
|
||||
function notify() {
|
||||
let dataTypesString = Object.keys(dataTypes).join(", ");
|
||||
let sinceString = new Date(since).toLocaleString();
|
||||
chrome.notifications.create({
|
||||
type: "basic",
|
||||
title: "Removed browsing data",
|
||||
message: `Removed ${dataTypesString}\nsince ${sinceString}`
|
||||
});
|
||||
}
|
||||
|
||||
chrome.browsingData.remove({ since }, dataTypes).then(notify);
|
||||
|
||||
setAllPrivacy();
|
||||
ResetPeerConnection();
|
||||
}
|
147
i2pchrome.js/proxy.js
Normal file
147
i2pchrome.js/proxy.js
Normal file
@ -0,0 +1,147 @@
|
||||
function platformCallback(platformInfo) {
|
||||
if (platformInfo.PlatformOs == "android") {
|
||||
console.log("android detected");
|
||||
return true;
|
||||
} else {
|
||||
console.log("desktop detected");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isDroid() {
|
||||
return chrome.runtime.getPlatformInfo(platformCallback);
|
||||
}
|
||||
|
||||
//chrome.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.");
|
||||
|
||||
function shouldProxyRequest(requestInfo) {
|
||||
return requestInfo.parentFrameId != -1;
|
||||
}
|
||||
|
||||
function handleProxyRequest(requestInfo) {
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
var proxy_port = "4444";
|
||||
|
||||
function getPort() {
|
||||
if (proxy_port == undefined) {
|
||||
proxy_port = "4444";
|
||||
}
|
||||
console.log("Got i2p proxy port:", proxy_port);
|
||||
return proxy_port;
|
||||
}
|
||||
|
||||
var control_port = "7657";
|
||||
|
||||
function getControlPort() {
|
||||
if (control_port == undefined) {
|
||||
return "7657";
|
||||
}
|
||||
console.log("Got i2p control port:", control_port);
|
||||
return control_port;
|
||||
}
|
||||
|
||||
function setupProxy() {
|
||||
var controlPort = getControlPort();
|
||||
var Host = getHost();
|
||||
var Port = getPort();
|
||||
var Scheme = getScheme();
|
||||
var config = {
|
||||
mode: "fixed_servers",
|
||||
rules: {
|
||||
singleProxy: {
|
||||
scheme: Scheme,
|
||||
host: Host,
|
||||
port: parseInt(Port)
|
||||
},
|
||||
bypassList: ["localhost:" + controlPort, "127.0.0.1:" + controlPort]
|
||||
}
|
||||
};
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
chrome.storage.local.get(function(got) {
|
||||
checkStoredSettings(got);
|
||||
update(got);
|
||||
setupProxy();
|
||||
});
|
||||
|
||||
chrome.windows.onCreated.addListener(() => {
|
||||
const gettingStoredSettings = chrome.storage.local.get();
|
||||
gettingStoredSettings.then(setupProxy, onError);
|
||||
});
|
44
i2pchrome.js/window.html
Normal file
44
i2pchrome.js/window.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="info.css"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="panel">
|
||||
<div class="panel-section panel-section-header">
|
||||
<div id="text-section-header" class="text-section-header">I2P Assistance</div>
|
||||
</div>
|
||||
|
||||
<div id="text-section-helptext">
|
||||
You are now free to browse the eepWeb!
|
||||
|
||||
Your browser is now configured to browse anonymously on the I2P network.
|
||||
As you browse, your traffic will be routed through other network nodes
|
||||
to disguise it's origin, both from the server and from the nodes
|
||||
themselves.
|
||||
|
||||
</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>"-->
|
||||
<!-- -->
|
||||
<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>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user