fix ip detection

This commit is contained in:
not-nullptr 2024-03-19 18:21:16 +00:00
parent 2a92663299
commit db626df718

View file

@ -58,7 +58,7 @@ export async function POST({ request, getClientAddress }) {
}, },
], ],
maxPlayers: body.maxPlayers, 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, host: user,
hasPassword: body.hasPassword || false, hasPassword: body.hasPassword || false,
}); });