about summary refs log tree commit diff stats
path: root/src/assets/javascripts
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2024-07-09 14:15:00 +0300
committerManeraKai <manerakai@protonmail.com>2024-07-09 14:15:00 +0300
commita20082de57fce45a25fe3fcd947e9aa50a900516 (patch)
tree5f081f52cdb708743d9ec9acea9e1f181c717ce6 /src/assets/javascripts
parentAdded Pasted https://github.com/libredirect/browser_extension/issues/930 (diff)
downloadlibredirect-a20082de57fce45a25fe3fcd947e9aa50a900516.zip
Added Freetube to YouTube Music https://github.com/libredirect/browser_extension/issues/940
Diffstat (limited to 'src/assets/javascripts')
-rw-r--r--src/assets/javascripts/services.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js
index ac841427..b9ee64e5 100644
--- a/src/assets/javascripts/services.js
+++ b/src/assets/javascripts/services.js
@@ -396,6 +396,13 @@ function rewrite(url, frontend, randomInstance) {
 				return url.href
 			return `${randomInstance}${url.pathname}${url.search}`
 		}
+		case "freetubeMusic": {
+			if (url.hostname == "youtu.be" || url.hostname.endsWith("youtube.com") && url.pathname.startsWith("/live")) {
+				const watch = url.pathname.substring(url.pathname.lastIndexOf('/') + 1)
+				return `freetube://youtube.com/watch?v=${watch}`
+			}
+			return 'freetube://' + url.href
+		}
 		case "invidiousMusic": {
 			if (url.hostname == "youtu.be" || url.hostname.endsWith("youtube.com") && url.pathname.startsWith("/live")) {
 				const watch = url.pathname.substring(url.pathname.lastIndexOf('/') + 1)
@@ -683,7 +690,7 @@ async function reverse(url) {
 			case "tekstowo":
 				return `${config.services[service].url}/${url.search.slice(1)}`
 			case "goodreads":
-					return `https://goodreads.com${url.pathname}${url.search}`
+				return `https://goodreads.com${url.pathname}${url.search}`
 			default:
 				return
 		}