From db626df71848376b1d11a1199624f318dd9646db Mon Sep 17 00:00:00 2001 From: not-nullptr Date: Tue, 19 Mar 2024 18:21:16 +0000 Subject: [PATCH] fix ip detection --- src/routes/lobby/+server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/lobby/+server.ts b/src/routes/lobby/+server.ts index f457498..9db5355 100644 --- a/src/routes/lobby/+server.ts +++ b/src/routes/lobby/+server.ts @@ -58,7 +58,7 @@ export async function POST({ request, getClientAddress }) { }, ], maxPlayers: body.maxPlayers, - ip: `${opts.ip || getClientAddress().split(":").at(-1)}:${body.port}`, + ip: `${opts.ip || request.headers.get("CF-Connecting-IP") || request.headers.get("X-Forwarded-For") || getClientAddress().split(":").at(-1)}:${body.port}`, host: user, hasPassword: body.hasPassword || false, });