diff options
| author | Edward <101938856+EdwardLangdon@users.noreply.github.com> | 2022-10-09 18:40:39 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-09 18:40:39 +0530 |
| commit | 488c8c7c8b6b3431aed56c7eb1bc394fc8b6a321 (patch) | |
| tree | 5e7d60bb0f818f0c37ab26babe127b26dd6baad7 /src/assets/javascripts/general.js | |
| parent | Update LibreDirect messages pt_BR 07-29-2022 (diff) | |
| parent | Updated instances (diff) | |
| download | libredirect-488c8c7c8b6b3431aed56c7eb1bc394fc8b6a321.zip | |
Merge branch 'master' into patch-1
Diffstat (limited to 'src/assets/javascripts/general.js')
| -rw-r--r-- | src/assets/javascripts/general.js | 54 |
1 files changed, 19 insertions, 35 deletions
diff --git a/src/assets/javascripts/general.js b/src/assets/javascripts/general.js index 0b34c148..6eb0a454 100644 --- a/src/assets/javascripts/general.js +++ b/src/assets/javascripts/general.js @@ -1,17 +1,20 @@ "use strict" window.browser = window.browser || window.chrome +let exceptions + function isException(url) { for (const item of exceptions.url) if (item == `${url.protocol}//${url.host}`) return true for (const item of exceptions.regex) if (new RegExp(item).test(url.href)) return true return false } -let exceptions - function init() { - browser.storage.local.get("exceptions", r => { - exceptions = r.exceptions + return new Promise(resolve => { + browser.storage.local.get("options", r => { + if (r.options) exceptions = r.options.exceptions + resolve() + }) }) } @@ -22,45 +25,26 @@ async function initDefaults() { return new Promise(resolve => browser.storage.local.set( { - exceptions: { - url: [], - regex: [], + options: { + exceptions: { + url: [], + regex: [], + }, + theme: "detect", + popupServices: ["youtube", "twitter", "instagram", "tiktok", "imgur", "reddit", "quora", "translate", "maps"], + autoRedirect: false, + firstPartyIsolate: false, + network: "clearnet", + networkFallback: true, + latencyThreshold: 1000, }, - theme: "DEFAULT", - popupFrontends: ["youtube", "twitter", "instagram", "tiktok", "imgur", "reddit", "quora", "translate", "maps"], - autoRedirect: false, - firstPartyIsolate: false, - protocol: "normal", - protocolFallback: true, }, () => resolve() ) ) } -const allPopupFrontends = [ - "youtube", - "youtubeMusic", - "twitter", - "instagram", - "tiktok", - "imgur", - "reddit", - "search", - "translate", - "maps", - "wikipedia", - "medium", - "quora", - "imdb", - "reuters", - "peertube", - "lbry", - "sendTargets", -] - export default { isException, initDefaults, - allPopupFrontends, } |
