From 09ba892d952d3e717c7d0adb4b910a24bf13a67d Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Tue, 6 May 2025 17:17:08 +0200 Subject: [PATCH] backend: Remove createdBy field from rom metadata and related code --- .../src/services/livekit-webhook.service.ts | 2 +- backend/src/services/room.service.ts | 2 -- backend/tests/helpers/request-helpers.ts | 24 ------------------- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/backend/src/services/livekit-webhook.service.ts b/backend/src/services/livekit-webhook.service.ts index 0434548..79305c3 100644 --- a/backend/src/services/livekit-webhook.service.ts +++ b/backend/src/services/livekit-webhook.service.ts @@ -1,7 +1,7 @@ import { MeetRecordingInfo, MeetRecordingStatus } from '@typings-ce'; import { inject, injectable } from 'inversify'; import { EgressInfo, ParticipantInfo, Room, WebhookEvent, WebhookReceiver } from 'livekit-server-sdk'; -import { LIVEKIT_API_KEY, LIVEKIT_API_SECRET, MEET_NAME_ID } from '../environment.js'; +import { LIVEKIT_API_KEY, LIVEKIT_API_SECRET } from '../environment.js'; import { RecordingHelper } from '../helpers/index.js'; import { SystemEventType } from '../models/system-event.model.js'; import { diff --git a/backend/src/services/room.service.ts b/backend/src/services/room.service.ts index a4bc70e..b127d6a 100644 --- a/backend/src/services/room.service.ts +++ b/backend/src/services/room.service.ts @@ -12,7 +12,6 @@ import { CreateOptions, Room, SendDataOptions } from 'livekit-server-sdk'; import { uid as secureUid } from 'uid/secure'; import { uid } from 'uid/single'; import INTERNAL_CONFIG from '../config/internal-config.js'; -import { MEET_NAME_ID } from '../environment.js'; import { MeetRoomHelper, OpenViduComponentsAdapterHelper, UtilsHelper } from '../helpers/index.js'; import { errorInvalidRoomSecret, errorRoomMetadataNotFound, internalError } from '../models/error.model.js'; import { @@ -98,7 +97,6 @@ export class RoomService { const livekitRoomOptions: CreateOptions = { name: roomId, metadata: JSON.stringify({ - createdBy: MEET_NAME_ID, roomOptions: MeetRoomHelper.toOpenViduOptions(meetRoom) }) //TODO: Uncomment this when bug in LiveKit is fixed diff --git a/backend/tests/helpers/request-helpers.ts b/backend/tests/helpers/request-helpers.ts index 4b8c03d..93b4299 100644 --- a/backend/tests/helpers/request-helpers.ts +++ b/backend/tests/helpers/request-helpers.ts @@ -12,7 +12,6 @@ import { MEET_ADMIN_SECRET, MEET_ADMIN_USER, MEET_API_KEY, - MEET_NAME_ID, MEET_SECRET, MEET_USER } from '../../src/environment.js'; @@ -264,33 +263,10 @@ export const generateParticipantToken = async ( /** * Adds a fake participant to a LiveKit room for testing purposes. * - * This workflow involves three key steps: - * 1. Create the LiveKit room manually - * 2. Set room metadata to mark it as managed by OpenVidu Meet - * 3. Connect a fake participant to the room - * * @param roomId The ID of the room to join * @param participantName The name for the fake participant */ export const joinFakeParticipant = async (roomId: string, participantName: string) => { - // Step 1: Manually create the LiveKit room - // In normal operation, the room is created when a real participant requests a token, - // but for testing we need to create it ourselves since we're bypassing the token flow. - // We set a short departureTimeout (1s) to ensure the room is quickly cleaned up - // when our tests disconnect participants, preventing lingering test resources. - const createRoomCommand = `lk room create --api-key ${LIVEKIT_API_KEY} --api-secret ${LIVEKIT_API_SECRET} --departure-timeout 1 ${roomId}`; - runCommandSync(createRoomCommand); - - // Step 2: Set required room metadata - // The room must have the createdBy field set to MEET_NAME_ID so that: - // 1. OpenVidu Meet recognizes it as a managed room - // 2. The room can be properly deleted through our API later - // 3. Other OpenVidu Meet features know this room belongs to our system - const metadata = JSON.stringify({ createdBy: MEET_NAME_ID }); - const updateMetadataCommand = `lk room update --metadata '${metadata}' --api-key ${LIVEKIT_API_KEY} --api-secret ${LIVEKIT_API_SECRET} ${roomId}`; - runCommandSync(updateMetadataCommand); - - // Step 3: Join a fake participant with demo audio/video const process = spawn('lk', [ 'room', 'join',