mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 10:51:42 +00:00
Configurar Blazer para mostrar estadísticas
This commit is contained in:
parent
5c36de818f
commit
3a2ce1d47d
4 changed files with 13 additions and 7 deletions
|
@ -62,6 +62,15 @@ class ApplicationController < ActionController::Base
|
|||
render 'application/page_not_found', status: :not_found
|
||||
end
|
||||
|
||||
# Necesario para poder acceder a Blazer. Solo les usuaries de este
|
||||
# sitio pueden acceder al panel.
|
||||
def require_usuarie
|
||||
unless find_site.usuarie? current_usuarie
|
||||
redirect_to root_path
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def configure_permitted_parameters
|
||||
|
|
|
@ -50,7 +50,7 @@ user_method: current_usuarie
|
|||
user_name: email
|
||||
|
||||
# custom before_action to use for auth
|
||||
# before_action_method: require_admin
|
||||
before_action_method: require_usuarie
|
||||
|
||||
# email to send checks from
|
||||
from_email: blazer@<%= ENV.fetch('SUTTY', 'sutty.nl') %>
|
||||
|
|
|
@ -4,8 +4,6 @@ Rails.application.routes.draw do
|
|||
devise_for :usuaries
|
||||
get '/.well-known/change-password', to: redirect('/usuaries/edit')
|
||||
|
||||
mount Blazer::Engine, at: 'blazer'
|
||||
|
||||
root 'application#index'
|
||||
|
||||
constraints(Constraints::ApiSubdomain.new) do
|
||||
|
@ -38,6 +36,9 @@ Rails.application.routes.draw do
|
|||
match '/api/v3/projects/:site_id/notices' => 'api/v1/notices#create', via: %i[post]
|
||||
|
||||
resources :sites, constraints: { site_id: %r{[^/]+}, id: %r{[^/]+} } do
|
||||
# Usar Blazer para mostrar estadísticas
|
||||
mount Blazer::Engine, at: 'stats', as: 'stats'
|
||||
|
||||
# Gestionar actualizaciones del sitio
|
||||
get 'pull', to: 'sites#fetch'
|
||||
post 'pull', to: 'sites#merge'
|
||||
|
@ -73,7 +74,5 @@ Rails.application.routes.draw do
|
|||
# Compilar el sitio
|
||||
post 'enqueue', to: 'sites#enqueue'
|
||||
post 'reorder_posts', to: 'sites#reorder_posts'
|
||||
|
||||
resources :stats, only: [:index]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
# Blazer
|
||||
class InstallBlazer < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
return unless Rails.env.production?
|
||||
|
||||
create_table :blazer_queries do |t|
|
||||
t.references :creator
|
||||
t.string :name
|
||||
|
|
Loading…
Reference in a new issue