about summary refs log tree commit diff stats
path: root/src/assets/javascripts/services.js
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2023-09-07 12:20:08 +0300
committerManeraKai <manerakai@protonmail.com>2023-09-07 12:20:12 +0300
commitd2cc8a146b01eb02411164b83ab02c665717bd96 (patch)
treee0958fb22df21a33b42b73825ea5972d47bf978c /src/assets/javascripts/services.js
parentAdded strings for localization https://github.com/libredirect/browser_extensi... (diff)
downloadlibredirect-d2cc8a146b01eb02411164b83ab02c665717bd96.zip
Temporary fixed invidious redirecting bug https://github.com/libredirect/browser_extension/issues/763
Diffstat (limited to 'src/assets/javascripts/services.js')
-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 573318ee..e096ef99 100644
--- a/src/assets/javascripts/services.js
+++ b/src/assets/javascripts/services.js
@@ -155,7 +155,7 @@ function redirect(url, type, initiator, forceRedirection) {
 			return url.href.replace(/^https?:\/{2}/, "yattee://")
 		}
 		case "freetube": {
-			return  'freetube://' + url.href
+			return 'freetube://' + url.href
 		}
 		case "poketube": {
 			if (url.pathname.startsWith('/channel')) {
@@ -561,6 +561,13 @@ function redirect(url, type, initiator, forceRedirection) {
 			}
 			return `${randomInstance}${url.pathname}${url.search}`
 		}
+		case "invidious": {
+			if (url.hostname == "youtu.be" || url.hostname.endsWith("youtube.com") && url.pathname.startsWith("/live")) {
+				const watch = url.pathname.substring(url.pathname.lastIndexOf('/') + 1)
+				return `${randomInstance}/watch?v=${watch}`
+			}
+			return `${randomInstance}${url.pathname}${url.search}`
+		}
 		default: {
 			return `${randomInstance}${url.pathname}${url.search}`
 		}