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:
@@ -0,0 +1,47 @@
|
||||
// The terminal app's root (plan step 3.1b, APPS_PLATFORM D-2, §9): one web app for every
|
||||
// paired screen, served on :8082 (LAN only). <AccessProvider> loads the platform bootstrap
|
||||
// (venue, language, modules) with the screen's session, if any.
|
||||
// Routes in 3.1b: "/" the start screen, "/app/:appKey" an app by key (its lazy chunk).
|
||||
// 3.1c replaces them with pairing → sign-in → the device's own app (by GET /api/devices/me).
|
||||
import { lazy, Suspense, useState } from 'react'
|
||||
import { BrowserRouter, Route, Routes, useParams } from 'react-router-dom'
|
||||
import { AccessProvider } from '@xenia/access'
|
||||
import { createI18n } from '@xenia/i18n'
|
||||
import { Spinner } from '@xenia/ui'
|
||||
import client from './api/client'
|
||||
import AppHost from './apps/AppHost'
|
||||
import { deviceStore } from './device/storage'
|
||||
import StartScreen from './screens/StartScreen'
|
||||
|
||||
const i18n = createI18n({ defaultNS: 'terminal' })
|
||||
|
||||
// Visual check pages for the shared packages, dev builds only (CS-16)
|
||||
const UiGallery = import.meta.env.DEV ? lazy(() => import('@xenia/ui/gallery')) : null
|
||||
const I18nSample = import.meta.env.DEV ? lazy(() => import('@xenia/i18n/sample')) : null
|
||||
|
||||
const loading = <main className="min-h-screen flex items-center justify-center"><Spinner /></main>
|
||||
|
||||
function AppRoute() {
|
||||
const { appKey } = useParams()
|
||||
return <AppHost appKey={appKey} />
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
const [token] = useState(() => deviceStore.sessionToken())
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<Routes>
|
||||
{UiGallery && <Route path="/ui-gallery" element={<Suspense fallback={null}><UiGallery /></Suspense>} />}
|
||||
{I18nSample && <Route path="/i18n-sample" element={<Suspense fallback={null}><I18nSample /></Suspense>} />}
|
||||
<Route path="*" element={
|
||||
<AccessProvider client={client} token={token} i18n={i18n} loading={loading}>
|
||||
<Routes>
|
||||
<Route path="/app/:appKey" element={<AppRoute />} />
|
||||
<Route path="*" element={<StartScreen />} />
|
||||
</Routes>
|
||||
</AccessProvider>
|
||||
} />
|
||||
</Routes>
|
||||
</BrowserRouter>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user