small fix
This commit is contained in:
parent
e8a67e9172
commit
84e863c477
|
@ -376,7 +376,8 @@ function redirect(url, type, initiator) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function computeService(url, returnFrontend) {
|
function computeService(url, returnFrontend) {
|
||||||
|
return new Promise(resolve => {
|
||||||
fetch("/config/config.json")
|
fetch("/config/config.json")
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(configData => {
|
.then(configData => {
|
||||||
|
@ -386,14 +387,21 @@ async function computeService(url, returnFrontend) {
|
||||||
const options = r.options
|
const options = r.options
|
||||||
for (const service in config.services) {
|
for (const service in config.services) {
|
||||||
if (regexArray(service, url, config)) {
|
if (regexArray(service, url, config)) {
|
||||||
if (returnFrontend) return [service, null]
|
if (returnFrontend) {
|
||||||
else return service
|
resolve([service, null])
|
||||||
|
} else {
|
||||||
|
resolve(service)
|
||||||
|
}
|
||||||
|
return
|
||||||
} else {
|
} else {
|
||||||
for (const frontend in config.services[service].frontends) {
|
for (const frontend in config.services[service].frontends) {
|
||||||
if (all(service, frontend, options, config, redirects).includes(utils.protocolHost(url))) {
|
if (all(service, frontend, options, config, redirects).includes(utils.protocolHost(url))) {
|
||||||
if (returnFrontend) {
|
if (returnFrontend) {
|
||||||
return [service, frontend]
|
resolve([service, frontend])
|
||||||
} else return service
|
} else {
|
||||||
|
resolve(service)
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -402,6 +410,7 @@ async function computeService(url, returnFrontend) {
|
||||||
// else return null
|
// else return null
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function switchInstance(url) {
|
async function switchInstance(url) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ const currentSiteIsFrontend = document.getElementById("current_site_divider")
|
||||||
|
|
||||||
browser.storage.local.get("options", r => {
|
browser.storage.local.get("options", r => {
|
||||||
browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
|
browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
|
||||||
for (const service in config.services) {
|
for (const service in config.services) {
|
||||||
if (!r.options.popupServices.includes(service)) allSites.getElementsByClassName(service)[0].classList.add("hide")
|
if (!r.options.popupServices.includes(service)) allSites.getElementsByClassName(service)[0].classList.add("hide")
|
||||||
else allSites.getElementsByClassName(service)[0].classList.remove("hide")
|
else allSites.getElementsByClassName(service)[0].classList.remove("hide")
|
||||||
currSite.getElementsByClassName(service)[0].classList.add("hide")
|
currSite.getElementsByClassName(service)[0].classList.add("hide")
|
||||||
|
|
Loading…
Reference in New Issue