fix up some flow issues, should be OK this way

This commit is contained in:
idk
2020-10-07 12:55:26 -04:00
parent 357b1a93b4
commit 100f27b4be
3 changed files with 58 additions and 6 deletions

View File

@@ -178,12 +178,14 @@ function themeWindow(window) {
}
});
}
browser.pageAction.setPopup({
tabId: tabInfo[0].id,
popup: 'security.html'
});
//console.log("(background) tabinfo", tabInfo[0].id)
browser.pageAction.show(tabInfo[0].id);
if (tabinfo.url.startsWith("https://")){
browser.pageAction.setPopup({
tabId: tabInfo[0].id,
popup: 'security.html'
});
//console.log("(background) tabinfo", tabInfo[0].id)
browser.pageAction.show(tabInfo[0].id);
}
} else if (context.name == routerpref) {
console.log('Active in Router Console window');
if (window.incognito) {

View File

@@ -625,6 +625,20 @@ var coolheadersSetup = function(e) {
});
break;
}
}else{
if (header.name.toUpperCase() === 'I2P-TORRENTLOCATION' || header.name.toUpperCase() === 'X-I2P-TORRENTLOCATION') {
browser.pageAction.setPopup({
tabId: tabId.id,
popup: 'torrent.html'
});
browser.pageAction.setIcon({path: 'icons/i2plogo.png', tabId: e.tabId});
browser.pageAction.show(e.tabId);
browser.pageAction.setTitle({
tabId: e.tabId,
title: header.value
});
break;
}
}
}
resolve({responseHeaders: e.responseHeaders});
@@ -651,6 +665,22 @@ function getClearTab(tobj) {
}
});
console.log("(pageaction)", tab.id, tab.url)
} else {
browser.tabs.sendMessage( tab.id, {'req':'i2p-torrentlocation'}).then( response => {
if (response.content.toUpperCase() != "NO-ALT-LOCATION"){
browser.pageAction.setPopup({
tabId: tab.id,
popup: 'torrent.html'
});
browser.pageAction.setIcon({path: 'icons/i2plogo.png', tabId: tab.id});
browser.pageAction.setTitle({
tabId: tab.id,
title: response.content
});
browser.pageAction.show(tab.id);
}
});
console.log("(pageaction)", tab.id, tab.url)
}
}
browser.tabs.get(tobj.tabId).then(getTabURL, onError)

View File

@@ -0,0 +1,20 @@
function gotCurrent(tab) {
function gotTitle(title) {
let addr = title;
document.getElementById('TypeInfo').innerHTML = '<div class=\"AddressInfo\"><a href=\"' + addr + '\">' + addr + '</a></div>';
}
console.log(tab);
var gettingTitle = browser.pageAction.getTitle({
tabId: tab[0].id
});
gettingTitle.then(gotTitle);
}
function tabError(error) {
console.log(`Error : ${error}`);
}
const gettingCurrent = browser.tabs.query({ active: true });
gettingCurrent.then(gotCurrent, tabError);