This commit is contained in:
ManeraKai 2024-01-08 23:58:18 +03:00
parent b79a485f61
commit cfa6c887f1
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337
2 changed files with 11 additions and 6 deletions

View File

@ -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()

View File

@ -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': {