mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Move user routes definitions to a macro in routing.cr
This commit is contained in:
parent
7ace3fc989
commit
fb36155022
2 changed files with 28 additions and 23 deletions
|
@ -364,29 +364,8 @@ end
|
||||||
Invidious::Routing.get "/results", Invidious::Routes::Search, :results
|
Invidious::Routing.get "/results", Invidious::Routes::Search, :results
|
||||||
Invidious::Routing.get "/search", Invidious::Routes::Search, :search
|
Invidious::Routing.get "/search", Invidious::Routes::Search, :search
|
||||||
|
|
||||||
# User login/out
|
# User routes
|
||||||
Invidious::Routing.get "/login", Invidious::Routes::Login, :login_page
|
define_user_routes()
|
||||||
Invidious::Routing.post "/login", Invidious::Routes::Login, :login
|
|
||||||
Invidious::Routing.post "/signout", Invidious::Routes::Login, :signout
|
|
||||||
|
|
||||||
# User preferences
|
|
||||||
Invidious::Routing.get "/preferences", Invidious::Routes::PreferencesRoute, :show
|
|
||||||
Invidious::Routing.post "/preferences", Invidious::Routes::PreferencesRoute, :update
|
|
||||||
Invidious::Routing.get "/toggle_theme", Invidious::Routes::PreferencesRoute, :toggle_theme
|
|
||||||
Invidious::Routing.get "/data_control", Invidious::Routes::PreferencesRoute, :data_control
|
|
||||||
Invidious::Routing.post "/data_control", Invidious::Routes::PreferencesRoute, :update_data_control
|
|
||||||
|
|
||||||
# User account management
|
|
||||||
Invidious::Routing.get "/change_password", Invidious::Routes::Account, :get_change_password
|
|
||||||
Invidious::Routing.post "/change_password", Invidious::Routes::Account, :post_change_password
|
|
||||||
Invidious::Routing.get "/delete_account", Invidious::Routes::Account, :get_delete
|
|
||||||
Invidious::Routing.post "/delete_account", Invidious::Routes::Account, :post_delete
|
|
||||||
Invidious::Routing.get "/clear_watch_history", Invidious::Routes::Account, :get_clear_history
|
|
||||||
Invidious::Routing.post "/clear_watch_history", Invidious::Routes::Account, :post_clear_history
|
|
||||||
Invidious::Routing.get "/authorize_token", Invidious::Routes::Account, :get_authorize_token
|
|
||||||
Invidious::Routing.post "/authorize_token", Invidious::Routes::Account, :post_authorize_token
|
|
||||||
Invidious::Routing.get "/token_manager", Invidious::Routes::Account, :token_manager
|
|
||||||
Invidious::Routing.post "/token_ajax", Invidious::Routes::Account, :token_ajax
|
|
||||||
|
|
||||||
# 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
|
||||||
|
|
|
@ -10,6 +10,32 @@ module Invidious::Routing
|
||||||
{% end %}
|
{% end %}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
macro define_user_routes
|
||||||
|
# User login/out
|
||||||
|
Invidious::Routing.get "/login", Invidious::Routes::Login, :login_page
|
||||||
|
Invidious::Routing.post "/login", Invidious::Routes::Login, :login
|
||||||
|
Invidious::Routing.post "/signout", Invidious::Routes::Login, :signout
|
||||||
|
|
||||||
|
# User preferences
|
||||||
|
Invidious::Routing.get "/preferences", Invidious::Routes::PreferencesRoute, :show
|
||||||
|
Invidious::Routing.post "/preferences", Invidious::Routes::PreferencesRoute, :update
|
||||||
|
Invidious::Routing.get "/toggle_theme", Invidious::Routes::PreferencesRoute, :toggle_theme
|
||||||
|
Invidious::Routing.get "/data_control", Invidious::Routes::PreferencesRoute, :data_control
|
||||||
|
Invidious::Routing.post "/data_control", Invidious::Routes::PreferencesRoute, :update_data_control
|
||||||
|
|
||||||
|
# User account management
|
||||||
|
Invidious::Routing.get "/change_password", Invidious::Routes::Account, :get_change_password
|
||||||
|
Invidious::Routing.post "/change_password", Invidious::Routes::Account, :post_change_password
|
||||||
|
Invidious::Routing.get "/delete_account", Invidious::Routes::Account, :get_delete
|
||||||
|
Invidious::Routing.post "/delete_account", Invidious::Routes::Account, :post_delete
|
||||||
|
Invidious::Routing.get "/clear_watch_history", Invidious::Routes::Account, :get_clear_history
|
||||||
|
Invidious::Routing.post "/clear_watch_history", Invidious::Routes::Account, :post_clear_history
|
||||||
|
Invidious::Routing.get "/authorize_token", Invidious::Routes::Account, :get_authorize_token
|
||||||
|
Invidious::Routing.post "/authorize_token", Invidious::Routes::Account, :post_authorize_token
|
||||||
|
Invidious::Routing.get "/token_manager", Invidious::Routes::Account, :token_manager
|
||||||
|
Invidious::Routing.post "/token_ajax", Invidious::Routes::Account, :token_ajax
|
||||||
|
end
|
||||||
|
|
||||||
macro define_v1_api_routes
|
macro define_v1_api_routes
|
||||||
{{namespace = Invidious::Routes::API::V1}}
|
{{namespace = Invidious::Routes::API::V1}}
|
||||||
# Videos
|
# Videos
|
||||||
|
|
Loading…
Reference in a new issue