chore(mirror): ws 抓包未启用时也定义 __ws_save__,调用时提示加 #hook

This commit is contained in:
TermiNexus committed 2026-10-11 20:43:14 +08:00
1 parent f3cd1aae67
commit 245e27e192
1 file changed
+5
+5
View File
@@ -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;