feat: bearer token auth, pairing, wifi config, ssh toggle, remove /cmd

This commit is contained in:
Kayos 2026-03-14 11:47:10 -07:00
parent 37aefb84c8
commit eaf49841f0
3 changed files with 126 additions and 3 deletions

View file

@ -1,21 +1,23 @@
"""Landmark detection endpoints."""
from flask import Blueprint, jsonify, request
from .. import db, forwarder
from ..auth import require_auth
bp = Blueprint("landmarks", __name__, url_prefix="/api/1/landmarks")
@bp.route("/last/<int:n>", methods=["GET"])
def get_last(n):
"""Get last N detections."""
"""Get last N detections (unauthenticated)."""
n = min(n, 1000) # Cap at 1000
landmarks = db.get_last_landmarks(n)
return jsonify(landmarks)
@bp.route("", methods=["POST"])
@require_auth
def ingest():
"""Ingest a new detection from camera pipeline."""
"""Ingest a new detection from camera pipeline (authenticated)."""
data = request.get_json()
if not data or "class_label" not in data:
return jsonify({"error": "Missing class_label"}), 400