From a9ff18812a06822775b68847c3433326b9de3f03 Mon Sep 17 00:00:00 2001 From: syeopite Date: Sat, 26 Jun 2021 19:28:42 -0700 Subject: [PATCH] Add new /channel/:ucid/search endpoint --- src/invidious.cr | 3 ++- src/invidious/routes/channels.cr | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index ef5f155c..fab08352 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -325,8 +325,9 @@ end Invidious::Routing.get "/channel/:ucid/community", Invidious::Routes::Channels, :community Invidious::Routing.get "/channel/:ucid/channels", Invidious::Routes::Channels, :channels 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 Invidious::Routing.get "/c/:user#{path}", Invidious::Routes::Channels, :brand_redirect # /user/linustechtips | Not always the same as /c/ diff --git a/src/invidious/routes/channels.cr b/src/invidious/routes/channels.cr index 4ce7ede0..bdaabbcd 100644 --- a/src/invidious/routes/channels.cr +++ b/src/invidious/routes/channels.cr @@ -240,7 +240,11 @@ module Invidious::Routes::Channels 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]? user = env.get? "user"