Tidy up homepage and navigation
This commit is contained in:
@@ -7,11 +7,11 @@ module Api
|
||||
# These endpoints are kept for administrative/debugging purposes only
|
||||
|
||||
skip_before_action :verify_authenticity_token
|
||||
allow_unauthenticated_access # Skip normal session auth, use project key auth instead
|
||||
before_action :authenticate_project!
|
||||
before_action :check_project_enabled
|
||||
allow_unauthenticated_access # Skip normal session auth, use DSN auth instead
|
||||
before_action :authenticate_dsn!
|
||||
before_action :check_dsn_enabled
|
||||
|
||||
# GET /api/:public_key/rules/version
|
||||
# GET /api/rules/version
|
||||
# Quick version check - returns latest updated_at timestamp
|
||||
def version
|
||||
current_sampling = HubLoad.current_sampling
|
||||
@@ -24,9 +24,9 @@ module Api
|
||||
}
|
||||
end
|
||||
|
||||
# GET /api/:public_key/rules?since=1730646186
|
||||
# GET /api/rules?since=1730646186
|
||||
# Incremental sync - returns rules updated since timestamp (Unix timestamp in seconds)
|
||||
# GET /api/:public_key/rules
|
||||
# GET /api/rules
|
||||
# Full sync - returns all active rules
|
||||
def index
|
||||
rules = if params[:since].present?
|
||||
@@ -52,20 +52,20 @@ module Api
|
||||
|
||||
private
|
||||
|
||||
def authenticate_project!
|
||||
public_key = params[:public_key] || params[:project_id]
|
||||
def authenticate_dsn!
|
||||
@dsn = DsnAuthenticationService.authenticate(request)
|
||||
|
||||
@project = Project.find_by(public_key: public_key)
|
||||
|
||||
unless @project
|
||||
render json: { error: "Invalid project key" }, status: :unauthorized
|
||||
unless @dsn
|
||||
render json: { error: "Invalid DSN key" }, status: :unauthorized
|
||||
return
|
||||
end
|
||||
rescue DsnAuthenticationService::AuthenticationError => e
|
||||
render json: { error: e.message }, status: :unauthorized
|
||||
end
|
||||
|
||||
def check_project_enabled
|
||||
unless @project.enabled?
|
||||
render json: { error: "Project is disabled" }, status: :forbidden
|
||||
def check_dsn_enabled
|
||||
unless @dsn.enabled?
|
||||
render json: { error: "DSN is disabled" }, status: :forbidden
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user