Add new /channel/:ucid/search endpoint

(cherry picked from commit a9ff18812a)
This commit is contained in:
syeopite 2021-06-26 19:28:42 -07:00
parent 65f22b42bf
commit 9a06546c5b
No known key found for this signature in database
GPG key ID: 6FA616E5A5294A82
2 changed files with 7 additions and 2 deletions

View file

@ -325,8 +325,9 @@ end
Invidious::Routing.get "/channel/:ucid/playlists", Invidious::Routes::Channels, :playlists Invidious::Routing.get "/channel/:ucid/playlists", Invidious::Routes::Channels, :playlists
Invidious::Routing.get "/channel/:ucid/community", Invidious::Routes::Channels, :community Invidious::Routing.get "/channel/:ucid/community", Invidious::Routes::Channels, :community
Invidious::Routing.get "/channel/:ucid/about", Invidious::Routes::Channels, :about Invidious::Routing.get "/channel/:ucid/about", Invidious::Routes::Channels, :about
Invidious::Routing.get "/channel/:ucid/search", Invidious::Routes::Channels, :search
["", "/videos", "/playlists", "/community", "/about"].each do |path| ["", "/home", "/videos", "/playlists", "/community", "/channels", "/about", "/search"].each do |path|
# /c/LinusTechTips # /c/LinusTechTips
Invidious::Routing.get "/c/:user#{path}", Invidious::Routes::Channels, :brand_redirect Invidious::Routing.get "/c/:user#{path}", Invidious::Routes::Channels, :brand_redirect
# /user/linustechtips | Not always the same as /c/ # /user/linustechtips | Not always the same as /c/

View file

@ -157,7 +157,11 @@ module Invidious::Routes::Channels
end end
end end
private def self.fetch_basic_information(env) private def search(env)
return env.redirect "/search?#{env.params.query}&channel=#{env.params.url["ucid"]}"
end
private def fetch_basic_information(env)
locale = LOCALES[env.get("preferences").as(Preferences).locale]? locale = LOCALES[env.get("preferences").as(Preferences).locale]?
user = env.get? "user" user = env.get? "user"