diff options
Diffstat (limited to 'src/assets/javascripts')
-rw-r--r-- | src/assets/javascripts/general.js | 30 | ||||
-rw-r--r-- | src/assets/javascripts/services.js | 13 |
2 files changed, 11 insertions, 32 deletions
diff --git a/src/assets/javascripts/general.js b/src/assets/javascripts/general.js deleted file mode 100644 index 588c67d1..00000000 --- a/src/assets/javascripts/general.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict" - -import utils from "./utils.js" - -window.browser = window.browser || window.chrome - -let exceptions - -function isException(url) { - if (exceptions && url) { - if (exceptions.url) for (const item of exceptions.url) if (item == url.href) return true - if (exceptions.regex) for (const item of exceptions.regex) if (new RegExp(item).test(url.href)) return true - } - return false -} - -function init() { - return new Promise(async resolve => { - const options = await utils.getOptions() - if (options) exceptions = options.exceptions - resolve() - }) -} - -init() -browser.storage.onChanged.addListener(init) - -export default { - isException, -} diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 12a08d32..37847a57 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -83,7 +83,6 @@ function redirect(url, type, initiator, forceRedirection) { ) return "BYPASSTAB" randomInstance = utils.getRandomInstance(instanceList) - console.log(options[service].localhost) if (config.services[service].frontends[frontend].localhost && options[service].instance == "localhost") { randomInstance = `http://${frontend}.localhost:8080` } @@ -819,6 +818,15 @@ async function copyRaw(url, test) { } } +function isException(url) { + let exceptions = options.exceptions + if (exceptions && url) { + if (exceptions.url) for (const item of exceptions.url) if (item == url.href) return true + if (exceptions.regex) for (const item of exceptions.regex) if (new RegExp(item).test(url.href)) return true + } + return false +} + export default { redirect, redirectAsync, @@ -828,5 +836,6 @@ export default { upgradeOptions, processUpdate, copyRaw, - switchInstance + switchInstance, + isException } |