feat: add remote device settings portal and Pi hot reload
- add /settings/device portal page and portal device-config GET endpoint - add portal navigation and client-side device settings editor UI - hot-reload Account/Car display config after local saves and server syncs - document portal workflow and Phase 25.5b completion - add runtime reload tests for account, car, and sync callback Co-authored-by: Copilot <[email protected]>
This commit is contained in:
+26
-1
@@ -1,6 +1,6 @@
|
||||
"""yaris-obd remote server: receives trip/GPS log batches and dashcam files
|
||||
uploaded by the Pi, storing them in Postgres + on-disk file storage.
|
||||
Also serves a read-only web portal for browsing trip history and dashcam archive.
|
||||
Also serves the remote web portal for browsing and managing the configured car.
|
||||
"""
|
||||
import functools
|
||||
import hashlib
|
||||
@@ -414,6 +414,15 @@ def portal_dashcam():
|
||||
return render_template("dashcam.html")
|
||||
|
||||
|
||||
@app.get("/settings/device")
|
||||
@require_login
|
||||
def portal_device_settings_page():
|
||||
return render_template(
|
||||
"device_settings.html",
|
||||
configured_device_name=os.environ.get("DEVICE_NAME", "yaris-2013"),
|
||||
)
|
||||
|
||||
|
||||
# ── Portal JSON API ────────────────────────────────────────────────────────
|
||||
|
||||
@app.get("/api/v1/portal/stats")
|
||||
@@ -621,6 +630,22 @@ def portal_trip_compat(trip_id):
|
||||
|
||||
# ── Phase 25.5a: Device configuration sync ──────────────────────────────────
|
||||
|
||||
@app.get("/api/v1/portal/device-config")
|
||||
@require_login
|
||||
def portal_device_config_get():
|
||||
"""Get the configured device identity for the remote portal."""
|
||||
device_id = _portal_device_id()
|
||||
if device_id is None:
|
||||
return jsonify(error="device not configured"), 404
|
||||
|
||||
config = device_config.get_device_config(device_id)
|
||||
if not config:
|
||||
return jsonify(error="device not found"), 404
|
||||
|
||||
config["configured_device_name"] = os.environ.get("DEVICE_NAME", "yaris-2013")
|
||||
return jsonify(config)
|
||||
|
||||
|
||||
@app.get("/api/device-config")
|
||||
@require_device_auth
|
||||
def api_device_config_get():
|
||||
|
||||
Reference in New Issue
Block a user