Add Pi-side upload client for Phase 9 remote server

- app_sql.py: add UPLOADED column + migration on tracking table, add
  settings and dashcam_uploads tables, add helpers for unsent-row
  queries, marking rows uploaded, and dashcam upload dedupe tracking.
- app_upload.py: new background upload client. Periodically batches
  unsent tracking rows to POST /api/v1/tracking/batch and uploads new
  dashcam files (sha256-verified) to POST /api/v1/dashcam/upload, with
  exponential backoff on failure. Exposes get_status() and a
  dashcam-upload enable/disable toggle backed by the settings table.
- app.py: start the upload client thread at startup, add
  GET /api/upload/status and POST /api/upload/dashcam_toggle routes.
- dash.html/dash.js: add a "Remote server upload" card with upload
  status and a toggle switch to pause dashcam video uploads while
  trip/GPS log uploads keep running (per user request - useful on a
  slow/metered connection).
- db/upload_creds.env: new gitignore-exempted template (mirrors
  db/creds.env) for YARIS_SERVER_URL/YARIS_DEVICE_NAME/YARIS_API_KEY.
- requirements.txt: add requests.

Tested against the real deployed unraid server: tracking batch upload
+ dedupe, dashcam upload + dedupe, and toggle-off correctly pausing
dashcam uploads while tracking uploads continue. Also verified the
full Flask app imports/runs cleanly and the new API routes + dash.html
toggle render correctly in a headless browser.

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Mathieu Moran
2026-08-08 20:05:42 -04:00
co-authored by Copilot
parent 9bdf5bad2c
commit 42e679782e
8 changed files with 405 additions and 5 deletions
+12
View File
@@ -0,0 +1,12 @@
##
## yaris-obd remote server upload client credentials
##
## Real values are set locally on the Pi only - never commit real credentials
## here. Get YARIS_DEVICE_NAME/YARIS_API_KEY by running
## `docker compose exec api python3 scripts/create_device.py <name>` on the
## server (see server/README.md).
##
YARIS_SERVER_URL = ""
YARIS_DEVICE_NAME = ""
YARIS_API_KEY = ""