A claimed PC forgets the old login and the old cameras
Seen on the first claimed demo install: 'session expired' on every screen, signed in as a user from the previous demo's head office, and 'Watching 3 cameras' for a shop with one - the PC had offered its two leftover cameras up to head office, without their passwords, so the same lens was listed twice and one copy could never be pushed anywhere. Claiming now clears any stored session (a new head office is a new world), a session whose refresh fails is forgotten on disk as well as in memory so the app returns to Login by itself, and the demo setup removes cameras left from an earlier install before it joins the shop, because head office is the source of truth from then on. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KGcjxF1cNLcuwc3DAPcnfj
This commit is contained in:
File diff suppressed because one or more lines are too long
2
desktop/frontend/dist/index.html
vendored
2
desktop/frontend/dist/index.html
vendored
@@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Behavision</title>
|
||||
<script type="module" crossorigin src="./assets/index-upywadx9.js"></script>
|
||||
<script type="module" crossorigin src="./assets/index-DKxK1S8I.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-Z_jL3Bie.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -40,10 +40,20 @@ export default function App() {
|
||||
const [helping, setHelping] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
try { setSession(await api.session()) } catch { setSession(null) }
|
||||
setBooting(false)
|
||||
})()
|
||||
let alive = true
|
||||
const load = async () => {
|
||||
try {
|
||||
const s = await api.session()
|
||||
if (alive) setSession(prev => JSON.stringify(prev) === JSON.stringify(s) ? prev : s)
|
||||
} catch { if (alive) setSession(null) }
|
||||
if (alive) setBooting(false)
|
||||
}
|
||||
load()
|
||||
// Re-read every few seconds: a session the server has ended - or one
|
||||
// that never belonged to this head office - must put Login back on
|
||||
// screen, not leave "session expired" banners on every page.
|
||||
const id = setInterval(load, 8000)
|
||||
return () => { alive = false; clearInterval(id) }
|
||||
}, [])
|
||||
|
||||
if (!isDesktop()) {
|
||||
|
||||
Reference in New Issue
Block a user