brutalism design

This commit is contained in:
2026-05-22 05:08:02 +06:00
parent abf4d41c23
commit e4ed785911
51 changed files with 940 additions and 1171 deletions

View File

@@ -4,7 +4,6 @@ import fp from 'fastify-plugin'
import { Lucia } from 'lucia'
interface DatabaseUserAttributes {
id: string
displayName: string
username: string
createdAt: Date

View File

@@ -1,7 +1,6 @@
import { Type } from 'typebox'
export const UserSchema = Type.Object({
id: Type.String(),
username: Type.String(),
displayName: Type.String(),
createdAt: Type.String({ format: 'date-time' }),

View File

@@ -2,7 +2,7 @@ import { Type } from 'typebox'
export const ChannelSchema = Type.Object({
id: Type.String(),
ownerId: Type.Union([Type.String(), Type.Null()]),
ownerUsername: Type.Union([Type.String(), Type.Null()]),
name: Type.String(),
persistent: Type.Boolean(),
}, { $id: 'Channel' })

View File

@@ -1,19 +1,20 @@
import { Type } from 'typebox'
import { AttachmentSchema } from './attachment.ts'
export const ReplySchema = Type.Object({
messageId: Type.String({ format: 'uuid' }),
senderId: Type.String({ format: 'uuid' }),
senderUsername: Type.String(),
text: Type.String(),
}, { $id: 'Reply' })
export const ChatMessageSchema = Type.Object({
id: Type.String({ format: 'uuid' }),
senderId: Type.String({ format: 'uuid' }),
senderUsername: Type.String(),
text: Type.String({ minLength: 1 }),
createdAt: Type.String({ format: 'date-time' }),
updatedAt: Type.String({ format: 'date-time' }),
attachments: Type.Array(Type.String({ format: 'uuid' })),
attachments: Type.Array(AttachmentSchema),
}, { $id: 'ChatMessage' })
export const NewChatMessagePayloadSchema = Type.Object({

View File

@@ -2,7 +2,6 @@ import { Type } from 'typebox'
export const GetUserQuerySchema = Type.Partial(Type.Object({
username: Type.String(),
id: Type.String(),
}), { $id: 'GetUserQuery' })
export const UserPreferencesSchema = Type.Object({

View File

@@ -4,7 +4,7 @@ import type { Channel, User } from '../../prisma/generated-client/client.ts'
export interface SerializedClient {
socketId: string
userId: User['id']
username: User['username']
channelId: Channel['id']
inputMuted: boolean
outputMuted: boolean

View File

@@ -26,7 +26,7 @@ interface ClientEvents {
export class Client extends EventEmitter<ClientEvents> {
readonly socketId: string
readonly userId: string
readonly username: string
channelId: string = ''
#inputMuted = false
@@ -38,11 +38,11 @@ export class Client extends EventEmitter<ClientEvents> {
readonly #producers = new Map<string, types.Producer>()
readonly #consumers = new Map<string, types.Consumer>()
constructor(socketId: string, userId: string, router: types.Router) {
constructor(socketId: string, username: string, router: types.Router) {
super()
this.socketId = socketId
this.userId = userId
this.username = username
this.#router = router
}
@@ -278,7 +278,7 @@ export class Client extends EventEmitter<ClientEvents> {
serialize(): SerializedClient {
return {
socketId: this.socketId,
userId: this.userId,
username: this.username,
channelId: this.channelId,
inputMuted: this.#inputMuted,
outputMuted: this.#outputMuted,

View File

@@ -23,7 +23,7 @@ export default async function (fastify: FastifyInstance) {
io.on('connection', async (socket) => {
consola.info('[WebRtc]', 'Client connected', socket.id)
const client = new Client(socket.id, socket.data.user.id, mediasoupRouter)
const client = new Client(socket.id, socket.data.user.username, mediasoupRouter)
defaultChannel.addClient(client)
socket.join(defaultChannel.id)