Fixed Switch Instance not working from context menu https://github.com/libredirect/libredirect/issues/609
This commit is contained in:
parent
a3b2f52836
commit
7ee9fb21ea
@ -77,7 +77,7 @@ browser.tabs.onRemoved.addListener(tabId => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
browser.commands.onCommand.addListener(async command => {
|
browser.commands.onCommand.addListener(async command => {
|
||||||
if (command === "switchInstance") {
|
if (command == "switchInstance") {
|
||||||
const newUrl = await servicesHelper.switchInstance()
|
const newUrl = await servicesHelper.switchInstance()
|
||||||
if (newUrl) browser.tabs.update({ url: newUrl })
|
if (newUrl) browser.tabs.update({ url: newUrl })
|
||||||
}
|
}
|
||||||
@ -117,7 +117,8 @@ browser.contextMenus.create({
|
|||||||
browser.contextMenus.onClicked.addListener((info, tab) => {
|
browser.contextMenus.onClicked.addListener((info, tab) => {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
if (info.menuItemId == 'switchInstance') {
|
if (info.menuItemId == 'switchInstance') {
|
||||||
servicesHelper.switchInstance()
|
const newUrl = await servicesHelper.switchInstance()
|
||||||
|
if (newUrl) browser.tabs.update({ url: newUrl })
|
||||||
}
|
}
|
||||||
else if (info.menuItemId == 'settings') {
|
else if (info.menuItemId == 'settings') {
|
||||||
browser.runtime.openOptionsPage()
|
browser.runtime.openOptionsPage()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user