fix the theme issue

This commit is contained in:
idk
2021-01-31 01:07:14 -05:00
parent 8bebe2a920
commit 54b5be97e2
23 changed files with 1158 additions and 1177 deletions

146
host.js
View File

@@ -1,15 +1,15 @@
function proxyHost(url) {
let hostname = '';
if (url.indexOf('://') > -1) {
hostname = url.split('/')[2];
let hostname = "";
if (url.indexOf("://") > -1) {
hostname = url.split("/")[2];
} else {
hostname = url.split('/')[0];
hostname = url.split("/")[0];
}
if (hostname == 'proxy.i2p') {
if (hostname == "proxy.i2p") {
return true;
}
if (
hostname == 'c6lilt4cr5x7jifxridpkesf2zgfwqfchtp6laihr4pdqomq25iq.b32.i2p'
hostname == "c6lilt4cr5x7jifxridpkesf2zgfwqfchtp6laihr4pdqomq25iq.b32.i2p"
) {
return true;
}
@@ -17,16 +17,16 @@ function proxyHost(url) {
}
function localHost(url) {
let hostname = '';
if (url.indexOf('://') > -1) {
hostname = url.split('/')[2];
let hostname = "";
if (url.indexOf("://") > -1) {
hostname = url.split("/")[2];
} else {
hostname = url.split('/')[0];
hostname = url.split("/")[0];
}
hostname = hostname.split(':')[0];
if (hostname === '127.0.0.1') {
hostname = hostname.split(":")[0];
if (hostname === "127.0.0.1") {
return true;
} else if (hostname === 'localhost') {
} else if (hostname === "localhost") {
return true;
}
@@ -35,122 +35,122 @@ function localHost(url) {
function extensionHost(url) {
if (url.originUrl !== undefined) {
var res = url.originUrl.startsWith(browser.runtime.getURL(''));
var res = url.originUrl.startsWith(browser.runtime.getURL(""));
if (res) return res;
}
if (url.url !== undefined) {
var res = url.url.startsWith(browser.runtime.getURL(''));
var res = url.url.startsWith(browser.runtime.getURL(""));
if (res) return res;
}
}
function i2pHostName(url) {
let hostname = '';
console.log('(hosts)', url);
let hostname = "";
console.log("(hosts)", url);
let u = new URL(url);
if (u.host.endsWith('.i2p')) {
if (u.host.endsWith(".i2p")) {
hostname = u.host;
} else if (url.includes('=')) {
if (url.includes('.i2p')) {
lsit = url.split('=');
} else if (url.includes("=")) {
if (url.includes(".i2p")) {
lsit = url.split("=");
for (let item in lsit) {
var items = lsit[item].split(`\ % `); //"\%")
for (let p in items) {
if (items[p].includes('.i2p')) {
hostname = items[p].replace('3D', 1);
if (items[p].includes(".i2p")) {
hostname = items[p].replace("3D", 1);
}
break;
}
if (hostname != '') {
if (hostname != "") {
break;
}
}
}
} else if (url.indexOf('://') > -1) {
hostname = url.split('/')[2];
} else if (url.indexOf("://") > -1) {
hostname = url.split("/")[2];
} else {
hostname = url.split('/')[0];
hostname = url.split("/")[0];
}
console.log('(hosts) scrub', hostname);
console.log("(hosts) scrub", hostname);
return hostname;
}
function i2pHost(url) {
let hostname = i2pHostName(url);
return hostname.endsWith('.i2p');
return hostname.endsWith(".i2p");
}
function routerHost(url) {
// console.log("(urlcheck) HOST URL CHECK");
let hostname = '';
let path = '';
let hostname = "";
let path = "";
function pathcheck(str) {
if (str != undefined) {
let final = str.split('/')[0];
if (final === 'i2ptunnelmgr' || final === 'i2ptunnel') {
console.log('(urlcheck) Tunnel application path', final);
return 'i2ptunnelmgr';
let final = str.split("/")[0];
if (final === "i2ptunnelmgr" || final === "i2ptunnel") {
console.log("(urlcheck) Tunnel application path", final);
return "i2ptunnelmgr";
} else if (
final === 'i2psnark' ||
final === 'torrents' ||
final.startsWith('transmission') ||
final.startsWith('tracker') ||
url.includes(':7662')
final === "i2psnark" ||
final === "torrents" ||
final.startsWith("transmission") ||
final.startsWith("tracker") ||
url.includes(":7662")
) {
console.log('(urlcheck) Torrent application path', final);
return 'i2psnark';
} else if (final === 'webmail' || final === 'susimail') {
console.log('(urlcheck) Mail application path', final);
return 'webmail';
} else if (final.startsWith('MuWire')) {
if (!url.includes('.png')) {
console.log('(urlcheck) MuWire application path', final);
return 'muwire';
console.log("(urlcheck) Torrent application path", final);
return "i2psnark";
} else if (final === "webmail" || final === "susimail") {
console.log("(urlcheck) Mail application path", final);
return "webmail";
} else if (final.startsWith("MuWire")) {
if (!url.includes(".png")) {
console.log("(urlcheck) MuWire application path", final);
return "muwire";
}
} else if (final.startsWith('i2pbote')) {
if (!url.includes('.png')) {
console.log('(urlcheck) I2PBote application path', final);
return 'i2pbote';
} else if (final.startsWith("i2pbote")) {
if (!url.includes(".png")) {
console.log("(urlcheck) I2PBote application path", final);
return "i2pbote";
}
} else if (
final === 'home' ||
final === 'console' ||
final === 'dns' ||
final === 'susidns' ||
final.startsWith('susidns') ||
final === 'sitemap' ||
final.startsWith('config')
final === "home" ||
final === "console" ||
final === "dns" ||
final === "susidns" ||
final.startsWith("susidns") ||
final === "sitemap" ||
final.startsWith("config")
) {
console.log('(urlcheck) Console application path', final);
return 'routerconsole';
console.log("(urlcheck) Console application path", final);
return "routerconsole";
}
}
return true;
}
if (url.indexOf('://') > -1) {
hostname = url.split('/')[2];
let prefix = url.substr(0, url.indexOf('://') + 3);
path = url.replace(prefix + hostname + '/', '');
if (url.indexOf("://") > -1) {
hostname = url.split("/")[2];
let prefix = url.substr(0, url.indexOf("://") + 3);
path = url.replace(prefix + hostname + "/", "");
} else if (identifyProtocolHandler(url)) {
let newurl = identifyProtocolHandler(url);
return routerHost(newurl);
} else {
hostname = url.split('/')[0];
path = url.replace(hostname + '/', '');
hostname = url.split("/")[0];
path = url.replace(hostname + "/", "");
}
if (hostname === control_host + ':' + control_port) {
if (hostname === control_host + ":" + control_port) {
return pathcheck(path);
}
if (hostname === 'localhost' + ':' + control_port) {
if (hostname === "localhost" + ":" + control_port) {
return pathcheck(path);
}
if (hostname === '127.0.0.1' + ':' + control_port) {
if (hostname === "127.0.0.1" + ":" + control_port) {
return pathcheck(path);
}
if (hostname === 'localhost' + ':' + 7070) {
if (hostname === "localhost" + ":" + 7070) {
return pathcheck(path);
}
if (hostname === '127.0.0.1' + ':' + 7070) {
if (hostname === "127.0.0.1" + ":" + 7070) {
return pathcheck(path);
}
return false;