feat(portable): bug 一键上报 + 自动崩溃上报 + openclaw 升级 2026.6.6

Bug 上报(方便服务器侧排查便携版问题):
- 新增 lib/report-bug.mjs:算设备指纹→sk-uc apiKey,收集 openclaw 版本/
  系统信息/最近日志(gzip+base64),POST 到 api.u-claw.org/recharge/bug/submit。
  静默失败,绝不影响主流程。复用 fingerprint.mjs + xiapan-client.mjs。
- config-server 加 POST /api/report-bug:本地补齐信息后转发,配置中心加
  「🐛 报 Bug」表单(标题/描述/是否附日志)。
- Windows-Start.bat / Mac-Start.command:gateway 端口耗尽或异常退出时
  自动后台上报(Ctrl+C 正常停止不上报)。

openclaw 升级:
- OPENCLAW_VERSION 2026.4.29 → 2026.6.6(X 盘真实 USB 实测 gateway
  启动/ready、Dashboard 200、旧配置兼容、虾盘云 status 均通过)。

便携性改进(借鉴 OpenClaw-Windows-Portable):
- setup.sh / 启动脚本的 npm install 设 npm_config_cache 指向盘内
  app/.npm-cache,避免污染系统缓存,拔盘不留痕。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hfshfg
2026-06-15 10:52:17 +08:00
parent d9dd98d650
commit 6eb54f8ea3
7 changed files with 316 additions and 4 deletions

View File

@@ -524,6 +524,37 @@ const server = http.createServer((req, res) => {
return;
}
// API: Report a bug — user fills title/description in the web UI; this endpoint
// attaches fingerprint/version/logs locally and forwards to api.u-claw.org.
if (req.url === '/api/report-bug' && req.method === 'POST') {
let body = '';
req.on('data', chunk => {
body += chunk;
if (body.length > 2 * 1024 * 1024) req.destroy(); // 2MB cap on user input
});
req.on('end', () => {
(async () => {
try {
const data = body ? JSON.parse(body) : {};
const mod = await import('../lib/report-bug.mjs');
const portableRoot = path.join(__dirname, '..');
const result = await mod.submitBugReport({
title: data.title,
description: data.description,
appRoot: portableRoot,
includeLogs: data.includeLogs !== false, // 默认带日志,用户可勾掉
});
res.writeHead(result.ok ? 200 : 400, { 'Content-Type': 'application/json' });
res.end(JSON.stringify(result));
} catch (err) {
res.writeHead(500, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ ok: false, error: err.message }));
}
})();
});
return;
}
// Serve static files
const filePath = req.url === '/'
? path.join(__dirname, 'public/index.html')