fix(conn): 拔线后不再永远「已连接」

1) pollStatus 把 5s 超时 AbortError / HTTP 非 2xx 计入失败,走离线+清指标
2) DeviceLink 快照不得把本页已判离线改回在线(Owner 连败 3 次前会盖绿灯)
This commit is contained in:
cbb
2026-09-16 20:38:37 +08:00
parent 5459bdeff7
commit 91a534514d
4 changed files with 15 additions and 6 deletions
+4 -2
View File
@@ -61,8 +61,10 @@ export function updateConnectionUi(connected, text) {
try {
var snap = deviceLink.getSnapshot();
if (snap && snap.ts && (Date.now() - snap.ts) < 5000) {
/* 只覆盖在线布尔,保留调用方语义文案(设备忙/诊断中/STA…) */
connected = !!snap.links.esp32.online;
/* Hub 可把在线压成离线;**不得**把本页刚判的离线改回在线。
* Owner 要连失败 3 次才翻离线,期间若无脑覆盖,
* OTA 页超时判离线后灯又会被点绿 → 拔线后永远「已连接」。 */
if (!snap.links.esp32.online) connected = false;
if (!text) text = connected ? '已连接' : '离线';
}
} catch (_) {}