import { useState } from 'react' import { AlertTriangle, CheckCircle2, KeyRound, Trash2 } from 'lucide-react' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { useClearCookie, useCookieStatus, useSetCookie } from '@/hooks/useMonitor' import { useCurrentPlatform } from '@/hooks/usePlatform' import { formatDateTime, formatRelative } from '@/lib/monitorFormat' /** * Cookie health for unattended runs. * * The expiry signal that matters is `last_ok_at` (the last run that actually * authenticated), not `updated_at`: a cookie can be saved long ago and still be * working, or be fresh and already rejected. */ export function CookiePanel() { const { capability, platform } = useCurrentPlatform() // Scoped to the selected platform: each keeps its own login. const { data: status } = useCookieStatus() const setCookie = useSetCookie() const clearCookie = useClearCookie() const [draft, setDraft] = useState('') const [editing, setEditing] = useState(false) const showForm = !status?.present || editing const label = capability?.label ?? platform return (
定时监控需要长期有效的登录态。在浏览器登录{label}后,从开发者工具复制完整 Cookie 粘贴到此处(需包含 web_session、 a1、 webId)。 Cookie 通常数周后失效,届时任务会提示重新粘贴。该 Cookie 只用于{label}。