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 }