From 245e27e1921c485d9c90966205d038c1e1682c4b Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Sun, 11 Oct 2026 20:43:14 +0800 Subject: [PATCH] =?UTF-8?q?chore(mirror):=20ws=20=E6=8A=93=E5=8C=85?= =?UTF-8?q?=E6=9C=AA=E5=90=AF=E7=94=A8=E6=97=B6=E4=B9=9F=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=20=5F=5Fws=5Fsave=5F=5F=EF=BC=8C=E8=B0=83=E7=94=A8=E6=97=B6?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E5=8A=A0=20#hook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sockets/ws_hook.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sockets/ws_hook.js b/sockets/ws_hook.js index 1236d60..0bc3563 100644 --- a/sockets/ws_hook.js +++ b/sockets/ws_hook.js @@ -16,6 +16,11 @@ if (window.__ws_hooked__) return; if (!/#hook/.test(location.hash) || /#nohook/.test(location.hash)) { console.log('[WS Hook] 未启用(默认关闭;URL 加 #hook 开启抓包)'); + // 兜底:即使没启用也定义,调用时提示怎么开,避免"__ws_save__ 不存在" + window.__ws_save__ = function () { + console.warn('[WS Hook] 未启用:请在 URL 末尾加 #hook(如 http://localhost:8080/#hook)后整页刷新,再调用 __ws_save__()'); + return Promise.resolve(null); + }; return; } window.__ws_hooked__ = true;