/* * CoreHalo Web Dump * 作用:访问 http://corehalo.dump/fetch 时,以网页形式显示捕获的链接并清空存储 */ // 1. 读取数据 let raw = $persistentStore.read("corehalo_links") || "[]"; let list; try { list = JSON.parse(raw); if (!Array.isArray(list)) list = []; } catch (e) { list = []; } const count = list.length; // 2. 发送通知 (保持原有的系统通知功能) if (count > 0) { $notification.post("CoreHalo Dump", `捕获 ${count} 条链接`, "已在浏览器显示并清空"); } else { $notification.post("CoreHalo Dump", "没有新链接", "列表为空"); } // 3. 准备 HTML 内容 // 生成列表项 HTML const listHtml = list.map((link, index) => `
${index + 1}. ${link}
`).join(""); // 页面样式 const css = ` `; const bodyContent = count > 0 ? `
${listHtml}
` : `
📭 暂无捕获的链接
`; const html = ` CoreHalo Links ${css}

捕获列表 ${count}

${bodyContent}
`; // 4. 清空存储 (提取后即焚) $persistentStore.write("[]", "corehalo_links"); // 5. 返回网页响应 $done({ response: { status: 200, headers: { "Content-Type": "text/html;charset=utf-8" }, body: html } });