Compare commits

..

2 Commits

Author SHA1 Message Date
FloppyMacguffum
56a186aa39
Merge cd9f8756ee into 1687d30417 2024-11-29 01:48:04 -08:00
FloppyMacguffum
cd9f8756ee Switched to literal regex notation for some MOTD logic, no temp object on ping 2024-11-28 21:56:48 -08:00

View File

@ -30,6 +30,7 @@ import { SkinServer } from "./skins/SkinServer.js";
let instanceCount = 0;
const chalk = new Chalk({ level: 2 });
const motdMatcher = /accept: motd/i;
export class Proxy extends EventEmitter {
public packetRegistry: Map<
@ -189,7 +190,7 @@ export class Proxy extends EventEmitter {
}
}, this.LOGIN_TIMEOUT);
try {
if (new RegExp("accept: motd", "i").test(firstPacket.toString())) {
if (motdMatcher.test(firstPacket.toString())) {
if (!this.ratelimit.motd.consume(req.socket.remoteAddress).success) {
return ws.close();
}