5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 13:56:22 +00:00
panel/config/routes.rb

132 lines
4.3 KiB
Ruby
Raw Normal View History

2019-03-26 15:32:20 +00:00
# frozen_string_literal: true
2018-01-02 17:19:25 +00:00
Rails.application.routes.draw do
2019-07-03 23:25:23 +00:00
devise_for :usuaries
get '/.well-known/change-password', to: redirect('/usuaries/edit')
require 'que/web'
mount Que::Web => '/que'
2019-07-03 23:25:23 +00:00
root 'application#index'
2018-02-26 22:08:21 +00:00
constraints(Constraints::ApiSubdomain.new) do
2019-09-05 18:56:24 +00:00
scope module: 'api' do
namespace :v1 do
2020-02-06 16:11:17 +00:00
resources :csp_reports, only: %i[create]
2020-07-18 19:26:54 +00:00
2024-03-01 18:04:07 +00:00
namespace :activity_pub do
resources :remote_flags, only: %i[show]
end
2020-12-07 16:22:29 +00:00
resources :sites, only: %i[index], constraints: { site_id: /[a-z0-9\-.]+/, id: /[a-z0-9\-.]+/ } do
2020-06-16 22:10:54 +00:00
get :'invitades/cookie', to: 'invitades#cookie'
2020-09-29 21:22:28 +00:00
post :'posts/:layout', to: 'posts#create', as: :posts
2020-06-16 22:10:54 +00:00
get :'contact/cookie', to: 'invitades#contact_cookie'
2020-09-29 21:22:28 +00:00
post :'contact/:form', to: 'contact#receive', as: :contact
2024-02-16 18:59:37 +00:00
namespace :webhooks do
2024-02-20 20:13:42 +00:00
post :pull, to: 'pull#pull'
2024-02-20 20:13:42 +00:00
scope :social_inbox do
post :moderationqueued, to: 'social_inbox#moderationqueued'
post :onapproved, to: 'social_inbox#onapproved'
post :onrejected, to: 'social_inbox#onrejected'
end
2024-02-16 18:59:37 +00:00
end
2020-02-11 15:06:36 +00:00
end
2019-09-05 18:56:24 +00:00
end
end
end
# Las rutas privadas empiezan con una ruta única para poder hacer un
# alias en nginx sin tener que usar expresiones regulares para
# detectar el nombre del sitio.
get '/sites/private/:site_id(*file)', to: 'private#show', constraints: { site_id: %r{[^/]+} }
2021-02-02 21:52:54 +00:00
get '/env.js', to: 'env#index'
2019-07-03 23:25:23 +00:00
match '/api/v3/projects/:site_id/notices' => 'api/v1/notices#create', via: %i[post]
resources :sites, constraints: { site_id: %r{[^/]+}, id: %r{[^/]+} } do
# Gestionar actualizaciones del sitio
get 'pull', to: 'sites#fetch'
post 'pull', to: 'sites#merge'
get 'status', to: 'sites#status'
get 'button', to: 'sites#button'
2019-07-04 16:23:43 +00:00
# Gestionar usuaries
2019-07-05 23:55:59 +00:00
get 'usuaries/invite', to: 'usuaries#invite'
post 'usuaries/invite', to: 'usuaries#send_invitations'
2019-07-08 17:55:19 +00:00
patch 'usuaries/accept_invitation', to: 'usuaries#accept_invitation'
patch 'usuaries/reject_invitation', to: 'usuaries#reject_invitation'
2019-07-04 16:23:43 +00:00
resources :usuaries do
patch 'demote', to: 'usuaries#demote'
patch 'promote', to: 'usuaries#promote'
2018-09-28 14:34:37 +00:00
end
2018-02-09 21:28:27 +00:00
2019-07-08 20:58:14 +00:00
get 'collaborate', to: 'collaborations#collaborate'
post 'collaborate', to: 'collaborations#accept_collaboration'
get 'moderation_queue', to: 'moderation_queue#index'
resources :instance_moderations, only: [] do
patch :pause, to: 'instance_moderations#pause'
patch :allow, to: 'instance_moderations#allow'
patch :block, to: 'instance_moderations#block'
end
patch :instance_moderations_action_on_several, to: 'instance_moderations#action_on_several'
patch :fediblock_states_action_on_several, to: 'fediblock_states#action_on_several'
resources :actor_moderations, only: %i[show] do
ActorModeration.events.each do |actor_event|
patch actor_event, to: "actor_moderations##{actor_event}"
end
end
patch :actor_moderations_action_on_several, to: 'actor_moderations#action_on_several'
2024-03-04 16:49:07 +00:00
resources :activity_pub, only: [] do
ActivityPub.events.each do |event|
patch event, to: "activity_pubs##{event}"
end
end
patch :activity_pubs_action_on_several, to: 'activity_pubs#action_on_several'
2020-05-23 15:38:03 +00:00
# Gestionar artículos según idioma
nested do
2022-03-02 16:56:19 +00:00
scope '/(:locale)', constraint: /[a-z]{2}(-[A-Z]{2})?/ do
2020-05-23 15:38:03 +00:00
post :'posts/reorder', to: 'posts#reorder'
2024-05-17 18:24:08 +00:00
get :'posts/new_array', to: 'posts#new_array'
get :'posts/new_array_value', to: 'posts#new_array_value'
2024-05-17 20:58:44 +00:00
get :'posts/new_related_post', to: 'posts#new_related_post'
get :'posts/form', to: 'posts#form'
2024-05-17 18:24:08 +00:00
resources :posts do
2021-09-16 00:02:09 +00:00
get 'p/:page', action: :index, on: :collection
get :preview, to: 'posts#preview'
end
2020-05-23 15:38:03 +00:00
end
end
2019-07-04 16:23:43 +00:00
# Gestionar traducciones
2018-02-09 21:28:27 +00:00
get 'i18n', to: 'i18n#index'
get 'i18n/edit', to: 'i18n#edit'
post 'i18n', to: 'i18n#update'
2018-02-20 17:47:11 +00:00
2019-07-04 16:23:43 +00:00
# Compilar el sitio
2018-02-20 17:47:11 +00:00
post 'enqueue', to: 'sites#enqueue'
2018-04-27 20:24:28 +00:00
post 'reorder_posts', to: 'sites#reorder_posts'
2019-08-02 00:20:42 +00:00
resources :stats, only: [:index]
2021-10-08 19:31:02 +00:00
get :'stats/host', to: 'stats#host'
get :'stats/uris', to: 'stats#uris'
get :'stats/resources', to: 'stats#resources'
2023-04-15 21:36:56 +00:00
resources :build_stats, only: %i[index]
2018-01-29 18:09:30 +00:00
end
2018-01-02 17:19:25 +00:00
end