change(mirror): 页面内 ws 抓包改为默认关闭(URL 加 #hook 才启用)

- 之前默认一直挂 window.WebSocket;为避免干扰排查(先排除 SW/hook 因素),改为显式 #hook 才抓;#nohook 仍可强制关
This commit is contained in:
TermiNexus committed 2026-10-11 20:14:40 +08:00
1 parent 562835c284
commit ba56ab9d7c
1 file changed
+3 -3
+3 -3
View File
@@ -5,7 +5,7 @@
// 用于与「中继转存」逐帧对比,定位「直连能进、中继不能进」的差异。
//
// 挂载:serve.js 提供 /ws_hook.js;web/index.html 在主脚本之前引入(先于游戏创建 WebSocket)。
// 开关:URL hash 带 #nohook 则不抓(默认抓)。
// 开关:**默认不启用**;URL hash 加 #hook 才抓(#nohook 可强制关)。
// 产物:
// window.__ws_capture__ —— 内存里的抓包(connections[].messages[] = {d,t,n,b},
// d=c2s/s2c,n=字节数,b=base64 原始字节,顺序即收发顺序)
@@ -14,8 +14,8 @@
// ============================================================
(function () {
if (window.__ws_hooked__) return;
if (/#nohook/.test(location.hash)) {
console.log('[WS Hook] #nohook:已跳过');
if (!/#hook/.test(location.hash) || /#nohook/.test(location.hash)) {
console.log('[WS Hook] 未启用(默认关闭;URL 加 #hook 开启抓包)');
return;
}
window.__ws_hooked__ = true;