Add private chat to multiplayer rooms
This commit is contained in:
@@ -43,6 +43,27 @@ export type Database = {
|
||||
};
|
||||
public: {
|
||||
Tables: {
|
||||
multiplayer_messages: {
|
||||
Row: {
|
||||
id: number;
|
||||
room_id: string;
|
||||
player_id: string;
|
||||
client_id: string;
|
||||
display_name: string;
|
||||
body: string;
|
||||
created_at: string;
|
||||
};
|
||||
Insert: {
|
||||
room_id: string;
|
||||
player_id: string;
|
||||
client_id: string;
|
||||
display_name: string;
|
||||
body: string;
|
||||
created_at?: string;
|
||||
};
|
||||
Update: { body?: string };
|
||||
Relationships: [];
|
||||
};
|
||||
multiplayer_rooms: {
|
||||
Row: {
|
||||
id: string;
|
||||
@@ -668,6 +689,15 @@ export type Database = {
|
||||
};
|
||||
Returns: Json;
|
||||
};
|
||||
multiplayer_chat: {
|
||||
Args: {
|
||||
p_room: string;
|
||||
p_access_hash: string;
|
||||
p_text: string | null;
|
||||
p_client_id: string | null;
|
||||
};
|
||||
Returns: Json;
|
||||
};
|
||||
legacy_password_needed: { Args: { p_user: string }; Returns: boolean };
|
||||
claim_legacy_password: { Args: { p_user: string }; Returns: boolean };
|
||||
set_beta_badge: {
|
||||
|
||||
@@ -700,5 +700,19 @@
|
||||
"This map is not ready to export": "Эта карта ещё не готова к экспорту",
|
||||
"Could not export map": "Не удалось экспортировать карту",
|
||||
"Could not import map": "Не удалось импортировать карту",
|
||||
"Close": "Закрыть"
|
||||
"Close": "Закрыть",
|
||||
"Room chat": "Чат комнаты",
|
||||
"Chat": "Чат",
|
||||
"Close chat": "Закрыть чат",
|
||||
"Chat messages": "Сообщения чата",
|
||||
"Message": "Сообщение",
|
||||
"Message your teammates…": "Сообщение друзьям…",
|
||||
"Send message": "Отправить сообщение",
|
||||
"Say hello to your teammates.": "Поздоровайтесь с друзьями.",
|
||||
"{count} unread messages": "Непрочитанных сообщений: {count}",
|
||||
"Write a message of 1–500 characters without hidden controls": "Напишите сообщение от 1 до 500 символов без скрытых управляющих символов",
|
||||
"Chat permission requires joining this room": "Чтобы пользоваться чатом, войдите в эту комнату",
|
||||
"Chat is unavailable in a closed or expired room": "Чат недоступен в закрытой комнате или комнате с истёкшим сроком",
|
||||
"Too many chat messages. Wait a moment and try again.": "Слишком много сообщений. Подождите немного и попробуйте снова.",
|
||||
"Invalid chat message": "Недопустимое сообщение чата"
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user