feat(client-info): 本地镜像的 ClientInfo 显示 SRV: CN1/CN2
This commit is contained in:
1 parent
2197f23517
commit
57481a1d09
3 files changed
+21
-14
No files matched your search
+12
-5
@@ -399,12 +399,19 @@ const Server = http.createServer((Req, Res) => {
|
||||
}
|
||||
const Ext = path.extname(File).toLowerCase();
|
||||
const Type = MIME[Ext] || 'application/octet-stream';
|
||||
// --ws-hook:HTML 里注入抓包脚本(在主脚本之前 → 先于游戏创建 WebSocket)
|
||||
if (WS_HOOK && (Ext === '.html' || Ext === '.htm')) {
|
||||
const Html = fs.readFileSync(File, 'utf8').replace(/<\/head>/i, '<script src="/ws_hook.js"></script></head>');
|
||||
// HTML 注入:
|
||||
// ① window.__HORNET_SRV__ —— 当前配置的目标服务器编号(ClientInfo 里显示 SRV: CN1 / CN2)
|
||||
// ② --ws-hook 时再注入抓包脚本(必须排在游戏主脚本之前)
|
||||
if (Ext === '.html' || Ext === '.htm') {
|
||||
const SrvMatch = /c([12])\.3dtank\.com/.exec(CONFIG_UPSTREAM);
|
||||
const Srv = SrvMatch ? SrvMatch[1] : '1';
|
||||
let Head = '<script>window.__HORNET_SRV__=' + Srv + ';</script>';
|
||||
if (WS_HOOK) Head += '<script src="/ws_hook.js"></script>';
|
||||
let Html = fs.readFileSync(File, 'utf8');
|
||||
Html = /<\/head>/i.test(Html) ? Html.replace(/<\/head>/i, Head + '</head>') : (Head + Html);
|
||||
const Buf = Buffer.from(Html, 'utf8');
|
||||
Res.writeHead(200, { 'Content-Type': Type, 'Content-Length': Buf.length, 'Cache-Control': 'no-cache' });
|
||||
if (VERBOSE) console.log('[200] ' + Buf.length + '\t' + UrlPath + ' (已注入 ws_hook)');
|
||||
if (VERBOSE) console.log('[200] ' + Buf.length + '\t' + UrlPath + ' (已注入 SRV=' + Srv + (WS_HOOK ? ' + ws_hook' : '') + ')');
|
||||
Res.end(Buf);
|
||||
return;
|
||||
}
|
||||
@@ -427,6 +434,6 @@ Server.listen(PORT, () => {
|
||||
console.log(' 404 记录 : ' + MISSING_LOG);
|
||||
console.log(' config.xml: ' + (RELAY_PORT > 0
|
||||
? ('中继改写 → ws://localhost:' + RELAY_PORT + '/(动态生成,不落盘)')
|
||||
: (!REAL_CONFIG && fs.existsSync(LOCAL_CONFIG) ? '本地覆盖 ' + LOCAL_CONFIG : '回源 c1.3dtank.com(--real-config)')));
|
||||
: (!REAL_CONFIG && fs.existsSync(LOCAL_CONFIG) ? '本地覆盖 ' + LOCAL_CONFIG : '回源 ' + CONFIG_UPSTREAM + '(--real-config)')));
|
||||
console.log(' ws 抓包 : ' + (WS_HOOK ? '已开启(HTML 注入 /ws_hook.js;保存用 __ws_save__())' : '关闭(要抓包加 --ws-hook,勿用 URL hash)'));
|
||||
});
|
||||
@@ -1 +1 @@
|
||||
{"version":"594803f26e3e89aa","base":"/play/static/js/unpacked/","count":127,"files":{"module_00806.js":"// ============================================================\n// Module ID: 806\n// ============================================================\n;(window.__modules__ = window.__modules__ || {})[806] = (t, n, i) => {\n \"use strict\";\n var r = i(19487),\n e = {\n childContextTypes: !0,\n contextType: !0,\n contextTypes: !0,\n defaultProps: !0,\n displayName: !0,\n getDefaultProps: !0,\n getDerivedStateFromError: !0,\n getDerivedStateFromProps: !0,\n mixins: !0,\n propTypes: !0,\n type: !0,\n },\n u = { name: !0, length: !0, prototype: !0, caller: !0, callee: !0, arguments: !0, arity: !0 },\n s = { $$typeof: !0, compare: !0, defaultProps: !0, displayName: !0, propTypes: !0, type: !0 },\n o = {};\n function _(t) {\n return r.isMemo(t) ? s : o[t.$$typeof] || e;\n }\n ((o[r.ForwardRef] = { $$typeof: !0, render: !0, defaultProps: !0, displayName: !0, propTypes: !0 }),\n (o[r.Memo] = s));\n var h = Object.defineProperty,\n a = Object.getOwnPropertyNames,\n c = Object.getOwnPropertySymbols,\n l = Object.getOwnPropertyDescriptor,\n f = Object.getPrototypeOf,\n v = Object.prototype;\n t.exports = function t(n, i, r) {\n if (\"string\" != typeof i) {\n if (v) {\n var e = f(i);\n e && e !== v && t(n, e, r);\n }\n var s = a(i);\n c && (s = s.concat(c(i)));\n for (var o = _(n), p = _(i), w = 0; w < s.length; ++w) {\n var d = s[w];\n if (!(u[d] || (r && r[d]) || (p && p[d]) || (o && o[d]))) {\n var g = l(i, d);\n try {\n h(n, d, g);\n } catch (t) {}\n }\n }\n }\n return n;\n };\n};\n","module_00905.js":"// ============================================================\n// Module ID: 905\n// ============================================================\n;(window.__modules__ = window.__modules__ || {})[905] = (t) => {\n \"use strict\";\n t.exports = \"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED\";\n};\n","module_01510.js":"// ============================================================\n// Module ID: 1510\n// ============================================================\n;(window.__modules__ = window.__modules__ || {})[1510] = (t, n, i) => {\n !(function (t, n, i, r, e) {\n \"use strict\";\n var u,\n s,\n o,\n _,\n h,\n a,\n c,\n l,\n f,\n v,\n p,\n w,\n d,\n g,\n m,\n k,\n z = n.$_$.ob,\n b = n.$_$.w4,\n q = i.$_$.e,\n y = n.$_$.he,\n $ = n.$_$.xj,\n x = n.$_$.h5,\n j = n.$_$.o1,\n S = n.$_$.gd,\n C = i.$_$.d,\n E = n.$_$.r5,\n T = n.$_$.ud,\n I = i.$_$.f,\n A = n.$_$.nf,\n R = r.$_$.s1,\n P = e.$_$.n,\n N = n.$_$.rf,\n M = n.$_$.dd,\n O = n.$_$.sj,\n D = i.$_$.r,\n L = i.$_$.b,\n B = e.$_$.f,\n U = n.$_$.yb,\n F = n.$_$.c,\n G = e.$_$.f1,\n H = n.$_$.ge,\n W = e.$_$.l,\n V = n.$_$.nj,\n K = n.$_$.ke;\n function Y(t) {\n var n = t.zuy_1;\n if (null != n) return n;\n z(\"codec_appId\");\n }\n function X() {}\n function J() {}\n function Z(t) {\n var n = t.cuz_1;\n if (null != n) return n;\n z(\"codec_questToAchievementMap\");\n }\n function Q() {}\n function tt(t) {\n var n = t.fuz_1;\n if (null != n) return n;\n z(\"codec_itemIdMap\");\n }\n function nt() {}\n function it() {\n ((this.iuz_1 = new R(A(I), null)), (this.juz_1 = new R(A(P), null)));\n }\n function rt() {\n (B.call(this),\n (this.nuz_1 = new R(A(I), null)),\n (this.ouz_1 = new R(A(P), null)),\n (this.quz_1 = new O(-621796162, 1132145095)),\n (this.ruz_1 = new O(1635469714, 1785333818)),\n (this.suz_1 = new O(-773564903, 1989636776)),\n (this.tuz_1 = new O(497901439, 366177258)),\n this.tay(),\n (this.uuz_1 = this.quz_1));\n }\n function et(t) {\n var n = N;\n return t.xuz_1.e2b(\n t,\n M(\n \"protocol\",\n 1,\n n,\n function (t) {\n return et(t);\n },\n null,\n ),\n );\n }\n function ut() {\n ((this.xuz_1 = new R(A(I), null)), (this.zuz_1 = new O(-1272608814, 1097348888)));\n }\n function st() {\n return ((t = H(y(ot))), ot.call(t), t);\n var t;\n }\n function ot() {}\n function _t(t) {\n var n = N;\n return t.fv0_1.e2b(\n t,\n M(\n \"protocol\",\n 1,\n n,\n function (t) {\n return _t(t);\n },\n null,\n ),\n );\n }\n function ht(t) {\n var n = N;\n return t.gv0_1.e2b(\n t,\n M(\n \"modelRegistry\",\n Line truncated
|
||||
{"version":"d033b7162e9fa34f","base":"/play/static/js/unpacked/","count":127,"files":{"module_00806.js":"// ============================================================\n// Module ID: 806\n// ============================================================\n;(window.__modules__ = window.__modules__ || {})[806] = (t, n, i) => {\n \"use strict\";\n var r = i(19487),\n e = {\n childContextTypes: !0,\n contextType: !0,\n contextTypes: !0,\n defaultProps: !0,\n displayName: !0,\n getDefaultProps: !0,\n getDerivedStateFromError: !0,\n getDerivedStateFromProps: !0,\n mixins: !0,\n propTypes: !0,\n type: !0,\n },\n u = { name: !0, length: !0, prototype: !0, caller: !0, callee: !0, arguments: !0, arity: !0 },\n s = { $$typeof: !0, compare: !0, defaultProps: !0, displayName: !0, propTypes: !0, type: !0 },\n o = {};\n function _(t) {\n return r.isMemo(t) ? s : o[t.$$typeof] || e;\n }\n ((o[r.ForwardRef] = { $$typeof: !0, render: !0, defaultProps: !0, displayName: !0, propTypes: !0 }),\n (o[r.Memo] = s));\n var h = Object.defineProperty,\n a = Object.getOwnPropertyNames,\n c = Object.getOwnPropertySymbols,\n l = Object.getOwnPropertyDescriptor,\n f = Object.getPrototypeOf,\n v = Object.prototype;\n t.exports = function t(n, i, r) {\n if (\"string\" != typeof i) {\n if (v) {\n var e = f(i);\n e && e !== v && t(n, e, r);\n }\n var s = a(i);\n c && (s = s.concat(c(i)));\n for (var o = _(n), p = _(i), w = 0; w < s.length; ++w) {\n var d = s[w];\n if (!(u[d] || (r && r[d]) || (p && p[d]) || (o && o[d]))) {\n var g = l(i, d);\n try {\n h(n, d, g);\n } catch (t) {}\n }\n }\n }\n return n;\n };\n};\n","module_00905.js":"// ============================================================\n// Module ID: 905\n// ============================================================\n;(window.__modules__ = window.__modules__ || {})[905] = (t) => {\n \"use strict\";\n t.exports = \"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED\";\n};\n","module_01510.js":"// ============================================================\n// Module ID: 1510\n// ============================================================\n;(window.__modules__ = window.__modules__ || {})[1510] = (t, n, i) => {\n !(function (t, n, i, r, e) {\n \"use strict\";\n var u,\n s,\n o,\n _,\n h,\n a,\n c,\n l,\n f,\n v,\n p,\n w,\n d,\n g,\n m,\n k,\n z = n.$_$.ob,\n b = n.$_$.w4,\n q = i.$_$.e,\n y = n.$_$.he,\n $ = n.$_$.xj,\n x = n.$_$.h5,\n j = n.$_$.o1,\n S = n.$_$.gd,\n C = i.$_$.d,\n E = n.$_$.r5,\n T = n.$_$.ud,\n I = i.$_$.f,\n A = n.$_$.nf,\n R = r.$_$.s1,\n P = e.$_$.n,\n N = n.$_$.rf,\n M = n.$_$.dd,\n O = n.$_$.sj,\n D = i.$_$.r,\n L = i.$_$.b,\n B = e.$_$.f,\n U = n.$_$.yb,\n F = n.$_$.c,\n G = e.$_$.f1,\n H = n.$_$.ge,\n W = e.$_$.l,\n V = n.$_$.nj,\n K = n.$_$.ke;\n function Y(t) {\n var n = t.zuy_1;\n if (null != n) return n;\n z(\"codec_appId\");\n }\n function X() {}\n function J() {}\n function Z(t) {\n var n = t.cuz_1;\n if (null != n) return n;\n z(\"codec_questToAchievementMap\");\n }\n function Q() {}\n function tt(t) {\n var n = t.fuz_1;\n if (null != n) return n;\n z(\"codec_itemIdMap\");\n }\n function nt() {}\n function it() {\n ((this.iuz_1 = new R(A(I), null)), (this.juz_1 = new R(A(P), null)));\n }\n function rt() {\n (B.call(this),\n (this.nuz_1 = new R(A(I), null)),\n (this.ouz_1 = new R(A(P), null)),\n (this.quz_1 = new O(-621796162, 1132145095)),\n (this.ruz_1 = new O(1635469714, 1785333818)),\n (this.suz_1 = new O(-773564903, 1989636776)),\n (this.tuz_1 = new O(497901439, 366177258)),\n this.tay(),\n (this.uuz_1 = this.quz_1));\n }\n function et(t) {\n var n = N;\n return t.xuz_1.e2b(\n t,\n M(\n \"protocol\",\n 1,\n n,\n function (t) {\n return et(t);\n },\n null,\n ),\n );\n }\n function ut() {\n ((this.xuz_1 = new R(A(I), null)), (this.zuz_1 = new O(-1272608814, 1097348888)));\n }\n function st() {\n return ((t = H(y(ot))), ot.call(t), t);\n var t;\n }\n function ot() {}\n function _t(t) {\n var n = N;\n return t.fv0_1.e2b(\n t,\n M(\n \"protocol\",\n 1,\n n,\n function (t) {\n return _t(t);\n },\n null,\n ),\n );\n }\n function ht(t) {\n var n = N;\n return t.gv0_1.e2b(\n t,\n M(\n \"modelRegistry\",\n Line truncated
|
||||
@@ -137037,14 +137037,14 @@
|
||||
}
|
||||
})(0, e),
|
||||
(function (t, n) {
|
||||
var i = tO.f7s_1,
|
||||
r = iO(Nq(nO)).s7j();
|
||||
if (null != i && 0 !== Mx(i)) {
|
||||
oVt(0, n);
|
||||
var e = pVt,
|
||||
u = Dq.xut(e);
|
||||
(u.tuv().jp8(yVt().k1lx()), u.dap("SRV: " + i + " " + r), n.cap(u.c9l()));
|
||||
}
|
||||
// 本地镜像不走 balancer,tO.f7s_1(serverVersion)恒为 null,原条件会导致整段 SRV 不显示。
|
||||
// 这里改为「有 serverId 就显示」,并统一显示成 CN1 / CN2。
|
||||
var r = iO(Nq(nO)).s7j();
|
||||
var Id = Number(window.__HORNET_SRV__) > 0 ? Number(window.__HORNET_SRV__) : (Number(r) > 0 ? Number(r) : 1);
|
||||
oVt(0, n);
|
||||
var e = pVt,
|
||||
u = Dq.xut(e);
|
||||
(u.tuv().jp8(yVt().k1lx()), u.dap("SRV: CN" + Id), n.cap(u.c9l()));
|
||||
})(0, e),
|
||||
(function (t, n) {
|
||||
var i,
|
||||
|
||||
Reference in new issue
Block a user