diff options
author | ManeraKai <manerakai@protonmail.com> | 2023-05-12 08:48:16 +0300 |
---|---|---|
committer | ManeraKai <manerakai@protonmail.com> | 2023-05-12 08:48:16 +0300 |
commit | 03d0b41a7fff3ee339944570d982db62312b9447 (patch) | |
tree | c5d1170d883068078d1de547ad0d235f2cd7cfa7 /src/assets/javascripts | |
parent | Updated README (diff) | |
download | libredirect-03d0b41a7fff3ee339944570d982db62312b9447.zip |
ignored http from url exclusions https://github.com/libredirect/browser_extension/issues/665. Cleaned other things
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 } |