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);
// There is absolutely no reason we should ever get
// more than 50 bytes legit.
if (reader.length > 0 && reader.length < 50) {
switch (reader.readUByte()) {
if (reader.length > 0 && reader.length < 1024) {
switch (reader.readByte()) {
case MessageType.ClientDetails:
{
if (user !== undefined) {
Console.printInfo("Tried to ClientDetails when already connected and ready!");
return;
}
const apiKey = reader.readShortString();
const rawURL = reader.readString();
const dbUser = await UserService.GetUserByAPIKey(apiKey);
if (dbUser == null) {
Console.printInfo("User for apiKey " + apiKey + " was null!");
return;
}
const dbUserParty = await UserService.GetActiveParty(dbUser.Id);