From 8c9de660c7d54a9fc87d8716a6be4ae14a7f54a7 Mon Sep 17 00:00:00 2001 From: kicer Date: Mon, 23 Nov 2026 09:15:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20=E5=90=AF=E5=8A=A8=E8=87=AA=E6=84=88?= =?UTF-8?q?=E7=9A=84=E8=84=9A=E6=9C=AC=E6=95=B0=E7=94=B1=E7=AD=89=E4=BA=8E?= =?UTF-8?q?=E6=94=B9=E4=B8=8B=E7=95=8C=EF=BC=8C=E5=8A=A0=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E8=AF=AF=E8=A7=A6=E6=95=B4=E9=A1=B5=E9=87=8D?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/server/public/index.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/server/public/index.html b/app/server/public/index.html index d5e1b8a..cecf68f 100644 --- a/app/server/public/index.html +++ b/app/server/public/index.html @@ -664,15 +664,18 @@ // 启动自愈:外部工具改前端文件是非原子写入,极端时机下浏览器可能拿到半截或重复拼接的 HTML // (脚本缺半 → 白屏裸首页;重复注入 → 每个文件报 duplicate variable 后 JS 全挂)。 // 这里检测关键脚本数量与入口全局,不对就自动整页重载一次(sessionStorage 防循环)。 - // 注意:js/ 脚本增减时需同步改这里的期望数 10。 + // 基线 10 只是下界:脚本只增不减,少于基线说明 HTML 被写坏(半截/漏标签); + // 正常加功能会变多,不需要改这里。白屏由下面三个入口全局兜住。 (function () { var ok = false; try { var n = document.querySelectorAll('script[src^="/js/"]').length; - ok = n === 10 && typeof state !== 'undefined' && + ok = n >= 10 && typeof state !== 'undefined' && typeof openFilePreview === 'function' && typeof restartNow === 'function'; } catch (_) {} if (ok) { try { sessionStorage.removeItem('boot-heal'); } catch (_) {} return; } + // 失败必留痕:以前静默 reload,把「正常加脚本」和「真白屏」混成同一个不可见动作。 + try { console.error('[boot] 自检未通过:脚本 ' + n + ' 个(基线 10);state=' + typeof state + ' openFilePreview=' + typeof openFilePreview + ' restartNow=' + typeof restartNow); } catch (_) {} try { if (sessionStorage.getItem('boot-heal')) { sessionStorage.removeItem('boot-heal'); return; } sessionStorage.setItem('boot-heal', '1');