This commit is contained in:
Holly Stubbs 2024-04-26 11:35:32 +01:00
parent 0c34cd0fab
commit deb31424e8
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E

View file

@ -413,19 +413,17 @@ websocketServer.on("connection", (socket) => {
const reader = createReader(Endian.LE, data as Buffer); const reader = createReader(Endian.LE, data as Buffer);
// There is absolutely no reason we should ever get // There is absolutely no reason we should ever get
// more than 50 bytes legit. // more than 50 bytes legit.
if (reader.length > 0 && reader.length < 50) { if (reader.length > 0 && reader.length < 1024) {
switch (reader.readUByte()) { switch (reader.readByte()) {
case MessageType.ClientDetails: case MessageType.ClientDetails:
{ {
if (user !== undefined) { if (user !== undefined) {
Console.printInfo("Tried to ClientDetails when already connected and ready!");
return; return;
} }
const apiKey = reader.readShortString(); const apiKey = reader.readShortString();
const rawURL = reader.readString(); const rawURL = reader.readString();
const dbUser = await UserService.GetUserByAPIKey(apiKey); const dbUser = await UserService.GetUserByAPIKey(apiKey);
if (dbUser == null) { if (dbUser == null) {
Console.printInfo("User for apiKey " + apiKey + " was null!");
return; return;
} }
const dbUserParty = await UserService.GetActiveParty(dbUser.Id); const dbUserParty = await UserService.GetActiveParty(dbUser.Id);