Tidy up homepage and navigation

This commit is contained in:
Dan Milne
2025-11-09 20:58:13 +11:00
parent c9e2992fe0
commit 1f4428348d
56 changed files with 2822 additions and 955 deletions

View File

@@ -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