From 5ab871b51f96c5d9380cdcc06bd9c4e49b3b862e Mon Sep 17 00:00:00 2001 From: idk Date: Sat, 5 Dec 2020 23:43:37 -0500 Subject: [PATCH] fix the search thing --- Makefile | 6 +++--- debian/changelog | 8 ++++++++ host.js | 17 +++++++++++++++-- privacy.js | 31 ++++++++++++++++++++++++------- scrub.js | 4 ++-- 5 files changed, 52 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index a60df75..524c263 100644 --- a/Makefile +++ b/Makefile @@ -37,11 +37,11 @@ clean: rc clean-artifacts ## EVEN RELEASES are AMO RELEASES ## ODD RELEASES are SELFHOSTED RELEASES -MOZ_VERSION=0.86 -VERSION=0.85 +MOZ_VERSION=0.88 +VERSION=0.87 ## INCREMENT THIS EVERY TIME YOU DO A RELEASE -LAST_VERSION=0.83 +LAST_VERSION=0.85 YELLOW=F7E59A ORANGE=FFC56D diff --git a/debian/changelog b/debian/changelog index cfa962d..01153cc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +i2psetproxy.js (0.87-1) UNRELEASED; urgency=low + + * Disable searching for i2p sites in non-i2p search engines + * Add contexts for i2pbote and Dispatch + * + + -- idk Sat, 10 NOV 2020 1:33:50 -0400 + i2psetproxy.js (0.85-1) UNRELEASED; urgency=low * Fix a bug which was causing i2psnark to fail to isolate. diff --git a/host.js b/host.js index 17639ed..e49f0b8 100644 --- a/host.js +++ b/host.js @@ -48,8 +48,21 @@ function i2pHostName(url) { let hostname = ''; console.log('(hosts)', url); if (url.includes('=')) { - lsit = url.split('='); - hostname = lsit[lsit.length - 1]; + 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) + } + break + } + if (hostname != ''){ + break + } + } + } } else if (url.indexOf('://') > -1) { hostname = url.split('/')[2]; } else { diff --git a/privacy.js b/privacy.js index a32783d..04fb994 100644 --- a/privacy.js +++ b/privacy.js @@ -327,20 +327,37 @@ function forgetBrowsingData(storedSettings) { } function i2pHostName(url) { - let hostname = ""; - if (url.includes("=")) { - lsit = url.split("="); - hostname = lsit[lsit.length - 1]; - } else if (url.indexOf("://") > -1) { - hostname = url.split("/")[2]; + let hostname = ''; + console.log('(hosts)', url); + 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) + } + break + } + if (hostname != ''){ + break + } + } + } + } else if (url.indexOf('://') > -1) { + hostname = url.split('/')[2]; } else { - hostname = url.split("/")[0]; + hostname = url.split('/')[0]; } return hostname; } function i2pHost(url) { let hostname = i2pHostName(url); + if (hostname.endsWith(".i2p")){ + console.log("(hostname) i2p", hostname) + } return hostname.endsWith(".i2p"); } diff --git a/scrub.js b/scrub.js index 51adcfb..2a26677 100644 --- a/scrub.js +++ b/scrub.js @@ -622,9 +622,9 @@ var contextSetup = function(requestDetails) { if (requestDetails.url.includes('=' + thn)) { console.log('(scrub)checking search hostnames =' + thn); var tpt = requestDetails.url.split('=' + thn, 2); - requestDetails.url = 'http://' + thn + tpt[1]; - // requestDetails.url = requestDetails.url.replace(requestDetails.url.split("="+i2pHostName(requestDetails.url), i2pHostName(requestDetails.url)) + requestDetails.url = 'http://' + thn +"/"+ tpt[1].replace('%2F', ''); } + console.log('(scrub) new hostname',requestDetails.url) var setcookie = browser.cookies.set({ firstPartyDomain: i2pHostName(requestDetails.url), url: requestDetails.url,