backend: simplify participant identity generation by using participant name directly
This commit is contained in:
parent
ca90a03b9a
commit
e1fd2a343b
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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 = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user