From 6f8f331125dadf75b9a5cc057e6536437e6f2911 Mon Sep 17 00:00:00 2001 From: Hellow <74311245+HeIIow2@users.noreply.github.com> Date: Tue, 5 Sep 2023 19:54:16 +0200 Subject: [PATCH 1/2] fixed youtu.be redirects --- src/pages/background/background.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 9b8c3a13..e7b44266 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -273,6 +273,13 @@ function redirectYouTube(url, initiator, type) { if (onlyEmbeddedVideo && type !== "sub_frame") { return null; } + if (url.host === "youtu.be" && !url.searchParams.has("v")) { + // add the video id of shortened if from the path, to the search params + // neither free tube nor invidious can work with shortened links till now + url.searchParams.append("v", url.pathname.replace("/", "")); // only works as long as video id's can't contain "/" + url.searchParams.delete("si"); + url.pathname = "/watch"; + } if (useFreeTube && type === "main_frame") { return `freetube://${url}`; } From bae58db7242c59c209a87873c9257510a6e7525a Mon Sep 17 00:00:00 2001 From: Hellow <74311245+HeIIow2@users.noreply.github.com> Date: Tue, 5 Sep 2023 19:59:42 +0200 Subject: [PATCH 2/2] fixed execution order --- src/pages/background/background.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pages/background/background.js b/src/pages/background/background.js index e7b44266..84e08c20 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -273,16 +273,15 @@ function redirectYouTube(url, initiator, type) { if (onlyEmbeddedVideo && type !== "sub_frame") { return null; } + if (useFreeTube && type === "main_frame") { + return `freetube://${url}`; + } if (url.host === "youtu.be" && !url.searchParams.has("v")) { // add the video id of shortened if from the path, to the search params - // neither free tube nor invidious can work with shortened links till now url.searchParams.append("v", url.pathname.replace("/", "")); // only works as long as video id's can't contain "/" url.searchParams.delete("si"); url.pathname = "/watch"; } - if (useFreeTube && type === "main_frame") { - return `freetube://${url}`; - } // Apply settings if (alwaysProxy) { url.searchParams.append("local", true);