Stopped custom instances displaying the toggle instance popup

This commit is contained in:
Hygna 2022-10-15 14:00:46 +01:00
parent 7d5a6561ab
commit ea4126d75e
No known key found for this signature in database

View File

@ -87,6 +87,9 @@ browser.storage.local.get(["options", "redirects"], r => {
instance = service[2]
frontend = service[1]
service = service[0]
let isCustom = false
for (const network in config.networks) if (r.options[frontend][network].custom.indexOf(instance) > -1) isCustom = true
if (!isCustom) {
divs.instance.innerHTML = instance.replace(/https?:\/{2}/, "")
let tmp
let instanceNetwork
@ -100,7 +103,7 @@ browser.storage.local.get(["options", "redirects"], r => {
instanceNetwork = network
instanceDiv.addEventListener("change", () => {
browser.storage.local.get("options", r => {
// Although options would be avaliable in this context, it is fetched again to make sure it is up to date
// Although options would be available in this context, it is fetched again to make sure it is up to date
let options = r.options
if (instanceDiv.checked) options[frontend][instanceNetwork].enabled.push(instance)
else options[frontend][instanceNetwork].enabled.splice(options[frontend][instanceNetwork].enabled.indexOf(instance), 1)
@ -112,6 +115,7 @@ browser.storage.local.get(["options", "redirects"], r => {
}
document.getElementById("instance-div").classList.remove("hide")
}
}
divs[service].current.classList.remove("hide")
divs[service].all.classList.add("hide")
if (frontend && config.services[service].frontends[frontend].preferences && !config.services[service].frontends[frontend].preferences.token) {