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) {
|
if (customService) {
|
||||||
const instancesList = options[options[customService].frontend]
|
const instancesList = options[options[customService].frontend]
|
||||||
if (instancesList !== undefined) {
|
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 {
|
} else {
|
||||||
for (const service in config.services) {
|
for (const service in config.services) {
|
||||||
|
@ -630,8 +634,11 @@ function switchInstance(url, customService) {
|
||||||
resolve()
|
resolve()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
resolve(`${utils.getNextInstance(url.origin, instancesList)}${url.pathname}${url.search}`)
|
const newInstance = utils.getNextInstance(url.origin, instancesList)
|
||||||
return
|
if (newInstance) {
|
||||||
|
resolve(`${newInstance}${url.pathname}${url.search}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resolve()
|
resolve()
|
||||||
|
|
|
@ -160,9 +160,7 @@ browser.contextMenus.onClicked.addListener(async (info) => {
|
||||||
case 'switchInstanceTab': {
|
case 'switchInstanceTab': {
|
||||||
const url = new URL(info.pageUrl)
|
const url = new URL(info.pageUrl)
|
||||||
const newUrl = await servicesHelper.switchInstance(url)
|
const newUrl = await servicesHelper.switchInstance(url)
|
||||||
if (newUrl) {
|
if (newUrl) browser.tabs.update({ url: newUrl })
|
||||||
browser.tabs.update({ url: newUrl })
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case 'settingsTab': {
|
case 'settingsTab': {
|
||||||
|
|
Loading…
Reference in New Issue