Routes: Redirect unknown channel tabs to channel home page
This commit is contained in:
parent
2425c47882
commit
ebee973b24
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue