From af810f14c77fc27301b0ded9e53582759170f3a2 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Mon, 13 Jul 2026 12:29:03 +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 --- src/components/AuthGate.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/AuthGate.tsx b/src/components/AuthGate.tsx index 348679f..a227a74 100644 --- a/src/components/AuthGate.tsx +++ b/src/components/AuthGate.tsx @@ -2,10 +2,12 @@ import { useEffect, useRef, useState } from 'react' import { useNavigate, useLocation } from 'react-router-dom' 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 }