From e2532de766bec9a2e967d551776823b83f44e995 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Wed, 10 Aug 2022 00:20:04 +0200 Subject: [PATCH] routing: move image proxy routes registration to Invidious::Routing --- src/invidious.cr | 7 +------ src/invidious/routing.cr | 9 +++++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index 969804a6..9daf5380 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -393,12 +393,7 @@ end Invidious::Routing.get "/modify_notifications", Invidious::Routes::Notifications, :modify {% end %} -Invidious::Routing.get "/ggpht/*", Invidious::Routes::Images, :ggpht -Invidious::Routing.options "/sb/:authority/:id/:storyboard/:index", Invidious::Routes::Images, :options_storyboard -Invidious::Routing.get "/sb/:authority/:id/:storyboard/:index", Invidious::Routes::Images, :get_storyboard -Invidious::Routing.get "/s_p/:id/:name", Invidious::Routes::Images, :s_p_image -Invidious::Routing.get "/yts/img/:name", Invidious::Routes::Images, :yts_image -Invidious::Routing.get "/vi/:id/:name", Invidious::Routes::Images, :thumbnails +Invidious::Routing.register_image_routes # API routes (macro) Invidious::Routing.register_api_v1_routes diff --git a/src/invidious/routing.cr b/src/invidious/routing.cr index 203aa024..45ae7c6b 100644 --- a/src/invidious/routing.cr +++ b/src/invidious/routing.cr @@ -94,6 +94,15 @@ module Invidious::Routing get "/latest_version", Routes::VideoPlayback, :latest_version end + def register_image_routes + get "/ggpht/*", Routes::Images, :ggpht + options "/sb/:authority/:id/:storyboard/:index", Routes::Images, :options_storyboard + get "/sb/:authority/:id/:storyboard/:index", Routes::Images, :get_storyboard + get "/s_p/:id/:name", Routes::Images, :s_p_image + get "/yts/img/:name", Routes::Images, :yts_image + get "/vi/:id/:name", Routes::Images, :thumbnails + end + # ------------------- # API routes # -------------------