fix proxy error page spam

This commit is contained in:
idk
2022-10-05 17:10:53 -04:00
parent 15893f5ff1
commit ad9374088a
3 changed files with 35 additions and 3 deletions

View File

@@ -30,6 +30,11 @@
<div class="hideIfI2PProxyOff" id="readyness">
<img class="readyness" src="icons/local_up.png"> <span id="proxy-check">Proxy is ready.</span>
</div>
<div class="hideIfI2PProxyOff" id="visit-url">
<form action="" method="get">
<input id="url-query" name="query" placeholder="Open a URL in an I2P tab:" type="search"> <input id="url-submit" text="Submit" type="submit">
</form>
</div>
</div>
<div class="hideIfI2PConsoleOff" id="onboarding">

27
info.js
View File

@@ -1,3 +1,5 @@
var titlepref = chrome.i18n.getMessage('titlePreface');
function checkPeerConnection() {
let getting = browser.privacy.network.peerConnectionEnabled.get({});
getting.then((got) => {
@@ -111,6 +113,9 @@ document.addEventListener("click", (clickEvent) => {
} else if (clickEvent.target.id === "search-submit") {
console.log("attempting to create search tab");
goSearch();
} else if (clickEvent.target.id === "url-submit") {
console.log("attempting to create search tab");
goURL();
} else if (clickEvent.target.id === "browser-action") {
console.log("showing a browser action");
showBrowsing();
@@ -318,6 +323,26 @@ function goSearch() {
creating.then(onTabCreated, onTabError);
}
function goURL() {
function onTabError() {
console.log("Search tab created");
}
function createNewURLTab(context) {
console.log("visiting URL");
let createData = {
url: document.getElementById("url-query").value,
cookieStoreId: context[0].cookieStoreId
};
let creating = browser.tabs.create(createData);
creating.then(onTabCreated, onTabError);
}
let context = browser.contextualIdentities.query({
name: titlepref
});
context.then(createNewURLTab, onTabError);
}
function routerAddr() {
if (!control_host) var control_host = "127.0.0.1";
if (!control_port) var control_port = "7657";
@@ -403,4 +428,4 @@ const interval = minutes * 60 * 1000;
setInterval(function() {
if (UpdateContents !== undefined) UpdateContents();
}, interval);
}, interval);

View File

@@ -454,7 +454,9 @@ function handleContextProxyError(err) {
console.error(`(proxy) Error : ${error}`);
}
if (err.message !== 'ProxyInfoData: Invalid proxy server type: \"undefined\"') {
if (err.message === 'ProxyInfoData: Invalid proxy server type: \"undefined\"') {
return;
} else {
console.warn('(proxy) Error:', err);
}
@@ -520,4 +522,4 @@ gettingListenerInfo.then(got => {
});
});
}
});
});