mirror of
https://github.com/iv-org/invidious.git
synced 2026-07-28 00:16:47 -05:00
Merge 492eab04e3d95d1694d08b956ad62102f9fb7e67 into 59bb97cdc3011b37cbcd9e85f2f708f009978893
This commit is contained in:
commit
57af78e751
@ -335,6 +335,18 @@ module Invidious::Routes::Channels
|
|||||||
"posts",
|
"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
|
# Redirects brand url channels to a normal /channel/:ucid route
|
||||||
def self.brand_redirect(env)
|
def self.brand_redirect(env)
|
||||||
locale = env.get("preferences").as(Preferences).locale
|
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."))
|
return error_template(404, I18n.translate(locale, "This channel does not exist."))
|
||||||
end
|
end
|
||||||
|
|
||||||
selected_tab = env.params.url["tab"]?
|
selected_tab = env.params.url["tab"]?.try &.downcase
|
||||||
|
|
||||||
if KNOWN_TABS.includes? selected_tab
|
if KNOWN_TABS.includes? selected_tab
|
||||||
url = "/channel/#{ucid}/#{selected_tab}"
|
url = "/channel/#{ucid}/#{selected_tab}"
|
||||||
|
|||||||
@ -47,6 +47,8 @@ module Invidious::Routing
|
|||||||
self.register_api_manifest_routes
|
self.register_api_manifest_routes
|
||||||
self.register_video_playback_routes
|
self.register_video_playback_routes
|
||||||
self.register_companion_routes
|
self.register_companion_routes
|
||||||
|
|
||||||
|
get "/:user/:tab", Routes::Channels, :potential_brand_redirect
|
||||||
end
|
end
|
||||||
|
|
||||||
# -------------------
|
# -------------------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user