This looks like something that should work

This commit is contained in:
MDMCK10
2023-03-27 01:05:18 +02:00
committed by GitHub
parent 7295da7cac
commit 81ed711fac

View File

@@ -212,7 +212,7 @@ export default class WSServer {
var msg = Utilities.HTMLSanitize(msgArr[1]); var msg = Utilities.HTMLSanitize(msgArr[1]);
// One of the things I hated most about the old server is it completely discarded your message if it was too long // One of the things I hated most about the old server is it completely discarded your message if it was too long
if (msg.length > this.Config.collabvm.maxChatLength) msg = msg.substring(0, this.Config.collabvm.maxChatLength); if (msg.length > this.Config.collabvm.maxChatLength) msg = msg.substring(0, this.Config.collabvm.maxChatLength);
if (msg.length < 1) return; if (msg.trim().length < 1) return;
//@ts-ignore //@ts-ignore
this.clients.forEach(c => c.sendMsg(guacutils.encode("chat", client.username, msg))); this.clients.forEach(c => c.sendMsg(guacutils.encode("chat", client.username, msg)));
this.ChatHistory.push({user: client.username, msg: msg}); this.ChatHistory.push({user: client.username, msg: msg});
@@ -500,7 +500,7 @@ export default class WSServer {
status = "1"; status = "1";
} }
} else } else
if (!/^[a-zA-Z0-9\ \-\_\.]+$/.test(newName) || newName.length > 20 || newName.length < 3) { if (!/^[a-zA-Z0-9\ \-\_\.]+$/.test(newName) || newName.length > 20 || newName.trim().length < 3) {
client.assignGuestName(this.getUsernameList()); client.assignGuestName(this.getUsernameList());
status = "2"; status = "2";
} else } else