feat: add server-side device deletion

- add portal API and UI action to delete non-default devices
- protect the configured portal default device from deletion
- document that trip/history pages still scope to the single DEVICE_NAME

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Mathieu Moran
2026-08-10 18:09:15 -04:00
co-authored by Copilot
parent 690cf0a5d4
commit 675bffb4a4
6 changed files with 78 additions and 0 deletions
+13
View File
@@ -699,6 +699,19 @@ def portal_device_request_sync(device_id):
return jsonify(result)
@app.delete("/api/v1/portal/devices/<int:device_id>")
@require_login
def portal_device_delete(device_id):
success, errors = device_registry.delete_device(
device_id,
protected_device_name=os.environ.get("DEVICE_NAME", "yaris-2013"),
)
if not success:
status = 404 if errors.get("error") == "Device not found." else 409
return jsonify(error=errors.get("error", "Could not delete device.")), status
return jsonify(status="deleted")
@app.get("/api/v1/portal/device-config")
@require_login
def portal_device_config_get():