feat: odometer baseline syncs to server — push on save, pull on sync, +/api/device-config/push endpoint

This commit is contained in:
Mathieu Moran
2026-08-11 19:31:52 -04:00
parent 878ba4a958
commit 32de77131c
6 changed files with 63 additions and 23 deletions
+16
View File
@@ -781,6 +781,22 @@ def api_device_config_get():
return jsonify(config)
@app.post("/api/device-config/push")
@require_device_auth
def api_device_config_push():
"""Update device configuration from the Pi (device-authenticated).
Pi pushes local config changes to server. Accepts a partial update:
any of owner_name, car_model, device_name, avatar_path, odometer_baseline.
"""
body = request.get_json(silent=True) or {}
success, errors = device_config.update_device_config(g.device_id, body)
if not success:
return jsonify(error="Invalid device config.", fields=errors), 400
config = device_config.get_device_config(g.device_id)
return jsonify(config)
@app.post("/api/v1/device-config/ack")
@require_device_auth
def api_device_config_ack():