Commit f6fd96fa authored by nanahira's avatar nanahira

fix

parent 1d74fcc8
Pipeline #43475 passed with stages
in 3 minutes and 34 seconds
...@@ -41,17 +41,21 @@ export class ClientHandler { ...@@ -41,17 +41,21 @@ export class ClientHandler {
async init() { async init() {
this.ctx this.ctx
.middleware(YGOProCtosExternalAddress, async (msg, client, next) => { .middleware(YGOProCtosExternalAddress, async (msg, client, next) => {
client.hostname = msg.hostname?.split(':')[0] || '';
if (client.ip) { if (client.ip) {
// ws/reverse-ws should already have IP from connection metadata, skip overwrite // ws/reverse-ws should already have IP from connection metadata, skip overwrite
return next(); return next();
} }
await this.ctx if (
.get(() => IpResolver) await this.ctx
.setClientIp( .get(() => IpResolver)
client, .setClientIp(
msg.real_ip === '0.0.0.0' ? undefined : msg.real_ip, client,
); msg.real_ip === '0.0.0.0' ? undefined : msg.real_ip,
client.hostname = msg.hostname?.split(':')[0] || ''; )
) {
return;
}
return next(); return next();
}) })
.middleware(YGOProCtosPlayerInfo, async (msg, client, next) => { .middleware(YGOProCtosPlayerInfo, async (msg, client, next) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment