From 02242eecf6ceadf8be32466502d4ab531e7dfc65 Mon Sep 17 00:00:00 2001 From: Sunset Mikoto <26019675+SunsetMkt@users.noreply.github.com> Date: Sun, 24 May 2026 18:00:36 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20randomCNIP=20=E4=B8=8D=E5=B7=A5=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/server.js b/server.js index a28f081..dae8d7b 100644 --- a/server.js +++ b/server.js @@ -303,8 +303,13 @@ async function constructServer(moduleDefs) { // 参数注入客户端IP const obj = [...params] const options = obj[2] || {} - if (!options.randomCNIP) { - let ip = req.ip + let ip = '' + + if (options.randomCNIP) { + ip = global.cnIp + // logger.info('Using random Chinese IP for request:', ip) + } else { + ip = req.ip if (ip.substring(0, 7) == '::ffff:') { ip = ip.substring(7) @@ -313,10 +318,11 @@ async function constructServer(moduleDefs) { ip = global.cnIp } // logger.info('Requested from ip:', ip) - obj[2] = { - ...options, - ip, - } + } + + obj[2] = { + ...options, + ip, } return request(...obj)