From 4c69fa7e292a3896ef5f4daf1e6dea3c9bd0b446 Mon Sep 17 00:00:00 2001 From: BobIsMyManager Date: Mon, 1 Aug 2022 13:31:16 +0100 Subject: Latency threshold, LBRY/Odysee -> LBRY Closes https://github.com/libredirect/libredirect/pull/405 --- src/assets/images/imgur-icon.png | Bin 26675 -> 0 bytes src/assets/images/imgur.png | Bin 0 -> 26675 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/assets/images/imgur-icon.png create mode 100644 src/assets/images/imgur.png (limited to 'src/assets/images') diff --git a/src/assets/images/imgur-icon.png b/src/assets/images/imgur-icon.png deleted file mode 100644 index c23a45b2..00000000 Binary files a/src/assets/images/imgur-icon.png and /dev/null differ diff --git a/src/assets/images/imgur.png b/src/assets/images/imgur.png new file mode 100644 index 00000000..c23a45b2 Binary files /dev/null and b/src/assets/images/imgur.png differ -- cgit 1.4.1 From 09b2b961164051314813fdf9984881b3a3124874 Mon Sep 17 00:00:00 2001 From: Hygna Date: Tue, 13 Sep 2022 21:15:52 +0100 Subject: add files --- src/assets/images/medium-icon.svg | 5 +++++ src/pages/widgets/head.ejs | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/assets/images/medium-icon.svg create mode 100644 src/pages/widgets/head.ejs (limited to 'src/assets/images') diff --git a/src/assets/images/medium-icon.svg b/src/assets/images/medium-icon.svg new file mode 100644 index 00000000..2939a189 --- /dev/null +++ b/src/assets/images/medium-icon.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/pages/widgets/head.ejs b/src/pages/widgets/head.ejs new file mode 100644 index 00000000..d9e3802a --- /dev/null +++ b/src/pages/widgets/head.ejs @@ -0,0 +1,8 @@ + + + + + + General + + -- cgit 1.4.1 From 4c1099771caba798573f147fc08e5a474fc7a81b Mon Sep 17 00:00:00 2001 From: Hygna Date: Fri, 16 Sep 2022 19:33:39 +0100 Subject: More ejs progress --- src/assets/images/about-icon.svg | 3 +++ src/assets/images/general-icon.svg | 0 src/assets/images/maps-icon.svg | 3 +++ src/assets/images/search-icon.svg | 3 +++ src/assets/images/translate-icon.svg | 3 +++ src/pages/options/index.ejs | 13 +++++++++++++ src/pages/widgets/links.ejs | 7 +++++++ 7 files changed, 32 insertions(+) create mode 100644 src/assets/images/about-icon.svg create mode 100644 src/assets/images/general-icon.svg create mode 100644 src/assets/images/maps-icon.svg create mode 100644 src/assets/images/search-icon.svg create mode 100644 src/assets/images/translate-icon.svg create mode 100644 src/pages/options/index.ejs create mode 100644 src/pages/widgets/links.ejs (limited to 'src/assets/images') diff --git a/src/assets/images/about-icon.svg b/src/assets/images/about-icon.svg new file mode 100644 index 00000000..551255e6 --- /dev/null +++ b/src/assets/images/about-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/images/general-icon.svg b/src/assets/images/general-icon.svg new file mode 100644 index 00000000..e69de29b diff --git a/src/assets/images/maps-icon.svg b/src/assets/images/maps-icon.svg new file mode 100644 index 00000000..c66a89d1 --- /dev/null +++ b/src/assets/images/maps-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/images/search-icon.svg b/src/assets/images/search-icon.svg new file mode 100644 index 00000000..cb73ff15 --- /dev/null +++ b/src/assets/images/search-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/images/translate-icon.svg b/src/assets/images/translate-icon.svg new file mode 100644 index 00000000..30f9c1b7 --- /dev/null +++ b/src/assets/images/translate-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/pages/options/index.ejs b/src/pages/options/index.ejs new file mode 100644 index 00000000..c17d1f0a --- /dev/null +++ b/src/pages/options/index.ejs @@ -0,0 +1,13 @@ + + + <%- include('../widgets/head') %> + +
+ <%- include('../widgets/links', {config: config}) %> + <%- include('widgets/general', {config: config}) %> + <%- include('widgets/services', {config: config}) %> + <%- include('widgets/about') %> +
+ + + diff --git a/src/pages/widgets/links.ejs b/src/pages/widgets/links.ejs new file mode 100644 index 00000000..eacfe91b --- /dev/null +++ b/src/pages/widgets/links.ejs @@ -0,0 +1,7 @@ + -- cgit 1.4.1 From 978e07930705e87b04d0eafe86233bb62fb36c03 Mon Sep 17 00:00:00 2001 From: Hygna Date: Sun, 18 Sep 2022 17:03:54 +0100 Subject: Converted index.html to ejs --- package.json | 3 +- src/assets/images/general-icon.svg | 3 + src/assets/images/imdb-icon.svg | 57 + src/assets/images/imdb.svg | 57 - src/assets/images/imgur-icon.png | Bin 0 -> 26675 bytes src/assets/images/imgur.png | Bin 26675 -> 0 bytes src/assets/images/medium-icon.svg | 10 +- src/assets/images/quora-icon.png | Bin 0 -> 5499 bytes src/assets/images/quora.png | Bin 5499 -> 0 bytes src/assets/images/reuters-icon.svg | 1 + src/assets/images/reuters.svg | 1 - src/assets/images/send-icon.svg | 51 - src/assets/images/sendTargets-icon.svg | 51 + src/assets/images/youtube-music-icon.png | Bin 25903 -> 0 bytes src/assets/images/youtubeMusic-icon.png | Bin 0 -> 25903 bytes src/assets/javascripts/services.js | 3 +- src/assets/javascripts/utils.js | 7 +- src/config/config.json | 822 ++-- src/pages/options/index.ejs | 10 +- src/pages/options/index.html | 6767 +++++++++++++++------------- src/pages/options/index.pug | 36 - src/pages/options/widgets/about.pug | 17 - src/pages/options/widgets/general.ejs | 97 + src/pages/options/widgets/general.pug | 210 - src/pages/options/widgets/imdb.pug | 26 - src/pages/options/widgets/imgur.pug | 27 - src/pages/options/widgets/instagram.pug | 27 - src/pages/options/widgets/lbry.pug | 39 - src/pages/options/widgets/maps.pug | 32 - src/pages/options/widgets/medium.pug | 26 - src/pages/options/widgets/peertube.pug | 26 - src/pages/options/widgets/quora.pug | 26 - src/pages/options/widgets/reddit.pug | 48 - src/pages/options/widgets/reuters.pug | 26 - src/pages/options/widgets/search.pug | 85 - src/pages/options/widgets/sendTargets.pug | 26 - src/pages/options/widgets/services.ejs | 43 +- src/pages/options/widgets/services.js | 3 +- src/pages/options/widgets/tiktok.pug | 26 - src/pages/options/widgets/translate.pug | 48 - src/pages/options/widgets/twitter.pug | 33 - src/pages/options/widgets/wikipedia.pug | 26 - src/pages/options/widgets/youtube.pug | 103 - src/pages/options/widgets/youtubeMusic.pug | 49 - src/pages/widgets/links.ejs | 4 +- 45 files changed, 4264 insertions(+), 4688 deletions(-) create mode 100644 src/assets/images/imdb-icon.svg delete mode 100644 src/assets/images/imdb.svg create mode 100644 src/assets/images/imgur-icon.png delete mode 100644 src/assets/images/imgur.png create mode 100644 src/assets/images/quora-icon.png delete mode 100644 src/assets/images/quora.png create mode 100644 src/assets/images/reuters-icon.svg delete mode 100644 src/assets/images/reuters.svg delete mode 100644 src/assets/images/send-icon.svg create mode 100644 src/assets/images/sendTargets-icon.svg delete mode 100644 src/assets/images/youtube-music-icon.png create mode 100644 src/assets/images/youtubeMusic-icon.png delete mode 100644 src/pages/options/index.pug delete mode 100644 src/pages/options/widgets/about.pug create mode 100644 src/pages/options/widgets/general.ejs delete mode 100644 src/pages/options/widgets/general.pug delete mode 100644 src/pages/options/widgets/imdb.pug delete mode 100644 src/pages/options/widgets/imgur.pug delete mode 100644 src/pages/options/widgets/instagram.pug delete mode 100644 src/pages/options/widgets/lbry.pug delete mode 100644 src/pages/options/widgets/maps.pug delete mode 100644 src/pages/options/widgets/medium.pug delete mode 100644 src/pages/options/widgets/peertube.pug delete mode 100644 src/pages/options/widgets/quora.pug delete mode 100644 src/pages/options/widgets/reddit.pug delete mode 100644 src/pages/options/widgets/reuters.pug delete mode 100644 src/pages/options/widgets/search.pug delete mode 100644 src/pages/options/widgets/sendTargets.pug delete mode 100644 src/pages/options/widgets/tiktok.pug delete mode 100644 src/pages/options/widgets/translate.pug delete mode 100644 src/pages/options/widgets/twitter.pug delete mode 100644 src/pages/options/widgets/wikipedia.pug delete mode 100644 src/pages/options/widgets/youtube.pug delete mode 100644 src/pages/options/widgets/youtubeMusic.pug (limited to 'src/assets/images') diff --git a/package.json b/package.json index 50872aac..ee0d9089 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "test": "web-ext lint --source-dir ./src/ || true", "pug": "pug ./src/pages/options/*.pug ./src/pages/popup/ -P -w", "prettier": "npx prettier --write .", - "instances": "python3 src/instances/get_instances.py; git update-index --assume-unchanged src/instances/blacklist.json src/instances/data.json" + "instances": "python3 src/instances/get_instances.py; git update-index --assume-unchanged src/instances/blacklist.json src/instances/data.json", + "ejs": "npx ejs src/pages/options/index.ejs -f src/config/config.json -o src/pages/options/index.html" }, "repository": { "type": "git", diff --git a/src/assets/images/general-icon.svg b/src/assets/images/general-icon.svg index e69de29b..55c5f8bc 100644 --- a/src/assets/images/general-icon.svg +++ b/src/assets/images/general-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/images/imdb-icon.svg b/src/assets/images/imdb-icon.svg new file mode 100644 index 00000000..a3f4103c --- /dev/null +++ b/src/assets/images/imdb-icon.svg @@ -0,0 +1,57 @@ + + + + + + + + + + + + diff --git a/src/assets/images/imdb.svg b/src/assets/images/imdb.svg deleted file mode 100644 index a3f4103c..00000000 --- a/src/assets/images/imdb.svg +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - diff --git a/src/assets/images/imgur-icon.png b/src/assets/images/imgur-icon.png new file mode 100644 index 00000000..c23a45b2 Binary files /dev/null and b/src/assets/images/imgur-icon.png differ diff --git a/src/assets/images/imgur.png b/src/assets/images/imgur.png deleted file mode 100644 index c23a45b2..00000000 Binary files a/src/assets/images/imgur.png and /dev/null differ diff --git a/src/assets/images/medium-icon.svg b/src/assets/images/medium-icon.svg index 2939a189..72612486 100644 --- a/src/assets/images/medium-icon.svg +++ b/src/assets/images/medium-icon.svg @@ -1,5 +1,5 @@ - - - - - \ No newline at end of file + + + + + diff --git a/src/assets/images/quora-icon.png b/src/assets/images/quora-icon.png new file mode 100644 index 00000000..d2a06954 Binary files /dev/null and b/src/assets/images/quora-icon.png differ diff --git a/src/assets/images/quora.png b/src/assets/images/quora.png deleted file mode 100644 index d2a06954..00000000 Binary files a/src/assets/images/quora.png and /dev/null differ diff --git a/src/assets/images/reuters-icon.svg b/src/assets/images/reuters-icon.svg new file mode 100644 index 00000000..aab389c3 --- /dev/null +++ b/src/assets/images/reuters-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/images/reuters.svg b/src/assets/images/reuters.svg deleted file mode 100644 index aab389c3..00000000 --- a/src/assets/images/reuters.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/assets/images/send-icon.svg b/src/assets/images/send-icon.svg deleted file mode 100644 index 2ed80a06..00000000 --- a/src/assets/images/send-icon.svg +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - diff --git a/src/assets/images/sendTargets-icon.svg b/src/assets/images/sendTargets-icon.svg new file mode 100644 index 00000000..2ed80a06 --- /dev/null +++ b/src/assets/images/sendTargets-icon.svg @@ -0,0 +1,51 @@ + + + + + + + + + diff --git a/src/assets/images/youtube-music-icon.png b/src/assets/images/youtube-music-icon.png deleted file mode 100644 index a33df696..00000000 Binary files a/src/assets/images/youtube-music-icon.png and /dev/null differ diff --git a/src/assets/images/youtubeMusic-icon.png b/src/assets/images/youtubeMusic-icon.png new file mode 100644 index 00000000..a33df696 Binary files /dev/null and b/src/assets/images/youtubeMusic-icon.png differ diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index b7ee2205..70928786 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -11,7 +11,8 @@ async function getConfig() { fetch("/config/config.json") .then(response => response.text()) .then(data => { - config = JSON.parse(data) + const tmp = JSON.parse(data) + config = tmp.config resolve() }) }) diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js index 9c5947a7..7337a13d 100644 --- a/src/assets/javascripts/utils.js +++ b/src/assets/javascripts/utils.js @@ -23,6 +23,10 @@ function getRandomInstance(instances) { return instances[~~(instances.length * Math.random())] } +function camelCase(str) { + return str.charAt(0).toUpperCase() + str.slice(1) +} + let cloudflareBlackList = [] let authenticateBlackList = [] let offlineBlackList = [] @@ -107,9 +111,6 @@ function protocolHost(url) { } async function processDefaultCustomInstances(target, name, protocol, document) { - function camelCase(str) { - return str.charAt(0).toUpperCase() + str.slice(1) - } let latencyKey = `${name}Latency` let instancesLatency let nameProtocolElement = document.getElementById(name).getElementsByClassName(protocol)[0] diff --git a/src/config/config.json b/src/config/config.json index 97fd838c..7c391552 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -1,439 +1,459 @@ { - "networks": { - "clearnet": { - "tld": "org", - "name": "Clearnet" - }, - "tor": { - "tld": "onion", - "name": "Tor" - }, - "i2p": { - "tld": "i2p", - "name": "I2P" + "config": { + "networks": { + "clearnet": { + "tld": "org", + "name": "Clearnet" + }, + "tor": { + "tld": "onion", + "name": "Tor" + }, + "i2p": { + "tld": "i2p", + "name": "I2P" + }, + "loki": { + "tld": "loki", + "name": "Lokinet" + } }, - "loki": { - "tld": "loki", - "name": "Lokinet" - } - }, - "services": { - "youtube": { - "frontends": { - "invidious": { - "preferences": { - "cookies": ["PREFS"] + "services": { + "youtube": { + "frontends": { + "invidious": { + "preferences": { + "cookies": ["PREFS"] + } + }, + "piped": { + "preferences": { + "localstorage": [ + "bufferGoal", + "comments", + "disableLBRY", + "enabledCodecs", + "hl", + "homepage", + "instance", + "listen", + "minimizeDescription", + "playerAutoPlay", + "proxyLBRY", + "quality", + "region", + "selectedSkip", + "sponsorblock", + "theme", + "volume", + "watchHistory" + ] + } + }, + "pipedMaterial": { + "preferences": { + "localstorage": ["PREFERENCES"] + } + }, + "cloudtube": { + "preferences": { + "token": "token", + "fetchEndpoint": "/api/settings", + "setEndpoint": "/settings" + } } }, - "piped": { - "preferences": { - "localstorage": [ - "bufferGoal", - "comments", - "disableLBRY", - "enabledCodecs", - "hl", - "homepage", - "instance", - "listen", - "minimizeDescription", - "playerAutoPlay", - "proxyLBRY", - "quality", - "region", - "selectedSkip", - "sponsorblock", - "theme", - "volume", - "watchHistory" - ] - } + "singleInstanceFrontends": ["freetube", "yatte"], + "targets": [ + "^https?:\\/{2}(www\\.|music\\.|m\\.|)youtube.com(\\(?!iframe_api)/.*|$)", + "^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*", + "^https?:\\/{2}(i|s)\\.ytimg.com\\/vi\\/.*\\/..*", + "^https?:\\/{2}(www\\.|music\\.|)youtube.com\\/watch?v=..*", + "^https?:\\/{2}youtu\\.be\\/..*", + "^https?:\\/{2}(www\\.|)(youtube|youtube-nocookie)\\.com\\/embed\\/..*" + ], + "name": "Youtube", + "options": { + "disabled": false, + "redirectType": "both", + "frontend": "invidious", + "embedFrontend": "invidious" }, - "pipedMaterial": { - "preferences": { - "localstorage": ["PREFERENCES"] + "imageType": "png", + "embeddable": true + }, + "youtubeMusic": { + "frontends": { + "beatbump": { + "preferences": { + "localstorage": ["settings"], + "indexeddb": "beatbump" + } + }, + "hyperpipe": { + "preferences": { + "localstorage": ["api", "authapi", "codec", "locale", "next", "pipedapi", "quality", "theme", "vol"], + "indexeddb": ["hyperpipedb"] + } } }, - "cloudtube": { - "preferences": { - "token": "token", - "fetchEndpoint": "/api/settings", - "setEndpoint": "/settings" - } - } - }, - "singleInstanceFrontends": ["freetube", "yatte"], - "targets": [ - "^https?:\\/{2}(www\\.|music\\.|m\\.|)youtube.com(\\(?!iframe_api)/.*|$)", - "^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*", - "^https?:\\/{2}(i|s)\\.ytimg.com\\/vi\\/.*\\/..*", - "^https?:\\/{2}(www\\.|music\\.|)youtube.com\\/watch?v=..*", - "^https?:\\/{2}youtu\\.be\\/..*", - "^https?:\\/{2}(www\\.|)(youtube|youtube-nocookie)\\.com\\/embed\\/..*" - ], - "name": "Youtube", - "options": { - "disabled": false, - "redirectType": "both", - "frontend": "invidious", - "embedFrontend": "invidious" - }, - "imageType": "png", - "embeddable": true - }, - "youtubeMusic": { - "frontends": { - "beatbump": {}, - "hyperpipe": {} - }, - "targets": ["^https?:\\/{2}music\\.youtube\\.com(\\/.*|$)"], - "name": "YT Music", - "options": { - "disabled": false, - "frontend": "beatbump" + "targets": ["^https?:\\/{2}music\\.youtube\\.com(\\/.*|$)"], + "name": "YT Music", + "options": { + "disabled": false, + "frontend": "beatbump" + }, + "imageType": "png", + "embeddable": false }, - "imageType": "png", - "embeddable": false - }, - "twitter": { - "frontends": { - "nitter": { - "preferences": { - "cookies": [ - "theme", - "infiniteScroll", - "stickyProfile", - "bidiSupport", - "hideTweetStats", - "hideBanner", - "hidePins", - "hideReplies", - "squareAvatars", - "mp4Playback", - "hlsPlayback", - "proxyVideos", - "muteVideos", - "autoplayGifs", - "replaceInstagram", - "replaceReddit", - "replaceTwitter", - "replaceYouTube" - ] + "twitter": { + "frontends": { + "nitter": { + "preferences": { + "cookies": [ + "theme", + "infiniteScroll", + "stickyProfile", + "bidiSupport", + "hideTweetStats", + "hideBanner", + "hidePins", + "hideReplies", + "squareAvatars", + "mp4Playback", + "hlsPlayback", + "proxyVideos", + "muteVideos", + "autoplayGifs", + "replaceInstagram", + "replaceReddit", + "replaceTwitter", + "replaceYouTube" + ] + } } - } - }, - "targets": ["^https?:\\/{2}(www\\.|mobile\\.|)twitter\\.com", "^https?:\\/{2}(pbs\\.|video\\.|)twimg\\.com", "^https?:\\/{2}platform\\.twitter\\.com/embed", "^https?:\\/{2}t\\.co"], - "name": "Twitter", - "options": { - "disabled": false, - "redirectType": "both" + }, + "targets": ["^https?:\\/{2}(www\\.|mobile\\.|)twitter\\.com", "^https?:\\/{2}(pbs\\.|video\\.|)twimg\\.com", "^https?:\\/{2}platform\\.twitter\\.com/embed", "^https?:\\/{2}t\\.co"], + "name": "Twitter", + "options": { + "disabled": false, + "redirectType": "both" + }, + "imageType": "png", + "embeddable": true }, - "imageType": "png", - "embeddable": true - }, - "instagram": { - "frontends": { - "bibliogram": { - "preferences": { - "token": "token", - "fetchEndpoint": "/settings.json", - "setEndpoint": "/applysettings" + "instagram": { + "frontends": { + "bibliogram": { + "preferences": { + "token": "token", + "fetchEndpoint": "/settings.json", + "setEndpoint": "/applysettings" + } } - } - }, - "targets": ["^https?:\\/{2}(www\\.)?instagram\\.com"], - "name": "Instagram", - "options": { "disabled": false }, - "imageType": "png", - "embeddable": false - }, - "tiktok": { - "frontends": { - "proxiTok": {} + }, + "targets": ["^https?:\\/{2}(www\\.)?instagram\\.com"], + "name": "Instagram", + "options": { "disabled": false }, + "imageType": "png", + "embeddable": false }, - "targets": ["^https?:\\/{2}(www\\.|)tiktok\\.com.*"], - "name": "TikTok", - "options": { "disabled": false }, - "imageType": "png", - "embeddable": false - }, - "reddit": { - "frontends": { - "libreddit": { - "preferences": { - "cookies": ["theme", "front_page", "layout", "wide", "post_sort", "comment_sort", "show_nsfw", "autoplay_videos", "use_hls", "hide_hls_notification", "subscriptions", "filters"] + "tiktok": { + "frontends": { + "proxiTok": { + "preferences": { + "cookies": ["api-test_endpoints", "theme"] + } } }, - "teddit": { - "preferences": { - "cookies": [ - "collapse_child_comments", - "domain_instagram", - "domain_twitter", - "domain_youtube", - "flairs", - "highlight_controversial", - "nsfw_enabled", - "post_media_max_height", - "show_upvoted_percentage", - "show_upvotes", - "theme", - "videos_muted" - ] - } - } + "targets": ["^https?:\\/{2}(www\\.|)tiktok\\.com.*"], + "name": "TikTok", + "options": { "disabled": false }, + "imageType": "png", + "embeddable": false }, - "targets": ["^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)reddit\\.com", "^https?:\\/{2}(i\\.|preview\\.)redd\\.it"], - "name": "Reddit", - "options": { - "disabled": false, - "frontend": "libreddit" - }, - "imageType": "png", - "embeddable": false - }, - "imgur": { - "frontends": { - "rimgo": { - "preferences": {} - } - }, - "targets": ["^https?:\\/{2}([im]\\.)?imgur\\.(com|io)(\\/|$)"], - "name": "Imgur", - "options": { "disabled": false }, - "imageType": "png", - "embeddable": false - }, - "wikipedia": { - "frontends": { - "wikiless": { - "preferences": { - "cookies": ["theme", "default_lang"] + "reddit": { + "frontends": { + "libreddit": { + "preferences": { + "cookies": ["theme", "front_page", "layout", "wide", "post_sort", "comment_sort", "show_nsfw", "autoplay_videos", "use_hls", "hide_hls_notification", "subscriptions", "filters"] + } + }, + "teddit": { + "preferences": { + "cookies": [ + "collapse_child_comments", + "domain_instagram", + "domain_twitter", + "domain_youtube", + "flairs", + "highlight_controversial", + "nsfw_enabled", + "post_media_max_height", + "show_upvoted_percentage", + "show_upvotes", + "theme", + "videos_muted" + ] + } } - } - }, - "targets": ["^https?:\\/{2}([a-z]+\\.)*wikipedia\\.org"], - "name": "Wikipedia", - "options": { "disabled": true }, - "imageType": "svg", - "embeddable": false - }, - "medium": { - "frontends": { - "scribe": { - "preferences": {} - } + }, + "targets": ["^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)reddit\\.com", "^https?:\\/{2}(i\\.|preview\\.)redd\\.it"], + "name": "Reddit", + "options": { + "disabled": false, + "frontend": "libreddit" + }, + "imageType": "png", + "embeddable": false }, - "targets": [ - "(?:.*\\.)*(? - <%- include('../widgets/head') %> + <%- include('src/pages/widgets/head') %> + <%- include('src/pages/widgets/links', {config: config}) %>
- <%- include('../widgets/links', {config: config}) %> - <%- include('widgets/general', {config: config}) %> - <%- include('widgets/services', {config: config}) %> - <%- include('widgets/about') %> + <%- include('src/pages/options/widgets/general', {config: config}) %> + <%- include('src/pages/options/widgets/services', {config: config}) %> + <%- include('src/pages/options/widgets/about') %>
diff --git a/src/pages/options/index.html b/src/pages/options/index.html index 5c0aedd5..8908c9bf 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -1,3189 +1,3600 @@ - - - - - General - - + + + + + General + + + - + +
+
+

General

+
+
+
+

Theme

+ +
+
+

+ +
+
+
+

Fallback to normal if no instances are available for the current protocol

+ +
+
+
+

+ +
+
+
+

Latency Threshold

+ + +
+
+
+

+
+
+
+
+   +   +
+ +
+
+
+ +
+ +     + + +   + Export Settings    + + + + + Reset Settings +
+
+
+

Customize Popup

+
+ + +
+ + +
+
+

Youtube

+
+
+
+

Enable

+ +
+ +
+

Frontend

+ +
+ + +
+
+

Embed Frontend

+ +
+
+ + +
+

Redirect Type

+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

General

-
-
-
-

Theme

- -
-
-

- -
-
-
-

Fallback to normal if no instances are available for the current protocol

- -
-
-
-

- -
- -
-

Latency Threshold

- - -
-
-
-

-
-
-
-
-   -   -
- -
-
-
- -
- -     - - -   - Export Settings    - - - - - Reset Settings -
-
-
-

Customize Popup

-
- - -
-
-
-

YouTube

-
-
-
-

Enable

- -
-
-

Frontend

- -
-
-
-

Embedded Videos Frontend

- -
-
-
-

Redirect Type

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

YouTube Music

-
-
-
-

Enable

- -
-
-

Frontend

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

Twitter

-
-
-
-

Enable

- -
-
-

Redirect Type

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

Instagram

-
-
-
-

Enable

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

TikTok

-
-
-
-

Enable

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

Reddit

-
-
-
-

Enable

- -
-
-

Frontend

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

Imgur

-
-
-
-

Enable

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

Wikipedia

-
-
-
-

Enable

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

Medium

-
-
-
-

Enable

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

Quora

-
-
-
-

Enable

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

IMDb

-
-
-
-

Enable

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

Reuters

-
-
-
-

Enable

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

PeerTube

-
-
-
-

Enable

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

LBRY

-
-
-
-

Enable

- -
-
-

Frontend

- -
-
-

Redirect Type

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

Search

-
-
-
-

Enable

- -
-
-

Frontend

- -
-
-

Note: To use Search, make LibRedirect the Default Search Engine

-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

Translate

-
-
-
-

Enable

- -
-
-

Frontend

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

Maps

-
-
-
-

Enable

- -
-
-

Frontend

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
-
-

Send Files

-
-
-
-

Enable

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
+ + +
+ +
+ +
+ + +
+ + + +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + + +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ + + +
+
+

YT Music

+
+
+
+

Enable

+ +
+ +
+

Frontend

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Twitter

+
+
+
+

Enable

+ +
+ + + +
+

Redirect Type

+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Instagram

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

About

-
-
- -
+ + + + +
+ + + +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + + + + +
+
+

TikTok

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Reddit

+
+
+
+

Enable

+ +
+ +
+

Frontend

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Imgur

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Wikipedia

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Medium

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Quora

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

IMDb

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Reuters

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

PeerTube

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

LBRY

+
+
+
+

Enable

+ +
+ +
+

Frontend

+ +
+ + + +
+

Redirect Type

+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Search

+
+
+
+

Enable

+ +
+ +
+

Frontend

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Translate

+
+
+
+

Enable

+ +
+ +
+

Frontend

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Maps

+
+
+
+

Enable

+ +
+ +
+

Frontend

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Send Files

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ + + +
+
+

About

+
+
+ +
+ - \ No newline at end of file + diff --git a/src/pages/options/index.pug b/src/pages/options/index.pug deleted file mode 100644 index 3711fdac..00000000 --- a/src/pages/options/index.pug +++ /dev/null @@ -1,36 +0,0 @@ -doctype html -html#elementToShowWithJavaScript(lang="en") - head - meta(charset='utf-8') - meta(name="viewport" content="width=device-width, initial-scale=1") - link(rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg") - link(href="../stylesheets/styles.css" rel="stylesheet") - title General - - script(type="module" src="./init.js") - body.option(dir="auto") - include ../widgets/links.pug - +links('general') - div#pages - include ./widgets/general.pug - include ./widgets/youtube.pug - include ./widgets/youtubeMusic.pug - include ./widgets/twitter.pug - include ./widgets/instagram.pug - include ./widgets/tiktok.pug - include ./widgets/reddit.pug - include ./widgets/imgur.pug - include ./widgets/wikipedia.pug - include ./widgets/medium.pug - include ./widgets/quora.pug - include ./widgets/imdb.pug - include ./widgets/reuters.pug - include ./widgets/peertube.pug - include ./widgets/lbry.pug - include ./widgets/search.pug - include ./widgets/translate.pug - include ./widgets/maps.pug - include ./widgets/sendTargets.pug - include ./widgets/about.pug - - script(type="module" src="./index.js") diff --git a/src/pages/options/widgets/about.pug b/src/pages/options/widgets/about.pug deleted file mode 100644 index 954522bb..00000000 --- a/src/pages/options/widgets/about.pug +++ /dev/null @@ -1,17 +0,0 @@ -section#about_page.option-block - .some-block.option-block - h1(data-localise="__MSG_about__") About - hr - .about - .some-block.option-block - h4 Donate: ♥️ - h4 https://libredirect.github.io/donate - .some-block.option-block - h4 FAQ: - h4 https://libredirect.github.io/faq - .some-block.option-block - h4 Docs: - h4 https://libredirect.github.io/docs - .some-block.option-block - h4 Source Code: - h4 https://libredirect.github.io/source_code \ No newline at end of file diff --git a/src/pages/options/widgets/general.ejs b/src/pages/options/widgets/general.ejs new file mode 100644 index 00000000..05ef0959 --- /dev/null +++ b/src/pages/options/widgets/general.ejs @@ -0,0 +1,97 @@ +
+
+

General

+
+
+
+

Theme

+ +
+
+

+ +
+
+
+

Fallback to normal if no instances are available for the current protocol

+ +
+
+
+

+ +
+
+
+

Latency Threshold

+ + +
+
+
+

+
+
+
+
+   +   +
+ +
+
+
+ +
+ +     + + +   + Export Settings    + + + + + Reset Settings +
+
+
+

Customize Popup

+
+ + +
diff --git a/src/pages/options/widgets/general.pug b/src/pages/options/widgets/general.pug deleted file mode 100644 index be3d495e..00000000 --- a/src/pages/options/widgets/general.pug +++ /dev/null @@ -1,210 +0,0 @@ -section#general_page.option-block - .some-block.option-block - h1(data-localise="__MSG_general__") General - hr - - .some-block.option-block - h4(data-localise="__MSG_theme__") Theme - select#theme - option(value="DEFAULT" data-localise="__MSG_system__") System - option(value="light" data-localise="__MSG_light__") Light - option(value="dark" data-localise="__MSG_dark__") Dark - - //- .some-block.option-block - h4 Tor Browser - input#firstPartyIsolate(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_protocol__") - select#protocol - option(value="clearnet" data-localise="__MSG_normal__") Clearnet - option(value="tor") Tor - option(value="i2p") I2P - option(value="loki") Lokinet - - #protocol-fallback - .some-block.option-block - h4(data-localise="__MSG_protocolFallback__") Fallback to normal if no instances are available for the current protocol - input#protocol-fallback-checkbox(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_autoRedirect__") - input#auto-redirect(type="checkbox") - - form - .some-block.option-block - h4(data-localise="__MSG_latencyThreshold") Latency Threshold - output#latency-output(for="latencyInput" name="latencyOutput") - input#latency-input(type="range" min="50" max="5000" value="1000" name="latencyInput" step="50") - - .some-block.option-block - h4(data-localise="__MSG_exceptions__") - - form#custom-exceptions-instance-form - .some-block.option-block - .some-block(style="padding:0;") - input#exceptions-custom-instance(placeholder="https://www.google.com" type="url") - |  - select#exceptions-custom-instance-type - option(value="url") URL - option(value="regex") Regex - |  - button#exceptions-add-instance.add(type="submit") - svg(xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor") - path(d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z") - - #exceptions-custom-checklist.checklist - - .buttons.buttons-inline - a#update-instances.button.button-inline - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z") - x(data-localise="__MSG_updateInstances__") Update Instances - - |    - - .buttons.buttons-inline - - label#import_settings_text.button.button-inline(for="import-settings") - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z") - |  - x(data-localise="__MSG_importSettings__") Import Settings - input#import-settings.button.button-inline(type="file" style="display:none;") - - |    - - a#export-settings.button.button-inline - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M10.09 15.59L11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z") - |  - x(data-localise="__MSG_exportSettings__") Export Settings - - |    - - a#reset-settings.button.button-inline - svg(xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M12,5V2L8,6l4,4V7c3.31,0,6,2.69,6,6c0,2.97-2.17,5.43-5,5.91v2.02c3.95-0.49,7-3.85,7-7.93C20,8.58,16.42,5,12,5z") - path(d="M6,13c0-1.65,0.67-3.15,1.76-4.24L6.34,7.34C4.9,8.79,4,10.79,4,13c0,4.08,3.05,7.44,7,7.93v-2.02 C8.17,18.43,6,15.97,6,13z") - x(data-localise="__MSG_resetSettings__") Reset Settings - hr - - .some-block.option-block - h4(data-localise="__MSG_customPopup__") Customize Popup - - #popup-frontends-checklist.checklist-popup - div - div - img(src="../../../assets/images/youtube-icon.png") - x(data-localise="__MSG_youtube__") YouTube - input#youtube(type="checkbox") - div - div - img(src="../../../assets/images/youtube-music-icon.png") - x(data-localise="__MSG_ytmusic__") YoutubeMusic - input#youtubeMusic(type="checkbox") - div - div - img(src="../../../assets/images/twitter-icon.png") - x(data-localise="__MSG_twitter__") Twitter - input#twitter(type="checkbox") - - div - div - img(src="../../../assets/images/instagram-icon.png") - x(data-localise="__MSG_instagram__") Instagram - input#instagram(type="checkbox") - - div - div - img(src="../../../assets/images/tiktok-icon.png") - x(data-localise="__MSG_tiktok__") TikTok - input#tiktok(type="checkbox") - - div - div - img(src="../../../assets/images/imgur.png") - x(data-localise="__MSG_imgur__") Imgur - input#imgur(type="checkbox") - - div - div - img(src="../../../assets/images/reddit-icon.png") - x(data-localise="__MSG_reddit__") Reddit - input#reddit(type="checkbox") - - div - div - svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor") - path(d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z") - x(data-localise="__MSG_search__") Search - input#search(type="checkbox") - - div - div - svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor") - path(d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z") - x(data-localise="__MSG_translate__") Translate - input#translate(type="checkbox") - - div - div - svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor") - path(d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM10 5.47l4 1.4v11.66l-4-1.4V5.47zm-5 .99l3-1.01v11.7l-3 1.16V6.46zm14 11.08l-3 1.01V6.86l3-1.16v11.84z") - x(data-localise="__MSG_maps__") Maps - input#maps(type="checkbox") - - div - div - img(src="../../../assets/images/wikipedia-icon.svg") - x(data-localise="__MSG_wikipedia__") Wikipedia - input#wikipedia(type="checkbox") - - div - div - svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor") - circle(cx="500" cy="500" r="500") - ellipse(ry="475" rx="250" cy="501" cx="1296") - ellipse(cx="1682" cy="502" rx="88" ry="424") - x(data-localise="__MSG_medium__") Medium - input#medium(type="checkbox") - - div - div - img(src="../../../assets/images/quora.png") - x(data-localise="__MSG_quora__") Quora - input#quora(type="checkbox") - - div - div - img(src="../../../assets/images/imdb.svg") - x(data-localise="__MSG_imdb__") IMDb - input#imdb(type="checkbox") - - div - div - img(src="../../../assets/images/reuters.svg") - x(data-localise="__MSG_reuters__") Reuters - input#reuters(type="checkbox") - - div - div - img(src="../../../assets/images/peertube-icon.svg") - x(data-localise="__MSG_peertube__") PeerTube - input#peertube(type="checkbox") - - div - div - img(src="../../../assets/images/lbry-icon.png") - x(data-localise="__MSG_lbry__") LBRY - input#lbry(type="checkbox") - - div - div - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z") - x(data-localise="__MSG_sendFiles__") Send Files - input#sendTargets(type="checkbox") - - - script(type="module" src="./widgets/general.js") diff --git a/src/pages/options/widgets/imdb.pug b/src/pages/options/widgets/imdb.pug deleted file mode 100644 index 67eb8eca..00000000 --- a/src/pages/options/widgets/imdb.pug +++ /dev/null @@ -1,26 +0,0 @@ -section#imdb_page.option-block - .some-block.option-block - h1(data-localise="__MSG_imdb__") IMDb - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#imdb-enable(type="checkbox") - - #libremdb - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://libremdb.com') - include ../../widgets/latency.pug - +latency('libremdb') - .tor - include ../../widgets/instances.pug - +instances('http://libremdb.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://libremdb.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://libremdb.loki') - - script(type="module" src="./widgets/imdb.js") diff --git a/src/pages/options/widgets/imgur.pug b/src/pages/options/widgets/imgur.pug deleted file mode 100644 index 46c497ec..00000000 --- a/src/pages/options/widgets/imgur.pug +++ /dev/null @@ -1,27 +0,0 @@ -section#imgur_page.option-block - .some-block.option-block - h1(data-localise="__MSG_imgur__") Imgur - hr - - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#imgur-enable(type="checkbox") - - #rimgo - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://rimgo.com') - include ../../widgets/latency.pug - +latency('rimgo') - .tor - include ../../widgets/instances.pug - +instances('http://rimgo.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://rimgo.onion') - .loki - include ../../widgets/instances.pug - +instances('http://rimgo.loki') - - script(type="module" src="./widgets/imgur.js") diff --git a/src/pages/options/widgets/instagram.pug b/src/pages/options/widgets/instagram.pug deleted file mode 100644 index 702aa651..00000000 --- a/src/pages/options/widgets/instagram.pug +++ /dev/null @@ -1,27 +0,0 @@ -section#instagram_page.option-block - .some-block.option-block - h1(data-localise="__MSG_instagram__") Instagram - hr - - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#instagram-enable(type="checkbox") - - #bibliogram - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://bibliogram.com') - include ../../widgets/latency.pug - +latency('bibliogram') - .tor - include ../../widgets/instances.pug - +instances('https://bibliogram.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://bibliogram.onion') - .loki - include ../../widgets/instances.pug - +instances('http://bibliogram.loki') - - script(type="module" src="./widgets/instagram.js") diff --git a/src/pages/options/widgets/lbry.pug b/src/pages/options/widgets/lbry.pug deleted file mode 100644 index 9f01ebc6..00000000 --- a/src/pages/options/widgets/lbry.pug +++ /dev/null @@ -1,39 +0,0 @@ -section#lbry_page.option-block - .some-block.option-block - h1(data-localise="__MSG_lbry__") LBRY - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#lbry-enable(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_frontend__") Frontend - select#lbry-frontend - option(value="librarian") Librarian - option(value="lbryDesktop" data-localise="__MSG_lbryDesktop__") LBRY Desktop - - .some-block.option-block - h4(data-localise="__MSG_redirectType__") Redirect Type - select#lbry-redirect_type - option(value="both" data-localise="__MSG_both__") both - option(value="sub_frame" data-localise="__MSG_onlyEmbedded__") Only Embedded - option(value="main_frame" data-localise="__MSG_onlyNotEmbedded__") Only Not Embedded - - #librarian - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://librarian.com') - include ../../widgets/latency.pug - +latency('librarian') - .tor - include ../../widgets/instances.pug - +instances('https://librarian.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://librarian.onion') - .loki - include ../../widgets/instances.pug - +instances('http://librarian.loki') - - script(type="module" src="./widgets/lbry.js") diff --git a/src/pages/options/widgets/maps.pug b/src/pages/options/widgets/maps.pug deleted file mode 100644 index 66d0d411..00000000 --- a/src/pages/options/widgets/maps.pug +++ /dev/null @@ -1,32 +0,0 @@ -section#maps_page.option-block - .some-block.option-block - h1(data-localise="__MSG_maps__") Maps - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#maps-enable(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_frontend__") Frontend - select#maps-frontend - option(value="osm") OpenStreetMap - option(value="facil") Facil Map - - #facil - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://facilmap.com') - include ../../widgets/latency.pug - +latency('facil') - .tor - +instances('http://facilmap.onion') - include ../../widgets/instances.pug - .i2p - include ../../widgets/instances.pug - +instances('http://facilmap.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://facilmap.loki') - - script(type="module" src="./widgets/maps.js") diff --git a/src/pages/options/widgets/medium.pug b/src/pages/options/widgets/medium.pug deleted file mode 100644 index 60223fdf..00000000 --- a/src/pages/options/widgets/medium.pug +++ /dev/null @@ -1,26 +0,0 @@ -section#medium_page.option-block - .some-block.option-block - h1(data-localise="__MSG_medium__") Medium - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#medium-enable(type="checkbox") - - #scribe - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://scribe.com') - include ../../widgets/latency.pug - +latency('scribe') - .tor - include ../../widgets/instances.pug - +instances('http://scribe.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://scribe.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://scribe.loki') - - script(type="module" src="./widgets/medium.js") diff --git a/src/pages/options/widgets/peertube.pug b/src/pages/options/widgets/peertube.pug deleted file mode 100644 index 2b818df4..00000000 --- a/src/pages/options/widgets/peertube.pug +++ /dev/null @@ -1,26 +0,0 @@ -section#peertube_page.option-block - .some-block.option-block - h1(data-localise="__MSG_peertube__") PeerTube - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#peertube-enable(type="checkbox") - - #simpleertube - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://simpleertube.com') - include ../../widgets/latency.pug - +latency('simpleertube') - .tor - include ../../widgets/instances.pug - +instances('http://simpleertube.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://simpleertube.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://simpleertube.loki') - - script(type="module" src="./widgets/peertube.js") diff --git a/src/pages/options/widgets/quora.pug b/src/pages/options/widgets/quora.pug deleted file mode 100644 index 7c3c52ac..00000000 --- a/src/pages/options/widgets/quora.pug +++ /dev/null @@ -1,26 +0,0 @@ -section#quora_page.option-block - .some-block.option-block - h1(data-localise="__MSG_quora__") Quora - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#quora-enable(type="checkbox") - - #quetre - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://quetre.com') - include ../../widgets/latency.pug - +latency('quetre') - .tor - include ../../widgets/instances.pug - +instances('http://quetre.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://quetre.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://quetre.loki') - - script(type="module" src="./widgets/quora.js") diff --git a/src/pages/options/widgets/reddit.pug b/src/pages/options/widgets/reddit.pug deleted file mode 100644 index 24c437f4..00000000 --- a/src/pages/options/widgets/reddit.pug +++ /dev/null @@ -1,48 +0,0 @@ -section#reddit_page.option-block - .some-block.option-block - h1(data-localise="__MSG_reddit__") Reddit - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#reddit-enable(type="checkbox") - - .some-block.option-block - h4#frontend(data-localise="__MSG_frontend__") Frontend - select#reddit-frontend - option(value="libreddit") Libreddit - option(value="teddit") Teddit - - #libreddit - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://libreddit.com') - include ../../widgets/latency.pug - +latency('libreddit') - .tor - include ../../widgets/instances.pug - +instances('http://libreddit.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://libreddit.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://libreddit.loki') - - #teddit - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://teddit.com') - +latency('teddit') - .tor - include ../../widgets/instances.pug - +instances('http://teddit.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://teddit.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://teddit.loki') - - script(type="module" src="./widgets/reddit.js") diff --git a/src/pages/options/widgets/reuters.pug b/src/pages/options/widgets/reuters.pug deleted file mode 100644 index 985965a1..00000000 --- a/src/pages/options/widgets/reuters.pug +++ /dev/null @@ -1,26 +0,0 @@ -section#reuters_page.option-block - .some-block.option-block - h1(data-localise="__MSG_reuters__") Reuters - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#reuters-enable(type="checkbox") - - #neuters - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://neuters.com') - include ../../widgets/latency.pug - +latency('neuters') - .tor - include ../../widgets/instances.pug - +instances('http://neuters.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://neuters.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://neuters.loki') - - script(type="module" src="./widgets/reuters.js") diff --git a/src/pages/options/widgets/search.pug b/src/pages/options/widgets/search.pug deleted file mode 100644 index f449e0db..00000000 --- a/src/pages/options/widgets/search.pug +++ /dev/null @@ -1,85 +0,0 @@ -section#search_page.option-block - .some-block.option-block - h1(data-localise="__MSG_search__") Search - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#search-enable(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_frontend__") Frontend - select#search-frontend - option(value="searxng") SearXNG - option(value="searx") SearX - option(value="whoogle") Whoogle - option(value="librex") LibreX - - .some-block - h4(data-localise="__MSG_searchNote__") Note: To use Search, make LibRedirect the Default Search Engine - - #searx - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://searx.com') - include ../../widgets/latency.pug - +latency('searx') - .tor - include ../../widgets/instances.pug - +instances('http://searx.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://searx.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://searx.loki') - - #searxng - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://searxng.com') - +latency('searxng') - .tor - include ../../widgets/instances.pug - +instances('http://searxng.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://searxng.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://searxng.loki') - - #whoogle - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://whoogle.com') - +latency('whoogle') - .tor - include ../../widgets/instances.pug - +instances('http://whoogle.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://whoogle.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://whoogle.loki') - - #librex - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://librex.com') - +latency('librex') - .tor - include ../../widgets/instances.pug - +instances('http://librex.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://librex.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://librex.loki') - - script(type="module" src="./widgets/search.js") diff --git a/src/pages/options/widgets/sendTargets.pug b/src/pages/options/widgets/sendTargets.pug deleted file mode 100644 index e7676b37..00000000 --- a/src/pages/options/widgets/sendTargets.pug +++ /dev/null @@ -1,26 +0,0 @@ -section#sendTargets_page.option-block - .some-block.option-block - h1(data-localise="__MSG_sendFiles__") Send Files - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#sendTargets-enable(type="checkbox") - - #send - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://send.com') - include ../../widgets/latency.pug - +latency('send') - .tor - include ../../widgets/instances.pug - +instances('http://send.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://send.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://send.loki') - - script(type="module" src="./widgets/sendTargets.js") diff --git a/src/pages/options/widgets/services.ejs b/src/pages/options/widgets/services.ejs index a1b0a538..aed5872b 100644 --- a/src/pages/options/widgets/services.ejs +++ b/src/pages/options/widgets/services.ejs @@ -1,5 +1,5 @@ -<% config.services.forEach(service=>{ %> -
+<% for (const service in config.services) { %> +

<%= config.services[service].name %>

@@ -8,33 +8,35 @@

Enable

+ <% if ((Object.keys(config.services[service].frontends).length > 1) || config.services[service].singleInstanceFrontends) { %>

Frontend

- <% if (config.services[service].embeddable) { %> - <% if (config.services[service].singleInstanceFrontends) { %> + <% } %> + <% if ((config.services[service].singleInstanceFrontends) && (Object.keys(config.services[service].frontends).length > 1)) { %>
-

Embedded Videos Frontend

+

Embed Frontend

<% } %> + <% if (config.services[service].embeddable) { %>

Redirect Type

- @@ -42,9 +44,9 @@
<% } %>
- <% config.services[service].frontends.forEach(frontend=>{ %> + <% for (const frontend in config.services[service].frontends) { %>
- <% config.networks.forEach(network=>{ %> + <% for (const network in config.networks) { %>

Default Instances

@@ -56,7 +58,7 @@
- +
<% } %>
- <% }); %> - <% }); %> + <% }; %> +
+ <% }; %>
-<% }); %> +<% }; %> diff --git a/src/pages/options/widgets/services.js b/src/pages/options/widgets/services.js index 5f370a18..c7955b40 100644 --- a/src/pages/options/widgets/services.js +++ b/src/pages/options/widgets/services.js @@ -12,7 +12,8 @@ async function getConfig() { fetch("/config/config.json") .then(response => response.text()) .then(data => { - config = JSON.parse(data) + const tmp = JSON.parse(data) + config = tmp.config resolve() }) }) diff --git a/src/pages/options/widgets/tiktok.pug b/src/pages/options/widgets/tiktok.pug deleted file mode 100644 index 986bd270..00000000 --- a/src/pages/options/widgets/tiktok.pug +++ /dev/null @@ -1,26 +0,0 @@ -section#tiktok_page.option-block - .some-block.option-block - h1(data-localise="__MSG_tiktok__") TikTok - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#tiktok-enable(type="checkbox") - - #proxiTok - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://proxitok.com') - include ../../widgets/latency.pug - +latency('proxiTok') - .tor - include ../../widgets/instances.pug - +instances('http://proxitok.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://proxitok.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://proxitok.loki') - - script(type="module" src="./widgets/tiktok.js") diff --git a/src/pages/options/widgets/translate.pug b/src/pages/options/widgets/translate.pug deleted file mode 100644 index 40d42bca..00000000 --- a/src/pages/options/widgets/translate.pug +++ /dev/null @@ -1,48 +0,0 @@ -section#translate_page.option-block - .some-block.option-block - h1(data-localise="__MSG_translate__") Translate - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#translate-enable(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_frontend__") Frontend - select#translate-frontend - option(value="simplyTranslate") SimplyTranslate - option(value="lingva") Lingva - - hr - #simplyTranslate - .clearnet - include ../../widgets/instances.pug - +instances('https://simplytranslate.org') - include ../../widgets/latency.pug - +latency('simplyTranslate') - .tor - include ../../widgets/instances.pug - +instances('http://hxecvvetgrznmprg.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://simplytranslate.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://simplytranslate.loki') - - #lingva - .clearnet - include ../../widgets/instances.pug - +instances('https://lingvatranslate.com') - +latency('lingva') - .tor - include ../../widgets/instances.pug - +instances('http://lingvatranslate.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://lingvatranslate.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://lingvatranslate.loki') - - - script(type="module" src="./widgets/translate.js") diff --git a/src/pages/options/widgets/twitter.pug b/src/pages/options/widgets/twitter.pug deleted file mode 100644 index fa7f1320..00000000 --- a/src/pages/options/widgets/twitter.pug +++ /dev/null @@ -1,33 +0,0 @@ -section#twitter_page.option-block - .some-block.option-block - h1(data-localise="__MSG_twitter__") Twitter - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#twitter-enable(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_redirectType__") Redirect Type - select#twitter-redirect_type - option(value="both" data-localise="__MSG_both__") both - option(value="sub_frame" data-localise="__MSG_onlyEmbedded__") Only Embedded - option(value="main_frame" data-localise="__MSG_onlyNotEmbedded__") Only Not Embedded - - #nitter - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://nitter.com') - include ../../widgets/latency.pug - +latency('nitter') - .tor - include ../../widgets/instances.pug - +instances('http://nitter.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://nitter.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://nitter.loki') - - script(type="module" src="./widgets/twitter.js") diff --git a/src/pages/options/widgets/wikipedia.pug b/src/pages/options/widgets/wikipedia.pug deleted file mode 100644 index a0ad37c3..00000000 --- a/src/pages/options/widgets/wikipedia.pug +++ /dev/null @@ -1,26 +0,0 @@ -section#wikipedia_page.option-block - .some-block.option-block - h1(data-localise="__MSG_wikipedia__") Wikipedia - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#wikipedia-enable(type="checkbox") - - #wikiless - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://wikiless.com') - include ../../widgets/latency.pug - +latency('wikiless') - .tor - include ../../widgets/instances.pug - +instances('http://wikiless.onion') - .i2p - include ../../widgets/instances.pug - +instances('https://wikiless.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://wikiless.loki') - - script(type="module" src="./widgets/wikipedia.js") diff --git a/src/pages/options/widgets/youtube.pug b/src/pages/options/widgets/youtube.pug deleted file mode 100644 index cf48d9be..00000000 --- a/src/pages/options/widgets/youtube.pug +++ /dev/null @@ -1,103 +0,0 @@ -section#youtube_page.option-block - .some-block.option-block - h1(data-localise="__MSG_youtube__") YouTube - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#youtube-enable(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_frontend__") Frontend - select#youtube-frontend - option(value="invidious") Invidious - option(value="piped") Piped - option(value="pipedMaterial") Piped-Material - option(value="cloudtube") CloudTube - option(value="freetube") FreeTube - option(value="yatte") Yattee - - #youtube-embedded_frontend - .some-block.option-block - h4(data-localise="__MSG_embeddedVids__") Embedded Videos Frontend - select#youtube-embed_frontend - option(value="invidious") Invidious - option(value="piped") Piped - option(value="pipedMaterial") Piped-Material - option(value="cloudtube") CloudTube - - .some-block.option-block - h4(data-localise="__MSG_redirectType__") Redirect Type - select#youtube-redirect_type - option(value="both" data-localise="__MSG_both__") both - option(value="onlyEmbedded" data-localise="__MSG_onlyEmbedded__") Only Embedded - option(value="onlyNotEmbedded" data-localise="__MSG_onlyNotEmbedded__") Only Not Embedded - - #invidious - hr - .clearnet - include ../../widgets/instances.pug - +instances('http://invidious.com') - include ../../widgets/latency.pug - +latency('invidious') - .tor - include ../../widgets/instances.pug - +instances('http://invidious.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://invidious.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://invidious.loki') - - #piped - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://piped.com') - include ../../widgets/latency.pug - +latency('piped') - .tor - +instances('http://piped.onion') - include ../../widgets/instances.pug - .i2p - include ../../widgets/instances.pug - +instances('http://piped.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://piped.loki') - - #pipedMaterial - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://piped-material.com') - include ../../widgets/latency.pug - +latency('pipedMaterial') - .tor - +instances('http://piped-material.onion') - include ../../widgets/instances.pug - .i2p - include ../../widgets/instances.pug - +instances('http://piped-material.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://piped-material.loki') - - #cloudtube - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://cloudtube.com') - include ../../widgets/latency.pug - +latency('cloudtube') - .tor - +instances('http://cloudtube.onion') - include ../../widgets/instances.pug - .i2p - include ../../widgets/instances.pug - +instances('http://cloudtube.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://cloudtube.loki') - - script(type="module" src="./widgets/youtube.js") diff --git a/src/pages/options/widgets/youtubeMusic.pug b/src/pages/options/widgets/youtubeMusic.pug deleted file mode 100644 index 9c2c08cf..00000000 --- a/src/pages/options/widgets/youtubeMusic.pug +++ /dev/null @@ -1,49 +0,0 @@ -section#youtubeMusic_page.option-block - .some-block.option-block - h1(data-localise="__MSG_ytmusic__") YouTube Music - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#youtubeMusic-enable(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_frontend__") Frontend - select#youtubeMusic-frontend - option(value="beatbump") Beatbump - option(value="hyperpipe") Hyperpipe - - #beatbump - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://beatbump.org') - include ../../widgets/latency.pug - +latency('beatbump') - .tor - +instances('http://beatbump.onion') - include ../../widgets/instances.pug - .i2p - include ../../widgets/instances.pug - +instances('http://beatbump.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://beatbump.loki') - - #hyperpipe - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://hyperpipe.org') - include ../../widgets/latency.pug - +latency('hyperpipe') - .tor - +instances('http://hyperpipe.onion') - include ../../widgets/instances.pug - .i2p - include ../../widgets/instances.pug - +instances('http://hyperpipe.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://hyperpipe.loki') - - script(type="module" src="./widgets/youtubeMusic.js") diff --git a/src/pages/widgets/links.ejs b/src/pages/widgets/links.ejs index eacfe91b..fe0cd37c 100644 --- a/src/pages/widgets/links.ejs +++ b/src/pages/widgets/links.ejs @@ -1,7 +1,7 @@ -- cgit 1.4.1 From 320d0175a8e1223618eb3b8d740b420ef674fc8d Mon Sep 17 00:00:00 2001 From: Hygna Date: Thu, 22 Sep 2022 19:58:07 +0100 Subject: Completed Migration to ejs --- package.json | 2 +- src/assets/images/sendTargets-icon.svg | 52 +---- src/assets/javascripts/services.js | 8 +- src/config/config.json | 67 ++++-- src/instances/get_instances.py | 2 +- src/pages/options/index.html | 109 ++++++--- src/pages/options/widgets/services.js | 2 +- src/pages/popup/popup.ejs | 49 ++++ src/pages/popup/popup.html | 396 ++++++++++++++++++--------------- src/pages/popup/popup.pug | 155 ------------- src/pages/widgets/head.pug | 5 - src/pages/widgets/icons.pug | 46 ---- src/pages/widgets/instances.pug | 15 -- src/pages/widgets/latency.pug | 14 -- src/pages/widgets/links.ejs | 12 +- src/pages/widgets/links.pug | 83 ------- src/pages/widgets/switches.ejs | 11 + 17 files changed, 422 insertions(+), 606 deletions(-) create mode 100644 src/pages/popup/popup.ejs delete mode 100644 src/pages/popup/popup.pug delete mode 100644 src/pages/widgets/head.pug delete mode 100644 src/pages/widgets/icons.pug delete mode 100644 src/pages/widgets/instances.pug delete mode 100644 src/pages/widgets/latency.pug delete mode 100644 src/pages/widgets/links.pug create mode 100644 src/pages/widgets/switches.ejs (limited to 'src/assets/images') diff --git a/package.json b/package.json index ee0d9089..76f57474 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "pug": "pug ./src/pages/options/*.pug ./src/pages/popup/ -P -w", "prettier": "npx prettier --write .", "instances": "python3 src/instances/get_instances.py; git update-index --assume-unchanged src/instances/blacklist.json src/instances/data.json", - "ejs": "npx ejs src/pages/options/index.ejs -f src/config/config.json -o src/pages/options/index.html" + "ejs": "npx ejs src/pages/options/index.ejs -f src/config/config.json -o src/pages/options/index.html; npx ejs src/pages/popup/popup.ejs -f src/config/config.json -o src/pages/popup/popup.html" }, "repository": { "type": "git", diff --git a/src/assets/images/sendTargets-icon.svg b/src/assets/images/sendTargets-icon.svg index 2ed80a06..5557664e 100644 --- a/src/assets/images/sendTargets-icon.svg +++ b/src/assets/images/sendTargets-icon.svg @@ -1,51 +1,3 @@ - - - - - - - - + + diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 79444442..f4c30873 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -68,7 +68,7 @@ function redirect(url, type, initiator) { let redirectType if (url.pathname == "/") return for (const service in config.services) { - if (!options[service].enabled && !disableOverride) continue + if (!options[service].enabled) continue let targets = service.targets if (targets == "datajson") { browser.storage.local.get(`${service}Targets`, (targets = r[service + "Targets"])) @@ -385,12 +385,12 @@ function initDefaults() { .then(response => response.text()) .then(async data => { let dataJson = JSON.parse(data) - redirects = dataJson.slice() + redirects = JSON.parse(data) browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList", "offlineBlackList"], async r => { for (const service in config.services) { if (config.services[service].targets == "datajson") { browser.storage.local.set({ [service + "Targets"]: [...dataJson[service]] }) - delete redirects[service] + delete dataJson[service] } for (const defaultOption in config.services[service].options) { browser.storage.local.set({ [service + utils.camelCase(defaultOption)]: config.services[service].options[defaultOption] }) @@ -422,7 +422,7 @@ function initDefaults() { } }) browser.storage.local.set({ - redirects, + redirects: dataJson, }) ;() => resolve() }) diff --git a/src/config/config.json b/src/config/config.json index ac393f18..1c8f5f9f 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -102,7 +102,8 @@ "embedFrontend": "invidious" }, "imageType": "png", - "embeddable": true + "embeddable": true, + "url": "https://youtube.com" }, "youtubeMusic": { "frontends": { @@ -130,7 +131,8 @@ "frontend": "beatbump" }, "imageType": "png", - "embeddable": false + "embeddable": false, + "url": "https://music.youtube.com" }, "twitter": { "frontends": { @@ -169,7 +171,8 @@ "redirectType": "both" }, "imageType": "png", - "embeddable": true + "embeddable": true, + "url": "https://twitter.com" }, "instagram": { "frontends": { @@ -187,7 +190,8 @@ "name": "Instagram", "options": { "enabled": true }, "imageType": "png", - "embeddable": false + "embeddable": false, + "url": "https://instagram.com" }, "tiktok": { "frontends": { @@ -203,7 +207,8 @@ "name": "TikTok", "options": { "enabled": true }, "imageType": "png", - "embeddable": false + "embeddable": false, + "url": "https://tiktok.com" }, "reddit": { "frontends": { @@ -242,7 +247,8 @@ "frontend": "libreddit" }, "imageType": "png", - "embeddable": false + "embeddable": false, + "url": "https://reddit.com" }, "imgur": { "frontends": { @@ -256,7 +262,8 @@ "name": "Imgur", "options": { "enabled": true }, "imageType": "png", - "embeddable": false + "embeddable": false, + "url": "https://imgur.com" }, "wikipedia": { "frontends": { @@ -272,7 +279,8 @@ "name": "Wikipedia", "options": { "enabled": false }, "imageType": "svg", - "embeddable": false + "embeddable": false, + "url": "https://wikipedia.com" }, "medium": { "frontends": { @@ -304,8 +312,9 @@ ], "name": "Medium", "options": { "enabled": true }, - "imageType": "svg", - "embeddable": false + "imageType": "svgMono", + "embeddable": false, + "url": "https://medium.com" }, "quora": { "frontends": { @@ -321,7 +330,8 @@ "name": "Quora", "options": { "enabled": true }, "imageType": "png", - "embeddable": false + "embeddable": false, + "url": "https://quora.com" }, "imdb": { "frontends": { @@ -337,7 +347,8 @@ "name": "IMDb", "options": { "enabled": false }, "imageType": "svg", - "embeddable": false + "embeddable": false, + "url": "https://imdb.com" }, "reuters": { "frontends": { @@ -351,7 +362,8 @@ "name": "Reuters", "options": { "enabled": false }, "imageType": "svg", - "embeddable": false + "embeddable": false, + "url": "https://reuters.com" }, "peertube": { "frontends": { @@ -365,7 +377,8 @@ "name": "PeerTube", "options": { "enabled": false }, "imageType": "svg", - "embeddable": false + "embeddable": false, + "url": "https://search.joinpeertube.org" }, "lbry": { "frontends": { @@ -389,10 +402,12 @@ "options": { "enabled": false, "frontend": "librarian", - "redirectType": "both" + "redirectType": "both", + "embedFrontend": "librarian" }, "imageType": "png", - "embeddable": true + "embeddable": true, + "url": "https://odysee.com" }, "search": { "frontends": { @@ -467,8 +482,9 @@ "enabled": true, "frontend": "searxng" }, - "imageType": "svg", - "embeddable": false + "imageType": "svgMono", + "embeddable": false, + "url": "https://search.libredirect.invalid" }, "translate": { "frontends": { @@ -493,8 +509,9 @@ "enabled": true, "frontend": "simplyTranslate" }, - "imageType": "svg", - "embeddable": false + "imageType": "svgMono", + "embeddable": false, + "url": "https://translate.google.com" }, "maps": { "frontends": { @@ -514,8 +531,9 @@ "enabled": true, "frontend": "osm" }, - "imageType": "svg", - "embeddable": false + "imageType": "svgMono", + "embeddable": false, + "url": "https://maps.google.com" }, "sendTargets": { "frontends": { @@ -528,8 +546,9 @@ "targets": ["^https?:\\/{2}send\\.libredirect\\.invalid\\/$", "^https?:\\/{2}send\\.firefox\\.com\\/$", "^https?:\\/{2}sendfiles\\.online\\/$"], "name": "Send Files", "options": { "enabled": true }, - "imageType": "svg", - "embeddable": false + "imageType": "svgMono", + "embeddable": false, + "url": "https://send.libredirect.invalid" } } } diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index 2547917a..85bdf1cf 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -446,7 +446,7 @@ def peertube(): 'https://instances.joinpeertube.org/api/v1/instances?start=0&count=1045&sort=-createdAt') rJson = json.loads(r.text) - myList = [] + myList = ['https://search.joinpeertube.org'] for k in rJson['data']: myList.append('https://'+k['host']) diff --git a/src/pages/options/index.html b/src/pages/options/index.html index e1163e99..a23ff247 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -10,26 +10,85 @@
@@ -169,7 +228,7 @@
-
+
medium
@@ -205,25 +264,25 @@
-
+
search
-
+
translate
-
+
maps
-
+
sendTargets
diff --git a/src/pages/options/widgets/services.js b/src/pages/options/widgets/services.js index 69840de4..b595943e 100644 --- a/src/pages/options/widgets/services.js +++ b/src/pages/options/widgets/services.js @@ -53,7 +53,7 @@ function changeFrontendsSettings(service) { } } } - } else if (Object.keys(config.services[service].frontends) > 1) divs[service].embedFrontend.disabled = true + } else if (Object.keys(config.services[service].frontends).length > 1) divs[service].embedFrontend.disabled = true } } diff --git a/src/pages/popup/popup.ejs b/src/pages/popup/popup.ejs new file mode 100644 index 00000000..efb73e5c --- /dev/null +++ b/src/pages/popup/popup.ejs @@ -0,0 +1,49 @@ + + + + + + + + + +
+ <%- include('src/pages/widgets/switches', {config: config}) -%> +
+
+
+
+
+ <%- include('src/pages/widgets/switches', {config: config}) -%> +
+
+ + + + + +
+ + + + diff --git a/src/pages/popup/popup.html b/src/pages/popup/popup.html index 25f70f48..e21a63a0 100644 --- a/src/pages/popup/popup.html +++ b/src/pages/popup/popup.html @@ -8,189 +8,227 @@
@@ -222,4 +260,4 @@ - \ No newline at end of file + diff --git a/src/pages/popup/popup.pug b/src/pages/popup/popup.pug deleted file mode 100644 index 7da687cc..00000000 --- a/src/pages/popup/popup.pug +++ /dev/null @@ -1,155 +0,0 @@ -include ../widgets/icons.pug - -mixin services - .youtube.some-block - a.title(href="https://youtube.com") - img(src="../../assets/images/youtube-icon.png") - h4(data-localise="__MSG_youtube__") YouTube - input.disable-youtube(type="checkbox") - - .youtubeMusic.some-block - a.title(href="https://music.youtube.com") - img(src="../../assets/images/youtube-music-icon.png") - h4(data-localise="__MSG_ytmusic__") YT Music - input.disable-youtubeMusic(type="checkbox") - - .twitter.some-block - a.title(href="https://twitter.com") - img(src="../../assets/images/twitter-icon.png") - h4(data-localise="__MSG_twitter__") Twitter - input.disable-nitter(type="checkbox") - - .instagram.some-block - a.title(href="https://instagram.com") - img(src="../../assets/images/instagram-icon.png") - h4(data-localise="__MSG_instagram__") Instagram - input.disable-bibliogram(type="checkbox") - - .tiktok.some-block - a.title(href="https://tiktok.com") - img(src="../../assets/images/tiktok-icon.png") - h4(data-localise="__MSG_tiktok__") TikTok - input.disable-tiktok(type="checkbox") - - .imgur.some-block - a.title(href="https://imgur.com") - img(src="../../assets/images/imgur.png") - h4(data-localise="__MSG_imgur__") Imgur - input.disable-imgur(type="checkbox") - - .reddit.some-block - a.title(href="https://reddit.com") - img(src="../../assets/images/reddit-icon.png") - h4(data-localise="__MSG_reddit__") Reddit - input.disable-reddit(type="checkbox") - - .wikipedia.some-block - a.title(href="https://wikipedia.com") - img(src="../../assets/images/wikipedia-icon.svg") - h4(data-localise="__MSG_wikipedia__") Wikipedia - input.disable-wikipedia(type="checkbox") - - .medium.some-block - a.title(href="https://medium.com") - +medium - h4(data-localise="__MSG_medium__") Medium - input.disable-medium(type="checkbox") - - .quora.some-block - a.title(href="https://quora.com") - img(src="../../assets/images/quora.png") - h4(data-localise="__MSG_quora__") Quora - input.disable-quora(type="checkbox") - - .imdb.some-block - a.title(href="https://imdb.com") - img(src="../../assets/images/imdb.svg") - h4(data-localise="__MSG_imdb__") IMDb - input.disable-imdb(type="checkbox") - - .reuters.some-block - a.title(href="https://reuters.com") - img(src="../../assets/images/reuters.svg") - h4(data-localise="__MSG_reuters__") Reuters - input.disable-reuters(type="checkbox") - - .peertube.some-block - a.title(href="https://search.joinpeertube.org") - img(src="../../assets/images/peertube-icon.svg") - h4(data-localise="__MSG_peertube__") PeerTube - input.disable-peertube(type="checkbox") - - .lbry.some-block - a.title(href="https://odysee.com/") - img(src="../../assets/images/lbry-icon.png") - h4(data-localise="__MSG_lbry__") LBRY - input.disable-lbry(type="checkbox") - - .search.some-block - a.title(href="https://search.libredirect.invalid") - +search - h4(data-localise="__MSG_search__") Search - input.disable-search(type="checkbox") - - .translate.some-block - a.title(href="https://translate.google.com") - +translate - h4(data-localise="__MSG_translate__") Translate - input.disable-translate(type="checkbox") - - .maps.some-block - a.title(href="https://www.openstreetmap.org") - +maps - h4(data-localise="__MSG_maps__") Maps - input.disable-osm(type="checkbox") - - .sendTargets.some-block - a.title(href="https://send.libredirect.invalid") - +send - h4(data-localise="__MSG_sendFiles__") Send Files - input.disable-sendTargets(type="checkbox") - -doctype html -html(lang="en") - head - meta(charset="utf-8") - meta(name="viewport" content="width=device-width, initial-scale=1") - link(href="../stylesheets/styles.css" rel="stylesheet") - link(href="./style.css" rel="stylesheet") - body(dir="auto") - .current_site - +services - #current_site_divider - hr - .all_sites - +services - hr - #change_instance_div.some-block - a#change_instance.title.button.prevent - h4(data-localise="__MSG_switchInstance__") Change Instance - +change_instance - - #copy_raw_div.some-block(title="Copy the original redirected link") - a#copy_raw.title.button.prevent - h4(data-localise="__MSG_copyRaw__") Copy Raw - +copy_raw - - #unify_div.some-block(title="Unify cookies across all selected instances") - a#unify.title.button.prevent - h4(data-localise="__MSG_unifySettings__") Unify Settings - +unify - - .some-block - a#more-options.title.button.prevent - h4(data-localise="__MSG_settings__") Settings - +settings - - .some-block - a#about.title.button(href="/pages/options/index.html#about") - h4(data-localise="__MSG_about__") About - +about - - .space - - script(type="module" src="../options/init.js") - script(type="module" src="./popup.js") diff --git a/src/pages/widgets/head.pug b/src/pages/widgets/head.pug deleted file mode 100644 index 53de42d3..00000000 --- a/src/pages/widgets/head.pug +++ /dev/null @@ -1,5 +0,0 @@ -head - meta(charset='utf-8') - meta(name="viewport" content="width=device-width, initial-scale=1") - link(rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg") - link(href="../../stylesheets/styles.css" rel="stylesheet") \ No newline at end of file diff --git a/src/pages/widgets/icons.pug b/src/pages/widgets/icons.pug deleted file mode 100644 index cc77ad16..00000000 --- a/src/pages/widgets/icons.pug +++ /dev/null @@ -1,46 +0,0 @@ -mixin medium - svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor") - circle(cx="500" cy="500" r="500") - ellipse(ry="475" rx="250" cy="501" cx="1296") - ellipse(cx="1682" cy="502" rx="88" ry="424") - -mixin search - svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor") - path(d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z") - -mixin translate - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z") - -mixin maps - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path( d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM10 5.47l4 1.4v11.66l-4-1.4V5.47zm-5 .99l3-1.01v11.7l-3 1.16V6.46zm14 11.08l-3 1.01V6.86l3-1.16v11.84z") - -mixin send - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z") - -mixin change_instance - svg(xmlns="http://www.w3.org/2000/svg" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor") - path(d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z") - -mixin settings - svg(xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" - width="26px" fill="currentColor") - path(d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z") - -mixin copy_raw - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z") - -mixin general - svg(xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor") - path(d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z") - -mixin unify - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z") - -mixin about - svg( xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="currentColor") - path( d="M11 17h2v-6h-2Zm1-8q.425 0 .713-.288Q13 8.425 13 8t-.287-.713Q12.425 7 12 7t-.712.287Q11 7.575 11 8t.288.712Q11.575 9 12 9Zm0 13q-2.075 0-3.9-.788-1.825-.787-3.175-2.137-1.35-1.35-2.137-3.175Q2 14.075 2 12t.788-3.9q.787-1.825 2.137-3.175 1.35-1.35 3.175-2.138Q9.925 2 12 2t3.9.787q1.825.788 3.175 2.138 1.35 1.35 2.137 3.175Q22 9.925 22 12t-.788 3.9q-.787 1.825-2.137 3.175-1.35 1.35-3.175 2.137Q14.075 22 12 22Zm0-2q3.35 0 5.675-2.325Q20 15.35 20 12q0-3.35-2.325-5.675Q15.35 4 12 4 8.65 4 6.325 6.325 4 8.65 4 12q0 3a.35 2.325 5.675Q8.65 20 12 20Zm0-8Z") \ No newline at end of file diff --git a/src/pages/widgets/instances.pug b/src/pages/widgets/instances.pug deleted file mode 100644 index 950bd46b..00000000 --- a/src/pages/widgets/instances.pug +++ /dev/null @@ -1,15 +0,0 @@ -mixin instances(myPlaceholder) - .some-block.option-block - h4(data-localise="__MSG_defaultInstances__") Default Instances - - .checklist - hr - .some-block.option-block - h4(data-localise="__MSG_customInstances__") Custom Instances - form.custom-instance-form - .some-block.option-block - input.custom-instance(placeholder=myPlaceholder type="url") - button.add.add-instance(type="submit") - svg(xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor") - path(d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z") - .checklist.custom-checklist \ No newline at end of file diff --git a/src/pages/widgets/latency.pug b/src/pages/widgets/latency.pug deleted file mode 100644 index e5bf53b2..00000000 --- a/src/pages/widgets/latency.pug +++ /dev/null @@ -1,14 +0,0 @@ -mixin latency(service) - - var latencyVal - if (service) - - latencyVal = `latency-${service}` - else - - latencyVal = `latency` - - .buttons.buttons-inline - label.button.button-inline(id=`${latencyVal}-label` for=latencyVal) - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z") - |  - x(data-localise="__MSG_testInstancesLatency__") Test Instances Latency - input.button.button-inline(id=latencyVal style="display:none;") \ No newline at end of file diff --git a/src/pages/widgets/links.ejs b/src/pages/widgets/links.ejs index c28d3668..86b9f260 100644 --- a/src/pages/widgets/links.ejs +++ b/src/pages/widgets/links.ejs @@ -1,7 +1,13 @@ diff --git a/src/pages/widgets/links.pug b/src/pages/widgets/links.pug deleted file mode 100644 index c7f8e0a6..00000000 --- a/src/pages/widgets/links.pug +++ /dev/null @@ -1,83 +0,0 @@ -include ./icons.pug - -mixin links(service) - section#links.links - .title - +general - a(href="#general" data-localise="__MSG_general__") General - - .title - img(src="../../../assets/images/youtube-icon.png") - a(href="#youtube" data-localise="__MSG_youtube__") YouTube - - .title - img(src="../../../assets/images/youtube-music-icon.png") - a(href="#youtubeMusic" data-localise="__MSG_ytmusic__") YT Music - - .title - img(src="../../../assets/images/twitter-icon.png") - a(href="#twitter" data-localise="__MSG_twitter__") Twitter - - .title - img(src="../../../assets/images/instagram-icon.png") - a(href="#instagram" data-localise="__MSG_instagram__") Instagram - - .title - img(src="../../../assets/images/tiktok-icon.png") - a(href="#tiktok" data-localise="__MSG_tiktok__") TikTok - - .title - img(src="../../../assets/images/reddit-icon.png") - a(href="#reddit" data-localise="__MSG_reddit__") Reddit - - .title - img(src="../../../assets/images/imgur.png") - a(href="#imgur" data-localise="__MSG_imgur__") Imgur - - .title - img(src="../../../assets/images/wikipedia-icon.svg") - a(href="#wikipedia" data-localise="__MSG_wikipedia__") Wikipedia - - .title - +medium - a(href="#medium" data-localise="__MSG_medium__") Medium - - .title - img(src="../../../assets/images/quora.png") - a(href="#quora" data-localise="__MSG_quora__") Quora - - .title - img(src="../../../assets/images/imdb.svg") - a(href="#imdb" data-localise="__MSG_imdb__") IMDb - - .title - img(src="../../../assets/images/reuters.svg") - a(href="#reuters" data-localise="__MSG_reuters__") Reuters - - .title - img(src="../../../assets/images/peertube-icon.svg") - a(href="#peertube" data-localise="__MSG_peertube__") PeerTube - - .title - img(src="../../../assets/images/lbry-icon.png") - a(href="#lbry" data-localise="__MSG_lbry__") LBRY - - .title - +search - a(href="#search" data-localise="__MSG_search__") Search - - .title - +translate - a(href="#translate" data-localise="__MSG_translate__") Translate - - .title - +maps - a(href="#maps" data-localise="__MSG_maps__") Maps - - .title - +send - a(href="#sendTargets" data-localise="__MSG_sendFiles__") Send Files - - .title - +about - a(href="#about" data-localise="__MSG_about") About diff --git a/src/pages/widgets/switches.ejs b/src/pages/widgets/switches.ejs new file mode 100644 index 00000000..45bcd790 --- /dev/null +++ b/src/pages/widgets/switches.ejs @@ -0,0 +1,11 @@ +<% for (const service in config.services) { -%> + +<% } %> -- cgit 1.4.1 From 18facf37a2f058b1314f5fd3a1f9d36c70ba27f5 Mon Sep 17 00:00:00 2001 From: Hygna Date: Fri, 30 Sep 2022 14:54:56 +0100 Subject: Squashed a few bugs --- src/assets/images/sendTargets-icon.svg | 3 - src/assets/javascripts/services.js | 36 +++++++--- src/assets/javascripts/utils.js | 124 ++++++++++++++++----------------- src/config/config.json | 19 ++--- src/pages/background/background.js | 30 ++++---- src/pages/options/index.html | 14 ++-- src/pages/options/widgets/general.js | 2 +- src/pages/options/widgets/services.js | 2 +- src/pages/popup/popup.html | 20 +++--- 9 files changed, 131 insertions(+), 119 deletions(-) delete mode 100644 src/assets/images/sendTargets-icon.svg (limited to 'src/assets/images') diff --git a/src/assets/images/sendTargets-icon.svg b/src/assets/images/sendTargets-icon.svg deleted file mode 100644 index 5557664e..00000000 --- a/src/assets/images/sendTargets-icon.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 49af6d1f..404962ee 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -391,7 +391,7 @@ function redirect(url, type, initiator) { } } -function initDefaults() { +async function initDefaults() { return new Promise(async resolve => { fetch("/instances/data.json") .then(response => response.text()) @@ -400,13 +400,12 @@ function initDefaults() { let redirects = JSON.parse(data) let options = r.options let targets = {} - // let latency = {} + const localstorage = {} + const latency = {} for (const service in config.services) { options[service] = {} - // latency[service] = {} if (config.services[service].targets == "datajson") { targets[service] = redirects[service] - //delete dataJson[service] } for (const defaultOption in config.services[service].options) { options[service][defaultOption] = config.services[service].options[defaultOption] @@ -416,11 +415,11 @@ function initDefaults() { options[frontend] = {} for (const network in config.networks) { options[frontend][network] = {} - options[frontend][network].enabled = redirects[frontend][network] + options[frontend][network].enabled = JSON.parse(data)[frontend][network] options[frontend][network].custom = [] } for (const blacklist in r.blacklists) { - for (const instance of blacklist) { + for (const instance of r.blacklists[blacklist]) { let i = options[frontend].clearnet.enabled.indexOf(instance) if (i > -1) options[frontend].clearnet.enabled.splice(i, 1) } @@ -428,7 +427,7 @@ function initDefaults() { } } } - browser.storage.local.set({ redirects, options, targets /*, latency*/ }) + browser.storage.local.set({ redirects, options, targets, latency, localstorage }) resolve() }) }) @@ -449,7 +448,8 @@ function computeService(url, returnFrontend) { } } } - return null + if (returnFrontend) return [null, null] + else return null } function switchInstance(url) { @@ -515,7 +515,7 @@ function reverse(url) { }) } -function unifyPreferences(url) { +function unifyPreferences(url, tabId) { return new Promise(async resolve => { // await init() // await getConfig() @@ -539,7 +539,23 @@ function unifyPreferences(url) { await utils.copyCookie(currentFrontend, url, instancesList, cookie) } } - if ("localStorage" in frontend.preferences) { + if ("localstorage" in frontend.preferences) { + browser.tabs.executeScript(tabId, { + code: "const frontend = " + frontend, + code: "const items = " + config.services[currentService].frontends[currentFrontend].preferences.localStorage, + //file: "/assets/javascripts/get-localstorage.js", + runAt: "document_start", + }) + + for (const instance of instancesList) + browser.tabs.create({ url: instance }, tab => + browser.tabs.executeScript(tab.id, { + code: "const frontend = " + frontend, + code: "const items = " + config.services[currentService].frontends[currentFrontend].preferences.localStorage, + file: "/assets/javascripts/set-localstorage.js", + runAt: "document_start", + }) + ) } if ("indexeddb" in frontend.preferences) { } diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js index 186fae43..a1c559df 100644 --- a/src/assets/javascripts/utils.js +++ b/src/assets/javascripts/utils.js @@ -59,27 +59,26 @@ function protocolHost(url) { return `${url.protocol}//${url.host}` } -async function processDefaultCustomInstances(service, name, network, document) { +async function processDefaultCustomInstances(service, frontend, network, document) { let instancesLatency - let nameNetworkElement = document.getElementById(name).getElementsByClassName(network)[0] + let frontendNetworkElement = document.getElementById(frontend).getElementsByClassName(network)[0] - let nameCustomInstances = [] - let nameCheckListElement = nameNetworkElement.getElementsByClassName("checklist")[0] + let frontendCustomInstances = [] + let frontendCheckListElement = frontendNetworkElement.getElementsByClassName("checklist")[0] await initBlackList() - let nameDefaultRedirects + let frontendDefaultRedirects let redirects, options async function getFromStorage() { return new Promise(async resolve => browser.storage.local.get(["options", "redirects", "latency"], r => { - nameDefaultRedirects = r.options[name][network].enabled - nameCustomInstances = r.options[name][network].custom + frontendDefaultRedirects = r.options[frontend][network].enabled + frontendCustomInstances = r.options[frontend][network].custom options = r.options - if (r.latency) instancesLatency = r.latency[name] ?? [] - else instancesLatency = [] + instancesLatency = r.latency[frontend] ?? [] redirects = r.redirects resolve() }) @@ -88,27 +87,26 @@ async function processDefaultCustomInstances(service, name, network, document) { await getFromStorage() - function calcNameCheckBoxes() { + function calcFrontendCheckBoxes() { let isTrue = true - for (const item of redirects[name][network]) { - if (nameDefaultRedirects === undefined) console.log(name + network + " is undefined") - if (!nameDefaultRedirects.includes(item)) { + for (const item of redirects[frontend][network]) { + if (!frontendDefaultRedirects.includes(item)) { isTrue = false break } } - for (const element of nameCheckListElement.getElementsByTagName("input")) { - element.checked = nameDefaultRedirects.includes(element.className) + for (const element of frontendCheckListElement.getElementsByTagName("input")) { + element.checked = frontendDefaultRedirects.includes(element.className) } - if (nameDefaultRedirects.length == 0) isTrue = false - nameNetworkElement.getElementsByClassName("toggle-all")[0].checked = isTrue + if (frontendDefaultRedirects.length == 0) isTrue = false + frontendNetworkElement.getElementsByClassName("toggle-all")[0].checked = isTrue } - nameCheckListElement.innerHTML = [ + frontendCheckListElement.innerHTML = [ `
Toggle All
`, - ...redirects[name][network].map(x => { + ...redirects[frontend][network].map(x => { const cloudflare = cloudflareBlackList.includes(x) ? ' cloudflare' : "" const authenticate = authenticateBlackList.includes(x) ? ' authenticate' : "" const offline = offlineBlackList.includes(x) ? ' offline' : "" @@ -132,33 +130,33 @@ async function processDefaultCustomInstances(service, name, network, document) { localise.localisePage() - calcNameCheckBoxes() - nameNetworkElement.getElementsByClassName("toggle-all")[0].addEventListener("change", async event => { - if (event.service.checked) nameDefaultRedirects = [...redirects[name][network]] - else nameDefaultRedirects = [] + calcFrontendCheckBoxes() + frontendNetworkElement.getElementsByClassName("toggle-all")[0].addEventListener("change", async event => { + if (event.target.checked) frontendDefaultRedirects = [...redirects[frontend][network]] + else frontendDefaultRedirects = [] - options[service][network].enabled = nameDefaultRedirects + options[frontend][network].enabled = frontendDefaultRedirects browser.storage.local.set({ options }) - calcNameCheckBoxes() + calcFrontendCheckBoxes() }) - for (let element of nameCheckListElement.getElementsByTagName("input")) { + for (let element of frontendCheckListElement.getElementsByTagName("input")) { if (element.className != "toggle-all") - nameNetworkElement.getElementsByClassName(element.className)[0].addEventListener("change", async event => { - if (event.service.checked) nameDefaultRedirects.push(element.className) + frontendNetworkElement.getElementsByClassName(element.className)[0].addEventListener("change", async event => { + if (event.target.checked) frontendDefaultRedirects.push(element.className) else { - let index = nameDefaultRedirects.indexOf(element.className) - if (index > -1) nameDefaultRedirects.splice(index, 1) + let index = frontendDefaultRedirects.indexOf(element.className) + if (index > -1) frontendDefaultRedirects.splice(index, 1) } - options[service][network].enabled = nameDefaultRedirects + options[frontend][network].enabled = frontendDefaultRedirects browser.storage.local.set({ options }) - calcNameCheckBoxes() + calcFrontendCheckBoxes() }) } - function calcNameCustomInstances() { - nameNetworkElement.getElementsByClassName("custom-checklist")[0].innerHTML = nameCustomInstances + function calcFrontendCustomInstances() { + frontendNetworkElement.getElementsByClassName("custom-checklist")[0].innerHTML = frontendCustomInstances .map( x => `
${x} @@ -172,30 +170,30 @@ async function processDefaultCustomInstances(service, name, network, document) { ) .join("\n") - for (const item of nameCustomInstances) { - nameNetworkElement.getElementsByClassName(`clear-${item}`)[0].addEventListener("click", async () => { - let index = nameCustomInstances.indexOf(item) - if (index > -1) nameCustomInstances.splice(index, 1) - options[service][network].custom = nameCustomInstances + for (const item of frontendCustomInstances) { + frontendNetworkElement.getElementsByClassName(`clear-${item}`)[0].addEventListener("click", async () => { + let index = frontendCustomInstances.indexOf(item) + if (index > -1) frontendCustomInstances.splice(index, 1) + options[frontend][network].custom = frontendCustomInstances browser.storage.local.set({ options }) - calcNameCustomInstances() + calcFrontendCustomInstances() }) } } - calcNameCustomInstances() - nameNetworkElement.getElementsByClassName("custom-instance-form")[0].addEventListener("submit", async event => { + calcFrontendCustomInstances() + frontendNetworkElement.getElementsByClassName("custom-instance-form")[0].addEventListener("submit", async event => { event.preventDefault() - let nameCustomInstanceInput = nameNetworkElement.getElementsByClassName("custom-instance")[0] - let url = new URL(nameCustomInstanceInput.value) + let frontendCustomInstanceInput = frontendNetworkElement.getElementsByClassName("custom-instance")[0] + let url = new URL(frontendCustomInstanceInput.value) let protocolHostVar = protocolHost(url) - if (nameCustomInstanceInput.validity.valid && !redirects[name][network].includes(protocolHostVar)) { - if (!nameCustomInstances.includes(protocolHostVar)) { - nameCustomInstances.push(protocolHostVar) - options[service][network].custom = nameCustomInstances + if (frontendCustomInstanceInput.validity.valid && !redirects[frontend][network].includes(protocolHostVar)) { + if (!frontendCustomInstances.includes(protocolHostVar)) { + frontendCustomInstances.push(protocolHostVar) + options[frontend][network].custom = frontendCustomInstances browser.storage.local.set({ options }) - nameCustomInstanceInput.value = "" + frontendCustomInstanceInput.value = "" } - calcNameCustomInstances() + calcFrontendCustomInstances() } }) } @@ -245,11 +243,12 @@ function pingOnce(href) { async function testLatency(element, instances, frontend) { return new Promise(async resolve => { let myList = {} - let latencyThreshold - let redirectsChecks = [] + let latencyThreshold, options + //let redirectsChecks = [] browser.storage.local.get(["options"], r => { latencyThreshold = r.options.latencyThreshold - redirectsChecks = r.options[frontend].clearnet.enabled + //redirectsChecks = r.options[frontend].clearnet.enabled + options = r.options }) for (const href of instances) await ping(href).then(time => { @@ -261,11 +260,9 @@ async function testLatency(element, instances, frontend) { else color = "red" if (time > latencyThreshold) { - redirectsChecks.splice(redirectsChecks.indexOf(href), 1) + options[frontend].clearnet.enabled.splice(options[frontend].clearnet.enabled.indexOf(href), 1) } - browser.storage.local.set({ [`${frontend}ClearnetRedirectsChecks`]: redirectsChecks }) - let text if (time == 5000) text = "5000ms+" else if (time > 5000) text = `ERROR: ${time - 5000}` @@ -273,6 +270,7 @@ async function testLatency(element, instances, frontend) { element.innerHTML = `${href}: ${text}` } }) + browser.storage.local.set({ options }) resolve(myList) }) } @@ -386,7 +384,7 @@ function unify() { return } - let result = await servicesHelper.unifyPreferences(url) + let result = await servicesHelper.unifyPreferences(url, currTab.id) resolve(result) } @@ -417,21 +415,21 @@ function switchInstance(test) { }) } -function latency(name, frontend, document, location) { +function latency(service, frontend, document, location) { let latencyElement = document.getElementById(`latency-${frontend}`) let latencyLabel = document.getElementById(`latency-${frontend}-label`) latencyElement.addEventListener("click", async () => { let reloadWindow = () => location.reload() latencyElement.addEventListener("click", reloadWindow) - let key = `${name} Redirects` - browser.storage.local.get(key, r => { - let redirects = r[key] + browser.storage.local.get(["redirects", "latency"], r => { + let redirects = r.redirects const oldHtml = latencyLabel.innerHTML latencyLabel.innerHTML = "..." testLatency(latencyLabel, redirects[frontend].clearnet, frontend).then(r => { - browser.storage.local.set({ [`${frontend}Latency`]: r }) + latency[frontend] = r + browser.storage.local.set({ latency }) latencyLabel.innerHTML = oldHtml - processDefaultCustomInstances(name, frontend, "clearnet", document) + processDefaultCustomInstances(service, frontend, "clearnet", document) latencyElement.removeEventListener("click", reloadWindow) }) }) diff --git a/src/config/config.json b/src/config/config.json index e2b511b9..b15c20d4 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -48,7 +48,8 @@ "sponsorblock", "theme", "volume", - "watchHistory" + "watchHistory", + "localSubscriptions" ] }, "name": "Piped", @@ -490,13 +491,13 @@ }, "lingva": { "preferences": { - "localstorage": ["isauto", "source", "target"] + "localstorage": ["isauto", "source", "target", "chakra-ui-color-mode"] }, - "name": "Lingva", + "name": "Lingva Translate", "instanceList": true } }, - "targets": ["^https?:\\/{2}translate\\.google(\\.[a-z]{2,3}){1,2}\\/"], + "targets": ["^https?:\\/{2}translate\\.google(\\.[a-z]{2,3}){1,2}\\/", "^https?:\\/{2}translate\\.libredirect\\.invalid"], "name": "Translate", "options": { "enabled": true, @@ -504,7 +505,7 @@ }, "imageType": "svgMono", "embeddable": false, - "url": "https://translate.google.com" + "url": "https://translate.libredirect.invalid" }, "maps": { "frontends": { @@ -518,7 +519,7 @@ "singleInstance": "https://www.openstreetmap.org" } }, - "targets": ["^https?:\\/{2}(((www|maps)\\.)?(google\\.).*(\\/maps)|maps\\.(google\\.).*)"], + "targets": ["^https?:\\/{2}maps\\.libredirect\\.invalid", "^https?:\\/{2}(((www|maps)\\.)?(google\\.).*(\\/maps)|maps\\.(google\\.).*)"], "name": "Maps", "options": { "enabled": true, @@ -526,16 +527,16 @@ }, "imageType": "svgMono", "embeddable": false, - "url": "https://maps.google.com" + "url": "https://maps.libredirect.invalid" }, - "sendTargets": { + "uploadFiles": { "frontends": { "send": { "name": "Send", "instanceList": "true" } }, - "targets": ["^https?:\\/{2}send\\.libredirect\\.invalid\\/?$", "^https?:\\/{2}send\\.firefox\\.com\\/?$", "^https?:\\/{2}sendfiles\\.online\\/?$"], + "targets": ["^https?:\\/{2}send\\.libredirect\\.invalid", "^https?:\\/{2}send\\.firefox\\.com\\/?$", "^https?:\\/{2}sendfiles\\.online\\/?$"], "name": "Send Files", "options": { "enabled": true }, "imageType": "svgMono", diff --git a/src/pages/background/background.js b/src/pages/background/background.js index e9bf691f..3a900609 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -6,20 +6,7 @@ import servicesHelper from "../../assets/javascripts/services.js" window.browser = window.browser || window.chrome -browser.runtime.onInstalled.addListener(details => { - function initDefaults() { - fetch("/instances/blacklist.json") - .then(response => response.text()) - .then(async data => { - browser.storage.local.clear(() => { - browser.storage.local.set({ blacklists: JSON.parse(data) }, () => { - generalHelper.initDefaults() - servicesHelper.initDefaults() - }) - }) - }) - } - +browser.runtime.onInstalled.addListener(async details => { // if (details.reason == 'install' || (details.reason == "update" && details.previousVersion != browser.runtime.getManifest().version)) { // if (details.reason == "update") // browser.storage.local.get(null, r => { @@ -38,12 +25,25 @@ browser.runtime.onInstalled.addListener(details => { case "update": switch (details.previousVersion) { case "2.2.1": - //do stuff + initDefaults() break } } }) +function initDefaults() { + browser.storage.local.clear(() => { + fetch("/instances/blacklist.json") + .then(response => response.text()) + .then(async data => { + browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { + await generalHelper.initDefaults() + await servicesHelper.initDefaults() + }) + }) + }) +} + let BYPASSTABs = [] browser.webRequest.onBeforeRequest.addListener( details => { diff --git a/src/pages/options/index.html b/src/pages/options/index.html index 6ef33723..71d04fd0 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -84,7 +84,7 @@ - Send Files
+ Send Files
@@ -318,9 +318,9 @@ - Send Files + Send Files
- +
@@ -2818,7 +2818,7 @@

Frontend

@@ -3134,14 +3134,14 @@
-
+
-

Send Files

+

Send Files


Enable

- +

diff --git a/src/pages/options/widgets/general.js b/src/pages/options/widgets/general.js index 23ed73ee..cd5cfb47 100644 --- a/src/pages/options/widgets/general.js +++ b/src/pages/options/widgets/general.js @@ -37,7 +37,6 @@ function setOption(option, multiChoice, event) { browser.storage.local.get("options", r => { let options = r.options if (multiChoice) { - console.log(event.target.options) options[option] = event.target.options[event.target.options.selectedIndex].value } else { options[option] = event.target.checked @@ -95,6 +94,7 @@ resetSettings.addEventListener("click", async () => { .then(response => response.text()) .then(async data => { browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { + await generalHelper.initDefaults() await servicesHelper.initDefaults() location.reload() }) diff --git a/src/pages/options/widgets/services.js b/src/pages/options/widgets/services.js index 873950f3..98e068a1 100644 --- a/src/pages/options/widgets/services.js +++ b/src/pages/options/widgets/services.js @@ -77,7 +77,7 @@ function changeNetworkSettings() { changeNetworkSettings() for (const service in config.services) { divs[service] = {} - divs[service][service] = document.getElementById(`${service}_page`) + //divs[service].page = document.getElementById(`${service}_page`) for (const option in config.services[service].options) { divs[service][option] = document.getElementById(`${service}-${option}`) diff --git a/src/pages/popup/popup.html b/src/pages/popup/popup.html index d52a34b6..56e4ca14 100644 --- a/src/pages/popup/popup.html +++ b/src/pages/popup/popup.html @@ -91,7 +91,7 @@

Search

-
+ -
+ -
+
-

Send Files

- +

Send Files

+
@@ -204,7 +204,7 @@

Search

-
+ -
+ -
+
-

Send Files

- +

Send Files

+
-- cgit 1.4.1 From e21ecb4e1d640add426865d5719ba8cd63eab977 Mon Sep 17 00:00:00 2001 From: Hygna Date: Sat, 1 Oct 2022 11:17:32 +0100 Subject: Unify Localstorage --- src/assets/images/uploadFiles-icon.svg | 3 ++ src/assets/javascripts/get-localstorage.js | 15 ++++++ src/assets/javascripts/init.js | 60 +++++++++++++++++++++++ src/assets/javascripts/services.js | 76 ++++-------------------------- src/assets/javascripts/set-localstorage.js | 13 +++++ src/assets/javascripts/utils.js | 14 ++++-- src/pages/background/background.js | 3 +- src/pages/options/index.html | 8 ++-- src/pages/options/widgets/about.ejs | 8 ++-- src/pages/options/widgets/services.js | 2 +- 10 files changed, 119 insertions(+), 83 deletions(-) create mode 100644 src/assets/images/uploadFiles-icon.svg create mode 100644 src/assets/javascripts/get-localstorage.js create mode 100644 src/assets/javascripts/init.js create mode 100644 src/assets/javascripts/set-localstorage.js (limited to 'src/assets/images') diff --git a/src/assets/images/uploadFiles-icon.svg b/src/assets/images/uploadFiles-icon.svg new file mode 100644 index 00000000..5557664e --- /dev/null +++ b/src/assets/images/uploadFiles-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/javascripts/get-localstorage.js b/src/assets/javascripts/get-localstorage.js new file mode 100644 index 00000000..66740408 --- /dev/null +++ b/src/assets/javascripts/get-localstorage.js @@ -0,0 +1,15 @@ +window.browser = window.browser || window.chrome + +browser.storage.local.get(["localstorage", "tmp"], r => { + let localstorageJson = r.localstorage + const frontend = r.tmp[0] + const items = r.tmp[1] + localstorageJson[frontend] = {} + + for (const item of items) { + let tmp = localStorage.getItem(item) + if (tmp) localstorageJson[frontend][item] = tmp + } + + browser.storage.local.set({ localstorage: localstorageJson }) +}) diff --git a/src/assets/javascripts/init.js b/src/assets/javascripts/init.js new file mode 100644 index 00000000..c6758530 --- /dev/null +++ b/src/assets/javascripts/init.js @@ -0,0 +1,60 @@ +async function getConfig() { + return new Promise(resolve => { + fetch("/config/config.json") + .then(response => response.text()) + .then(data => { + config = JSON.parse(data) + resolve() + }) + }) +} + +let config +await getConfig() + +async function initDefaults() { + return new Promise(async resolve => { + fetch("/instances/data.json") + .then(response => response.text()) + .then(async data => { + browser.storage.local.get(["options", "blacklists"], async r => { + let redirects = JSON.parse(data) + let options = r.options + let targets = {} + const localstorage = {} + const latency = {} + for (const service in config.services) { + options[service] = {} + if (config.services[service].targets == "datajson") { + targets[service] = redirects[service] + } + for (const defaultOption in config.services[service].options) { + options[service][defaultOption] = config.services[service].options[defaultOption] + } + for (const frontend in config.services[service].frontends) { + if (config.services[service].frontends[frontend].instanceList) { + options[frontend] = {} + for (const network in config.networks) { + options[frontend][network] = {} + options[frontend][network].enabled = JSON.parse(data)[frontend][network] + options[frontend][network].custom = [] + } + for (const blacklist in r.blacklists) { + for (const instance of r.blacklists[blacklist]) { + let i = options[frontend].clearnet.enabled.indexOf(instance) + if (i > -1) options[frontend].clearnet.enabled.splice(i, 1) + } + } + } + } + } + browser.storage.local.set({ redirects, options, targets, latency, localstorage }) + resolve() + }) + }) + }) +} + +export default { + initDefaults, +} diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 404962ee..718b3f5e 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -2,7 +2,7 @@ window.browser = window.browser || window.chrome import utils from "./utils.js" -let config, redirects, options, targets, blacklists +let config, redirects, options, blacklists async function getConfig() { return new Promise(resolve => { @@ -17,12 +17,10 @@ async function getConfig() { function init() { return new Promise(async resolve => { - // await getConfig() - browser.storage.local.get(["options", "targets", "redirects", "blacklists"], r => { + browser.storage.local.get(["options", "redirects", "blacklists"], r => { if (r.options) { blacklists = r.blacklists redirects = r.redirects - targets = r.targets options = r.options } resolve() @@ -37,7 +35,6 @@ function fetchFrontendInstanceList(service, frontend) { let tmp = [] if (config.services[service].frontends[frontend].instanceList) { for (const network in config.networks) { - if (!redirects[frontend]) console.log(frontend) tmp.push(...redirects[frontend][network], ...options[frontend][network].custom) } } else if (config.services[service].frontends[frontend].singleInstance) tmp = config.services[service].frontends[frontend].singleInstance @@ -45,8 +42,6 @@ function fetchFrontendInstanceList(service, frontend) { } function all(service, frontend) { - // init() - // getConfig() let instances = [] if (!frontend) { for (const frontend in config.services[service].frontends) { @@ -90,10 +85,9 @@ function redirect(url, type, initiator) { if (!regexArray(service, url)) continue if (Object.keys(config.services[service].frontends).length > 1) { - frontend = options[service].frontend - } else { - frontend = Object.keys(config.services[service].frontends)[0] - } + if (type == "sub_frame") frontend = options[service].embedFrontend + else frontend = options[service].frontend + } else frontend = Object.keys(config.services[service].frontends)[0] if (config.services[service].frontends[frontend].instanceList) { let instanceList = [...options[frontend][network].enabled, ...options[frontend][network].custom] @@ -103,7 +97,7 @@ function redirect(url, type, initiator) { } else if (config.services[service].frontends[frontend].singleInstance) randomInstance = config.services[service].frontends[frontend].singleInstance break } - if (frontend == null) return + if (!frontend) return // Here is a (temperory) space for defining constants required in 2 or more switch cases. // When possible, try have the two switch cases share all their code as done with searx and searxng. @@ -391,49 +385,6 @@ function redirect(url, type, initiator) { } } -async function initDefaults() { - return new Promise(async resolve => { - fetch("/instances/data.json") - .then(response => response.text()) - .then(async data => { - browser.storage.local.get(["options", "blacklists"], async r => { - let redirects = JSON.parse(data) - let options = r.options - let targets = {} - const localstorage = {} - const latency = {} - for (const service in config.services) { - options[service] = {} - if (config.services[service].targets == "datajson") { - targets[service] = redirects[service] - } - for (const defaultOption in config.services[service].options) { - options[service][defaultOption] = config.services[service].options[defaultOption] - } - for (const frontend in config.services[service].frontends) { - if (config.services[service].frontends[frontend].instanceList) { - options[frontend] = {} - for (const network in config.networks) { - options[frontend][network] = {} - options[frontend][network].enabled = JSON.parse(data)[frontend][network] - options[frontend][network].custom = [] - } - for (const blacklist in r.blacklists) { - for (const instance of r.blacklists[blacklist]) { - let i = options[frontend].clearnet.enabled.indexOf(instance) - if (i > -1) options[frontend].clearnet.enabled.splice(i, 1) - } - } - } - } - } - browser.storage.local.set({ redirects, options, targets, latency, localstorage }) - resolve() - }) - }) - }) -} - function computeService(url, returnFrontend) { for (const service in config.services) { if (regexArray(service, url)) { @@ -454,8 +405,6 @@ function computeService(url, returnFrontend) { function switchInstance(url) { return new Promise(async resolve => { - // await init() - // await getConfig() const protocolHost = utils.protocolHost(url) for (const service in config.services) { if (!options[service].enabled) continue @@ -487,8 +436,6 @@ function switchInstance(url) { function reverse(url) { return new Promise(async resolve => { - // await init() - // await getConfig() let protocolHost = utils.protocolHost(url) let currentService for (const service in config.services) { @@ -517,8 +464,6 @@ function reverse(url) { function unifyPreferences(url, tabId) { return new Promise(async resolve => { - // await init() - // await getConfig() const protocolHost = utils.protocolHost(url) let currentFrontend, currentService serviceloop: for (const service in config.services) { @@ -540,18 +485,14 @@ function unifyPreferences(url, tabId) { } } if ("localstorage" in frontend.preferences) { + browser.storage.local.set({ tmp: [currentFrontend, frontend.preferences.localstorage] }) browser.tabs.executeScript(tabId, { - code: "const frontend = " + frontend, - code: "const items = " + config.services[currentService].frontends[currentFrontend].preferences.localStorage, - //file: "/assets/javascripts/get-localstorage.js", + file: "/assets/javascripts/get-localstorage.js", runAt: "document_start", }) - for (const instance of instancesList) browser.tabs.create({ url: instance }, tab => browser.tabs.executeScript(tab.id, { - code: "const frontend = " + frontend, - code: "const items = " + config.services[currentService].frontends[currentFrontend].preferences.localStorage, file: "/assets/javascripts/set-localstorage.js", runAt: "document_start", }) @@ -594,7 +535,6 @@ function setRedirects(redirects) { export default { redirect, - initDefaults, computeService, switchInstance, reverse, diff --git a/src/assets/javascripts/set-localstorage.js b/src/assets/javascripts/set-localstorage.js new file mode 100644 index 00000000..8dbfcad7 --- /dev/null +++ b/src/assets/javascripts/set-localstorage.js @@ -0,0 +1,13 @@ +window.browser = window.browser || window.chrome + +browser.storage.local.get(["localstorage", "tmp"], r => { + const localstorageJson = r.localstorage + const frontend = r.tmp[0] + const items = localstorageJson[frontend] + + for (const item in items) { + localStorage.setItem(item, items[item]) + } + + window.close() +}) diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js index a1c559df..aaa52955 100644 --- a/src/assets/javascripts/utils.js +++ b/src/assets/javascripts/utils.js @@ -244,22 +244,20 @@ async function testLatency(element, instances, frontend) { return new Promise(async resolve => { let myList = {} let latencyThreshold, options - //let redirectsChecks = [] browser.storage.local.get(["options"], r => { latencyThreshold = r.options.latencyThreshold - //redirectsChecks = r.options[frontend].clearnet.enabled options = r.options }) - for (const href of instances) + for (const href of instances) { await ping(href).then(time => { + let color if (time) { myList[href] = time - let color if (time <= 1000) color = "green" else if (time <= 2000) color = "orange" else color = "red" - if (time > latencyThreshold) { + if (time > latencyThreshold && options[frontend].clearnet.enabled.includes(href)) { options[frontend].clearnet.enabled.splice(options[frontend].clearnet.enabled.indexOf(href), 1) } @@ -268,8 +266,13 @@ async function testLatency(element, instances, frontend) { else if (time > 5000) text = `ERROR: ${time - 5000}` else text = `${time}ms` element.innerHTML = `${href}: ${text}` + } else { + color = "red" + element.innerHTML = `${href}: Server not found` + if (options[frontend].clearnet.enabled.includes(href)) options[frontend].clearnet.enabled.splice(options[frontend].clearnet.enabled.indexOf(href), 1) } }) + } browser.storage.local.set({ options }) resolve(myList) }) @@ -423,6 +426,7 @@ function latency(service, frontend, document, location) { latencyElement.addEventListener("click", reloadWindow) browser.storage.local.get(["redirects", "latency"], r => { let redirects = r.redirects + let latency = r.latency const oldHtml = latencyLabel.innerHTML latencyLabel.innerHTML = "..." testLatency(latencyLabel, redirects[frontend].clearnet, frontend).then(r => { diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 3a900609..5e164d58 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -3,6 +3,7 @@ import generalHelper from "../../assets/javascripts/general.js" import utils from "../../assets/javascripts/utils.js" import servicesHelper from "../../assets/javascripts/services.js" +import initHelper from "../../assets/javascripts/init.js" window.browser = window.browser || window.chrome @@ -38,7 +39,7 @@ function initDefaults() { .then(async data => { browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { await generalHelper.initDefaults() - await servicesHelper.initDefaults() + await initHelper.initDefaults() }) }) }) diff --git a/src/pages/options/index.html b/src/pages/options/index.html index 71d04fd0..384b32bd 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -3252,19 +3252,19 @@
diff --git a/src/pages/options/widgets/about.ejs b/src/pages/options/widgets/about.ejs index 99202141..63c5b027 100644 --- a/src/pages/options/widgets/about.ejs +++ b/src/pages/options/widgets/about.ejs @@ -6,19 +6,19 @@
diff --git a/src/pages/options/widgets/services.js b/src/pages/options/widgets/services.js index 98e068a1..eb7f1ba7 100644 --- a/src/pages/options/widgets/services.js +++ b/src/pages/options/widgets/services.js @@ -40,7 +40,7 @@ function changeFrontendsSettings(service) { } if (config.services[service].embeddable) { - if (!config.services[service].frontends[divs[service].frontend.value].instanceList) { + if (!config.services[service].frontends[divs[service].frontend.value].embeddable) { divs[service].embedFrontend.disabled = false for (const frontend in config.services[service].frontends) { if (config.services[service].frontends[frontend].embeddable) { -- cgit 1.4.1 From c1af086c2756f401d8403b259e29f1354c5e001f Mon Sep 17 00:00:00 2001 From: Hygna Date: Mon, 3 Oct 2022 06:44:49 +0100 Subject: Finished options upgrading --- src/_locales/filter.py | 8 - src/assets/images/sendFiles-icon.svg | 3 + src/assets/images/uploadFiles-icon.svg | 3 - src/assets/javascripts/services.js | 277 +++++++++++++++++---------------- src/assets/javascripts/utils.js | 8 +- src/config/config.json | 5 +- src/instances/get_instances.py | 1 + src/pages/options/index.html | 17 +- src/pages/options/widgets/general.js | 25 ++- src/pages/popup/popup.html | 12 +- src/pages/popup/popup.js | 6 +- 11 files changed, 190 insertions(+), 175 deletions(-) create mode 100644 src/assets/images/sendFiles-icon.svg delete mode 100644 src/assets/images/uploadFiles-icon.svg (limited to 'src/assets/images') diff --git a/src/_locales/filter.py b/src/_locales/filter.py index 581bb36c..0d5fb44d 100644 --- a/src/_locales/filter.py +++ b/src/_locales/filter.py @@ -1,12 +1,4 @@ -import requests import json -from urllib.parse import urlparse -from bs4 import BeautifulSoup -import re -from colorama import Fore, Back, Style -from urllib.parse import urlparse -import socket -import subprocess ar_json = {} diff --git a/src/assets/images/sendFiles-icon.svg b/src/assets/images/sendFiles-icon.svg new file mode 100644 index 00000000..5557664e --- /dev/null +++ b/src/assets/images/sendFiles-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/images/uploadFiles-icon.svg b/src/assets/images/uploadFiles-icon.svg deleted file mode 100644 index 5557664e..00000000 --- a/src/assets/images/uploadFiles-icon.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 279c8c21..59316dfc 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -406,123 +406,115 @@ function computeService(url, returnFrontend) { } } } - // if (returnFrontend) return [null, null] - // else return null + resolve() }) }) }) } -async function switchInstance(url) { - fetch("/config/config.json") - .then(response => response.text()) - .then(configData => { - const config = JSON.parse(configData) - browser.storage.local.get(["redirects", "options"], r => { - const redirects = r.redirects - const options = r.options - const protocolHost = utils.protocolHost(url) - for (const service in config.services) { - if (!options[service].enabled) continue - if (!all(service, null, options, config, redirects).includes(protocolHost)) continue - - let instancesList = [...options[options[service].frontend][options.network].enabled, ...options[options[service].frontend][options.network].custom] - if (instancesList.length === 0 && options.networkFallback) instancesList = [...options[options[service].frontend].clearnet.enabled, ...options[options[service].frontend].clearnet.custom] - - let oldInstance - const i = instancesList.indexOf(protocolHost) - if (i > -1) { - oldInstance = instancesList[i] - instancesList.splice(i, 1) - } - if (instancesList.length === 0) return - const randomInstance = utils.getRandomInstance(instancesList) - const oldUrl = `${oldInstance}${url.pathname}${url.search}` - // This is to make instance switching work when the instance depends on the pathname, eg https://darmarit.org/searx - // Doesn't work because of .includes array method, not a top priotiry atm - return oldUrl.replace(oldInstance, randomInstance) - } - }) - }) +function switchInstance(url) { + return new Promise(async resolve => { + await init() + const protocolHost = utils.protocolHost(url) + for (const service in config.services) { + if (!all(service, null, options, config, redirects).includes(protocolHost)) continue + + let instancesList = [...options[options[service].frontend][options.network].enabled, ...options[options[service].frontend][options.network].custom] + if (instancesList.length === 0 && options.networkFallback) instancesList = [...options[options[service].frontend].clearnet.enabled, ...options[options[service].frontend].clearnet.custom] + + let oldInstance + const i = instancesList.indexOf(protocolHost) + if (i > -1) { + oldInstance = instancesList[i] + instancesList.splice(i, 1) + } + if (instancesList.length === 0) { + resolve() + return + } + const randomInstance = utils.getRandomInstance(instancesList) + const oldUrl = `${oldInstance}${url.pathname}${url.search}` + // This is to make instance switching work when the instance depends on the pathname, eg https://darmarit.org/searx + // Doesn't work because of .includes array method, not a top priotiry atm + resolve(oldUrl.replace(oldInstance, randomInstance)) + return + } + resolve() + }) } -async function reverse(url) { - fetch("/config/config.json") - .then(response => response.text()) - .then(configData => { - const config = JSON.parse(configData) - browser.storage.local.get(["redirects", "options"], r => { - const redirects = r.redirects - const options = r.options - let protocolHost = utils.protocolHost(url) - for (const service in config.services) { - if (!all(service, null, options, config, redirects).includes(protocolHost)) continue - - switch (service) { - case "instagram": - if (url.pathname.startsWith("/p")) return `https://instagram.com${url.pathname.replace("/p", "")}${url.search}` - if (url.pathname.startsWith("/u")) return `https://instagram.com${url.pathname.replace("/u", "")}${url.search}` - return config.services[service].url + url.pathname + url.search - case "youtube": - case "imdb": - case "imgur": - case "tiktok": - case "twitter": - case "reddit": - return config.services[service].url + url.pathname + url.search - default: - return - } - } - }) - }) +function reverse(url) { + return new Promise(async resolve => { + await init() + let protocolHost = utils.protocolHost(url) + for (const service in config.services) { + if (!all(service, null, options, config, redirects).includes(protocolHost)) continue + + switch (service) { + case "instagram": + if (url.pathname.startsWith("/p")) resolve(`https://instagram.com${url.pathname.replace("/p", "")}${url.search}`) + if (url.pathname.startsWith("/u")) resolve(`https://instagram.com${url.pathname.replace("/u", "")}${url.search}`) + resolve(config.services[service].url + url.pathname + url.search) + return + case "youtube": + case "imdb": + case "imgur": + case "tiktok": + case "twitter": + case "reddit": + resolve(config.services[service].url + url.pathname + url.search) + return + default: + resolve() + return + } + } + resolve() + }) } -async function unifyPreferences(url, tabId) { - fetch("/config/config.json") - .then(response => response.text()) - .then(configData => { - const config = JSON.parse(configData) - browser.storage.local.get(["options", "reidrects"], r => { - const redirects = r.redirects - const options = r.options - const protocolHost = utils.protocolHost(url) - for (const service in config.services) { - for (const frontend in config.services[service].frontends) { - if (all(service, frontend, options, config, redirects).includes(protocolHost)) { - let instancesList = [...options[frontend][options.network].enabled, ...options[frontend][options.network].custom] - if (options.networkFallback && options.network != "clearnet") instancesList.push(...options[frontend].clearnet.enabled, ...options[frontend].clearnet.custom) - - const frontend = config.services[service].frontends[frontend] - if ("cookies" in frontend.preferences) { - for (const cookie of frontend.preferences.cookies) { - utils.copyCookie(frontend, url, instancesList, cookie) - } - } - if ("localstorage" in frontend.preferences) { - browser.storage.local.set({ tmp: [frontend, frontend.preferences.localstorage] }) - browser.tabs.executeScript(tabId, { - file: "/assets/javascripts/get-localstorage.js", +function unifyPreferences(url, tabId) { + return new Promise(async resolve => { + await init() + const protocolHost = utils.protocolHost(url) + for (const service in config.services) { + for (const frontend in config.services[service].frontends) { + if (all(service, frontend, options, config, redirects).includes(protocolHost)) { + let instancesList = [...options[frontend][options.network].enabled, ...options[frontend][options.network].custom] + if (options.networkFallback && options.network != "clearnet") instancesList.push(...options[frontend].clearnet.enabled, ...options[frontend].clearnet.custom) + + const frontendObject = config.services[service].frontends[frontend] + if ("cookies" in frontendObject.preferences) { + for (const cookie of frontendObject.preferences.cookies) { + utils.copyCookie(frontendObject, url, instancesList, cookie) + } + } + if ("localstorage" in frontendObject.preferences) { + browser.storage.local.set({ tmp: [frontend, frontendObject.preferences.localstorage] }) + browser.tabs.executeScript(tabId, { + file: "/assets/javascripts/get-localstorage.js", + runAt: "document_start", + }) + for (const instance of instancesList) + browser.tabs.create({ url: instance }, tab => + browser.tabs.executeScript(tab.id, { + file: "/assets/javascripts/set-localstorage.js", runAt: "document_start", }) - for (const instance of instancesList) - browser.tabs.create({ url: instance }, tab => - browser.tabs.executeScript(tab.id, { - file: "/assets/javascripts/set-localstorage.js", - runAt: "document_start", - }) - ) - } - if ("indexeddb" in frontend.preferences) { - } - if ("token" in frontend.preferences) { - } - return true - } + ) + } + /* + if ("indexeddb" in frontendObject.preferences) { } + if ("token" in frontendObject.preferences) { + } + */ + resolve(true) + return } - }) - }) + } + } + }) } async function setRedirects(redirects) { @@ -612,46 +604,67 @@ function upgradeOptions() { fetch("/config/config.json") .then(response => response.text()) .then(configData => { - browser.storage.local.get(["options", "exceptions", "theme", "popupFrontends", "autoRedirect", "firstPartyIsolate"], r => { + browser.storage.local.get(null, r => { let options = r.options let latency = {} const config = JSON.parse(configData) options.exceptions = r.exceptions if (r.theme != "DEFAULT") options.theme = r.theme options.popupServices = r.popupFrontends + let tmp = options.popupServices.indexOf("tikTok") + if (tmp > -1) { + options.popupServices.splice(tmp, 1) + options.popupServices.push("tiktok") + } + tmp = options.popupServices.indexOf("sendTarget") + if (tmp > -1) { + options.popupServices.splice(tmp, 1) + options.popupServices.push("sendFiles") + } options.firstPartyIsolate = r.firstPartyIsolate options.autoRedirect = r.autoRedirect + switch (r.onlyEmbeddedVideo) { + case "onlyNotEmbedded": + options.youtube.redirectType = "main_frame" + case "onlyEmbedded": + options.youtube.redirectType = "sub_frame" + case "both": + options.youtube.redirectType = "both" + } for (const service in config.services) { - browser.storage.local.get([`disable${utils.camelCase(service)}`, `${service}RedirectType`, `${service}Frontend`, `${service}Latency`, `${service}EmbedFrontend`], r => { - if (r) { - options[service].enabled = !r["disable" + utils.camelCase(service)] - if (r[service + "Frontend"]) { - if (r[service + "Frontend"] == "yatte") options[service].frontend = "yattee" - else options[service].frontend = r[service + "Frontend"] - } - if (r[service + "RedirectType"]) options[service].redirectType = r[service + "RedirectType"] - if (r[service + "EmbedFrontend"] && (service != "youtube" || r[service + "EmbedFrontend"] == "invidious" || "piped")) options[service].embedFrontend = r[service + "EmbedFrontend"] - for (const frontend in config.services[service].frontends) { - browser.local.storage.get(`${frontend}Latency`, r => { - if (r) latency[frontend] = r[frontend + "Latency"] - for (const network in config.networks) { - let protocol - if (network == "clearnet") protocol = "normal" - else protocol = network - browser.storage.local.get([`${frontend}${utils.camelCase(protocol)}RedirectsChecks`, `${frontend}${utils.camelCase(protocol)}CustomRedirects`], r => { - if (r) { - options[frontend][network].checks = r[frontend + utils.camelCase(protocol) + "RedirectsChecks"] - options[frontend][network].custom = r[frontend + utils.camelCase(protocol) + "CustomRedirects"] - } - }) - } - }) + let oldService + switch (service) { + case "tiktok": + oldService = "tikTok" + break + case "sendFiles": + oldService = "sendTarget" + break + default: + oldService = service + } + options[service].enabled = !r["disable" + utils.camelCase(oldService)] + if (r[oldService + "Frontend"]) { + if (r[oldService + "Frontend"] == "yatte") options[service].frontend = "yattee" + else options[service].frontend = r[oldService + "Frontend"] + } + if (r[oldService + "RedirectType"]) options[service].redirectType = r[oldService + "RedirectType"] + if (r[oldService + "EmbedFrontend"] && (service != "youtube" || r[oldService + "EmbedFrontend"] == "invidious" || r[oldService + "EmbedFrontend"] == "piped")) + options[service].embedFrontend = r[oldService + "EmbedFrontend"] + for (const frontend in config.services[service].frontends) { + if (r[frontend + "Latency"]) latency[frontend] = r[frontend + "Latency"] + for (const network in config.networks) { + let protocol + if (network == "clearnet") protocol = "normal" + else protocol = network + if (r[frontend + utils.camelCase(protocol) + "RedirectsChecks"]) { + options[frontend][network].enabled = r[frontend + utils.camelCase(protocol) + "RedirectsChecks"] + options[frontend][network].custom = r[frontend + utils.camelCase(protocol) + "CustomRedirects"] } } - }) + } } - browser.storage.local.set({ options, latency }) - resolve() + browser.storage.local.set({ options, latency }, () => resolve()) }) }) }) diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js index 26fe11d6..056bbc00 100644 --- a/src/assets/javascripts/utils.js +++ b/src/assets/javascripts/utils.js @@ -342,7 +342,7 @@ function getPreferencesFromToken(frontend, targetUrl, urls, name, endpoint) { }) } -function copyRaw(test, copyRawElement, config) { +function copyRaw(test, copyRawElement) { return new Promise(resolve => { browser.tabs.query({ active: true, currentWindow: true }, async tabs => { let currTab = tabs[0] @@ -355,7 +355,7 @@ function copyRaw(test, copyRawElement, config) { return } - let newUrl = servicesHelper.reverse(url, config) + const newUrl = await servicesHelper.reverse(url) if (newUrl) { resolve(newUrl) @@ -387,9 +387,7 @@ function unify() { return } - const result = await servicesHelper.unifyPreferences(url, currTab.id) - - resolve(result) + resolve(await servicesHelper.unifyPreferences(url, currTab.id)) } }) }) diff --git a/src/config/config.json b/src/config/config.json index b15c20d4..6866453c 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -22,7 +22,8 @@ "frontends": { "invidious": { "preferences": { - "cookies": ["PREFS"] + "cookies": ["PREFS"], + "localstorage": ["dark_mode"] }, "name": "Invidious", "embeddable": true, @@ -529,7 +530,7 @@ "embeddable": false, "url": "https://maps.libredirect.invalid" }, - "uploadFiles": { + "sendFiles": { "frontends": { "send": { "name": "Send", diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index 06b547b3..9a53f927 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -431,6 +431,7 @@ def peertube(): def isValid(url): # This code is contributed by avanitrachhadiya2155 try: + url.encode('ascii') result = urlparse(url) return all([result.scheme, result.netloc]) except Exception: diff --git a/src/pages/options/index.html b/src/pages/options/index.html index 2549566c..5421bb81 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -84,7 +84,7 @@ - Send Files + Send Files
@@ -150,11 +150,6 @@
-
- + @@ -3139,14 +3134,14 @@ -
+
-

Send Files

+

Send Files


Enable

- +

diff --git a/src/pages/options/widgets/general.js b/src/pages/options/widgets/general.js index 1a2f44c6..92632f23 100644 --- a/src/pages/options/widgets/general.js +++ b/src/pages/options/widgets/general.js @@ -49,16 +49,16 @@ function setOption(option, multiChoice, event) { let exportSettingsElement = document.getElementById("export-settings") function exportSettings() { - browser.storage.local.get(null, result => { - let resultString = JSON.stringify(result, null, " ") - exportSettingsElement.href = "data:application/json;base64," + btoa(encodeURI(resultString)) + browser.storage.local.get("options", result => { + result.options.version = browser.runtime.getManifest().version + let resultString = JSON.stringify(result.options, null, " ") + exportSettingsElement.href = "data:application/json;base64," + btoa(resultString) exportSettingsElement.download = "libredirect-settings.json" }) } exportSettings() document.getElementById("general_page").addEventListener("click", exportSettings) -document.getElementById("test").addEventListener("click", servicesHelper.upgradeOptions) let importSettingsElement = document.getElementById("import-settings") let importSettingsElementText = document.getElementById("import_settings_text") @@ -70,7 +70,22 @@ importSettingsElement.addEventListener("change", () => { reader.onload = async () => { const data = JSON.parse(reader.result) if ("theme" in data && "disableImgur" in data && "imgurRedirects" in data) { - browser.storage.local.clear(() => browser.storage.local.set({ ...data }, () => location.reload())) + browser.storage.local.clear(() => + browser.storage.local.set({ ...data }, () => { + fetch("/instances/blacklist.json") + .then(response => response.text()) + .then(async data => { + browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { + await generalHelper.initDefaults() + await servicesHelper.initDefaults() + await servicesHelper.upgradeOptions() + location.reload() + }) + }) + }) + ) + } else if ("version" in data) { + browser.storage.local.clear(() => browser.storage.local.set({ options: data }, () => location.reload())) } else { console.log("incompatible settings") importError() diff --git a/src/pages/popup/popup.html b/src/pages/popup/popup.html index 56e4ca14..b5076635 100644 --- a/src/pages/popup/popup.html +++ b/src/pages/popup/popup.html @@ -107,13 +107,13 @@

Maps

-
+
-

Send Files

- +

Send Files

+
@@ -220,13 +220,13 @@

Maps

-
+
-

Send Files

- +

Send Files

+
diff --git a/src/pages/popup/popup.js b/src/pages/popup/popup.js index 05dd70f7..ed1546c7 100644 --- a/src/pages/popup/popup.js +++ b/src/pages/popup/popup.js @@ -26,7 +26,7 @@ utils.switchInstance(true).then(r => { else document.getElementById("change_instance").addEventListener("click", () => utils.switchInstance(false)) }) -utils.copyRaw(true, null, config).then(r => { +utils.copyRaw(true).then(r => { if (!r) document.getElementById("copy_raw_div").style.display = "none" else { const copy_raw = document.getElementById("copy_raw") @@ -81,13 +81,13 @@ browser.storage.local.get("options", r => { let service = await serviceHelper.computeService(url, true) let frontend if (service) { - if (service[1]) { + if (service[0]) { frontend = service[1] service = service[0] } divs[service].current.classList.remove("hide") divs[service].all.classList.add("hide") - if (config.services[service].frontends[frontend].preferences && !config.services[service].frontends[frontend].preferences.token) { + if (frontend && config.services[service].frontends[frontend].preferences && !config.services[service].frontends[frontend].preferences.token) { const unify = document.getElementById("unify") const textElement = document.getElementById("unify").getElementsByTagName("h4")[0] unify.addEventListener("click", () => { -- cgit 1.4.1 From a96f3188b7eac79f19f2bd438b13a310d3cea90b Mon Sep 17 00:00:00 2001 From: Hygna Date: Wed, 5 Oct 2022 17:29:27 +0100 Subject: Changes: Added BreezeWiki as a frontend for Fandom Closes https://github.com/libredirect/libredirect/issues/444 Futureproofed bug caused by adding new frontend/service --- src/assets/images/fandom-icon.svg | 1 + src/assets/javascripts/services.js | 56 +++++++++++++++++ src/config/config.json | 14 +++++ src/instances/blacklist.json | 23 ++----- src/instances/data.json | 115 ++++++++--------------------------- src/instances/get_instances.py | 5 ++ src/pages/background/background.js | 3 + src/pages/options/index.html | 120 +++++++++++++++++++++++++++++++++++++ src/pages/popup/popup.html | 10 ++++ 9 files changed, 238 insertions(+), 109 deletions(-) create mode 100644 src/assets/images/fandom-icon.svg (limited to 'src/assets/images') diff --git a/src/assets/images/fandom-icon.svg b/src/assets/images/fandom-icon.svg new file mode 100644 index 00000000..0cd873bf --- /dev/null +++ b/src/assets/images/fandom-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 572a6a9c..d7cb520b 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -386,6 +386,11 @@ function redirect(url, type, initiator) { return `${randomInstance}/${params.sl}/${params.tl}/${params.text}` } return randomInstance + case "breezeWiki": + let wiki = url.hostname.match(/^[a-zA-Z0-9]+(?=\.fandom\.com)/) + if (wiki == "www" || !wiki) wiki = "" + else wiki = "/" + wiki + return `${randomInstance}${wiki}${url.pathname}${url.search}`.replace(/Special:Search\?query/, "search?q") default: return `${randomInstance}${url.pathname}${url.search}` } @@ -685,6 +690,56 @@ function upgradeOptions() { }) } +function processUpdate() { + return new Promise(resolve => { + fetch("/instances/data.json") + .then(response => response.text()) + .then(data => { + fetch("/config/config.json") + .then(response => response.text()) + .then(configData => { + browser.storage.local.get(["options", "blacklists", "targets"], r => { + let redirects = JSON.parse(data) + let options = r.options + let targets = r.targets + let config = JSON.parse(configData) + 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) { + options[service][defaultOption] = config.services[service].options[defaultOption] + } + } + for (const frontend in config.services[service].frontends) { + if (!options[service][frontend]) { + if (config.services[service].frontends[frontend].instanceList) { + options[frontend] = {} + for (const network in config.networks) { + options[frontend][network] = {} + options[frontend][network].enabled = JSON.parse(data)[frontend][network] + options[frontend][network].custom = [] + } + for (const blacklist in r.blacklists) { + for (const instance of r.blacklists[blacklist]) { + let i = options[frontend].clearnet.enabled.indexOf(instance) + if (i > -1) options[frontend].clearnet.enabled.splice(i, 1) + } + } + } + } + } + } + browser.storage.local.set({ redirects, options, targets }) + resolve() + }) + }) + }) + }) +} + export default { redirect, computeService, @@ -694,4 +749,5 @@ export default { setRedirects, initDefaults, upgradeOptions, + processUpdate, } diff --git a/src/config/config.json b/src/config/config.json index fde17a02..61195830 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -362,6 +362,20 @@ "embeddable": false, "url": "https://reuters.com" }, + "fandom": { + "frontends": { + "breezeWiki": { + "name": "BreezeWiki", + "instanceList": true + } + }, + "targets": ["^https?:\\/{2}(?:[a-zA-Z0-9]+\\.)?fandom\\.com(?=(?:\\/wiki)|(?:\\/?$))"], + "name": "Fandom", + "options": { "enabled": true }, + "imageType": "svg", + "embeddable": false, + "url": "https://fandom.com" + }, "peertube": { "frontends": { "simpleertube": { diff --git a/src/instances/blacklist.json b/src/instances/blacklist.json index 90febd0a..d75c36d8 100644 --- a/src/instances/blacklist.json +++ b/src/instances/blacklist.json @@ -28,18 +28,6 @@ "https://n.sneed.network", "https://nitter.twei.space", "https://nitter.d420.de", - "https://libreddit.domain.glass", - "https://r.nf", - "https://libreddit.hu", - "https://lr.stilic.ml", - "https://reddi.tk", - "https://r.walkx.org", - "https://libreddit.yonalee.eu", - "https://libreddit.winscloud.net", - "https://r.ahwx.org", - "https://reddit.dr460nf1r3.org", - "https://libreddit.encrypted-data.xyz", - "https://libreddit.eu.org", "https://teddit.domain.glass", "https://teddit.httpjames.space", "https://teddit.encrypted-data.xyz", @@ -73,18 +61,14 @@ "https://nhanh.cloud", "https://nitter.winscloud.net", "https://ntr.odyssey346.dev", - "https://libreddit.yonalee.eu", - "https://libreddit.winscloud.net", - "https://libreddit.notyourcomputer.net", "https://teddit.ggc-project.de", "https://teddit.tokhmi.xyz", - "https://wiki.privacytools.io", "https://quetre.odyssey346.dev", + "https://simplytranslate.org", "https://st.odyssey346.dev", "https://jsearch.pw", "https://searx.gnu.style", "https://searx.semipvt.com", - "https://searx.tyil.nl", "https://etsi.me", "https://search.zzls.xyz", "https://searx.ericaftereric.top", @@ -93,7 +77,10 @@ "https://whoogle.esmailelbob.xyz", "https://search.wef.lol", "https://i.bcow.xyz", + "https://rimgo.totaldarkness.net", + "https://imgur.artemislena.eu", "https://lbry.bcow.xyz", - "https://beatbump.ml" + "https://beatbump.ml", + "https://bw.odyssey346.dev" ] } \ No newline at end of file diff --git a/src/instances/data.json b/src/instances/data.json index fac7962d..eaefc4ed 100644 --- a/src/instances/data.json +++ b/src/instances/data.json @@ -13,19 +13,20 @@ "https://invidious.sethforprivacy.com", "https://invidious.flokinet.to", "https://inv.bp.projectsegfau.lt", - "https://inv.vern.cc", "https://invidious.nerdvpn.de", "https://invidious.projectsegfau.lt", "https://invidious.rhyshl.live", "https://inv.privacy.com.de", "https://invidious.slipfox.xyz", - "https://invidious.esmailelbob.xyz", "https://youtube.076.ne.jp", + "https://invidious.esmailelbob.xyz", + "https://inv.vern.cc", "https://invidious.namazso.eu" ], "tor": [ - "http://w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion", "http://c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion", + "http://w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion", + "http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion", "http://grwp24hodrefzvjjuccrkw3mjq4tzhaaq32amf33dzpmuxe7ilepcmad.onion", "http://osbivz6guyeahrwp2lnwyjk2xos342h4ocsxyqrlaopqjuhwn2djiiyd.onion", "http://u2cvlit75owumwpy4dj2hsmvkq7nvrclkpht7xgyye2pyoxhpmclkrad.onion", @@ -33,8 +34,7 @@ "http://invidious.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", "http://inv.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion", "http://am74vkcrjp2d5v36lcdqgsj2m6x36tbrkhsruoegwfcizzabnfgf5zyd.onion", - "http://ng27owmagn5amdm7l5s3rsqxwscl5ynppnis5dqcasogkyxcfqn7psid.onion", - "http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion" + "http://ng27owmagn5amdm7l5s3rsqxwscl5ynppnis5dqcasogkyxcfqn7psid.onion" ], "i2p": [], "loki": [] @@ -51,9 +51,7 @@ "https://piped.garudalinux.org", "https://y.rivo.lol", "https://yt.jae.fi", - "https://piped.mint.lgbt", "https://il.ax", - "https://piped.esmailelbob.xyz", "https://piped.projectsegfau.lt", "https://piped.privacydev.net", "https://piped.smnz.de", @@ -208,7 +206,8 @@ "https://nitter.caioalonso.com", "https://nitter.at", "https://nitter.drivet.xyz", - "https://nitter.pw" + "https://nitter.pw", + "https://nitter.nicfab.eu" ], "tor": [ "http://nitter7bryz3jv7e3uekphigvmoyoem4al3fynerxkj22dmoxoq553qd.onion", @@ -261,87 +260,8 @@ "loki": [] }, "libreddit": { - "clearnet": [ - "https://libredd.it", - "https://libreddit.spike.codes", - "https://libreddit.dothq.co", - "https://libreddit.kavin.rocks", - "https://reddit.invak.id", - "https://reddit.phii.me", - "https://lr.riverside.rocks", - "https://libreddit.strongthany.cc", - "https://libreddit.database.red", - "https://libreddit.privacy.com.de", - "https://libreddit.domain.glass", - "https://libreddit.sugoma.tk", - "https://libreddit.jamiethalacker.dev", - "https://reddit.artemislena.eu", - "https://r.nf", - "https://libreddit.some-things.org", - "https://reddit.stuehieyr.com", - "https://lr.mint.lgbt", - "https://libreddit.igna.rocks", - "https://libreddit.autarkic.org", - "https://libreddit.flux.industries", - "https://libreddit.drivet.xyz", - "https://lr.oversold.host", - "https://libreddit.de", - "https://libreddit.pussthecat.org", - "https://libreddit.mutahar.rocks", - "https://libreddit.northboot.xyz", - "https://leddit.xyz", - "https://de.leddit.xyz", - "https://lr.cowfee.moe", - "https://libreddit.hu", - "https://libreddit.totaldarkness.net", - "https://libreddit.esmailelbob.xyz", - "https://lr.vern.cc", - "https://libreddit.nl", - "https://lr.stilic.ml", - "https://reddi.tk", - "https://libreddit.bus-hit.me", - "https://libreddit.datatunnel.xyz", - "https://libreddit.crewz.me", - "https://r.walkx.org", - "https://libreddit.kylrth.com", - "https://libreddit.yonalee.eu", - "https://libreddit.winscloud.net", - "https://libreddit.tiekoetter.com", - "https://reddit.rtrace.io", - "https://libreddit.lunar.icu", - "https://libreddit.privacydev.net", - "https://libreddit.notyourcomputer.net", - "https://r.ahwx.org", - "https://bob.fr.to", - "https://reddit.beparanoid.de", - "https://libreddit.dcs0.hu", - "https://reddit.dr460nf1r3.org", - "https://rd.jae.su", - "https://libreddit.mha.fi", - "https://libreddit.foss.wtf", - "https://libreddit.encrypted-data.xyz", - "https://libreddit.eu.org", - "https://l.opnxng.com" - ], - "tor": [ - "http://spjmllawtheisznfs7uryhxumin26ssv2draj7oope3ok3wuhy43eoyd.onion", - "http://fwhhsbrbltmrct5hshrnqlqygqvcgmnek3cnka55zj4y7nuus5muwyyd.onion", - "http://kphht2jcflojtqte4b4kyx7p2ahagv4debjj32nre67dxz7y57seqwyd.onion", - "http://inytumdgnri7xsqtvpntjevaelxtgbjqkuqhtf6txxhwbll2fwqtakqd.onion", - "http://liredejj74h5xjqr2dylnl5howb2bpikfowqoveub55ru27x43357iid.onion", - "http://kzhfp3nvb4qp575vy23ccbrgfocezjtl5dx66uthgrhu7nscu6rcwjyd.onion", - "http://ecue64ybzvn6vjzl37kcsnwt4ycmbsyf74nbttyg7rkc3t3qwnj7mcyd.onion", - "http://ledditqo2mxfvlgobxnlhrkq4dh34jss6evfkdkb2thlvy6dn4f4gpyd.onion", - "http://libredoxhxwnmsb6dvzzd35hmgzmawsq5i764es7witwhddvpc2razid.onion", - "http://libreddit.2syis2nnyytz6jnusnjurva4swlaizlnleiks5mjp46phuwjbdjqwgqd.onion", - "http://ol5begilptoou34emq2sshf3may3hlblvipdjtybbovpb7c7zodxmtqd.onion", - "http://lbrdtjaj7567ptdd4rv74lv27qhxfkraabnyphgcvptl64ijx2tijwid.onion", - "http://libreddit.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion", - "http://reddit.prnoid54e44a4bduq5due64jkk7wcnkxcp5kv3juncm7veptjcqudgyd.onion", - "http://inz6tbezfwzexva6dize4cqraj2tjdhygxabmcgysccesvw2pybzhbyd.onion", - "http://libreddit.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion", - "http://lr.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion" - ], + "clearnet": [], + "tor": [], "i2p": [], "loki": [] }, @@ -596,8 +516,10 @@ "http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion", "http://yra4tke2pwcnatxjkufpw6kvebu3h3ti2jca2lcdpgx3mpwol326lzid.onion", "http://z5vawdol25vrmorm4yydmohsd4u6rdoj2sylvoi3e3nqvxkvpqul7bqd.onion", + "http://searxdr3pqz4nydgnqocsia2xbywptxbkympa2emn7zlgggrir4bkfad.onion", "http://zbuc3bbzbfdqqo2x46repx2ddajbha6fpsjeeptjhhhhzji3zopxdqyd.onion", "http://f4qfqajszpx5b7itzxt6mb7kj4ktpgbdq7lq6xaiqyqx6a7de3epptad.onion", + "http://searx.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", "http://searx.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion" ], "i2p": [ @@ -694,8 +616,6 @@ "http://searxngg6zleq6ceboe5ltkyo4hyrb3aaycrgzmrljv3jjlb5vcytead.onion", "http://gbat2pbpg7ys3fi3pbp64667tt5x66mg45xok35bxdw7v55brm7a27yd.onion", "http://b2c7fvbhnfvwnl6oh2tydhzfx4i37kmmrycq42heqbbe7wovq3uzenid.onion", - "http://searxdr3pqz4nydgnqocsia2xbywptxbkympa2emn7zlgggrir4bkfad.onion", - "http://searx.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", "http://searxfilowxokbogygrigir4wqxfxqzuxofxgdon7dg6rsii4yxzytyd.onion", "http://searx.privpw3tndpkw6pnp3g727zfgfdzbu3k6a7chv226s3xymv2p4eiuqyd.onion", "http://rq2w52kyrif3xpfihkgjnhqm3a5aqhoikpv72z3drpjglfzc2wr5z4yd.onion", @@ -829,8 +749,21 @@ "i2p": [], "loki": [] }, + "breezeWiki": { + "clearnet": [ + "https://breezewiki.com", + "https://breezewiki.pussthecat.org", + "https://bw.odyssey346.dev", + "https://bw.vern.cc", + "https://breezewiki.esmailelbob.xyz" + ], + "tor": [], + "i2p": [], + "loki": [] + }, "peertube": [ "https://search.joinpeertube.org", + "https://freedomadultgames.video", "https://tbh.co-shaoghal.net", "https://tube.kansanvalta.org", "https://duanrra.cf", diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index 9fc64adc..fc730cf6 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -437,6 +437,10 @@ def libreTranslate(): fetchRegexList('libreTranslate', 'LibreTranslate', 'https://raw.githubusercontent.com/LibreTranslate/LibreTranslate/main/README.md', r"\[(?:[^\s\/]+\.)+[a-zA-Z0-9]+\]\((https?:\/{2}(?:[^\s\/]+\.)+[a-zA-Z0-9]+)\/?\)\|") +def breezeWiki(): + fetchRegexList('breezeWiki', 'BreezeWiki', 'https://gitdab.com/cadence/breezewiki-docs/raw/branch/main/docs.scrbl', r"\(\"[^\n\s\r\t\f\v\"]+\" \"https?:\/{2}(?:[^\s\/]+\.)+[a-zA-Z0-9]+(?:\/[^\s\/]+)*\" \"(https?:\/{2}(?:[^\s\/]+\.)+[a-zA-Z0-9]+(?:\/[^\s\/]+)*)\"\)") + + def peertube(): r = requests.get( 'https://instances.joinpeertube.org/api/v1/instances?start=0&count=1045&sort=-createdAt') @@ -485,6 +489,7 @@ beatbump() hyperpipe() facil() simpleertube() +breezeWiki() mightyList = filterLastSlash(mightyList) mightyList = idnaEncode(mightyList) diff --git a/src/pages/background/background.js b/src/pages/background/background.js index e8d0fd76..3f0e0fdd 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -30,11 +30,14 @@ browser.runtime.onInstalled.addListener(details => { .then(async data => { browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { switch (details.previousVersion) { + case "2.2.0": case "2.2.1": await generalHelper.initDefaults() await servicesHelper.initDefaults() await servicesHelper.upgradeOptions() break + default: + await servicesHelper.processUpdate() } }) }) diff --git a/src/pages/options/index.html b/src/pages/options/index.html index 323984ed..faeb5124 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -84,6 +84,11 @@ Reuters
+
+
+ + +
+ +
+
@@ -2200,6 +2212,114 @@
+
+
+
+

Fandom

+
+
+
+

Enable

+ +
+
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+ + +
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+ +
+
+

PeerTube

@@ -186,6 +191,11 @@

Reuters

+

PeerTube

-- cgit 1.4.1 From 375f4371c3c5e703b07ae3e3d677315134a035ce Mon Sep 17 00:00:00 2001 From: Hygna Date: Sun, 9 Oct 2022 13:11:05 +0100 Subject: Toggle current instance in popup Fixed bug where testing latency of multiple frontends at the same time wouldn't save all of the timings --- src/assets/images/instance-icon.svg | 3 + src/assets/javascripts/services.js | 4 +- src/assets/javascripts/utils.js | 17 ++-- src/config/config.json | 192 ++++++++++++++++++++++++++++-------- src/pages/background/background.js | 1 - src/pages/popup/popup.ejs | 6 ++ src/pages/popup/popup.html | 12 ++- src/pages/popup/popup.js | 31 +++++- src/pages/popup/style.css | 40 ++++++++ 9 files changed, 252 insertions(+), 54 deletions(-) create mode 100644 src/assets/images/instance-icon.svg (limited to 'src/assets/images') diff --git a/src/assets/images/instance-icon.svg b/src/assets/images/instance-icon.svg new file mode 100644 index 00000000..6b034c6f --- /dev/null +++ b/src/assets/images/instance-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 80a1ac45..806624d7 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -422,7 +422,7 @@ function computeService(url, returnFrontend) { } else { for (const frontend in config.services[service].frontends) { if (all(service, frontend, options, config, redirects).includes(utils.protocolHost(url))) { - if (returnFrontend) resolve([service, frontend, url.hostname]) + if (returnFrontend) resolve([service, frontend, utils.protocolHost(url)]) else resolve(service) return } @@ -520,7 +520,7 @@ function unifyPreferences(url, tabId) { const frontendObject = config.services[service].frontends[frontend] if ("cookies" in frontendObject.preferences) { for (const cookie of frontendObject.preferences.cookies) { - utils.copyCookie(frontendObject, url, instancesList, cookie) + await utils.copyCookie(frontendObject, url, instancesList, cookie) } } if ("localstorage" in frontendObject.preferences) { diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js index 9ae9123f..62041690 100644 --- a/src/assets/javascripts/utils.js +++ b/src/assets/javascripts/utils.js @@ -424,17 +424,20 @@ function latency(service, frontend, document, location) { latencyElement.addEventListener("click", async () => { let reloadWindow = () => location.reload() latencyElement.addEventListener("click", reloadWindow) - browser.storage.local.get(["redirects", "latency"], r => { + browser.storage.local.get("redirects", r => { let redirects = r.redirects - let latency = r.latency const oldHtml = latencyLabel.innerHTML latencyLabel.innerHTML = "..." testLatency(latencyLabel, redirects[frontend].clearnet, frontend).then(r => { - latency[frontend] = r - browser.storage.local.set({ latency }) - latencyLabel.innerHTML = oldHtml - processDefaultCustomInstances(service, frontend, "clearnet", document) - latencyElement.removeEventListener("click", reloadWindow) + const frontendLatency = r + browser.storage.local.get("latency", r => { + let latency = r.latency + latency[frontend] = frontendLatency + browser.storage.local.set({ latency }) + latencyLabel.innerHTML = oldHtml + processDefaultCustomInstances(service, frontend, "clearnet", document) + latencyElement.removeEventListener("click", reloadWindow) + }) }) }) }) diff --git a/src/config/config.json b/src/config/config.json index ff4a869f..8110748f 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -22,8 +22,12 @@ "frontends": { "invidious": { "preferences": { - "cookies": ["PREFS"], - "localstorage": ["dark_mode"] + "cookies": [ + "PREFS" + ], + "localstorage": [ + "dark_mode" + ] }, "name": "Invidious", "embeddable": true, @@ -59,7 +63,9 @@ }, "pipedMaterial": { "preferences": { - "localstorage": ["PREFERENCES"] + "localstorage": [ + "PREFERENCES" + ] }, "name": "Piped-Material", "embeddable": false, @@ -109,7 +115,9 @@ "frontends": { "beatbump": { "preferences": { - "localstorage": ["settings"], + "localstorage": [ + "settings" + ], "indexeddb": "beatbump" }, "name": "Beatbump", @@ -117,14 +125,26 @@ }, "hyperpipe": { "preferences": { - "localstorage": ["api", "authapi", "codec", "locale", "next", "pipedapi", "quality", "theme", "vol"], + "localstorage": [ + "api", + "authapi", + "codec", + "locale", + "next", + "pipedapi", + "quality", + "theme", + "vol" + ], "indexeddb": "hyperpipedb" }, "name": "HyperPipe", "instanceList": true } }, - "targets": ["^https?:\\/{2}music\\.youtube\\.com(\\/.*|$)"], + "targets": [ + "^https?:\\/{2}music\\.youtube\\.com(\\/.*|$)" + ], "name": "YT Music", "options": { "enabled": true, @@ -139,24 +159,23 @@ "nitter": { "preferences": { "cookies": [ - "theme", - "infiniteScroll", - "stickyProfile", + "autoplayGifs", "bidiSupport", - "hideTweetStats", "hideBanner", "hidePins", "hideReplies", - "squareAvatars", - "mp4Playback", + "hideTweetStats", "hlsPlayback", - "proxyVideos", + "infiniteScroll", + "mp4Playback", "muteVideos", - "autoplayGifs", + "proxyVideos", "replaceInstagram", "replaceReddit", "replaceTwitter", - "replaceYouTube" + "replaceYouTube", + "squareAvatars", + "theme" ] }, "name": "Nitter", @@ -164,7 +183,12 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}(www\\.|mobile\\.|)twitter\\.com", "^https?:\\/{2}(pbs\\.|video\\.|)twimg\\.com", "^https?:\\/{2}platform\\.twitter\\.com/embed", "^https?:\\/{2}t\\.co"], + "targets": [ + "^https?:\\/{2}(www\\.|mobile\\.|)twitter\\.com", + "^https?:\\/{2}(pbs\\.|video\\.|)twimg\\.com", + "^https?:\\/{2}platform\\.twitter\\.com/embed", + "^https?:\\/{2}t\\.co" + ], "name": "Twitter", "options": { "enabled": true, @@ -186,7 +210,9 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}(www\\.)?instagram\\.com\\/p\\/"], + "targets": [ + "^https?:\\/{2}(www\\.)?instagram\\.com\\/p\\/" + ], "name": "Instagram", "options": { "enabled": true @@ -199,13 +225,18 @@ "frontends": { "proxiTok": { "preferences": { - "cookies": ["api-test_endpoints", "theme"] + "cookies": [ + "api-test_endpoints", + "theme" + ] }, "name": "ProxiTok", "instanceList": true } }, - "targets": ["^https?:\\/{2}(www\\.|)tiktok\\.com.*"], + "targets": [ + "^https?:\\/{2}(www\\.|)tiktok\\.com.*" + ], "name": "TikTok", "options": { "enabled": true @@ -218,7 +249,20 @@ "frontends": { "libreddit": { "preferences": { - "cookies": ["theme", "front_page", "layout", "wide", "post_sort", "comment_sort", "show_nsfw", "autoplay_videos", "use_hls", "hide_hls_notification", "subscriptions", "filters"] + "cookies": [ + "theme", + "front_page", + "layout", + "wide", + "post_sort", + "comment_sort", + "show_nsfw", + "autoplay_videos", + "use_hls", + "hide_hls_notification", + "subscriptions", + "filters" + ] }, "name": "Libreddit", "instanceList": true @@ -248,7 +292,10 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)reddit\\.com", "^https?:\\/{2}(i\\.|preview\\.)redd\\.it"], + "targets": [ + "^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)reddit\\.com", + "^https?:\\/{2}(i\\.|preview\\.)redd\\.it" + ], "name": "Reddit", "options": { "enabled": true, @@ -266,7 +313,9 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}([im]\\.)?(stack\\.)?imgur\\.(com|io)(\\/|$)"], + "targets": [ + "^https?:\\/{2}([im]\\.)?(stack\\.)?imgur\\.(com|io)(\\/|$)" + ], "name": "Imgur", "options": { "enabled": true, @@ -280,13 +329,18 @@ "frontends": { "wikiless": { "preferences": { - "cookies": ["theme", "default_lang"] + "cookies": [ + "theme", + "default_lang" + ] }, "name": "Wikiless", "instanceList": true } }, - "targets": ["^https?:\\/{2}(?:[a-z]+\\.)*wikipedia\\.org"], + "targets": [ + "^https?:\\/{2}(?:[a-z]+\\.)*wikipedia\\.org" + ], "name": "Wikipedia", "options": { "enabled": false @@ -334,13 +388,17 @@ "frontends": { "quetre": { "preferences": { - "localstorage": ["theme"] + "localstorage": [ + "theme" + ] }, "name": "Quetre", "instanceList": true } }, - "targets": ["^https?:\\/{2}([a-z]+\\.)*quora\\.com.*"], + "targets": [ + "^https?:\\/{2}([a-z]+\\.)*quora\\.com.*" + ], "name": "Quora", "options": { "enabled": true @@ -353,13 +411,17 @@ "frontends": { "libremdb": { "preferences": { - "localstorage": ["theme"] + "localstorage": [ + "theme" + ] }, "name": "libremdb", "instanceList": true } }, - "targets": ["^https?:\\/{2}(?:www\\.|)imdb\\.com\\/title"], + "targets": [ + "^https?:\\/{2}(?:www\\.|)imdb\\.com\\/title" + ], "name": "IMDb", "options": { "enabled": true @@ -375,7 +437,9 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}(www\\.|)reuters\\.com.*"], + "targets": [ + "^https?:\\/{2}(www\\.|)reuters\\.com.*" + ], "name": "Reuters", "options": { "enabled": false @@ -391,7 +455,9 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}(?:[a-zA-Z0-9]+\\.)?fandom\\.com(?=(?:\\/wiki)|(?:\\/?$))"], + "targets": [ + "^https?:\\/{2}(?:[a-zA-Z0-9]+\\.)?fandom\\.com(?=(?:\\/wiki)|(?:\\/?$))" + ], "name": "Fandom", "options": { "enabled": true @@ -420,8 +486,18 @@ "frontends": { "librarian": { "preferences": { - "cookies": ["nsfw", "theme"], - "localstorage": ["autoplay", "autoplayNextVid", "collapseComments", "plyr", "sb_categories", "showRelated"] + "cookies": [ + "nsfw", + "theme" + ], + "localstorage": [ + "autoplay", + "autoplayNextVid", + "collapseComments", + "plyr", + "sb_categories", + "showRelated" + ] }, "name": "Librarian", "embeddable": true, @@ -433,7 +509,10 @@ "instanceList": false } }, - "targets": ["^https?:\\/{2}odysee\\.com", "^https?:\\/{2}lbry\\.tv"], + "targets": [ + "^https?:\\/{2}odysee\\.com", + "^https?:\\/{2}lbry\\.tv" + ], "name": "LBRY", "options": { "enabled": true, @@ -506,13 +585,26 @@ }, "librex": { "preferences": { - "cookies": ["bibliogram", "disable_frontends", " disable_special", "invidious", "libreddit", "nitter", "proxitok", "save", "theme", "wikiless"] + "cookies": [ + "bibliogram", + "disable_frontends", + " disable_special", + "invidious", + "libreddit", + "nitter", + "proxitok", + "save", + "theme", + "wikiless" + ] }, "name": "LibreX", "instanceList": true } }, - "targets": ["^https?:\\/{2}search\\.libredirect\\.invalid"], + "targets": [ + "^https?:\\/{2}search\\.libredirect\\.invalid" + ], "name": "Search", "options": { "enabled": true, @@ -526,14 +618,24 @@ "frontends": { "simplyTranslate": { "preferences": { - "cookies": ["from_lang", "to_lang", "tts_enabled", "use_text_fields"] + "cookies": [ + "from_lang", + "to_lang", + "tts_enabled", + "use_text_fields" + ] }, "name": "SimplyTranslate", "instanceList": true }, "lingva": { "preferences": { - "localstorage": ["isauto", "source", "target", "chakra-ui-color-mode"] + "localstorage": [ + "isauto", + "source", + "target", + "chakra-ui-color-mode" + ] }, "name": "Lingva Translate", "instanceList": true @@ -543,7 +645,10 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}translate\\.google(\\.[a-z]{2,3}){1,2}\\/", "^https?:\\/{2}translate\\.libredirect\\.invalid"], + "targets": [ + "^https?:\\/{2}translate\\.google(\\.[a-z]{2,3}){1,2}\\/", + "^https?:\\/{2}translate\\.libredirect\\.invalid" + ], "name": "Translate", "options": { "enabled": true, @@ -565,7 +670,10 @@ "singleInstance": "https://www.openstreetmap.org" } }, - "targets": ["^https?:\\/{2}maps\\.libredirect\\.invalid", "^https?:\\/{2}(((www|maps)\\.)?(google\\.).*(\\/maps)|maps\\.(google\\.).*)"], + "targets": [ + "^https?:\\/{2}maps\\.libredirect\\.invalid", + "^https?:\\/{2}(((www|maps)\\.)?(google\\.).*(\\/maps)|maps\\.(google\\.).*)" + ], "name": "Maps", "options": { "enabled": true, @@ -582,7 +690,11 @@ "instanceList": "true" } }, - "targets": ["^https?:\\/{2}send\\.libredirect\\.invalid", "^https?:\\/{2}send\\.firefox\\.com\\/?$", "^https?:\\/{2}sendfiles\\.online\\/?$"], + "targets": [ + "^https?:\\/{2}send\\.libredirect\\.invalid", + "^https?:\\/{2}send\\.firefox\\.com\\/?$", + "^https?:\\/{2}sendfiles\\.online\\/?$" + ], "name": "Send Files", "options": { "enabled": true diff --git a/src/pages/background/background.js b/src/pages/background/background.js index d252e580..dd8f1715 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -232,7 +232,6 @@ browser.contextMenus.onClicked.addListener((info, tab) => { } } case "redirectLink": - console.log(info.linkUrl) const tmpUrl = new URL(info.linkUrl) const newUrl = servicesHelper.redirect(tmpUrl, "main_frame", null, true) if (newUrl) browser.tabs.create({ url: newUrl }) diff --git a/src/pages/popup/popup.ejs b/src/pages/popup/popup.ejs index e862e0cb..e6cc6fca 100644 --- a/src/pages/popup/popup.ejs +++ b/src/pages/popup/popup.ejs @@ -8,6 +8,12 @@
+ <%- include('src/pages/widgets/switches', {services: services}) -%>

diff --git a/src/pages/popup/popup.html b/src/pages/popup/popup.html index 2dcc12bc..6dc48478 100644 --- a/src/pages/popup/popup.html +++ b/src/pages/popup/popup.html @@ -8,6 +8,14 @@
+

Youtube

@@ -78,7 +86,7 @@

Fandom

-
+

PeerTube

@@ -196,7 +204,7 @@

Fandom

-
+

PeerTube

diff --git a/src/pages/popup/popup.js b/src/pages/popup/popup.js index a4b73093..78e50004 100644 --- a/src/pages/popup/popup.js +++ b/src/pages/popup/popup.js @@ -2,7 +2,6 @@ window.browser = window.browser || window.chrome import utils from "../../assets/javascripts/utils.js" -// import generalHelper from "../../assets/javascripts/general.js" import serviceHelper from "../../assets/javascripts/services.js" let config, @@ -40,6 +39,7 @@ const currSite = document.getElementsByClassName("current_site")[0] function setDivs() { return new Promise(resolve => { + divs.instance = document.getElementById("instance") for (const service in config.services) { divs[service] = {} divs[service].toggle = {} @@ -56,8 +56,9 @@ await setDivs() const currentSiteIsFrontend = document.getElementById("current_site_divider") -browser.storage.local.get("options", r => { +browser.storage.local.get(["options", "redirects"], r => { browser.tabs.query({ active: true, currentWindow: true }, async tabs => { + document.getElementById("instance-div").classList.add("hide") for (const service in config.services) { if (!r.options.popupServices.includes(service)) allSites.getElementsByClassName(service)[0].classList.add("hide") else allSites.getElementsByClassName(service)[0].classList.remove("hide") @@ -80,10 +81,36 @@ browser.storage.local.get("options", r => { let service = await serviceHelper.computeService(url, true) let frontend + let instance if (service) { if (typeof service != "string") { + instance = service[2] frontend = service[1] service = service[0] + divs.instance.innerHTML = instance.replace(/https?:\/{2}/, "") + let tmp + let instanceNetwork + for (const network in config.networks) { + tmp = r.redirects[frontend][network].indexOf(instance) + if (tmp > -1) { + const instanceDiv = document.getElementById("instance-enabled") + tmp = r.options[frontend][network].enabled.indexOf(instance) + if (tmp > -1) instanceDiv.checked = true + else instanceDiv.checked = false + 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 + 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) + browser.storage.local.set({ options }) + }) + }) + break + } + } + document.getElementById("instance-div").classList.remove("hide") } divs[service].current.classList.remove("hide") divs[service].all.classList.add("hide") diff --git a/src/pages/popup/style.css b/src/pages/popup/style.css index 0cb27912..3b409be8 100644 --- a/src/pages/popup/style.css +++ b/src/pages/popup/style.css @@ -22,3 +22,43 @@ body { .space { height: 10px; } + +input { + height: 23px; + width: 46px; +} + +#instance { + max-width: 110px; + max-height: 22px; + overflow-x: scroll; + white-space: nowrap; + scrollbar-width: none; + -ms-overflow-style: none; +} + +#instance::-webkit-scrollbar { + display: none; +} + +#instance::before { + background-image: linear-gradient(to right, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0)); + position: absolute; + width: 5px; + height: 22px; + content: ""; + display: block; + pointer-events: none; +} + +#end::before { + background-image: linear-gradient(to left, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0)); + position: absolute; + width: 5px; + height: 22px; + content: ""; + display: block; + pointer-events: none; + top: 13px; + left: 157.4px; +} -- cgit 1.4.1