From c43a23b00d31e237a36f0e7d902096ffa05f2706 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Mon, 13 Jul 2026 12:29:00 +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 147fa58..7f0d9f2 100644 --- a/frontend/src/components/AuthGate.tsx +++ b/frontend/src/components/AuthGate.tsx @@ -1,10 +1,12 @@ import { useEffect, useState, createContext, useContext } 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 }