mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-04 08:39:49 +01:00
routing: register user routes with a function, rather than a macro
This commit is contained in:
parent
c23ad25899
commit
e22cc73f32
@ -389,7 +389,7 @@ end
|
|||||||
Invidious::Routing.get "/hashtag/:hashtag", Invidious::Routes::Search, :hashtag
|
Invidious::Routing.get "/hashtag/:hashtag", Invidious::Routes::Search, :hashtag
|
||||||
|
|
||||||
# User routes
|
# User routes
|
||||||
define_user_routes()
|
Invidious::Routing.register_user_routes
|
||||||
|
|
||||||
# Feeds
|
# Feeds
|
||||||
Invidious::Routing.get "/view_all_playlists", Invidious::Routes::Feeds, :view_all_playlists_redirect
|
Invidious::Routing.get "/view_all_playlists", Invidious::Routes::Feeds, :view_all_playlists_redirect
|
||||||
@ -410,9 +410,6 @@ end
|
|||||||
Invidious::Routing.post "/feed/webhook/:token", Invidious::Routes::Feeds, :push_notifications_post
|
Invidious::Routing.post "/feed/webhook/:token", Invidious::Routes::Feeds, :push_notifications_post
|
||||||
|
|
||||||
Invidious::Routing.get "/modify_notifications", Invidious::Routes::Notifications, :modify
|
Invidious::Routing.get "/modify_notifications", Invidious::Routes::Notifications, :modify
|
||||||
|
|
||||||
Invidious::Routing.post "/subscription_ajax", Invidious::Routes::Subscriptions, :toggle_subscription
|
|
||||||
Invidious::Routing.get "/subscription_manager", Invidious::Routes::Subscriptions, :subscription_manager
|
|
||||||
{% end %}
|
{% end %}
|
||||||
|
|
||||||
Invidious::Routing.get "/ggpht/*", Invidious::Routes::Images, :ggpht
|
Invidious::Routing.get "/ggpht/*", Invidious::Routes::Images, :ggpht
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
module Invidious::Routing
|
module Invidious::Routing
|
||||||
|
extend self
|
||||||
|
|
||||||
{% for http_method in {"get", "post", "delete", "options", "patch", "put"} %}
|
{% for http_method in {"get", "post", "delete", "options", "patch", "put"} %}
|
||||||
|
|
||||||
macro {{http_method.id}}(path, controller, method = :handle)
|
macro {{http_method.id}}(path, controller, method = :handle)
|
||||||
@ -8,33 +10,35 @@ module Invidious::Routing
|
|||||||
end
|
end
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
end
|
|
||||||
|
|
||||||
macro define_user_routes
|
def register_user_routes
|
||||||
# User login/out
|
# User login/out
|
||||||
Invidious::Routing.get "/login", Invidious::Routes::Login, :login_page
|
get "/login", Routes::Login, :login_page
|
||||||
Invidious::Routing.post "/login", Invidious::Routes::Login, :login
|
post "/login", Routes::Login, :login
|
||||||
Invidious::Routing.post "/signout", Invidious::Routes::Login, :signout
|
post "/signout", Routes::Login, :signout
|
||||||
Invidious::Routing.get "/Captcha", Invidious::Routes::Login, :captcha
|
get "/Captcha", Routes::Login, :captcha
|
||||||
|
|
||||||
# User preferences
|
# User preferences
|
||||||
Invidious::Routing.get "/preferences", Invidious::Routes::PreferencesRoute, :show
|
get "/preferences", Routes::PreferencesRoute, :show
|
||||||
Invidious::Routing.post "/preferences", Invidious::Routes::PreferencesRoute, :update
|
post "/preferences", Routes::PreferencesRoute, :update
|
||||||
Invidious::Routing.get "/toggle_theme", Invidious::Routes::PreferencesRoute, :toggle_theme
|
get "/toggle_theme", Routes::PreferencesRoute, :toggle_theme
|
||||||
Invidious::Routing.get "/data_control", Invidious::Routes::PreferencesRoute, :data_control
|
get "/data_control", Routes::PreferencesRoute, :data_control
|
||||||
Invidious::Routing.post "/data_control", Invidious::Routes::PreferencesRoute, :update_data_control
|
post "/data_control", Routes::PreferencesRoute, :update_data_control
|
||||||
|
|
||||||
# User account management
|
# User account management
|
||||||
Invidious::Routing.get "/change_password", Invidious::Routes::Account, :get_change_password
|
get "/change_password", Routes::Account, :get_change_password
|
||||||
Invidious::Routing.post "/change_password", Invidious::Routes::Account, :post_change_password
|
post "/change_password", Routes::Account, :post_change_password
|
||||||
Invidious::Routing.get "/delete_account", Invidious::Routes::Account, :get_delete
|
get "/delete_account", Routes::Account, :get_delete
|
||||||
Invidious::Routing.post "/delete_account", Invidious::Routes::Account, :post_delete
|
post "/delete_account", Routes::Account, :post_delete
|
||||||
Invidious::Routing.get "/clear_watch_history", Invidious::Routes::Account, :get_clear_history
|
get "/clear_watch_history", Routes::Account, :get_clear_history
|
||||||
Invidious::Routing.post "/clear_watch_history", Invidious::Routes::Account, :post_clear_history
|
post "/clear_watch_history", Routes::Account, :post_clear_history
|
||||||
Invidious::Routing.get "/authorize_token", Invidious::Routes::Account, :get_authorize_token
|
get "/authorize_token", Routes::Account, :get_authorize_token
|
||||||
Invidious::Routing.post "/authorize_token", Invidious::Routes::Account, :post_authorize_token
|
post "/authorize_token", Routes::Account, :post_authorize_token
|
||||||
Invidious::Routing.get "/token_manager", Invidious::Routes::Account, :token_manager
|
get "/token_manager", Routes::Account, :token_manager
|
||||||
Invidious::Routing.post "/token_ajax", Invidious::Routes::Account, :token_ajax
|
post "/token_ajax", Routes::Account, :token_ajax
|
||||||
|
post "/subscription_ajax", Routes::Subscriptions, :toggle_subscription
|
||||||
|
get "/subscription_manager", Routes::Subscriptions, :subscription_manager
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
macro define_v1_api_routes
|
macro define_v1_api_routes
|
||||||
|
Loading…
Reference in New Issue
Block a user