Add private chat to multiplayer rooms

This commit is contained in:
2026-10-08 10:22:19 +05:00
parent 1307436e65
commit 36e8d11eb4
14 changed files with 810 additions and 4 deletions

View File

@@ -9,6 +9,28 @@ export const createRoomSchema = z.object({
playerLimit: z.number().int().min(2).max(16),
});
export const joinRoomSchema = z.object({ displayName: displayNameSchema });
export const chatMessageSchema = z.object({
clientId: z.string().uuid(),
text: z
.string()
.trim()
.min(1)
.max(500)
.refine(
(text) =>
!/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/u.test(text),
"Messages cannot contain hidden controls",
),
});
export type RoomChat = {
messages: {
id: string;
playerId: string;
name: string;
text: string;
createdAt: string;
}[];
};
export const roomRoundSchema = z.object({
round: z.number().int().min(0).max(4),
});