aboutsummaryrefslogtreecommitdiffstats
path: root/src/assets
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2022-02-05 18:45:37 +0300
committerManeraKai <manerakai@protonmail.com>2022-02-05 18:45:48 +0300
commit0f2dff5330bd1f41c8ca0ca68f7501dcf525ebc1 (patch)
tree979850c00a981487962ba68137aebae02dd64fd8 /src/assets
parentAdded hard cancel requests, will be more improved (diff)
downloadlibredirect-0f2dff5330bd1f41c8ca0ca68f7501dcf525ebc1.zip
combining some of piped and invidious settings #14
Diffstat (limited to '')
-rw-r--r--src/assets/javascripts/helpers/youtube/youtube.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/assets/javascripts/helpers/youtube/youtube.js b/src/assets/javascripts/helpers/youtube/youtube.js
index 49a3b31f..71eb0c38 100644
--- a/src/assets/javascripts/helpers/youtube/youtube.js
+++ b/src/assets/javascripts/helpers/youtube/youtube.js
@@ -180,7 +180,6 @@ function isYoutube(url) {
...targets,
...invidiousHostNames(),
]
- console.log("mightyList.includes(url.host)", mightyList.includes(url.host))
return mightyList.includes(url.host);
} else
return targets.includes(url.host)
@@ -244,7 +243,7 @@ function redirect(url, initiator, type) {
)
return null;
- if (url.host.split(".")[0] === "studio") return null;// Avoid `studio.youtube.com`
+ if (url.hostname == "studio.youtube.com") return null;
if (url.pathname.match(/iframe_api/) || url.pathname.match(/www-widgetapi/)) return null; // Don't redirect YouTube Player API.
@@ -265,20 +264,21 @@ function redirect(url, initiator, type) {
let randomInstance = commonHelper.getRandomInstance(redirects.invidious.normal)
- return `${randomInstance}${url.pathname.replace("/shorts", "")}${url.search}`;
+ return `${randomInstance}${url.pathname.replace("/shorts/", "/watch?v=")}${url.search}`;
} else if (frontend == 'piped') {
if (invidiousOnlyEmbeddedVideo && type !== "sub_frame") return null;
+
+ if (invidiousTheme != "DEFAULT") url.searchParams.append("theme", invidiousTheme);
+ if (invidiousVolume != "--") url.searchParams.append("volume", invidiousVolume / 100);
+ if (invidiousAutoplay != "DEFAULT") url.searchParams.append("playerAutoPlay", invidiousAutoplay);
+
let randomInstance = commonHelper.getRandomInstance(redirects.piped.normal);
- if (
- url.hostname.endsWith("youtube.com") ||
- url.hostname.endsWith("youtube-nocookie.com") ||
- invidiousHostNames().includes(url.hostname)
- )
- return `${randomInstance}${url.pathname}${url.search}`;
+ if (url.hostname.endsWith("youtube.com") || url.hostname.endsWith("youtube-nocookie.com") || invidiousHostNames().includes(url.hostname))
+ return `${randomInstance}${url.pathname.replace("/shorts/", "/watch?v=")}${url.search}`;
if (url.hostname.endsWith("youtu.be") && url.pathname.length > 1)
return `${randomInstance}/watch?v=${url.pathname.substring(1)}`;