feat(panel): 前端 NOT_JSON 自动回传原始响应到 /api/debug/report_bad_json(落 /tmp/overview_client_bad.txt,抓浏览器收到的真实字节)

This commit is contained in:
AskaEth committed 2026-09-02 08:39:29 +08:00
1 parent 57676766c0
commit 524e5d6967
2 files changed
+9

No files matched your search

+1
View File
@@ -178,6 +178,7 @@
if (!json || typeof json.ok !== 'boolean') {
// 静态服务器返回 HTML / 404 等
dbgErr(method || 'GET', path, 'HTTP', res.status, ms + 'ms', '非 JSON 响应, len=' + text.length, '头:', text.slice(0, 200), '尾:', text.slice(-200));
try { fetch('/api/debug/report_bad_json', { method: 'POST', headers: { 'Content-Type': 'text/plain', 'X-MeowToken': storageGet('meowpanel.token') || '' }, body: text }); } catch (e2) {}
setConn(res.ok ? true : false);
throw { code: 'NOT_JSON', message: '后端返回了非 JSON 响应(HTTP ' + res.status + ')', status: res.status };
}