From e1fd2a343b3064b5703f39f64f96853f05d395be Mon Sep 17 00:00:00 2001 From: juancarmore Date: Fri, 22 Aug 2025 22:46:43 +0200 Subject: [PATCH] backend: simplify participant identity generation by using participant name directly --- backend/src/services/participant.service.ts | 10 +++++----- backend/src/services/token.service.ts | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/backend/src/services/participant.service.ts b/backend/src/services/participant.service.ts index c4e2b37..dc93360 100644 --- a/backend/src/services/participant.service.ts +++ b/backend/src/services/participant.service.ts @@ -9,10 +9,7 @@ import { inject, injectable } from 'inversify'; import { ParticipantInfo } from 'livekit-server-sdk'; import { MeetRoomHelper } from '../helpers/room.helper.js'; import { validateMeetTokenMetadata } from '../middlewares/index.js'; -import { - errorParticipantIdentityNotProvided, - errorParticipantNotFound -} from '../models/error.model.js'; +import { errorParticipantIdentityNotProvided, errorParticipantNotFound } from '../models/error.model.js'; import { FrontendEventService, LiveKitService, @@ -81,7 +78,10 @@ export class ParticipantService { const role = await this.roomService.getRoomRoleBySecret(roomId, secret); const token = await this.generateParticipantToken(finalParticipantOptions, role, currentRoles); - this.logger.verbose(`Participant token generated for room '${roomId}' with name '${finalParticipantName}'`); + this.logger.verbose( + `Participant token generated for room '${roomId}'` + + (finalParticipantName ? ` with name '${finalParticipantName}'` : '') + ); return token; } diff --git a/backend/src/services/token.service.ts b/backend/src/services/token.service.ts index eab5b66..8579e25 100644 --- a/backend/src/services/token.service.ts +++ b/backend/src/services/token.service.ts @@ -55,9 +55,7 @@ export class TokenService { let { participantIdentity } = participantOptions; if (participantName && !participantIdentity) { - // Generate participant identity based on name and unique ID - const identityPrefix = participantName.replace(/\s+/g, ''); // Remove all spaces - participantIdentity = `${identityPrefix}-${uid(8)}`; + participantIdentity = participantName; } const metadata: MeetTokenMetadata = {