From 7f9724477527c09dd00c6e1d46fed12c42ef6ba8 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Sun, 17 Sep 2023 18:53:55 +0300 Subject: [PATCH] Added Tubo https://github.com/libredirect/browser_extension/issues/783 --- src/assets/images/soundcloud-icon.svg | 43 +++++++++++++++++++++++++++ src/assets/javascripts/services.js | 22 +++++++++++++- src/config.json | 41 +++++++++++++++++++++++-- 3 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 src/assets/images/soundcloud-icon.svg diff --git a/src/assets/images/soundcloud-icon.svg b/src/assets/images/soundcloud-icon.svg new file mode 100644 index 0000000..fe800af --- /dev/null +++ b/src/assets/images/soundcloud-icon.svg @@ -0,0 +1,43 @@ + + + + diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 69c6935..6ed7762 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -517,6 +517,24 @@ function redirect(url, type, initiator, forceRedirection) { } return `${randomInstance}${url.pathname}${url.search}` } + case "tuboYoutube": { + if (url.pathname.startsWith("/channel")) { + return `${randomInstance}/channel?url=${encodeURIComponent(url.href)}` + } + if (url.pathname.startsWith("/watch")) { + return `${randomInstance}/stream?url=${encodeURIComponent(url.href)}` + } + return `${randomInstance}` + } + case "tuboSoundcloud": { + if (url.pathname.match(/\/user[^\/]+(\/$|$)/)) { + return `${randomInstance}/channel?url=${encodeURIComponent(url.href)}` + } + if (url.pathname.match(/\/user[^\/]+\/[^\/]+/)) { + return `${randomInstance}/stream?url=${encodeURIComponent(url.href)}` + } + return `${randomInstance}` + } default: { return `${randomInstance}${url.pathname}${url.search}` } @@ -670,7 +688,9 @@ const defaultInstances = { 'destructables': ['https://ds.vern.cc'], 'wtfismyip': ['https://myip.wtf'], 'safetwitch': ['https://safetwitch.drgns.space'], - 'proxigram': ['https://proxigram.privacyfrontends.repl.co'] + 'proxigram': ['https://proxigram.privacyfrontends.repl.co'], + 'tuboYoutube': ['https://tubo.migalmoreno.com'], + 'tuboSoundcloud': ['https://tubo.migalmoreno.com'], } function initDefaults() { diff --git a/src/config.json b/src/config.json index abc3747..1efcd64 100644 --- a/src/config.json +++ b/src/config.json @@ -60,7 +60,21 @@ "name": "CloudTube", "embeddable": false, "instanceList": true, - "url": "https://sr.ht/~cadence/tube/" + "url": "https://sr.ht/~cadence/tube", + "excludeTargets": [ + 2, + 3 + ] + }, + "tuboYoutube": { + "name": "Tubo", + "embeddable": false, + "instanceList": true, + "url": "https://github.com/migalmoreno/tubo", + "excludeTargets": [ + 2, + 3 + ] }, "freetube": { "excludeTargets": [ @@ -213,7 +227,7 @@ } }, "targets": [ - "^https?:\\/{2}(www\\.)?instagram\\.com\\/?" + "^https?:\\/{2}(www\\.)?instagram\\.com" ], "name": "Instagram", "options": { @@ -299,6 +313,29 @@ "imageType": "svg", "url": "https://www.pixiv.net" }, + "soundcloud": { + "frontends": { + "tuboSoundcloud": { + "name": "Tubo", + "embeddable": false, + "instanceList": true, + "url": "https://github.com/migalmoreno/tubo" + } + }, + "targets": [ + "^https?:\\/{2}soundcloud\\.com" + ], + "name": "SoundCloud", + "options": { + "enabled": false, + "redirectType": "main_frame", + "frontend": "tuboSoundcloud", + "unsupportedUrls": "bypass" + }, + "imageType": "svg", + "embeddable": false, + "url": "https://soundcloud.com" + }, "medium": { "frontends": { "scribe": {