From 59984fc0acf48b132ff2f02c9f6f38bcd92fe03d Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Mon, 13 Jul 2026 12:29:02 +0000 Subject: [PATCH] =?UTF-8?q?Configurable=20inactivity=20timeout=20=E2=80=94?= =?UTF-8?q?=20disabled=20automatically=20in=20PWA/standalone=20mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/AuthGate.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/AuthGate.tsx b/frontend/src/components/AuthGate.tsx index dd3764b..a1e1f3d 100644 --- a/frontend/src/components/AuthGate.tsx +++ b/frontend/src/components/AuthGate.tsx @@ -2,10 +2,12 @@ import { createContext, useContext, useEffect, useState } from 'react' import type { ReactNode } from 'react' import type { User } from '../types' -const SHARED_TIMEOUT_MS = 10 * 60 * 1000 - -function isSharedDevice() { - return document.cookie.split(';').some(c => c.trim() === 'hnf_shared_device=1') +function getInactivityMs(): number | null { + if (window.matchMedia('(display-mode: standalone)').matches) return null + const c = document.cookie.split(';').map(s => s.trim()).find(s => s.startsWith('hnf_inactivity_mins=')) + if (!c) return null + const mins = parseInt(c.split('=')[1]) + return isNaN(mins) || mins <= 0 ? null : mins * 60 * 1000 }