feat: config files, settings screen, hardware check
- Add config.py with multi-source config (YAML, .env, env vars) - Add .env.example and config.yaml.example - Add settings API endpoints (GET/POST /api/v1/settings) - Add status endpoint (GET /api/v1/status) with hardware subsystem check - Add settings screen to web client (protected by API token) - Add localization strings for settings UI - Add tests for config module and new endpoints - Update README with config documentation
This commit is contained in:
@@ -66,7 +66,10 @@ flowchart TD
|
||||
- **Media Playback Tracking** — Song title, artist, playback percentage, and cover art via Windows GSMTC
|
||||
- **Audio Mixer Control** — Real-time volume and mute from Windows default output or Voicemeeter per-strip gains, mutes, and track states
|
||||
- **Hardware Telemetry** — CPU/GPU core temps, VRAM usage from HWiNFO64
|
||||
- **Hardware Fallbacks** — Startup check reports which subsystems are available/unavailable
|
||||
- **Custom Notifications** — External scripts can push progress bars or rich text alerts via `POST /api/v1/notify`
|
||||
- **Settings Screen** — Change PIN and API token via the web client (protected by API token)
|
||||
- **Configuration Files** — Use `config.yaml`, `.env`, or environment variables
|
||||
- **E-Ink Optimized UI** — High-contrast styling, discrete zone gestures, minimal refresh
|
||||
- **System Tray .exe** — Runs unobtrusively in the Windows notification bar with a quit option
|
||||
|
||||
@@ -84,12 +87,14 @@ e-ink-dash/
|
||||
│ └── paperdash_architecture_document.txt
|
||||
├── server/ # Python FastAPI server
|
||||
│ ├── main.py # Application entry point
|
||||
│ ├── config.py # Configuration management (YAML/.env/env vars)
|
||||
│ ├── audio_mixer.py # Audio mixer abstraction (Windows + Voicemeeter)
|
||||
│ ├── media.py # Media playback tracking (GSMTC)
|
||||
│ ├── notifications.py # Notification system (progress + alerts)
|
||||
│ ├── telemetry.py # Hardware telemetry (HWiNFO)
|
||||
│ ├── tray_wrapper.py # System tray .exe wrapper
|
||||
│ ├── build_exe.py # PyInstaller build script
|
||||
│ ├── .env.example # Example environment file
|
||||
│ ├── requirements.txt
|
||||
│ └── tests/ # Test suite
|
||||
├── client/ # E-Ink web client
|
||||
@@ -113,10 +118,27 @@ pip install -r requirements.txt
|
||||
python -m uvicorn main:app --host 0.0.0.0 --port 8921
|
||||
```
|
||||
|
||||
Set environment variables:
|
||||
Configure via one of:
|
||||
|
||||
- `DASHBOARD_PIN` — 4-digit PIN for the E-Ink client
|
||||
- `API_TOKEN` — Bearer token for external scripts
|
||||
1. **Environment variables:**
|
||||
- `DASHBOARD_PIN` — 4-digit PIN for the E-Ink client
|
||||
- `API_TOKEN` — Bearer token for external scripts
|
||||
|
||||
2. **`.env` file** (in project root or exe directory):
|
||||
|
||||
```
|
||||
DASHBOARD_PIN=1234
|
||||
API_TOKEN=your-token-here
|
||||
```
|
||||
|
||||
3. **`config.yaml`** (in project root or exe directory):
|
||||
|
||||
```yaml
|
||||
dashboard_pin: "1234"
|
||||
api_token: "your-token-here"
|
||||
```
|
||||
|
||||
See `.env.example` and `config.yaml.example` for reference.
|
||||
|
||||
### Build .exe
|
||||
|
||||
@@ -144,6 +166,40 @@ adb install app/build/outputs/apk/debug/app-debug.apk
|
||||
|
||||
The WebView loads `file:///android_asset/index.html` and connects to the server via WebSocket at `ws://<pc-ip>:8921/ws`.
|
||||
|
||||
#### Localization
|
||||
|
||||
The app supports multiple languages via Android string resources. The web client loads strings from Android via a JavaScript interface.
|
||||
|
||||
**Adding a new language:**
|
||||
|
||||
1. Create a new values folder: `android/app/src/main/res/values-{lang}/`
|
||||
- Example: `values-es/` for Spanish, `values-fr/` for French
|
||||
2. Copy `values/strings.xml` to the new folder
|
||||
3. Translate the string values
|
||||
|
||||
**Example `values-es/strings.xml`:**
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">PaperDash</string>
|
||||
<string name="login_title">PaperDash</string>
|
||||
<string name="login_subtitle">Ingrese PIN para conectar</string>
|
||||
<string name="login_placeholder">****</string>
|
||||
<string name="login_button">Conectar</string>
|
||||
<string name="login_error_enter_pin">Ingrese un PIN</string>
|
||||
<string name="login_error_disconnected">Desconectado. Reingrese PIN.</string>
|
||||
<string name="connecting">Conectando…</string>
|
||||
<string name="no_playback">Sin reproducción</string>
|
||||
<string name="mute">SILENCIAR</string>
|
||||
<string name="muted">SILENCIADO</string>
|
||||
<string name="no_notifications">Sin notificaciones</string>
|
||||
<string name="eta_prefix">ETA:</string>
|
||||
</resources>
|
||||
```
|
||||
|
||||
The app automatically uses the device's language. No code changes needed.
|
||||
|
||||
### Design Decisions
|
||||
|
||||
See `.pi/docs/design/` for detailed design decision records covering architecture, audio mixer, notifications, and the .exe build.
|
||||
|
||||
Reference in New Issue
Block a user