From b8026934a09f4a364548a83fa1d437ffcdde17c5 Mon Sep 17 00:00:00 2001 From: Cameron Radmore Date: Sun, 19 Jul 2026 17:31:35 -0400 Subject: [PATCH 1/2] feat: add support for additional channel urls (:user/:tab) --- src/invidious/routes/channels.cr | 12 ++++++++++++ src/invidious/routing.cr | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/invidious/routes/channels.cr b/src/invidious/routes/channels.cr index 0477802ae..23eeeeb8d 100644 --- a/src/invidious/routes/channels.cr +++ b/src/invidious/routes/channels.cr @@ -335,6 +335,18 @@ module Invidious::Routes::Channels "posts", } + def self.potential_brand_redirect(env) + # Check for known tab in url before trying to brand_redirect (avoids unneeded request to YouTube) + + selected_tab = env.params.url["tab"]? + + if KNOWN_TABS.includes? selected_tab + brand_redirect(env) + else + Invidious::Routes::Misc.home(env) + end + end + # Redirects brand url channels to a normal /channel/:ucid route def self.brand_redirect(env) locale = env.get("preferences").as(Preferences).locale diff --git a/src/invidious/routing.cr b/src/invidious/routing.cr index 12bf5459f..889ff8ee6 100644 --- a/src/invidious/routing.cr +++ b/src/invidious/routing.cr @@ -47,6 +47,8 @@ module Invidious::Routing self.register_api_manifest_routes self.register_video_playback_routes self.register_companion_routes + + get "/:user/:tab", Routes::Channels, :potential_brand_redirect end # ------------------- From 492eab04e3d95d1694d08b956ad62102f9fb7e67 Mon Sep 17 00:00:00 2001 From: Cameron Radmore Date: Sun, 19 Jul 2026 17:32:12 -0400 Subject: [PATCH 2/2] fix: check known_tabs against downcased selected_tab --- src/invidious/routes/channels.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/invidious/routes/channels.cr b/src/invidious/routes/channels.cr index 23eeeeb8d..25348e7d8 100644 --- a/src/invidious/routes/channels.cr +++ b/src/invidious/routes/channels.cr @@ -338,7 +338,7 @@ module Invidious::Routes::Channels def self.potential_brand_redirect(env) # Check for known tab in url before trying to brand_redirect (avoids unneeded request to YouTube) - selected_tab = env.params.url["tab"]? + selected_tab = env.params.url["tab"]?.try &.downcase if KNOWN_TABS.includes? selected_tab brand_redirect(env) @@ -369,7 +369,7 @@ module Invidious::Routes::Channels return error_template(404, I18n.translate(locale, "This channel does not exist.")) end - selected_tab = env.params.url["tab"]? + selected_tab = env.params.url["tab"]?.try &.downcase if KNOWN_TABS.includes? selected_tab url = "/channel/#{ucid}/#{selected_tab}"