Cattura periodica client-side (con consenso), storage ActiveStorage e overlay allineato all’immagine. Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
656 B
Ruby
22 lines
656 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Analytics
|
|
class SnapshotsController < ActionController::API
|
|
def create
|
|
result = Analytics::SnapshotIngest.new(
|
|
path: params[:path] || params[:page_path],
|
|
device: params[:device],
|
|
width: params[:width],
|
|
height: params[:height],
|
|
image: params[:image],
|
|
remote_ip: request.remote_ip
|
|
).call
|
|
|
|
return head :too_many_requests if result.rate_limited
|
|
return render json: { ok: false, error: result.error }, status: :unprocessable_content unless result.ok
|
|
|
|
render json: { ok: true, skipped: result.skipped }, status: :accepted
|
|
end
|
|
end
|
|
end
|