()
| 26 | |
| 27 | // ===== Init ===== |
| 28 | async function init(){ |
| 29 | try{ |
| 30 | const[a,b]=await Promise.all([fetch(authQ('/api/requests?limit=100')),fetch(authQ('/api/logs?limit=500'))]); |
| 31 | if (a.status === 401) { localStorage.removeItem('cursor2api_token'); window.location.href = '/logs'; return; } |
| 32 | reqs=await a.json();logs=await b.json();rmap={};reqs.forEach(r=>rmap[r.requestId]=r); |
| 33 | renderRL();updCnt();updStats(); |
| 34 | // 默认显示实时日志流 |
| 35 | renderLogs(logs.slice(-200)); |
| 36 | }catch(e){console.error(e)} |
| 37 | connectSSE(); |
| 38 | logoutBtn(); |
| 39 | } |
| 40 | |
| 41 | // ===== SSE ===== |
| 42 | let es; |
no test coverage detected