feat(terminal): terminal app shell, pos-terminal image, LAN-only proxy port 8082 (platform-v2 3.1b)

- terminal/: new workspace app (Vite + React 19 + Router 7, Tailwind on the shared
  preset, @xenia/i18n namespace `terminal`, @xenia/api client sending X-Xenia-Device,
  @xenia/access bootstrap). Apps are lazy chunks by app_key (kds, pos_counter,
  customer_display placeholders); start screen; "unknown app" screen; dev-only
  /ui-gallery and /i18n-sample. Device + session tokens in a storage wrapper.
- Image pos-terminal (terminal/Dockerfile, context client-services/); every frontend
  Dockerfile copies terminal/package.json for npm ci.
- docker-compose(.dev).yml: service terminal; proxy publishes 8082.
- Proxy (nginx-proxy/nginx.conf == install.sh heredoc, CS-5): server :8082, LAN-only
  allow/deny, WebSocket upgrade; the terminal upstream is resolved per request so the
  proxy still starts on a stack without the terminal container.
- install.sh prints the screens address.
- Tests: terminal unit tests + lint in run-all; new tests/e2e/stack.mjs (release images
  on one compose stack: :8082 serves the app, /api + WebSocket through both hops,
  403 from a non-LAN docker network on 8082 and 8081, proxy up without terminal).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 17:02:20 +02:00
co-authored by Claude Opus 5.5
parent bda5cde92b
commit 7ff3c3b48e
38 changed files with 1445 additions and 707 deletions
+3
View File
@@ -22,6 +22,8 @@ npm test -w @xenia/api # live client = the waiter's old WebSoc
npm test -w @xenia/access # can(): one key, any/all
npm test -w manager-dashboard # platform pages' logic: module states, what stops with a module, device status/usage/limits
npm run lint -w manager-dashboard # ESLint (waiter rules) on the manager's v2 code; the file list is the `lint` script
npm test -w terminal # terminal shell: which apps a screen can run, the device/session token store
npm run lint -w terminal # ESLint on all of terminal/src (same rules)
```
**DB tests** (`local_backend/tests/conftest.py`) run the real FastAPI app against a throwaway SQLite database in a temp folder (never your dev or venue DB). Fixtures: `db` (session, rolled back after each test even if the code commits), `client` (TestClient with `get_db` overridden, license check open, no lifespan), `make_user(role=..., perms=...)` (password `password`, PIN `1234`), `login(user)` (auth headers). A test that uses any of them is marked `db` automatically.
@@ -43,6 +45,7 @@ Or run one suite at a time:
| `python license_e2e.py` | Offline licensing with a real cloud + site process: 400 days offline, tampered file, clock set back, expiry deferred to workday close, renewal, remote lock | Python deps of both backends | ~2 min |
| `node ui.mjs` | `@xenia/ui` components on the dev-only gallery (`/ui-gallery`, manager Vite :5185): dialog focus/Escape/backdrop, sheet, toasts, field wiring, switch, InfoTip, PinPad, themes; `@xenia/i18n` on `/i18n-sample` with the browser in New York: venue time, live language switch, el/en money and numbers, price input, translated component labels | Edge | ~40 s |
| `node manager.mjs` | Manager on `@xenia/api`/`@xenia/access` (backend :8057 on a demo DB, manager Vite :5186): bootstrap before/after login, wrong password and wrong lock PIN stay on screen, sidebar from keys, KDS module off → "turned off" screen, session ended elsewhere → /login, a waiter's cancel approved by a manager PIN (wrong PIN first) and audited; Apps, Integrations, License, Devices (pairing played through the API, a device setting chosen when pairing and edited, the screen's live connection told of the edit and closed on app change and removal); the approvals log, "Signed in now" + end session, the staff permission editor (give, reset to role, a staff manager can't give what they lack); the notification bell (live, read, read all), sign-in/venue/print settings, log download; the **owner flow** (sign in → turn on KDS → pair a screen → give a chef the kitchen permissions → the chef signs in on that screen) | Edge | ~1 min |
| `node stack.mjs` | The release images + the real `docker-compose.yml` and proxy config on one stack (:19080/:19081/:19082): the terminal on :8082 (app, deep links, assets, `/api`, WebSocket through both nginx hops); :8082 and :8081 refuse a non-LAN address (a second docker network, 100.64.50.0/24) and answer a LAN one; the proxy still starts without a terminal container | Docker | ~3 min (first build longer) |
| `node browser.mjs` | Waiter web modes (same-origin, plain HTTP by LAN IP, venue mode), install dialog + drawer entry (Android / iPhone / desktop / no APK) | Docker, Edge | ~2 min |
| `node android.mjs basics` | Pairing, wrong address / other venue's QR, login + live WS, back button, restart, two venues, camera permission | Android emulator | ~5 min |
| `node android.mjs rediscovery` | Server IP change (logged in / out), server down + manual search, cold start while offline | Android emulator | ~4 min |