Add tabbed settings and system shell

This commit is contained in:
2026-07-31 21:30:51 +02:00
parent d663979ebb
commit c36e5e811f
20 changed files with 698 additions and 29 deletions
+16 -4
View File
@@ -18,6 +18,7 @@ The current MVP slice includes:
- atomic, dashboard-triggered Git updates with automatic verification and rollback safety;
- optional dual-radio Wi-Fi failover with an always-recoverable offline car hotspot;
- authenticated live network diagnostics for hotspot clients, DNS query metadata, and active destination flows;
- tabbed Network, System, and restricted Shell settings for on-device administration;
- automated API security tests and reproducible quality commands.
The ADB transport, job UI, artifacts, Android companion, and remaining operations work are tracked in [PLAN.md](./PLAN.md).
@@ -42,7 +43,7 @@ cd pi-car-companion
The script asks for sudo access and then:
- installs Node.js 22, Git, Avahi, SQLite, and native build requirements;
- installs Node.js 22, Git, Avahi, SQLite, the complete hotspot/Realtek networking stack, and native build requirements;
- creates a dedicated `pi-companion` service account;
- builds and verifies the server and dashboard;
- installs an atomic release under `/opt/pi-car-companion`;
@@ -62,7 +63,7 @@ git pull --ff-only
## Dashboard updates
Open **Settings** and select **Update now**. The Pi will:
Open **Settings → System**, select **Check for updates**, then choose **Install update**. The Pi will:
1. fetch the configured branch from `origin`;
2. refuse non-fast-forward history changes;
@@ -178,7 +179,7 @@ Then create the recovery hotspot and enable its controller:
sudo pi-car-companion-network-setup
```
The helper requires `wlan1` to be connected before it enables switching, asks interactively for a unique hotspot password, and never places that password in the application configuration. Alternatively, an authenticated administrator can configure or rotate the hotspot SSID and password directly in **Settings → Car network**. The dashboard uses a narrowly scoped root service; the one-time password request is deleted before processing and NetworkManager stores only the derived WPA key.
The helper requires `wlan1` to be connected before it enables switching, asks interactively for a unique hotspot password, and never places that password in the application configuration. Alternatively, an authenticated administrator can configure or rotate the hotspot SSID and password directly in **Settings → Network**. The dashboard uses a narrowly scoped root service; the one-time password request is deleted before processing and NetworkManager stores only the derived WPA key.
Settings also shows the current mode and offers **Try upstream again** and **Restore hotspot** controls. Applying new hotspot credentials can disconnect the dashboard, after which devices must reconnect using the new values.
@@ -233,6 +234,17 @@ If the device is disconnected, offline, unauthorized, partially readable, or ADB
missing, the dashboard reports that state without substituting generated data. Do not
add shell strings or state-changing commands to this collector.
### System controls and shell
**Settings → System** provides confirmed reboot and power-off actions through a fixed,
sudo-allowlisted helper. It also separates remote update checks from installation.
**Settings → Shell** opens an authenticated WebSocket and a real local pseudo-terminal.
The shell runs as the restricted `pi-companion` service account inside the companion
service sandbox; it is not a root shell and does not request or store SSH credentials.
The WebSocket requires the active session, a trusted browser origin, and the session's
CSRF token. A terminal closes when its tab is left and expires after 30 minutes.
## Safety boundary
This project does not modify the MG4 firmware, launcher, vehicle controls, CAN bus, or safety systems. It does not expose arbitrary shell commands, SSH, ADB, the Docker socket, or unrestricted filesystem access through the dashboard.
This project does not modify the MG4 firmware, launcher, vehicle controls, CAN bus, or safety systems. The authenticated dashboard includes a restricted `pi-companion` shell for local diagnostics, but it does not expose a root shell, SSH credentials, the Docker socket, unrestricted filesystem access, or arbitrary ADB commands.