feat: odometer baseline syncs to server — push on save, pull on sync, +/api/device-config/push endpoint
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user