Fix kiosk 'Install' installing the main hvac app instead
The whole hvac SPA shares one index.html/<link rel=manifest>, so 'Install' from any route always used the main manifest (start_url '/hvac/', staff AuthGate) -- hit 2026-08-26, installing from /hvac/kiosk opened the staff login instead of the kiosk password prompt. Fix: new static kiosk-manifest.webmanifest (start_url/scope '/hvac/kiosk', name 'HVAC Kiosk'), swapped into the document's manifest link while the Kiosk route is mounted (useKioskManifest hook), restored on unmount. Reuses the existing hvac icon set. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
55afcaa786
commit
9b4e49b801
2 changed files with 32 additions and 0 deletions
|
|
@ -17,6 +17,23 @@ function liveDevicesOf(zone: ZoneStatus): DeviceSummary[] {
|
|||
return zone.devices.filter(d => KIOSK_DEVICE_TYPES.includes(d.device_type))
|
||||
}
|
||||
|
||||
// The whole hvac SPA shares one index.html, so there's only one <link
|
||||
// rel="manifest"> in the document — "Install" from any route otherwise always
|
||||
// installs the main app (start_url '/hvac/', staff login). Swap it to a
|
||||
// kiosk-specific manifest (start_url/scope '/hvac/kiosk') while this route is
|
||||
// mounted, so installing from here opens straight back into the kiosk and its
|
||||
// own password prompt instead — restore it on unmount in case something ever
|
||||
// navigates away client-side rather than via a full page load.
|
||||
function useKioskManifest() {
|
||||
useEffect(() => {
|
||||
const link = document.querySelector<HTMLLinkElement>('link[rel="manifest"]')
|
||||
if (!link) return
|
||||
const original = link.href
|
||||
link.href = '/hvac/kiosk-manifest.webmanifest'
|
||||
return () => { link.href = original }
|
||||
}, [])
|
||||
}
|
||||
|
||||
// The wall-panel kiosk view — a dedicated route/login, deliberately outside the
|
||||
// normal staff AuthGate/Layout (see App.tsx). One master panel: one tile per
|
||||
// ROOM/ZONE (same as the Dashboard's ZoneCard — a room's TRV and AC show
|
||||
|
|
@ -25,6 +42,8 @@ function liveDevicesOf(zone: ZoneStatus): DeviceSummary[] {
|
|||
// across zones. See project_hvac_kiosk memory for the design decisions behind
|
||||
// this (access model, layout, bulk-edit mechanism).
|
||||
export default function Kiosk() {
|
||||
useKioskManifest()
|
||||
|
||||
const [authState, setAuthState] = useState<'checking' | 'login' | 'authed'>('checking')
|
||||
const [password, setPassword] = useState('')
|
||||
const [loginError, setLoginError] = useState('')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue