mirror of
https://github.com/iv-org/invidious.git
synced 2026-09-06 00:52:45 -05:00
Merge a4fd9aaafbfd538f43f4600ce8a6310103bb7925 into 049d591d294e2a43cb32b97a0bb018c2093e5beb
This commit is contained in:
commit
84cf771d2c
@ -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"]?.try &.downcase
|
||||
|
||||
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
|
||||
@ -357,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}"
|
||||
|
||||
@ -40,6 +40,8 @@ module Invidious::Routing
|
||||
if CONFIG.enable_user_notifications
|
||||
get "/modify_notifications", Routes::Notifications, :modify
|
||||
end
|
||||
|
||||
get "/:user/:tab", Routes::Channels, :potential_brand_redirect
|
||||
{% end %}
|
||||
|
||||
self.register_image_routes
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user