MCPcopy
hub / github.com/7836246/cursor2api / init

Function init

public/logs.js:28–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26
27// ===== Init =====
28async 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 =====
42let es;

Callers 1

logs.jsFile · 0.85

Calls 9

authQFunction · 0.85
renderRLFunction · 0.85
updCntFunction · 0.85
updStatsFunction · 0.85
renderLogsFunction · 0.85
connectSSEFunction · 0.85
logoutBtnFunction · 0.85
errorMethod · 0.80
jsonMethod · 0.45

Tested by

no test coverage detected