实战📊 中级🛠 AI赚钱
`index.js` (server)
**A. Write user events to `.events` file.** In the WebSocket `message` handler, after logging the event to stdout: append the event as a JSON line to `$SCREEN_DIR/.events` via `fs.appendFileSync`. Only write user interaction events (those with `source: 'user-event'`), not server lifecycle events. **B. Clear `.events` on new screen.** In the chokidar `add` handler (new `.html` file detected), delete `$SCREEN_DIR/.events` if it exists. This is the definitive "new screen" signal — better than clearing on GET `/` which fires on every reload. **C. Replace `wrapInFrame` content injection.** The current regex anchors on `
← 返回教程列表
AI8899 · 内容仅供学习参考