enable-disable history, don't try to kill undefined tabs

This commit is contained in:
idk
2019-11-25 20:19:44 -05:00
parent 4e00c72d5f
commit ab7774ea29
10 changed files with 245 additions and 117 deletions

View File

@@ -76,8 +76,10 @@ p {
border: 1px solid #d9d9d6;
border-radius: 2px;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc;
background: #f8f8ff
background: #f8f8ff;
min-width: 95%
}
.application-info,
.extended-info {
min-height: 3rem;
padding: 1rem;
@@ -87,17 +89,7 @@ p {
border-radius: 2px;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc;
background: #f8f8ff;
min-width: 50%
}
.application-info {
min-height: 3rem;
padding: 1rem;
margin-top: 1.5rem;
display: inline-block;
border: 1px solid #d9d9d6;
border-radius: 2px;
box-shadow: inset 0 0 0 1px #fff,0 0 1px #ccc;
background: #f8f8ff
min-width: 95%
}
h1 {
margin-right: auto;
@@ -269,11 +261,15 @@ li {
}
.onboardingContent {
font-size: .8rem!important;
text-align: left
text-align: left;
display: none
}
#proxy-check {
visibility: hidden
}
#info-content {
display: none
}
.consoleOn:hover #proxy-check,
.proxyReady:hover #proxy-check {
visibility: visible;
@@ -283,7 +279,7 @@ img.readyness {
height: 100%;
width: auto
}
@media only screen and (min-width: 768px) {
@media only screen and (max-width: 399px) {
.application-info {
display: none
}

View File

@@ -32,15 +32,15 @@
</div>
<div id="onboarding" class="hideIfI2PConsoleOff">
<h3 id="onboardingTitle">New to I2P? Learn more here.</h3>
<h4 id="onboardingZero"><button class="showhider" onclick="flipVisibility('onboardingContentZero')">Protect your Privacy</button></h4>
<h4 id="onboardingZero"><button id="onboardingButtonZero" class="showhider" onclick="flipVisibility('onboardingContentZero')">Protect your Privacy</button></h4>
<p id="onboardingContentZero" class="onboardingContent">I2P Browser allows you to surf the internet using the private and secure I2P network. When using it, you are protected against tracking, surveillance, and censorship as a first-class participant in the I2P network. I2P Browser isolates cookies and deletes your browser history after your session. These modifications ensure your privacy and security are protected in the browser.</p>
<h4 id="onboardingOne"><button class="showhider" onclick="flipVisibility('onboardingContentOne')">Configure your Experience</button></h4>
<h4 id="onboardingOne"><button id="onboardingButtonOne" class="showhider" onclick="flipVisibility('onboardingContentOne')">Configure your Experience</button></h4>
<p id="onboardingContentOne" class="onboardingContent">We also provide you with additional settings for bumping up your browser security. Our Security Settings allow you to block elements that could be used to attack your computer. Click below to see what the different options do. Note: By default, NoScript and HTTPS Everywhere are not included on the toolbar, but you can customize your toolbar to add them. With all the security and privacy features provided by I2P, your experience while browsing the internet may be a little different. Things may be a bit slower, and depending on your security level, some elements may not work or load. You may also be asked to prove you are a human and not a robot.</p>
<h4 id="onboardingTwo"><button class="showhider" onclick="flipVisibility('onboardingContentTwo')">Share Files</button></h4>
<h4 id="onboardingTwo"><button id="onboardingButtonTwo" class="showhider" onclick="flipVisibility('onboardingContentTwo')">Share Files</button></h4>
<p id="onboardingContentTwo" class="onboardingContent">I2P is capable of using peer-to-peer applications like BitTorrent, protecting your identity when you share files. Our anonymous bittorrent client is available in the browser.</p>
<h4 id="onboardingThree"><button class="showhider" onclick="flipVisibility('onboardingContentThree')">Hidden e-mail</button></h4>
<h4 id="onboardingThree"><button id="onboardingButtonThree" class="showhider" onclick="flipVisibility('onboardingContentThree')">Hidden e-mail</button></h4>
<p id="onboardingContentThree" class="onboardingContent">There is also an anonymous e-mail service available inside of I2P, which is accessible from our browser via the menu directly below.</p>
<h4 id="onboardingFour"><button class="showhider" onclick="flipVisibility('onboardingContentFour')">Experience Tips</button></h4>
<h4 id="onboardingFour"><button id="onboardingButtonFour" class="showhider" onclick="flipVisibility('onboardingContentFour')">Experience Tips</button></h4>
<p id="onboardingContentFour" class="onboardingContent">With all the security and privacy features provided by I2P, your experience while browsing the internet may be a little different. Things may be a bit slower, and depending on your security level, some elements may not work or load. You may also be asked to prove you are a human and not a robot.</p>
</div>
<!--<p class="hideIfI2POn">&aboutI2p.warn_not_running; <a href="about:i2p">&aboutI2p.refresh_text;</a> &aboutI2p.reccommend_not_running;</p>-->
@@ -49,17 +49,17 @@
<h3>Applications</h3>
<p id="applicationExplain">These applications use I2P to provide them with security and privacy.</p>
<ul>
<a class="applicationName" href="http://127.0.0.1:7657/i2ptunnel">
<a class="applicationName" target="_blank" href="http://127.0.0.1:7657/i2ptunnel">
<li class="application">
Hidden Services Manager <span class="applicationDesc">I2P has a web-based interface for configuring .i2p services like web sites, to set up your own web sites, go here:</span>
</li>
</a>
<a class="applicationName" href="http://127.0.0.1:7657/susimail">
<a class="applicationName" target="_blank" href="http://127.0.0.1:7657/susimail">
<li class="application">
E-Mail <span class="applicationDesc">I2P also bundles a webmail client which can be used to access in-I2P e-mail. To use it, go here:</span>
</li>
</a>
<a class="applicationName" href="http://127.0.0.1:7657/i2psnark">
<a class="applicationName" target="_blank" href="http://127.0.0.1:7657/i2psnark">
<li class="application">
BitTorrent <span class="applicationDesc">I2P is capable of anonymous Peer-to-Peer file sharing, to use the built-in bittorrent client go here:</span>
</li>
@@ -68,7 +68,7 @@
</p>
</div>
<div class="extended-info">
<h3 id="links"><button class="showhider" onclick="flipVisibility('info-content')">Links</button></h3>
<h3 id="links"><button id="fliplinks" class="showhider">Links</button></h3>
<div id="info-content">
<p id="linksExplain">If you want to get more information about I2P, you can visit these links.</p>
<p>

16
home.js
View File

@@ -1,3 +1,19 @@
document.addEventListener("click", e => {
if (e.target.id === "onboardingButtonZero") {
flipVisibility("onboardingContentZero");
} else if (e.target.id === "onboardingButtonOne") {
flipVisibility("onboardingContentOne");
} else if (e.target.id === "onboardingButtonTwo") {
flipVisibility("onboardingContentTwo");
} else if (e.target.id === "onboardingButtonThree") {
flipVisibility("onboardingContentThree");
} else if (e.target.id === "onboardingButtonFour") {
flipVisibility("onboardingContentFour");
} else if (e.target.id === "fliplinks") {
flipVisibility("info-content");
}
});
function flipVisibility(div) {
var x = document.getElementById(div);
if (x.style.display === "none") {

93
info.js
View File

@@ -1,3 +1,25 @@
function checkPeerConnection() {
var getting = browser.privacy.network.peerConnectionEnabled.get({});
getting.then(got => {
webrtc = got.value;
console.log("checking webrtc", webrtc);
document.getElementById("enable-web-rtc").checked = webrtc;
});
}
checkPeerConnection();
function checkHistory() {
var getting = browser.storage.local.get("disable_history");
getting.then(got => {
disable_history = got.disable_history;
console.log("checking history", disable_history);
document.getElementById("disable-history").checked = disable_history;
});
}
checkHistory();
document.addEventListener("click", e => {
if (e.target.id === "window-create-help-panel") {
let createData = {
@@ -52,6 +74,15 @@ document.addEventListener("click", e => {
} else {
browser.runtime.sendMessage({ rtc: "disableWebRTC" });
}
//checkPeerConnection()
return;
} else if (e.target.id === "disable-history") {
if (e.target.checked) {
browser.runtime.sendMessage({ history: "disableHistory" });
} else {
browser.runtime.sendMessage({ history: "enableHistory" });
}
//checkHistory()
return;
}
@@ -62,6 +93,8 @@ function proxyReadiness() {
console.log(this.responseText);
}
browser.history.onVisited.addListener(onVisited);
function goHome() {
function gotProxyInfo(info) {
let host = info.value.http.split(":")[0];
@@ -109,44 +142,26 @@ function goSnark() {
console.log("visiting homepage");
let creating = browser.tabs.create(createData);
}
/*
//document.addEventListener("onpageshow", e => {
console.log("(Check) Checking Proxy Readiness");
const Http = new XMLHttpRequest();
Http.addEventListener("load", proxyReadiness);
const url = "http://proxy.i2p"; ///themes/console/images/favicon.ico";
Http.open("GET", url);
Http.send();
//});
function transferComplete(evt) {
console.log(
"The transfer is complete.",
this.status,
this.statusText,
this.responseText
);
function onVisited(historyItem) {
function onCleaned(results) {
if (!results.length) {
console.log(" was removed");
} else {
console.log(" was not removed");
}
}
function onRemoved() {
var searching = browser.history.search({
text: historyItem.url,
startTime: 0
});
searching.then(onCleaned);
}
if (!history) {
if (i2pHost(historyItem.url))
var deletingUrl = browser.history.deleteUrl(historyItem.url);
deletingUrl.then(onRemoved);
}
}
function transferFailed(evt) {
console.log(
"An error occurred while transferring the file.",
this.status,
this.statusText,
this.responseText
);
}
function transferCanceled(evt) {
console.log(
"The transfer has been canceled by the user.",
this.status,
this.statusText,
this.responseText
);
}
Http.addEventListener("load", transferComplete);
Http.addEventListener("error", transferFailed);
Http.addEventListener("abort", transferCanceled);
*/

View File

@@ -269,9 +269,6 @@ function updateUI(restoredSettings) {
function onError(e) {
console.error(e);
}
chrome.storage.local.get(function(got) {
checkStoredSettings(got);
});
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {

View File

@@ -1,13 +1,30 @@
var titlepref = chrome.i18n.getMessage("titlePreface");
var titleprefpriv = chrome.i18n.getMessage("titlePrefacePrivate");
var webpref = chrome.i18n.getMessage("webPreface");
var webprefpriv = chrome.i18n.getMessage("webPrefacePrivate");
var routerpref = chrome.i18n.getMessage("routerPreface");
var routerprefpriv = chrome.i18n.getMessage("routerPrefacePrivate");
var mailpref = chrome.i18n.getMessage("mailPreface");
var mailprefpriv = chrome.i18n.getMessage("mailPrefacePrivate");
var torrentpref = chrome.i18n.getMessage("torrentPreface");
var torrentprefpriv = chrome.i18n.getMessage("torrentPrefacePrivate");
var tunnelpref = chrome.i18n.getMessage("i2ptunnelPreface");
var tunnelprefpriv = chrome.i18n.getMessage("i2ptunnelPrefacePrivate");
var android = false;
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
if (got.os == "android") {
console.log("Running in Android detected");
android = true;
return true;
} else {
console.log("Running in Desktop detected");
return false;
}
});
function isDroid() {
var gettingInfo = browser.runtime.getPlatformInfo();
gettingInfo.then(got => {
if (got.os == "android") {
console.log("Running in Android detected");
return true;
} else {
console.log("Running in Desktop detected");
return false;
}
});
return false;
return android;
}

View File

@@ -139,32 +139,40 @@ function setAllPrivacy() {
setAllPrivacy();
function ResetPeerConnection() {
browser.privacy.network.peerConnectionEnabled.set({
value: false
});
browser.privacy.network.networkPredictionEnabled.set({
value: false
});
chrome.privacy.network.webRTCIPHandlingPolicy.set({
value: "proxy_only"
var webrtc = false;
var rtc = browser.privacy.network.peerConnectionEnabled.set({
value: webrtc
});
rtc.then(AssurePeerConnection);
console.log("Re-disabled WebRTC");
}
function EnablePeerConnection() {
browser.privacy.network.peerConnectionEnabled.set({
value: true
});
browser.privacy.network.networkPredictionEnabled.set({
value: false
});
chrome.privacy.network.webRTCIPHandlingPolicy.set({
value: "disable_non_proxied_udp"
var webrtc = true;
rtc = browser.privacy.network.peerConnectionEnabled.set({
value: webrtc
});
rtc.then(AssurePeerConnection);
console.log("Enabled WebRTC");
}
ResetPeerConnection();
function AssurePeerConnection() {
function assure(webrtc) {
browser.privacy.network.peerConnectionEnabled.set({
value: webrtc.value
});
browser.privacy.network.networkPredictionEnabled.set({
value: false
});
chrome.privacy.network.webRTCIPHandlingPolicy.set({
value: "proxy_only"
});
}
rtc = browser.privacy.network.peerConnectionEnabled.get({});
rtc.then(assure);
}
AssurePeerConnection();
function ResetDisableSavePasswords() {
browser.privacy.services.passwordSavingEnabled.set({
@@ -196,13 +204,6 @@ function onError(e) {
console.error(e);
}
function checkStoredSettings(storedSettings) {
chrome.storage.local.set(appSettings);
}
const gettingStoredSettings = browser.storage.local.get();
gettingStoredSettings.then(checkStoredSettings, onError);
function clearCookiesContext(cookieStoreId) {}
function forgetBrowsingData(storedSettings) {
@@ -348,13 +349,48 @@ function onContextGotLog(contexts) {
browser.runtime.onMessage.addListener(message);
function enableHistory() {
function checkStoredSettings(storedSettings) {
storedSettings["disable_history"] = false;
console.log(storedSettings);
function enablehistory(settings) {
console.log("Store History:", storedSettings);
}
var setting = browser.storage.local.set(storedSettings);
setting.then(enablehistory);
}
const gettingStoredSettings = browser.storage.local.get();
gettingStoredSettings.then(checkStoredSettings, onError);
}
function disableHistory() {
function checkStoredSettings(storedSettings) {
storedSettings["disable_history"] = true;
console.log(storedSettings);
function enablehistory(settings) {
console.log("Store History:", storedSettings);
}
var setting = browser.storage.local.set(storedSettings);
setting.then(enablehistory);
}
const gettingStoredSettings = browser.storage.local.get();
gettingStoredSettings.then(checkStoredSettings, onError);
}
function message(message) {
console.log(message);
if (message.rtc === "enableWebRTC") {
console.log("enableWebRTC");
EnablePeerConnection();
} else {
} else if (message.rtc === "disableWebRTC") {
console.log("disableWebRTC");
ResetPeerConnection();
}
if (message.history === "enableHistory") {
console.log("enableHistory");
enableHistory();
} else if (message.history === "disableHistory") {
console.log("disableHistory");
disableHistory();
}
}

View File

@@ -1,4 +1,5 @@
var titlepref = chrome.i18n.getMessage("titlePreface");
var titleprefpriv = chrome.i18n.getMessage("titlePrefacePrivate");
var webpref = chrome.i18n.getMessage("webPreface");
var webprefpriv = chrome.i18n.getMessage("webPrefacePrivate");
var routerpref = chrome.i18n.getMessage("routerPreface");
@@ -173,37 +174,58 @@ var proxy_host = "127.0.0.1";
var proxy_port = "4444";
var control_host = "127.0.0.1";
var control_port = "4444";
var disable_history = false;
function SetupSettings() {
console.log("Initialising Settings");
//
function checkSchemeStoredSettings(storedSettings) {
if (storedSettings.proxy_scheme != undefined) {
proxy_scheme = storedSettings.proxy_scheme;
} else {
proxy_scheme = "http";
storedSettings.proxy_scheme = proxy_scheme;
}
console.log("Initialising Proxy Scheme", storedSettings.proxy_scheme);
proxy_scheme = storedSettings.proxy_scheme;
}
var gettingSchemeStoredSettings = browser.storage.local.get("proxy_scheme");
gettingSchemeStoredSettings.then(checkSchemeStoredSettings, onError);
//
function checkHostStoredSettings(storedSettings) {
if (storedSettings.proxy_host != undefined) {
proxy_host = storedSettings.proxy_host;
} else {
proxy_host = "127.0.0.1";
storedSettings.proxy_host = proxy_host;
}
console.log("Initialising Host", storedSettings.proxy_host);
proxy_host = storedSettings.proxy_host;
}
var gettingHostStoredSettings = browser.storage.local.get("proxy_host");
gettingHostStoredSettings.then(checkHostStoredSettings, onError);
//
function checkPortStoredSettings(storedSettings) {
if (storedSettings.proxy_port != undefined) {
proxy_port = storedSettings.proxy_port;
} else {
proxy_port = "4444";
storedSettings.proxy_port = proxy_port;
}
console.log("Initialising Port", storedSettings.proxy_port);
proxy_port = storedSettings.proxy_port;
}
var gettingPortStoredSettings = browser.storage.local.get("proxy_port");
gettingPortStoredSettings.then(checkPortStoredSettings, onError);
//
function checkControlHostStoredSettings(storedSettings) {
if (storedSettings.control_host != undefined) {
control_host = storedSettings.control_host;
} else {
control_host = "127.0.0.1";
storedSettings.control_host = control_host;
}
console.log("Initialising Control Host", storedSettings.control_host);
proxy_host = storedSettings.control_host;
}
var gettingControlHostStoredSettings = browser.storage.local.get(
"control_host"
@@ -215,8 +237,13 @@ function SetupSettings() {
//
function checkControlPortStoredSettings(storedSettings) {
if (storedSettings.control_port != undefined) {
contro_port = storedSettings.control_port;
} else {
control_port = "4445";
storedSettings.control_port = control_port;
}
console.log("Initialising Control Port", storedSettings.control_port);
proxy_port = storedSettings.control_port;
}
var gettingControlPortStoredSettings = browser.storage.local.get(
"control_port"
@@ -225,6 +252,24 @@ function SetupSettings() {
checkControlPortStoredSettings,
onError
);
//
function checkHistoryStoredSettings(storedSettings) {
if (storedSettings.disable_history != undefined) {
disable_history = storedSettings.disable_history;
} else {
disable_history = false;
storedSettings.disable_history = disable_history;
}
console.log(
"Initialising Disabled History",
storedSettings.disable_history
);
}
var gettingHistoryStoredSettings = browser.storage.local.get(
"disable_history"
);
gettingHistoryStoredSettings.then(checkHistoryStoredSettings, onError);
}
function getScheme() {
@@ -323,3 +368,4 @@ function updateFromStorage() {
}
browser.storage.onChanged.addListener(updateFromStorage);
SetupSettings();

View File

@@ -109,7 +109,7 @@ var contextSetup = async function(requestDetails) {
function Create(window) {
function onCreated(tab) {
console.log("(isolate) Closing old, un-isolated tab", window);
browser.tabs.remove(tabId.id);
if (tabId != undefined) browser.tabs.remove(tabId.id);
}
var created = browser.tabs.create({
active: true,
@@ -141,7 +141,7 @@ var contextSetup = async function(requestDetails) {
function Create(window) {
function onCreated(tab) {
console.log("(isolate) Closing old, un-isolated tab");
browser.tabs.remove(tabId.id);
if (tabId != undefined) browser.tabs.remove(tabId.id);
}
var created = browser.tabs.create({
active: true,
@@ -174,7 +174,7 @@ var contextSetup = async function(requestDetails) {
function Create(window) {
function onCreated(tab) {
console.log("(isolate) Closing old, un-isolated tab");
browser.tabs.remove(tabId.id);
if (tabId != undefined) browser.tabs.remove(tabId.id);
}
var created = browser.tabs.create({
active: true,
@@ -207,7 +207,7 @@ var contextSetup = async function(requestDetails) {
function Create(window) {
function onCreated(tab) {
console.log("(isolate) Closing old, un-isolated tab");
browser.tabs.remove(tabId.id);
if (tabId != undefined) browser.tabs.remove(tabId.id);
}
var created = browser.tabs.create({
active: true,
@@ -239,7 +239,7 @@ var contextSetup = async function(requestDetails) {
function Create(window) {
function onCreated(tab) {
console.log("(isolate) Closing old, un-isolated tab");
browser.tabs.remove(tabId.id);
if (tabId != undefined) browser.tabs.remove(tabId.id);
}
var created = browser.tabs.create({
active: true,
@@ -276,7 +276,7 @@ var contextSetup = async function(requestDetails) {
function Create(window) {
function onCreated(tab) {
console.log("(isolate) Closing old, un-isolated tab");
browser.tabs.remove(tabId.id);
if (tabId != undefined) browser.tabs.remove(tabId.id);
}
var created = browser.tabs.create({
active: true,

View File

@@ -39,13 +39,18 @@
<li class="application">
<input type="checkbox" id="enable-web-rtc" name="enablewebrtc" value="webrtc">
<label for="enable-web-rtc">Enable WebRTC <strong>with Proxy?</strong></label>
<span class="applicationDesc">For more information about this extension, go here:</span>
<span class="applicationDesc">WebRTC is disabled by default, but can be enabled by checking this box.</span>
</li>
<li class="application">
<div class="panel-section-separator"></div>
<div class="panel-section-identity">
<div id="identity-list"></div>
</li>
<li class="application">
<input type="checkbox" id="disable-history" name="disablehistory" value="history">
<label for="disable-history">Disable History in I2P Tabs</label>
<span class="applicationDesc">History is automatically cleared when your I2P tabs are closed. If you want to clear history as you go, check this box.</span>
</li>
</ul>
</p>
</p>
@@ -56,16 +61,16 @@
<h3>Applications</h3>
<p id="applicationExplain">These applications use I2P to provide them with security and privacy.</p>
<ul>
<li class="application"><button id="window-visit-homepage" class="applicationName window-visit-homepage" href="#">
<li class="application"><button id="window-visit-homepage" target="_blank" class="applicationName window-visit-homepage" href="#">
Home Page <span class="applicationDesc">For more information about this extension, go here:</span>
</button></li>
<li class="application"><button id="window-visit-i2ptunnel" class="applicationName">
<li class="application"><button id="window-visit-i2ptunnel" target="_blank" class="applicationName">
Hidden Services Manager <span class="applicationDesc">I2P has a web-based interface for configuring .i2p services like web sites, to set up your own web sites, go here:</span>
</button></li>
<li class="application"><button id="window-visit-susimail" class="applicationName">
<li class="application"><button id="window-visit-susimail" target="_blank" class="applicationName">
E-Mail <span class="applicationDesc">I2P also bundles a webmail client which can be used to access in-I2P e-mail. To use it, go here:</span>
</button></li>
<li class="application"><button id="window-visit-snark" class="applicationName">
<li class="application"><button id="window-visit-snark" target="_blank" class="applicationName">
BitTorrent <span class="applicationDesc">I2P is capable of anonymous Peer-to-Peer file sharing, to use the built-in bittorrent client go here:</span>
</button></li>
</ul>