diff --git a/src/invidious/routes/channels.cr b/src/invidious/routes/channels.cr index 5500672f..d744712d 100644 --- a/src/invidious/routes/channels.cr +++ b/src/invidious/routes/channels.cr @@ -1,6 +1,12 @@ {% skip_file if flag?(:api_only) %} module Invidious::Routes::Channels + # Redirection for unsupported routes ("tabs") + def self.redirect_home(env) + ucid = env.params.url["ucid"] + return env.redirect "/channel/#{URI.encode_www_form(ucid)}" + end + def self.home(env) self.videos(env) end diff --git a/src/invidious/routing.cr b/src/invidious/routing.cr index f6b3aaa6..8c38aaed 100644 --- a/src/invidious/routing.cr +++ b/src/invidious/routing.cr @@ -131,7 +131,7 @@ module Invidious::Routing # Channel catch-all, to redirect future routes to the channel's home # NOTE: defined last in order to be processed after the other routes - get "/channel/:ucid/*", Routes::Channels, :home + get "/channel/:ucid/*", Routes::Channels, :redirect_home # /c/LinusTechTips get "/c/:user", Routes::Channels, :brand_redirect