Configurable inactivity timeout — disabled automatically in PWA/standalone mode

This commit is contained in:
jtricerolph 2026-07-13 12:29:02 +00:00
parent 071ea9bfc3
commit 59984fc0ac

View file

@ -2,10 +2,12 @@ import { createContext, useContext, useEffect, useState } from 'react'
import type { ReactNode } from 'react' import type { ReactNode } from 'react'
import type { User } from '../types' import type { User } from '../types'
const SHARED_TIMEOUT_MS = 10 * 60 * 1000 function getInactivityMs(): number | null {
if (window.matchMedia('(display-mode: standalone)').matches) return null
function isSharedDevice() { const c = document.cookie.split(';').map(s => s.trim()).find(s => s.startsWith('hnf_inactivity_mins='))
return document.cookie.split(';').some(c => c.trim() === 'hnf_shared_device=1') if (!c) return null
const mins = parseInt(c.split('=')[1])
return isNaN(mins) || mins <= 0 ? null : mins * 60 * 1000
} }