routing: move image proxy routes registration to Invidious::Routing

This commit is contained in:
Samantaz Fox 2022-08-10 00:20:04 +02:00
parent 3ac4390d11
commit e2532de766
No known key found for this signature in database
GPG Key ID: F42821059186176E
2 changed files with 10 additions and 6 deletions

View File

@ -393,12 +393,7 @@ end
Invidious::Routing.get "/modify_notifications", Invidious::Routes::Notifications, :modify Invidious::Routing.get "/modify_notifications", Invidious::Routes::Notifications, :modify
{% end %} {% end %}
Invidious::Routing.get "/ggpht/*", Invidious::Routes::Images, :ggpht Invidious::Routing.register_image_routes
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
# API routes (macro) # API routes (macro)
Invidious::Routing.register_api_v1_routes Invidious::Routing.register_api_v1_routes

View File

@ -94,6 +94,15 @@ module Invidious::Routing
get "/latest_version", Routes::VideoPlayback, :latest_version get "/latest_version", Routes::VideoPlayback, :latest_version
end 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 # API routes
# ------------------- # -------------------