From 6d1f75f229b7094f31bd55849d5710d17f9549ba Mon Sep 17 00:00:00 2001 From: Burial0268 Date: Thu, 12 Feb 2026 18:59:32 +0800 Subject: [PATCH] fix(server): Correctly inject client IP into request parameters --- server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 83133e9..25545b8 100644 --- a/server.js +++ b/server.js @@ -227,6 +227,7 @@ async function consturctServer(moduleDefs) { const moduleResponse = await moduleDef.module(query, (...params) => { // 参数注入客户端IP const obj = [...params] + // 获取请求中的 IP 参数 let ip = req.ip if (ip.substring(0, 7) == '::ffff:') { @@ -236,8 +237,8 @@ async function consturctServer(moduleDefs) { ip = global.cnIp } // logger.info('Requested from ip:', ip) - obj[3] = { - ...obj[3], + obj[2] = { + ...obj[2], ip, } return request(...obj)