fix the search thing

This commit is contained in:
idk
2020-12-05 23:43:37 -05:00
parent 858d03fa2b
commit 5ab871b51f
5 changed files with 52 additions and 14 deletions

View File

@@ -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

8
debian/changelog vendored
View File

@@ -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 <hankhill19580@gmail.com> 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.

17
host.js
View File

@@ -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 {

View File

@@ -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");
}

View File

@@ -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,