mirror of
https://gitea.invidious.io/iv-org/invidious.git
synced 2024-08-15 00:53:41 +00:00
routing: move the remaining routes registration to a wrapper function
This commit is contained in:
parent
223e74569a
commit
1e25894f7e
2 changed files with 32 additions and 34 deletions
|
@ -329,40 +329,7 @@ before_all do |env|
|
|||
env.set "current_page", URI.encode_www_form(current_page)
|
||||
end
|
||||
|
||||
{% unless flag?(:api_only) %}
|
||||
Invidious::Routing.get "/", Invidious::Routes::Misc, :home
|
||||
Invidious::Routing.get "/privacy", Invidious::Routes::Misc, :privacy
|
||||
Invidious::Routing.get "/licenses", Invidious::Routes::Misc, :licenses
|
||||
Invidious::Routing.get "/redirect", Invidious::Routes::Misc, :cross_instance_redirect
|
||||
|
||||
Invidious::Routing.register_channel_routes
|
||||
Invidious::Routing.register_watch_routes
|
||||
|
||||
Invidious::Routing.register_iv_playlist_routes
|
||||
Invidious::Routing.register_yt_playlist_routes
|
||||
|
||||
Invidious::Routing.register_search_routes
|
||||
|
||||
# User routes
|
||||
Invidious::Routing.register_user_routes
|
||||
|
||||
Invidious::Routing.register_feed_routes
|
||||
|
||||
# Support push notifications via PubSubHubbub
|
||||
Invidious::Routing.get "/feed/webhook/:token", Invidious::Routes::Feeds, :push_notifications_get
|
||||
Invidious::Routing.post "/feed/webhook/:token", Invidious::Routes::Feeds, :push_notifications_post
|
||||
|
||||
Invidious::Routing.get "/modify_notifications", Invidious::Routes::Notifications, :modify
|
||||
{% end %}
|
||||
|
||||
Invidious::Routing.register_image_routes
|
||||
|
||||
# API routes (macro)
|
||||
Invidious::Routing.register_api_v1_routes
|
||||
|
||||
# Video playback (macros)
|
||||
Invidious::Routing.register_api_manifest_routes
|
||||
Invidious::Routing.register_video_playback_routes
|
||||
Invidious::Routing.register_all
|
||||
|
||||
error 404 do |env|
|
||||
if md = env.request.path.match(/^\/(?<id>([a-zA-Z0-9_-]{11})|(\w+))$/)
|
||||
|
|
|
@ -11,6 +11,37 @@ module Invidious::Routing
|
|||
|
||||
{% end %}
|
||||
|
||||
def register_all
|
||||
{% unless flag?(:api_only) %}
|
||||
get "/", Routes::Misc, :home
|
||||
get "/privacy", Routes::Misc, :privacy
|
||||
get "/licenses", Routes::Misc, :licenses
|
||||
get "/redirect", Routes::Misc, :cross_instance_redirect
|
||||
|
||||
self.register_channel_routes
|
||||
self.register_watch_routes
|
||||
|
||||
self.register_iv_playlist_routes
|
||||
self.register_yt_playlist_routes
|
||||
|
||||
self.register_search_routes
|
||||
|
||||
self.register_user_routes
|
||||
self.register_feed_routes
|
||||
|
||||
# Support push notifications via PubSubHubbub
|
||||
get "/feed/webhook/:token", Routes::Feeds, :push_notifications_get
|
||||
post "/feed/webhook/:token", Routes::Feeds, :push_notifications_post
|
||||
|
||||
get "/modify_notifications", Routes::Notifications, :modify
|
||||
{% end %}
|
||||
|
||||
self.register_image_routes
|
||||
self.register_api_v1_routes
|
||||
self.register_api_manifest_routes
|
||||
self.register_video_playback_routes
|
||||
end
|
||||
|
||||
# -------------------
|
||||
# Invidious routes
|
||||
# -------------------
|
||||
|
|
Loading…
Reference in a new issue