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:
Mathieu Moran
2026-08-10 17:34:22 -04:00
co-authored by Copilot
parent c4ccc3efb9
commit 585da18225
12 changed files with 383 additions and 22 deletions
+26 -5
View File
@@ -1532,11 +1532,32 @@ phase roadmap.
service restarted cleanly, and unraid rebuilt the API stack after manually applying
`migrate_phase25_5a.sql`.
#### Next phase (Phase 25.5b)
- Hot-reload handler to apply config changes without restart
- Server portal UI for editing device config (admin page)
- Device settings page on portal to test config updates
- Mobile-friendly device management UI
### Phase 25.5b: Remote portal device settings + hot-reload — ✅ COMPLETE
**The remote editor and Pi-side hot-reload are now wired.** The server portal can
edit the device identity that the Pi sync thread consumes, and the running Pi UI
updates its display-facing values without a manual restart once sync lands.
#### Implemented (Phase 25.5b so far)
- **Remote portal page**: `/settings/device` renders a login-protected editor for
`owner_name`, `car_model`, `device_name`, and `avatar_path`
- **Portal JSON endpoint**: `GET /api/v1/portal/device-config` returns the current
config for the configured single-device deployment
- **Navigation**: desktop sidebar + mobile bottom nav now expose **Device settings**
- **Portal UX**: live avatar preview, config-version display, dirty-state save
button, and inline sync/explanation text
- **Pi hot-reload**:
- `Account.reload_runtime_config()` and `Car.reload_runtime_config()` refresh
display fields from the live SQLite-backed device config
- local `/api/device-config` saves now reload the in-process `account`/`car`
objects immediately
- server sync now invokes a registered reload callback after writing new config
locally, so next-page renders reflect synced values without restarting Flask
#### Validation
- Added runtime reload tests for `Account`, `Car`, and the sync callback path
- Existing suite still passes (`66 passed`)
- Remote deployment / live portal-path verification still recommended whenever the
server portal is updated
---