aboutsummaryrefslogtreecommitdiffstats
path: root/src/assets
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/assets/javascripts/services.js40
1 files changed, 10 insertions, 30 deletions
diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js
index 7b73d9d5..8aa044ea 100644
--- a/src/assets/javascripts/services.js
+++ b/src/assets/javascripts/services.js
@@ -716,7 +716,11 @@ function processUpdate() {
for (const service in config.services) {
if (!options[service]) options[service] = {}
if (config.services[service].targets == "datajson") targets[service] = redirects[service]
- for (const defaultOption in config.services[service].options) if (!options[service][defaultOption]) options[service][defaultOption] = config.services[service].options[defaultOption]
+ for (const defaultOption in config.services[service].options) {
+ if (options[service][defaultOption] === undefined) {
+ options[service][defaultOption] = config.services[service].options[defaultOption]
+ }
+ }
for (const frontend in config.services[service].frontends) {
if (config.services[service].frontends[frontend].instanceList) {
if (!options[frontend]) options[frontend] = {}
@@ -733,6 +737,11 @@ function processUpdate() {
}
}
}
+ } else {
+ for (const instance of options[frontend][network].enabled) {
+ let i = redirects[frontend][network].indexOf(instance)
+ if (i < 0) options[frontend][network].enabled.splice(i, 1)
+ }
}
}
}
@@ -784,34 +793,6 @@ function modifyContentSecurityPolicy(details) {
}
}
-function processEnabledInstanceList() {
- return new Promise(resolve => {
- fetch("/config/config.json")
- .then(response => response.text())
- .then(configData => {
- const config = JSON.parse(configData)
- browser.storage.local.get(["redirects", "options"], r => {
- let options = r.options
- for (const service in config.services) {
- for (const frontend in config.services[service].frontends) {
- if (config.services[service].frontends[frontend].instanceList) {
- for (const network in config.networks) {
- for (const instance of options[frontend][network].enabled) {
- let i = redirects[frontend][network].indexOf(instance)
- if (i < 0) options[frontend][network].enabled.splice(i, 1)
- }
- }
- }
- }
- }
- browser.storage.local.set({ options }, () => {
- resolve()
- })
- })
- })
- })
-}
-
export default {
redirect,
computeService,
@@ -823,5 +804,4 @@ export default {
upgradeOptions,
processUpdate,
modifyContentSecurityPolicy,
- processEnabledInstanceList,
}