add some debug info

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

View file

@ -416,12 +416,16 @@ websocketServer.on("connection", (socket) => {
if (reader.length > 0 && reader.length < 50) { if (reader.length > 0 && reader.length < 50) {
switch (reader.readUByte()) { switch (reader.readUByte()) {
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 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);
@ -430,7 +434,6 @@ websocketServer.on("connection", (socket) => {
dbParty = await UserService.GetParty(dbUserParty.PartyId); dbParty = await UserService.GetParty(dbUserParty.PartyId);
} }
const rawURL = reader.readString();
let page = rawURL.toLowerCase().replace(".htm", "").replace(".html", ""); let page = rawURL.toLowerCase().replace(".htm", "").replace(".html", "");
if (page === "index") { if (page === "index") {
page = ""; page = "";
@ -456,6 +459,7 @@ websocketServer.on("connection", (socket) => {
user.send(usersToSend.toBuffer()); user.send(usersToSend.toBuffer());
sendGroupUpdate(user); sendGroupUpdate(user);
break; break;
}
case MessageType.CursorPos: case MessageType.CursorPos:
{ {
if (user === undefined) { if (user === undefined) {