mirror of
https://github.com/iv-org/invidious.git
synced 2026-08-17 05:20:51 -05:00
feat: add support for additional channel urls (:user/:tab)
This commit is contained in:
parent
8fde720f94
commit
ba88959f5e
@ -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"]?
|
||||||
|
|
||||||
|
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
|
||||||
|
|||||||
@ -40,6 +40,8 @@ module Invidious::Routing
|
|||||||
if CONFIG.enable_user_notifications
|
if CONFIG.enable_user_notifications
|
||||||
get "/modify_notifications", Routes::Notifications, :modify
|
get "/modify_notifications", Routes::Notifications, :modify
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get "/:user/:tab", Routes::Channels, :potential_brand_redirect
|
||||||
{% end %}
|
{% end %}
|
||||||
|
|
||||||
self.register_image_routes
|
self.register_image_routes
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user