From 8e93230930ede3e179232837732db246c65a193b Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Wed, 7 Jun 2023 17:13:04 +0300 Subject: [PATCH 01/10] Fixed Bibloireads not redirecting /series https://github.com/libredirect/browser_extension/issues/728 --- src/assets/javascripts/services.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index ca672c6..4f2653b 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -459,7 +459,6 @@ function redirect(url, type, initiator, forceRedirection) { } } case "biblioReads": { - if (!url.pathname.startsWith('/book/show/') && url.pathname != '/') return randomInstance return `${randomInstance}${url.pathname}${url.search}` } case "wikiless": { From 3cf6a430938eb39deb1a8752137786c73bbf79d2 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Sun, 11 Jun 2023 03:37:31 +0300 Subject: [PATCH 02/10] Added language support for Quetre https://github.com/libredirect/browser_extension/issues/736 --- src/assets/javascripts/services.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 4f2653b..22b73f5 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -557,6 +557,16 @@ function redirect(url, type, initiator, forceRedirection) { default: { return `${randomInstance}${url.pathname}${url.search}` } + case "quetre": { + const regex = /([a-z]+)\.quora\.com/.exec(url.hostname) + console.log(regex) + if (regex) { + const lang = regex[1] + url.searchParams.append("lang", lang) + return `${randomInstance}${url.pathname}${url.search}` + } + return `${randomInstance}${url.pathname}${url.search}` + } } } From 9e728914591c0d60f48b897f7294f752f8082415 Mon Sep 17 00:00:00 2001 From: NoPlagiarism <37241775+NoPlagiarism@users.noreply.github.com> Date: Sun, 11 Jun 2023 16:39:19 +0500 Subject: [PATCH 03/10] Small regex improvement & twitter www optional --- src/config.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/config.json b/src/config.json index a465f62..71438fa 100644 --- a/src/config.json +++ b/src/config.json @@ -85,12 +85,12 @@ }, "targets": [ "^https?:\\/{2}redirect\\.invidious\\.io\\/.*", - "^https?:\\/{2}(?:www\\.|m\\.|)youtube.com(\\/|$)(?!iframe_api\\/|redirect\\/)", + "^https?:\\/{2}(?:www\\.|m\\.)youtube.com(\\/|$)(?!iframe_api\\/|redirect\\/)", "^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*", "^https?:\\/{2}(?:i|s)\\.ytimg.com\\/vi\\/.*\\/..*", - "^https?:\\/{2}(?:www\\.|)youtube.com\\/watch?v=..*", + "^https?:\\/{2}(?:www\\.)youtube.com\\/watch?v=..*", "^https?:\\/{2}youtu\\.be\\/..*", - "^https?:\\/{2}(?:www\\.|)(youtube|youtube-nocookie)\\.com\\/embed\\/..*" + "^https?:\\/{2}(?:www\\.)(youtube|youtube-nocookie)\\.com\\/embed\\/..*" ], "name": "YouTube", "options": { @@ -140,8 +140,8 @@ } }, "targets": [ - "^https?:\\/{2}(www\\.|mobile\\.|)twitter\\.com(\\/|$)", - "^https?:\\/{2}(pbs\\.|video\\.|)twimg\\.com(\\/|$)", + "^https?:\\/{2}(www\\.|mobile\\.)?twitter\\.com(\\/|$)", + "^https?:\\/{2}(pbs\\.|video\\.)twimg\\.com(\\/|$)", "^https?:\\/{2}platform\\.twitter\\.com/embed(\\/|$)", "^https?:\\/{2}t\\.co(\\/|$)" ], @@ -167,7 +167,7 @@ } }, "targets": [ - "^https?:\\/{2}(www\\.|)tiktok\\.com(\\/|$)" + "^https?:\\/{2}(www\\.)?tiktok\\.com(\\/|$)" ], "name": "TikTok", "options": { @@ -196,7 +196,7 @@ } }, "targets": [ - "^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)(reddit|reddittorjg6rue252oqsxryoxengawnmo46qy4kyii5wtqnwfj4ooad)\\.(com|onion)(?=\\/u(ser)?\\/|\\/r\\/|\\/search|\\/new|\\/?$)", + "^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.)(reddit|reddittorjg6rue252oqsxryoxengawnmo46qy4kyii5wtqnwfj4ooad)\\.(com|onion)(?=\\/u(ser)?\\/|\\/r\\/|\\/search|\\/new|\\/?$)", "^https?:\\/{2}(i|(external-)?preview)\\.redd\\.it" ], "name": "Reddit", @@ -312,7 +312,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:www\\.|m\\.|)imdb\\.com" + "^https?:\\/{2}(?:www\\.|m\\.)imdb\\.com" ], "name": "IMDb", "options": { From fa70daf43b935095dd2cf0e904fc5e9f2d8e2c46 Mon Sep 17 00:00:00 2001 From: NoPlagiarism <37241775+NoPlagiarism@users.noreply.github.com> Date: Sun, 11 Jun 2023 16:54:45 +0500 Subject: [PATCH 04/10] Optional www in some regex + non-capturing groups --- src/config.json | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/config.json b/src/config.json index 71438fa..4876ae6 100644 --- a/src/config.json +++ b/src/config.json @@ -85,12 +85,12 @@ }, "targets": [ "^https?:\\/{2}redirect\\.invidious\\.io\\/.*", - "^https?:\\/{2}(?:www\\.|m\\.)youtube.com(\\/|$)(?!iframe_api\\/|redirect\\/)", + "^https?:\\/{2}(?:www\\.|m\\.)?youtube.com(\\/|$)(?!iframe_api\\/|redirect\\/)", "^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*", "^https?:\\/{2}(?:i|s)\\.ytimg.com\\/vi\\/.*\\/..*", - "^https?:\\/{2}(?:www\\.)youtube.com\\/watch?v=..*", - "^https?:\\/{2}youtu\\.be\\/..*", - "^https?:\\/{2}(?:www\\.)(youtube|youtube-nocookie)\\.com\\/embed\\/..*" + "^https?:\\/{2}(?:www\\.)?youtube.com\\/watch?v=..*", + "^https?:\\/{2}(?:www\\.)?youtu\\.be\\/..*", + "^https?:\\/{2}(?:www\\.)?(youtube|youtube-nocookie)\\.com\\/embed\\/..*" ], "name": "YouTube", "options": { @@ -140,7 +140,7 @@ } }, "targets": [ - "^https?:\\/{2}(www\\.|mobile\\.)?twitter\\.com(\\/|$)", + "^https?:\\/{2}(?:www\\.|mobile\\.)?twitter\\.com(\\/|$)", "^https?:\\/{2}(pbs\\.|video\\.)twimg\\.com(\\/|$)", "^https?:\\/{2}platform\\.twitter\\.com/embed(\\/|$)", "^https?:\\/{2}t\\.co(\\/|$)" @@ -167,7 +167,7 @@ } }, "targets": [ - "^https?:\\/{2}(www\\.)?tiktok\\.com(\\/|$)" + "^https?:\\/{2}(?:www\\.)?tiktok\\.com(\\/|$)" ], "name": "TikTok", "options": { @@ -196,7 +196,7 @@ } }, "targets": [ - "^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.)(reddit|reddittorjg6rue252oqsxryoxengawnmo46qy4kyii5wtqnwfj4ooad)\\.(com|onion)(?=\\/u(ser)?\\/|\\/r\\/|\\/search|\\/new|\\/?$)", + "^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.)?(reddit|reddittorjg6rue252oqsxryoxengawnmo46qy4kyii5wtqnwfj4ooad)\\.(com|onion)(?=\\/u(ser)?\\/|\\/r\\/|\\/search|\\/new|\\/?$)", "^https?:\\/{2}(i|(external-)?preview)\\.redd\\.it" ], "name": "Reddit", @@ -312,7 +312,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:www\\.|m\\.)imdb\\.com" + "^https?:\\/{2}(?:www\\.|m\\.)?imdb\\.com" ], "name": "IMDb", "options": { @@ -359,7 +359,7 @@ }, "targets": [ "^https?:\\/{2}i\\.pinimg\\.com", - "^https?:\\/{2}(www\\.)?pinterest\\.com" + "^https?:\\/{2}(?:www\\.)?pinterest\\.com" ], "options": { "enabled": false, @@ -524,7 +524,7 @@ } }, "targets": [ - "^https?:\\/{2}(www\\.)?reuters\\.com\\/" + "^https?:\\/{2}(?:www\\.)?reuters\\.com\\/" ], "name": "Reuters", "options": { @@ -552,7 +552,7 @@ } }, "targets": [ - "^https?:\\/{2}(www\\.)?genius\\.com\\/" + "^https?:\\/{2}(?:www\\.)?genius\\.com\\/" ], "name": "Genius", "options": { @@ -574,7 +574,7 @@ } }, "targets": [ - "^https?:\\/{2}(www\\.)?urbandictionary\\.com\\/" + "^https?:\\/{2}(?:www\\.)?urbandictionary\\.com\\/" ], "name": "Urban Dictionary", "options": { @@ -596,7 +596,7 @@ } }, "targets": [ - "^https?:\\/{2}?stackoverflow\\.com\\/", + "^https?:\\/{2}(?:www\\.)?stackoverflow\\.com\\/", "^https?:\\/{2}([a-zA-Z0-9-]+\\.)?stackexchange\\.com\\/" ], "name": "Stack Overflow", @@ -620,7 +620,7 @@ } }, "targets": [ - "^https?:\\/{2}(www\\.)?goodreads\\.com\\/" + "^https?:\\/{2}(?:www\\.)?goodreads\\.com\\/" ], "name": "Goodreads", "options": { @@ -663,7 +663,7 @@ } }, "targets": [ - "^https?:\\/{2}(www\\.)?snopes\\.com\\/" + "^https?:\\/{2}(?:www\\.)?snopes\\.com\\/" ], "name": "Snopes", "options": { @@ -793,7 +793,7 @@ } }, "targets": [ - "^https?:\\/{2}(www\\.)?wolframalpha\\.com\\/" + "^https?:\\/{2}(?:www\\.)?wolframalpha\\.com\\/" ], "name": "Wolfram Alpha", "options": { @@ -815,8 +815,8 @@ }, "targets": [ "^https?:\\/{2}speedtest\\.libredirect\\.invalid\\/", - "^https?:\\/{2}(www\\.)?fast\\.com\\/$", - "^https?:\\/{2}(www\\.)?speedtest\\.net\\/$" + "^https?:\\/{2}(?:www\\.)?fast\\.com\\/$", + "^https?:\\/{2}(?:www\\.)?speedtest\\.net\\/$" ], "name": "Speed Test", "options": { From a23f903a95c469302ed11faaedff1785151a4aa0 Mon Sep 17 00:00:00 2001 From: NoPlagiarism <37241775+NoPlagiarism@users.noreply.github.com> Date: Mon, 12 Jun 2023 13:02:36 +0500 Subject: [PATCH 05/10] Made groups "capturing" to make them lightweighter --- src/config.json | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/config.json b/src/config.json index 4876ae6..d769b30 100644 --- a/src/config.json +++ b/src/config.json @@ -85,12 +85,12 @@ }, "targets": [ "^https?:\\/{2}redirect\\.invidious\\.io\\/.*", - "^https?:\\/{2}(?:www\\.|m\\.)?youtube.com(\\/|$)(?!iframe_api\\/|redirect\\/)", + "^https?:\\/{2}(www\\.|m\\.)?youtube.com(\\/|$)(?!iframe_api\\/|redirect\\/)", "^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*", - "^https?:\\/{2}(?:i|s)\\.ytimg.com\\/vi\\/.*\\/..*", - "^https?:\\/{2}(?:www\\.)?youtube.com\\/watch?v=..*", - "^https?:\\/{2}(?:www\\.)?youtu\\.be\\/..*", - "^https?:\\/{2}(?:www\\.)?(youtube|youtube-nocookie)\\.com\\/embed\\/..*" + "^https?:\\/{2}(i|s)\\.ytimg.com\\/vi\\/.*\\/..*", + "^https?:\\/{2}(www\\.)?youtube.com\\/watch?v=..*", + "^https?:\\/{2}(www\\.)?youtu\\.be\\/..*", + "^https?:\\/{2}(www\\.)?(youtube|youtube-nocookie)\\.com\\/embed\\/..*" ], "name": "YouTube", "options": { @@ -140,7 +140,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:www\\.|mobile\\.)?twitter\\.com(\\/|$)", + "^https?:\\/{2}(www\\.|mobile\\.)?twitter\\.com(\\/|$)", "^https?:\\/{2}(pbs\\.|video\\.)twimg\\.com(\\/|$)", "^https?:\\/{2}platform\\.twitter\\.com/embed(\\/|$)", "^https?:\\/{2}t\\.co(\\/|$)" @@ -167,7 +167,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:www\\.)?tiktok\\.com(\\/|$)" + "^https?:\\/{2}(www\\.)?tiktok\\.com(\\/|$)" ], "name": "TikTok", "options": { @@ -312,7 +312,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:www\\.|m\\.)?imdb\\.com" + "^https?:\\/{2}(www\\.|m\\.)?imdb\\.com" ], "name": "IMDb", "options": { @@ -334,7 +334,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:[a-zA-Z0-9-]+\\.)?(?:fandom|wikia)\\.com(?=\\/wiki|\\/?$)" + "^https?:\\/{2}([a-zA-Z0-9-]+\\.)?(fandom|wikia)\\.com(?=\\/wiki|\\/?$)" ], "name": "Fandom", "options": { @@ -359,7 +359,7 @@ }, "targets": [ "^https?:\\/{2}i\\.pinimg\\.com", - "^https?:\\/{2}(?:www\\.)?pinterest\\.com" + "^https?:\\/{2}(www\\.)?pinterest\\.com" ], "options": { "enabled": false, @@ -524,7 +524,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:www\\.)?reuters\\.com\\/" + "^https?:\\/{2}(www\\.)?reuters\\.com\\/" ], "name": "Reuters", "options": { @@ -552,7 +552,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:www\\.)?genius\\.com\\/" + "^https?:\\/{2}(www\\.)?genius\\.com\\/" ], "name": "Genius", "options": { @@ -574,7 +574,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:www\\.)?urbandictionary\\.com\\/" + "^https?:\\/{2}(www\\.)?urbandictionary\\.com\\/" ], "name": "Urban Dictionary", "options": { @@ -596,7 +596,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:www\\.)?stackoverflow\\.com\\/", + "^https?:\\/{2}(www\\.)?stackoverflow\\.com\\/", "^https?:\\/{2}([a-zA-Z0-9-]+\\.)?stackexchange\\.com\\/" ], "name": "Stack Overflow", @@ -620,7 +620,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:www\\.)?goodreads\\.com\\/" + "^https?:\\/{2}(www\\.)?goodreads\\.com\\/" ], "name": "Goodreads", "options": { @@ -642,7 +642,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:[a-z]+\\.)*wikipedia\\.org\\/?" + "^https?:\\/{2}([a-z]+\\.)*wikipedia\\.org\\/?" ], "name": "Wikipedia", "options": { @@ -663,7 +663,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:www\\.)?snopes\\.com\\/" + "^https?:\\/{2}(www\\.)?snopes\\.com\\/" ], "name": "Snopes", "options": { @@ -793,7 +793,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:www\\.)?wolframalpha\\.com\\/" + "^https?:\\/{2}(www\\.)?wolframalpha\\.com\\/" ], "name": "Wolfram Alpha", "options": { @@ -815,8 +815,8 @@ }, "targets": [ "^https?:\\/{2}speedtest\\.libredirect\\.invalid\\/", - "^https?:\\/{2}(?:www\\.)?fast\\.com\\/$", - "^https?:\\/{2}(?:www\\.)?speedtest\\.net\\/$" + "^https?:\\/{2}(www\\.)?fast\\.com\\/$", + "^https?:\\/{2}(www\\.)?speedtest\\.net\\/$" ], "name": "Speed Test", "options": { From 74560b14d82e54bbcf47603d66a795312c293622 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Thu, 15 Jun 2023 20:43:52 +0300 Subject: [PATCH 06/10] Added PixivFE https://github.com/libredirect/browser_extension/issues/735 --- src/assets/images/pixiv-icon.svg | 49 ++++++++++++++++++++++++++++++ src/assets/javascripts/services.js | 17 ++++++++--- src/config.json | 21 +++++++++++++ 3 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 src/assets/images/pixiv-icon.svg diff --git a/src/assets/images/pixiv-icon.svg b/src/assets/images/pixiv-icon.svg new file mode 100644 index 0000000..9460979 --- /dev/null +++ b/src/assets/images/pixiv-icon.svg @@ -0,0 +1,49 @@ + + + + diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 22b73f5..412c044 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -554,9 +554,6 @@ function redirect(url, type, initiator, forceRedirection) { if (path == "/") path = "" return `${randomInstance}/${url.hostname}${path}${url.search}` } - default: { - return `${randomInstance}${url.pathname}${url.search}` - } case "quetre": { const regex = /([a-z]+)\.quora\.com/.exec(url.hostname) console.log(regex) @@ -567,6 +564,17 @@ function redirect(url, type, initiator, forceRedirection) { } return `${randomInstance}${url.pathname}${url.search}` } + case "pixivFe": { + const regex = /\/[a-z]{1,3}\/(.*)/.exec(url.pathname) + if (regex) { + const path = regex[1] + return `${randomInstance}/${path}${url.search}` + } + return `${randomInstance}${url.pathname}${url.search}` + } + default: { + return `${randomInstance}${url.pathname}${url.search}` + } } } @@ -711,7 +719,8 @@ const defaultInstances = { "laboratory": ['https://lab.vern.cc'], "libreSpeed": ['https://librespeed.org'], 'jitsi': ['https://meet.jit.si', 'https://8x8.vc'], - 'binternet': ['https://binternet.ahwx.org'] + 'binternet': ['https://binternet.ahwx.org'], + 'pixivFe': ['https://pixivfe.exozy.me'] } function initDefaults() { diff --git a/src/config.json b/src/config.json index a465f62..878e962 100644 --- a/src/config.json +++ b/src/config.json @@ -235,6 +235,27 @@ "embeddable": true, "url": "https://imgur.com" }, + "pixiv": { + "name": "Pixiv", + "frontends": { + "pixivFe": { + "name": "PixivFE", + "instanceList": true, + "url": "https://codeberg.org/VnPower/pixivfe" + } + }, + "targets": [ + "^https?:\\/{2}(www\\.)?pixiv\\.net\\/" + ], + "options": { + "enabled": false, + "unsupportedUrls": "bypass", + "frontend": "pixivFe" + }, + "imageType": "svg", + "embeddable": false, + "url": "https://www.pixiv.net" + }, "medium": { "frontends": { "scribe": { From a44ba0effef81a938b8263bc6ede84e19c747bcd Mon Sep 17 00:00:00 2001 From: SC Date: Thu, 15 Jun 2023 16:31:02 +0000 Subject: [PATCH 07/10] Translated using Weblate (Portuguese) Currently translated at 100.0% (26 of 26 strings) Translation: LibRedirect/extension Translate-URL: https://hosted.weblate.org/projects/libredirect/extension/pt/ --- src/_locales/pt/messages.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/_locales/pt/messages.json b/src/_locales/pt/messages.json index 81f08a2..5340cb1 100644 --- a/src/_locales/pt/messages.json +++ b/src/_locales/pt/messages.json @@ -36,7 +36,7 @@ "description": "used in the settings page" }, "excludeFromRedirecting": { - "message": "Excluded from redirecting", + "message": "Excluído do redirecionamento", "description": "used in the settings page" }, "importSettings": { @@ -56,7 +56,7 @@ "description": "used in the settings page" }, "showInPopup": { - "message": "Show in popup", + "message": "Mostrar no pop-up", "description": "used in the settings page" }, "frontend": { @@ -80,7 +80,7 @@ "description": "used in the settings page" }, "addYourFavoriteInstances": { - "message": "Add your favorite instances", + "message": "Adicionar a sua instância favorita", "description": "used in the settings page" }, "copyRaw": { @@ -90,14 +90,14 @@ "message": "Copiado" }, "redirectToOriginal": { - "message": "Redirect to original", + "message": "Redirecionar para o original", "description": "Used in context menus when right clicking on a page/tab" }, "redirectLink": { - "message": "Tentar redirecionar esta hiperligação", + "message": "Tentar redirecionar", "description": "Used in context menus when right clicking on a hyperlink" }, "about": { - "message": "About" + "message": "Sobre" } -} \ No newline at end of file +} From 39a19e56cc40669f631dd873e2c51f6440feb015 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Tue, 20 Jun 2023 02:47:28 +0300 Subject: [PATCH 08/10] Re-added EmbedFrontend https://github.com/libredirect/browser_extension/issues/624 --- src/assets/javascripts/services.js | 29 +++++++++++++++--------- src/config.json | 31 +++----------------------- src/pages/options/index.js | 15 ++++++++++--- src/pages/options/widgets/services.pug | 17 ++++++++++---- 4 files changed, 47 insertions(+), 45 deletions(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 412c044..3ff1159 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -56,22 +56,31 @@ function redirect(url, type, initiator, forceRedirection) { for (const service in config.services) { if (!forceRedirection && !options[service].enabled) continue - frontend = options[service].frontend - - if (!regexArray(service, url, config, frontend)) { - frontend = null - continue - } - + frontend = options[service] if ( - (config.services[service].embeddable && type != options[service].redirectType && options[service].redirectType != "both") - || - (!config.services[service].embeddable && type != "main_frame") + config.services[service].embeddable && + type != options[service].redirectType && + options[service].redirectType != "both" ) { if (options[service].unsupportedUrls == 'block') return 'CANCEL' return } + if ( + config.services[service].embeddable + && + type != "main_frame" + && + options[service].redirectType != "main_frame" + && + options[service].embedFrontend != "disabled" + ) frontend = options[service].embedFrontend + + if (!regexArray(service, url, config, frontend)) { + frontend = null + continue + } + let instanceList = options[frontend] if (instanceList === undefined) break if (instanceList.length === 0) return null diff --git a/src/config.json b/src/config.json index f5527ed..9659bc8 100644 --- a/src/config.json +++ b/src/config.json @@ -69,6 +69,7 @@ ], "name": "FreeTube", "embeddable": false, + "desktopApp": true, "instanceList": false, "url": "https://github.com/FreeTubeApp/FreeTube" }, @@ -79,6 +80,7 @@ ], "name": "Yattee", "embeddable": false, + "desktopApp": true, "instanceList": false, "url": "https://github.com/yattee/yattee" } @@ -97,6 +99,7 @@ "enabled": false, "redirectType": "main_frame", "frontend": "invidious", + "embedFrontend": "disabled", "unsupportedUrls": "bypass" }, "imageType": "png", @@ -126,7 +129,6 @@ "unsupportedUrls": "bypass" }, "imageType": "png", - "embeddable": false, "url": "https://music.youtube.com" }, "twitter": { @@ -177,7 +179,6 @@ "instance": "public" }, "imageType": "png", - "embeddable": false, "url": "https://tiktok.com" }, "reddit": { @@ -207,7 +208,6 @@ "instance": "public" }, "imageType": "png", - "embeddable": false, "url": "https://reddit.com" }, "imgur": { @@ -253,7 +253,6 @@ "frontend": "pixivFe" }, "imageType": "svg", - "embeddable": false, "url": "https://www.pixiv.net" }, "medium": { @@ -297,7 +296,6 @@ "unsupportedUrls": "bypass" }, "imageType": "svg", - "embeddable": false, "url": "https://medium.com" }, "quora": { @@ -320,7 +318,6 @@ "instance": "public" }, "imageType": "png", - "embeddable": false, "url": "https://quora.com" }, "imdb": { @@ -343,7 +340,6 @@ "instance": "public" }, "imageType": "svg", - "embeddable": false, "url": "https://imdb.com" }, "fandom": { @@ -365,7 +361,6 @@ "frontend": "breezeWiki" }, "imageType": "svg", - "embeddable": false, "url": "https://fandom.com" }, "pinterest": { @@ -427,7 +422,6 @@ "instance": "public" }, "imageType": "svgMono", - "embeddable": false, "url": "https://search.libredirect.invalid" }, "translate": { @@ -462,7 +456,6 @@ "instance": "public" }, "imageType": "svgMono", - "embeddable": false, "url": "https://translate.libredirect.invalid" }, "maps": { @@ -489,7 +482,6 @@ "unsupportedUrls": "bypass" }, "imageType": "svgMono", - "embeddable": false, "url": "https://maps.libredirect.invalid" }, "sendFiles": { @@ -512,7 +504,6 @@ "frontend": "send" }, "imageType": "svgMono", - "embeddable": false, "url": "https://send.libredirect.invalid" }, "textStorage": { @@ -533,7 +524,6 @@ "frontend": "privateBin" }, "imageType": "svgMono", - "embeddable": false, "url": "https://paste.libredirect.invalid" }, "reuters": { @@ -554,7 +544,6 @@ "frontend": "neuters" }, "imageType": "svg", - "embeddable": false, "url": "https://reuters.com" }, "genius": { @@ -583,7 +572,6 @@ "instance": "public" }, "imageType": "svg", - "embeddable": false, "url": "https://genius.com" }, "urbanDictionary": { @@ -604,7 +592,6 @@ "frontend": "ruralDictionary" }, "imageType": "svg", - "embeddable": false, "url": "https://urbandictionary.com" }, "stackOverflow": { @@ -628,7 +615,6 @@ "instance": "public" }, "imageType": "svgMono", - "embeddable": false, "url": "https://stackoverflow.com/" }, "goodreads": { @@ -651,7 +637,6 @@ "instance": "public" }, "imageType": "svgMono", - "embeddable": false, "url": "https://goodreads.com/" }, "wikipedia": { @@ -672,7 +657,6 @@ "frontend": "wikiless" }, "imageType": "svg", - "embeddable": false, "url": "https://wikipedia.org" }, "snopes": { @@ -693,7 +677,6 @@ "frontend": "suds" }, "imageType": "svg", - "embeddable": false, "url": "https://www.snopes.com" }, "waybackMachine": { @@ -714,7 +697,6 @@ "frontend": "waybackClassic" }, "imageType": "svgMono", - "embeddable": false, "url": "https://web.archive.org" }, "github": { @@ -735,7 +717,6 @@ "frontend": "gothub" }, "imageType": "svgMono", - "embeddable": false, "url": "https://github.com" }, "bilibili": { @@ -757,7 +738,6 @@ "frontend": "mikuInvidious" }, "imageType": "svgMono", - "embeddable": false, "url": "https://bilibili.com/" }, "bandcamp": { @@ -779,7 +759,6 @@ "frontend": "tent" }, "imageType": "svg", - "embeddable": false, "url": "https://bandcamp.com" }, "gitlab": { @@ -802,7 +781,6 @@ "frontend": "laboratory" }, "imageType": "svg", - "embeddable": false, "url": "https://gitlab.com/" }, "wolframAlpha": { @@ -823,7 +801,6 @@ "frontend": "wolfreeAlpha" }, "imageType": "svg", - "embeddable": false, "url": "https://www.wolframalpha.com" }, "speedTest": { @@ -846,7 +823,6 @@ "frontend": "libreSpeed" }, "imageType": "svgMono", - "embeddable": false, "url": "https://speedtest.libredirect.invalid" }, "meet": { @@ -867,7 +843,6 @@ "frontend": "jitsi" }, "imageType": "svgMono", - "embeddable": false, "url": "https://meet.libredirect.invalid" } } diff --git a/src/pages/options/index.js b/src/pages/options/index.js index 002a8aa..cf0fb03 100644 --- a/src/pages/options/index.js +++ b/src/pages/options/index.js @@ -33,7 +33,11 @@ async function changeFrontendsSettings(service) { if (config.services[service].frontends[frontend].instanceList) { const frontendDiv = document.getElementById(frontend) if (typeof divs[service].frontend !== "undefined") { - if (frontend == divs[service].frontend.value) { + if ( + frontend == divs[service].frontend.value + || + (!config.services[service].frontends[divs[service].frontend.value].embeddable && divs[service].embedFrontend && frontend == divs[service].embedFrontend.value) + ) { frontendDiv.style.display = "" if (config.services[service].frontends[frontend].localhost === true) { document.getElementById(`${service}-instance-div`).style.display = "" @@ -52,19 +56,24 @@ async function changeFrontendsSettings(service) { } if (document.getElementById(`${service}-redirectType`)) { const frontend = options[service].frontend - if (config.services[service].frontends[frontend].embeddable) { + if (config.services[service].frontends[frontend].embeddable || config.services[service].frontends[frontend].desktopApp) { document.getElementById(`${service}-redirectType`).innerHTML = ` ` - document.getElementById(`${service}-redirectType`).value = options[frontend].redirectType = options[service].redirectType + document.getElementById(`${service}-redirectType`).value = options[service].redirectType } else { document.getElementById(`${service}-redirectType`).innerHTML = '' options[service].redirectType = "main_frame" browser.storage.local.set({ options }) } + if (config.services[service].frontends[frontend].desktopApp) { + document.getElementById(`${service}-embedFrontend-div`).style.display = '' + } else { + document.getElementById(`${service}-embedFrontend-div`).style.display = 'none' + } } const frontend_name_element = document.getElementById(`${service}_page`).getElementsByClassName("frontend_name")[0] frontend_name_element.href = config.services[service].frontends[divs[service].frontend.value].url diff --git a/src/pages/options/widgets/services.pug b/src/pages/options/widgets/services.pug index 5d09b39..64830cc 100644 --- a/src/pages/options/widgets/services.pug +++ b/src/pages/options/widgets/services.pug @@ -29,10 +29,19 @@ each val, service in services option(value="localhost") localhost option(value="public") public instances - if services[service].embeddable - div(class="some-block option-block") - h4(data-localise="__MSG_redirectType__") Redirect Type - select(id=service+"-redirectType") + div(class="some-block option-block") + h4(data-localise="__MSG_redirectType__") Redirect Type + select(id=service+"-redirectType") + + + div(id=service+"-embedFrontend-div" class="some-block option-block") + h4(data-localise="__MSG_embedFrontend__") Embed Frontend + select(id=service+"-embedFrontend") + option(value="disabled") Disabled + each val, frontend in services[service].frontends + if services[service].frontends[frontend].embeddable && services[service].frontends[frontend].instanceList + option(value=frontend)=services[service].frontends[frontend].name + div(class="some-block option-block") h4 Unsupported iframes handling From 3d883f52ab03f0fa2d0d650aa3a3789fb326c6ad Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Tue, 20 Jun 2023 11:20:32 +0300 Subject: [PATCH 09/10] Added Indestructables https://codeberg.org/LibRedirect/browser_extension/issues/91 . Fixed bugs in embedFrontend https://github.com/libredirect/browser_extension/issues/624 --- src/assets/images/instructables-icon.svg | 372 +++++++++++++++++++++++ src/assets/javascripts/services.js | 23 +- src/config.json | 62 ++-- src/pages/options/index.js | 17 +- src/pages/options/widgets/services.pug | 1 - src/pages/stylesheets/styles.css | 2 +- 6 files changed, 437 insertions(+), 40 deletions(-) create mode 100644 src/assets/images/instructables-icon.svg diff --git a/src/assets/images/instructables-icon.svg b/src/assets/images/instructables-icon.svg new file mode 100644 index 0000000..9b7eaa2 --- /dev/null +++ b/src/assets/images/instructables-icon.svg @@ -0,0 +1,372 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 3ff1159..4613d34 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -56,26 +56,20 @@ function redirect(url, type, initiator, forceRedirection) { for (const service in config.services) { if (!forceRedirection && !options[service].enabled) continue - frontend = options[service] + frontend = options[service].frontend + if ( config.services[service].embeddable && - type != options[service].redirectType && - options[service].redirectType != "both" + type != options[service].redirectType && options[service].redirectType != "both" ) { if (options[service].unsupportedUrls == 'block') return 'CANCEL' return } - if ( - config.services[service].embeddable - && - type != "main_frame" - && - options[service].redirectType != "main_frame" - && - options[service].embedFrontend != "disabled" - ) frontend = options[service].embedFrontend - + if (config.services[service].frontends[frontend].desktopApp && type != "main_frame" && options[service].redirectType != "main_frame") + frontend = options[service].embedFrontend + + if (!regexArray(service, url, config, frontend)) { frontend = null continue @@ -729,7 +723,8 @@ const defaultInstances = { "libreSpeed": ['https://librespeed.org'], 'jitsi': ['https://meet.jit.si', 'https://8x8.vc'], 'binternet': ['https://binternet.ahwx.org'], - 'pixivFe': ['https://pixivfe.exozy.me'] + 'pixivFe': ['https://pixivfe.exozy.me'], + 'indestructables': ['https://indestructables.private.coffee'] } function initDefaults() { diff --git a/src/config.json b/src/config.json index 9659bc8..ee6a62d 100644 --- a/src/config.json +++ b/src/config.json @@ -99,7 +99,7 @@ "enabled": false, "redirectType": "main_frame", "frontend": "invidious", - "embedFrontend": "disabled", + "embedFrontend": "invidious", "unsupportedUrls": "bypass" }, "imageType": "png", @@ -783,26 +783,6 @@ "imageType": "svg", "url": "https://gitlab.com/" }, - "wolframAlpha": { - "frontends": { - "wolfreeAlpha": { - "name": "WolfreeAlpha", - "instanceList": true, - "url": "https://git.disroot.org/wolfree" - } - }, - "targets": [ - "^https?:\\/{2}(www\\.)?wolframalpha\\.com\\/" - ], - "name": "Wolfram Alpha", - "options": { - "enabled": false, - "unsupportedUrls": "bypass", - "frontend": "wolfreeAlpha" - }, - "imageType": "svg", - "url": "https://www.wolframalpha.com" - }, "speedTest": { "frontends": { "libreSpeed": { @@ -825,6 +805,26 @@ "imageType": "svgMono", "url": "https://speedtest.libredirect.invalid" }, + "instructables": { + "name": "Instructables", + "frontends": { + "indestructables": { + "name": "Indestructables", + "instanceList": true, + "url": "https://indestructables.codeberg.page" + } + }, + "targets": [ + "^https?:\\/{2}(www\\.)?instructables\\.com\\/" + ], + "options": { + "enabled": false, + "unsupportedUrls": "bypass", + "frontend": "indestructables" + }, + "imageType": "svg", + "url": "https://www.instructables.com" + }, "meet": { "name": "Meet", "frontends": { @@ -844,6 +844,26 @@ }, "imageType": "svgMono", "url": "https://meet.libredirect.invalid" + }, + "wolframAlpha": { + "frontends": { + "wolfreeAlpha": { + "name": "WolfreeAlpha", + "instanceList": true, + "url": "https://git.disroot.org/wolfree" + } + }, + "targets": [ + "^https?:\\/{2}(www\\.)?wolframalpha\\.com\\/" + ], + "name": "Wolfram Alpha", + "options": { + "enabled": false, + "unsupportedUrls": "bypass", + "frontend": "wolfreeAlpha" + }, + "imageType": "svg", + "url": "https://www.wolframalpha.com" } } } \ No newline at end of file diff --git a/src/pages/options/index.js b/src/pages/options/index.js index cf0fb03..2cf525e 100644 --- a/src/pages/options/index.js +++ b/src/pages/options/index.js @@ -56,20 +56,31 @@ async function changeFrontendsSettings(service) { } if (document.getElementById(`${service}-redirectType`)) { const frontend = options[service].frontend - if (config.services[service].frontends[frontend].embeddable || config.services[service].frontends[frontend].desktopApp) { + if (config.services[service].frontends[frontend].embeddable) { document.getElementById(`${service}-redirectType`).innerHTML = ` ` - document.getElementById(`${service}-redirectType`).value = options[service].redirectType + } + else if (config.services[service].frontends[frontend].desktopApp && Object.values(config.services[service].frontends).some(frontend => frontend.embeddable)) { + document.getElementById(`${service}-redirectType`).innerHTML = ` + + ` + if (options[service].redirectType == "sub_frame") { + options[service].redirectType = "main_frame" + browser.storage.local.set({ options }) + } } else { document.getElementById(`${service}-redirectType`).innerHTML = '' options[service].redirectType = "main_frame" + browser.storage.local.set({ options }) } - if (config.services[service].frontends[frontend].desktopApp) { + document.getElementById(`${service}-redirectType`).value = options[service].redirectType + if (config.services[service].frontends[frontend].desktopApp && options[service].redirectType != "main_frame") { document.getElementById(`${service}-embedFrontend-div`).style.display = '' } else { document.getElementById(`${service}-embedFrontend-div`).style.display = 'none' diff --git a/src/pages/options/widgets/services.pug b/src/pages/options/widgets/services.pug index 64830cc..d710ed7 100644 --- a/src/pages/options/widgets/services.pug +++ b/src/pages/options/widgets/services.pug @@ -37,7 +37,6 @@ each val, service in services div(id=service+"-embedFrontend-div" class="some-block option-block") h4(data-localise="__MSG_embedFrontend__") Embed Frontend select(id=service+"-embedFrontend") - option(value="disabled") Disabled each val, frontend in services[service].frontends if services[service].frontends[frontend].embeddable && services[service].frontends[frontend].instanceList option(value=frontend)=services[service].frontends[frontend].name diff --git a/src/pages/stylesheets/styles.css b/src/pages/stylesheets/styles.css index 875763d..fb246b7 100644 --- a/src/pages/stylesheets/styles.css +++ b/src/pages/stylesheets/styles.css @@ -128,7 +128,7 @@ section.links { flex-wrap: wrap; flex-direction: column; width: 300px; - max-height: 800px; + max-height: 850px; } section.links div { From c46c0fb83a38ca73aa30a64a49c7973bcf1d01df Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Tue, 20 Jun 2023 21:00:36 +0300 Subject: [PATCH 10/10] Added WTF IS MY IP! https://github.com/libredirect/browser_extension/issues/746 --- src/assets/images/myIp-icon-light.svg | 39 +++++++++++++++++++++++++++ src/assets/images/myIp-icon.svg | 1 + src/assets/javascripts/services.js | 3 ++- src/config.json | 20 ++++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 src/assets/images/myIp-icon-light.svg create mode 100644 src/assets/images/myIp-icon.svg diff --git a/src/assets/images/myIp-icon-light.svg b/src/assets/images/myIp-icon-light.svg new file mode 100644 index 0000000..bfa5bbd --- /dev/null +++ b/src/assets/images/myIp-icon-light.svg @@ -0,0 +1,39 @@ + + + + + + diff --git a/src/assets/images/myIp-icon.svg b/src/assets/images/myIp-icon.svg new file mode 100644 index 0000000..c386420 --- /dev/null +++ b/src/assets/images/myIp-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 4613d34..d0d85ac 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -724,7 +724,8 @@ const defaultInstances = { 'jitsi': ['https://meet.jit.si', 'https://8x8.vc'], 'binternet': ['https://binternet.ahwx.org'], 'pixivFe': ['https://pixivfe.exozy.me'], - 'indestructables': ['https://indestructables.private.coffee'] + 'indestructables': ['https://indestructables.private.coffee'], + 'wtfismyip': ['https://myip.wtf'] } function initDefaults() { diff --git a/src/config.json b/src/config.json index ee6a62d..36d8b86 100644 --- a/src/config.json +++ b/src/config.json @@ -845,6 +845,26 @@ "imageType": "svgMono", "url": "https://meet.libredirect.invalid" }, + "myIp": { + "frontends": { + "wtfismyip": { + "name": "wtfismyip", + "instanceList": true, + "url": "https://gitlab.com/wtfismyip/wtfismyip" + } + }, + "targets": [ + "^https?:\\/{2}myip\\.libredirect\\.invalid\\/" + ], + "name": "My IP", + "options": { + "enabled": false, + "unsupportedUrls": "bypass", + "frontend": "wtfismyip" + }, + "imageType": "svgMono", + "url": "https://myip.libredirect.invalid" + }, "wolframAlpha": { "frontends": { "wolfreeAlpha": {