5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-17 03:36:22 +00:00
panel/config/routes.rb
2020-09-29 18:22:28 -03:00

71 lines
2.3 KiB
Ruby

# frozen_string_literal: true
Rails.application.routes.draw do
devise_for :usuaries
mount Blazer::Engine, at: 'blazer'
root 'application#index'
get 'markdown', to: 'application#markdown'
constraints subdomain: 'api' do
scope module: 'api' do
namespace :v1 do
resources :csp_reports, only: %i[create]
get :'sites/hidden_services', to: 'sites#hidden_services'
post :'sites/add_onion', to: 'sites#add_onion'
resources :sites, only: %i[index], constraints: { site_id: /[a-z0-9\-\.]+/, id: /[a-z0-9\-\.]+/ } do
get :'invitades/cookie', to: 'invitades#cookie'
post :'posts/:layout', to: 'posts#create', as: :posts
get :'contact/cookie', to: 'invitades#contact_cookie'
post :'contact/:form', to: 'contact#receive', as: :contact
end
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{[^/]+} }
resources :sites, constraints: { site_id: %r{[^/]+}, id: %r{[^/]+} } do
# Gestionar actualizaciones del sitio
get 'pull', to: 'sites#fetch'
post 'pull', to: 'sites#merge'
# Gestionar usuaries
get 'usuaries/invite', to: 'usuaries#invite'
post 'usuaries/invite', to: 'usuaries#send_invitations'
patch 'usuaries/accept_invitation', to: 'usuaries#accept_invitation'
patch 'usuaries/reject_invitation', to: 'usuaries#reject_invitation'
resources :usuaries do
patch 'demote', to: 'usuaries#demote'
patch 'promote', to: 'usuaries#promote'
end
get 'collaborate', to: 'collaborations#collaborate'
post 'collaborate', to: 'collaborations#accept_collaboration'
# Gestionar artículos según idioma
nested do
scope '(:locale)' do
post :'posts/reorder', to: 'posts#reorder'
resources :posts
end
end
# Gestionar traducciones
get 'i18n', to: 'i18n#index'
get 'i18n/edit', to: 'i18n#edit'
post 'i18n', to: 'i18n#update'
# Compilar el sitio
post 'enqueue', to: 'sites#enqueue'
post 'reorder_posts', to: 'sites#reorder_posts'
resources :stats, only: [:index]
end
end