fix xhr redirect thing when a router console page is passed to firefox as an argument at startup
This commit is contained in:
12
handler.js
12
handler.js
@@ -7,7 +7,12 @@ function routerHost(url) {
|
||||
if (final === 'i2ptunnelmgr' || final === 'i2ptunnel') {
|
||||
console.log('(urlcheck) Tunnel application path', final);
|
||||
return 'i2ptunnelmgr';
|
||||
} else if (final === 'i2psnark' || final === 'torrents') {
|
||||
} else if (
|
||||
final === 'i2psnark' ||
|
||||
final === 'torrents' ||
|
||||
final.startsWith('transmission') ||
|
||||
final.startsWith('tracker')
|
||||
) {
|
||||
console.log('(urlcheck) Torrent application path', final);
|
||||
return 'i2psnark';
|
||||
} else if (final === 'webmail' || final === 'susimail') {
|
||||
@@ -15,13 +20,14 @@ function routerHost(url) {
|
||||
return 'webmail';
|
||||
} else if (final.startsWith('MuWire')) {
|
||||
if (!url.includes('.png')) {
|
||||
console.log('(urlcheck) MuWire application path', final);
|
||||
return 'muwire';
|
||||
console.log('(urlcheck) MuWire application path', final);
|
||||
return 'muwire';
|
||||
}
|
||||
} else if (
|
||||
final === 'home' ||
|
||||
final === 'console' ||
|
||||
final === 'dns' ||
|
||||
final === 'sitemap' ||
|
||||
final.startsWith('config')
|
||||
) {
|
||||
console.log('(urlcheck) Console application path', final);
|
||||
|
||||
12
host.js
12
host.js
@@ -71,7 +71,8 @@ function routerHost(url) {
|
||||
} else if (
|
||||
final === 'i2psnark' ||
|
||||
final === 'torrents' ||
|
||||
final.startsWith('transmission')
|
||||
final.startsWith('transmission') ||
|
||||
final.startsWith('tracker')
|
||||
) {
|
||||
console.log('(urlcheck) Torrent application path', final);
|
||||
return 'i2psnark';
|
||||
@@ -110,6 +111,15 @@ function routerHost(url) {
|
||||
if (hostname === control_host + ':' + control_port) {
|
||||
return pathcheck(path);
|
||||
}
|
||||
if (hostname === control_host + ':' + "7662") {
|
||||
return pathcheck(path);
|
||||
}
|
||||
if (hostname === 'localhost' + ':' + "7662") {
|
||||
return pathcheck(path);
|
||||
}
|
||||
if (hostname === '127.0.0.1' + ':' + "7662") {
|
||||
return pathcheck(path);
|
||||
}
|
||||
if (hostname === 'localhost' + ':' + control_port) {
|
||||
return pathcheck(path);
|
||||
}
|
||||
|
||||
29
scrub.js
29
scrub.js
@@ -205,6 +205,11 @@ var contextSetup = function(requestDetails) {
|
||||
});
|
||||
pins.then(closeOldTab, onError);
|
||||
}
|
||||
if (requestDetails.url.endsWith("xhr1.html")){
|
||||
hostname = url.split('/')[2];
|
||||
let prefix = url.substr(0, url.indexOf('://') + 3);
|
||||
requestDetails.url = prefix+hostname+"/home"
|
||||
}
|
||||
var created = browser.tabs.create({
|
||||
active: true,
|
||||
pinned: true,
|
||||
@@ -246,6 +251,11 @@ var contextSetup = function(requestDetails) {
|
||||
});
|
||||
pins.then(closeOldTab, onError);
|
||||
}
|
||||
if (requestDetails.url.endsWith("xhr1.html")){
|
||||
hostname = url.split('/')[2];
|
||||
let prefix = url.substr(0, url.indexOf('://') + 3);
|
||||
requestDetails.url = prefix+hostname+"/i2ptunnelmgr/"
|
||||
}
|
||||
var created = browser.tabs.create({
|
||||
active: true,
|
||||
pinned: true,
|
||||
@@ -287,6 +297,11 @@ var contextSetup = function(requestDetails) {
|
||||
});
|
||||
pins.then(closeOldTab, onError);
|
||||
}
|
||||
if (requestDetails.url.endsWith("xhr1.html")){
|
||||
hostname = url.split('/')[2];
|
||||
let prefix = url.substr(0, url.indexOf('://') + 3);
|
||||
requestDetails.url = prefix+hostname+"/i2psnark/"
|
||||
}
|
||||
var created = browser.tabs.create({
|
||||
active: true,
|
||||
pinned: true,
|
||||
@@ -328,6 +343,11 @@ var contextSetup = function(requestDetails) {
|
||||
});
|
||||
pins.then(closeOldTab, onError);
|
||||
}
|
||||
if (requestDetails.url.endsWith("xhr1.html")){
|
||||
hostname = url.split('/')[2];
|
||||
let prefix = url.substr(0, url.indexOf('://') + 3);
|
||||
requestDetails.url = prefix+hostname+"/muwire/"
|
||||
}
|
||||
var created = browser.tabs.create({
|
||||
active: true,
|
||||
pinned: true,
|
||||
@@ -369,6 +389,11 @@ var contextSetup = function(requestDetails) {
|
||||
});
|
||||
pins.then(closeOldTab, onError);
|
||||
}
|
||||
if (requestDetails.url.endsWith("xhr1.html")){
|
||||
hostname = url.split('/')[2];
|
||||
let prefix = url.substr(0, url.indexOf('://') + 3);
|
||||
requestDetails.url = prefix+hostname+"/webmail/"
|
||||
}
|
||||
var created = browser.tabs.create({
|
||||
active: true,
|
||||
pinned: true,
|
||||
@@ -566,12 +591,9 @@ var contextSetup = function(requestDetails) {
|
||||
var coolheadersSetup = function(e) {
|
||||
var asyncSetPageAction = new Promise((resolve, reject) => {
|
||||
window.setTimeout(() => {
|
||||
console.log('(alternate)', e.responseHeaders)
|
||||
// for (header in Object.entries(e.responseHeaders)) {
|
||||
for (i = 0; i < e.responseHeaders.length; i++) {
|
||||
let header = e.responseHeaders[i];
|
||||
if (header.name.toUpperCase() === 'I2P-LOCATION' || header.name.toUpperCase() === 'X-I2P-LOCATION') {
|
||||
console.log('(alternate-header)\n\t', header.name.toUpperCase(), '\n\t', e.tabId);
|
||||
browser.pageAction.setPopup({
|
||||
tabId: e.tabId,
|
||||
popup: 'location.html'
|
||||
@@ -584,7 +606,6 @@ var coolheadersSetup = function(e) {
|
||||
browser.pageAction.show(e.tabId);
|
||||
}
|
||||
if (header.name.toUpperCase() === 'I2P-TORRENTLOCATION' || header.name.toUpperCase() === 'I2P-TORRENTLOCATION') {
|
||||
console.log('(alternate-header)', header.name);
|
||||
browser.pageAction.setPopup({
|
||||
tabId: tabId.id,
|
||||
popup: 'torrent.html'
|
||||
|
||||
Reference in New Issue
Block a user