fix(apps): harden desktop and mobile server connectivity

Desktop (Electron):
- Add two-step first-run wizard: test TimeTracker via GET /api/v1/info, then log in with API token
- Replace bogus token check with validateSession (users/me, fallback to timer/status for narrow scopes)
- Normalize base URLs; classify TLS/DNS/timeout errors; periodic 401 forces re-login
- Settings save/test use public + authenticated checks; prebuild/prestart and npm test

Server:
- Exempt /api/v1/info, /api/v1/health, and POST /api/v1/auth/login from HTML setup redirect
- Include setup_required on GET /api/v1/info for unfinished installs

Mobile (Flutter):
- Validate saved token against new server URL before persisting settings change
- Remove unused lib/core/config.dart; point BUILD_CONFIGURATION at app_config.dart

Docs: DESKTOP_SETTINGS, desktop README, mobile-desktop-apps README, REST_API /info
This commit is contained in:
Dries Peeters
2026-04-16 19:59:20 +02:00
parent b746fa912e
commit eb2f5c6afa
19 changed files with 1178 additions and 300 deletions
+3
View File
@@ -185,11 +185,14 @@ GET /api/v1/info
Returns API version and available endpoints. No authentication required.
`setup_required` is a boolean: when `true`, the installations initial web setup is not complete; finish setup in the browser. Desktop and mobile apps use this (and JSON shape) to avoid treating arbitrary HTTP 200 pages as TimeTracker. During that phase, `GET /api/v1/info`, `GET /api/v1/health`, and `POST /api/v1/auth/login` are not redirected to the HTML setup wizard so clients still receive JSON.
**Response:**
```json
{
"api_version": "v1",
"app_version": "1.0.0",
"setup_required": false,
"documentation_url": "/api/docs",
"endpoints": {
"projects": "/api/v1/projects",