feat(terminal): pairing, sign-in per mode, device app router and live states (platform-v2 3.1c)
- Pairing screen: requests a code, shows it big, polls with the secret, new code on expiry, keeps the device token; "removed from the venue" notice after a revoke. - Sign-in per device mode: PIN (name + PinPad), tap your name, password (name + password), none (straight into the app). Names = holders of <app>.access, refreshed every 30 s and on reconnect. Slim bar with screen, user and Sign out; idle sign-out after the device's auto_sign_out_minutes; hourly token refresh (same session). - DeviceProvider: GET /api/devices/me (retried while unreachable), session, the live connection with credentials in the first frame (device.updated -> reload, app moved -> sign out, device.revoked -> forget, session.ended -> sign out), offline banner; useLiveEvent for apps. Screen choice is pure (device/flow.js, unit-tested). - Blocked screen: app turned off / not licensed / device refused, recovers by itself. - @xenia/access AccessProvider: autoRetryMs (retry bootstrap while unreachable). - Tests: terminal unit tests (screen choice, live actions, idle, pairing polls), new tests/e2e/terminal.mjs (18 checks), manager.mjs owner flow now pairs and signs in on the real terminal screen; run-all runs terminal.mjs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// A paired screen that can't run its app (plan step 3.1c): the app is turned off or not in
|
||||
// the license (me.app_status), or the server refuses the device itself (e.g. more screens
|
||||
// than the license allows). It changes by itself: module on/off sends device.updated live,
|
||||
// and GET /me is retried every few seconds while refused.
|
||||
import { PowerOff } from 'lucide-react'
|
||||
import { errorMessage } from '@xenia/api'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
import { EmptyState } from '@xenia/ui'
|
||||
import { useDevice } from '../device/context'
|
||||
|
||||
export default function BlockedScreen() {
|
||||
const { t } = useTranslation('terminal')
|
||||
const { me, meError } = useDevice()
|
||||
let title, body
|
||||
if (me) {
|
||||
const app = t(`modules:${me.app_key}.name`)
|
||||
title = me.app_status === 'module.not_licensed' ? t('blocked.notLicensed', { app }) : t('blocked.off', { app })
|
||||
body = me.app_status === 'module.not_licensed' ? t('blocked.notLicensedBody') : t('blocked.offBody')
|
||||
} else {
|
||||
title = t('blocked.refused')
|
||||
body = errorMessage({ xenia: meError }, t)
|
||||
}
|
||||
return (
|
||||
<main className="min-h-screen bg-surface-2 flex items-center justify-center p-6" data-testid="blocked-screen" data-reason={me?.app_status || meError?.code}>
|
||||
<EmptyState icon={<PowerOff />} title={title} description={body} />
|
||||
</main>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user