From 58c4700bdeaaea9c659b901de413667f46f69dbe 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 | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/invidious.cr b/src/invidious.cr index a4cda7fd..26b5220d 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -316,8 +316,9 @@ Invidious::Routing.get "/channel/:ucid/playlists", Invidious::Routes::Channels, 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 -["", "/home", "/videos", "/playlists", "/community", "/channels", "/about"].each do |path| +["", "/home", "/videos", "/playlists", "/community", "/channels", "/about", "/search"].each do |path| Invidious::Routing.get "/c/:user#{path}", Invidious::Routes::Channels, :brand_redirect end diff --git a/src/invidious/routes/channels.cr b/src/invidious/routes/channels.cr index ae641b3a..c5167181 100644 --- a/src/invidious/routes/channels.cr +++ b/src/invidious/routes/channels.cr @@ -194,6 +194,10 @@ class Invidious::Routes::Channels < Invidious::Routes::BaseRoute env.redirect url end + 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]?