Fixed a bug in Switch Instance https://github.com/libredirect/browser_extension/issues/877
This commit is contained in:
parent
b79a485f61
commit
cfa6c887f1
@ -617,7 +617,11 @@ function switchInstance(url, customService) {
|
||||
if (customService) {
|
||||
const instancesList = options[options[customService].frontend]
|
||||
if (instancesList !== undefined) {
|
||||
resolve(`${utils.getNextInstance(url.origin, instancesList)}${url.pathname}${url.search}`)
|
||||
const newInstance = utils.getNextInstance(url.origin, instancesList)
|
||||
if (newInstance) {
|
||||
resolve(`${newInstance}${url.pathname}${url.search}`)
|
||||
return
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (const service in config.services) {
|
||||
@ -630,8 +634,11 @@ function switchInstance(url, customService) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
resolve(`${utils.getNextInstance(url.origin, instancesList)}${url.pathname}${url.search}`)
|
||||
return
|
||||
const newInstance = utils.getNextInstance(url.origin, instancesList)
|
||||
if (newInstance) {
|
||||
resolve(`${newInstance}${url.pathname}${url.search}`)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
resolve()
|
||||
|
@ -160,9 +160,7 @@ browser.contextMenus.onClicked.addListener(async (info) => {
|
||||
case 'switchInstanceTab': {
|
||||
const url = new URL(info.pageUrl)
|
||||
const newUrl = await servicesHelper.switchInstance(url)
|
||||
if (newUrl) {
|
||||
browser.tabs.update({ url: newUrl })
|
||||
}
|
||||
if (newUrl) browser.tabs.update({ url: newUrl })
|
||||
return
|
||||
}
|
||||
case 'settingsTab': {
|
||||
|
Loading…
x
Reference in New Issue
Block a user