fix #102
This commit is contained in:
6
host.js
6
host.js
@ -47,7 +47,10 @@ function extensionHost(url) {
|
||||
function i2pHostName(url) {
|
||||
let hostname = '';
|
||||
console.log('(hosts)', url);
|
||||
if (url.includes('=')) {
|
||||
let u = new URL(url);
|
||||
if (u.host.endsWith('.i2p')) {
|
||||
hostname = u.host;
|
||||
} else if (url.includes('=')) {
|
||||
if (url.includes('.i2p')) {
|
||||
lsit = url.split('=');
|
||||
for (let item in lsit) {
|
||||
@ -68,6 +71,7 @@ function i2pHostName(url) {
|
||||
} else {
|
||||
hostname = url.split('/')[0];
|
||||
}
|
||||
console.log('(hosts) scrub', hostname);
|
||||
return hostname;
|
||||
}
|
||||
|
||||
|
14
privacy.js
14
privacy.js
@ -417,27 +417,37 @@ function forgetBrowsingData(storedSettings) {
|
||||
function i2pHostName(url) {
|
||||
let hostname = "";
|
||||
console.log("(hosts)", url);
|
||||
if (url.includes("=")) {
|
||||
let u = new URL(url);
|
||||
if (u.host.endsWith(".i2p")) {
|
||||
hostname = u.host;
|
||||
} else if (url.includes("=")) {
|
||||
console.log("(hosts) scrub 1", url);
|
||||
if (url.includes(".i2p")) {
|
||||
lsit = url.split("=");
|
||||
console.log("(hosts) scrub 2", hostname);
|
||||
for (let item in lsit) {
|
||||
var items = lsit[item].split(`\%`); //"\%")
|
||||
var items = lsit[item].split(`\ % `); //"\%")
|
||||
for (let p in items) {
|
||||
if (items[p].includes(".i2p")) {
|
||||
hostname = items[p].replace("3D", 1);
|
||||
}
|
||||
console.log("(hosts) scrub 3", hostname);
|
||||
break;
|
||||
}
|
||||
if (hostname != "") {
|
||||
console.log("(hosts) scrub 4", hostname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (url.indexOf("://") > -1) {
|
||||
hostname = url.split("/")[2];
|
||||
console.log("(hosts) scrub 5", hostname);
|
||||
} else {
|
||||
hostname = url.split("/")[0];
|
||||
console.log("(hosts) scrub 6", hostname);
|
||||
}
|
||||
console.log("(hosts) scrub 7", hostname);
|
||||
return hostname;
|
||||
}
|
||||
|
||||
|
79
scrub.js
79
scrub.js
@ -489,80 +489,6 @@ var contextSetup = function(requestDetails) {
|
||||
console.log('(isolate)Context Error', error);
|
||||
}
|
||||
};
|
||||
var normalTabFind = async function(tabId) {
|
||||
if (tabId == undefined) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
var anoncontext = await browser.contextualIdentities.query({
|
||||
name: titlepref,
|
||||
});
|
||||
var irccontext = await browser.contextualIdentities.query({
|
||||
name: ircpref,
|
||||
});
|
||||
var othercontexts = await notMyContextNotMyProblem();
|
||||
var nmp = false;
|
||||
for (context in othercontexts) {
|
||||
if (tabId.cookieStoreId == othercontexts[context].cookieStoreId) {
|
||||
console.log('Not my problem');
|
||||
nmp = true;
|
||||
}
|
||||
}
|
||||
if (
|
||||
tabId.cookieStoreId == 'firefox-default' ||
|
||||
tabId.cookieStoreId == 'firefox-private' ||
|
||||
tabId.cookieStoreId == anoncontext[0].cookieStoreId ||
|
||||
tabId.cookieStoreId == irccontext[0].cookieStoreId ||
|
||||
nmp
|
||||
) {
|
||||
console.log(
|
||||
'(ISOLATE)',
|
||||
tabId.cookieStoreId,
|
||||
'not',
|
||||
anoncontext[0].cookieStoreId,
|
||||
irccontext[0].cookieStoreId
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
function Create() {
|
||||
function onCreated(tab) {
|
||||
function closeOldTab() {
|
||||
if (
|
||||
tabId.id != tab.id &&
|
||||
tabId.cookieStoreId != tab.cookieStoreId
|
||||
) {
|
||||
console.log(
|
||||
'(isolate) Closing isolated tab',
|
||||
tabId.id,
|
||||
'with context',
|
||||
tabId.cookieStoreId
|
||||
);
|
||||
console.log(
|
||||
'(isolate) in favor of',
|
||||
tab.id,
|
||||
'with context',
|
||||
tab.cookieStoreId
|
||||
);
|
||||
browser.tabs.remove(tabId.id);
|
||||
}
|
||||
}
|
||||
closeOldTab(tab);
|
||||
}
|
||||
var created = browser.tabs.create({
|
||||
active: true,
|
||||
cookieStoreId: 'firefox-default',
|
||||
url: requestDetails.url,
|
||||
});
|
||||
created.then(onCreated, onContextError);
|
||||
}
|
||||
var gettab = browser.tabs.get(tabId.id);
|
||||
gettab.then(Create, onContextError);
|
||||
return tabId;
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('(isolate)Context Error', error);
|
||||
}
|
||||
};
|
||||
var tabGet = async function(tabId) {
|
||||
try {
|
||||
//console.log("(isolate)Tab ID from Request", tabId);
|
||||
@ -617,9 +543,6 @@ var contextSetup = function(requestDetails) {
|
||||
var irctab = tab.then(ircTabFind, onContextError);
|
||||
return requestDetails;
|
||||
}
|
||||
var normalTab = tab.then(normalTabFind, onContextError);
|
||||
return requestDetails;
|
||||
//return requestDetails;
|
||||
}
|
||||
// if (oldtab.cookieStoreId == 'firefox-default') {
|
||||
if (i2pHost(requestDetails.url)) {
|
||||
@ -646,7 +569,7 @@ var contextSetup = function(requestDetails) {
|
||||
secure: true,
|
||||
});
|
||||
setcookie.then(onContextGotLog, onContextError);
|
||||
if (!localhost) {
|
||||
if (!routerhost) {
|
||||
var i2ptab = tab.then(i2pTabFind, onContextError);
|
||||
}
|
||||
return requestDetails;
|
||||
|
Reference in New Issue
Block a user