backend: Remove createdBy field from rom metadata and related code
This commit is contained in:
parent
bcb8c82e59
commit
09ba892d95
@ -1,7 +1,7 @@
|
|||||||
import { MeetRecordingInfo, MeetRecordingStatus } from '@typings-ce';
|
import { MeetRecordingInfo, MeetRecordingStatus } from '@typings-ce';
|
||||||
import { inject, injectable } from 'inversify';
|
import { inject, injectable } from 'inversify';
|
||||||
import { EgressInfo, ParticipantInfo, Room, WebhookEvent, WebhookReceiver } from 'livekit-server-sdk';
|
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 { RecordingHelper } from '../helpers/index.js';
|
||||||
import { SystemEventType } from '../models/system-event.model.js';
|
import { SystemEventType } from '../models/system-event.model.js';
|
||||||
import {
|
import {
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import { CreateOptions, Room, SendDataOptions } from 'livekit-server-sdk';
|
|||||||
import { uid as secureUid } from 'uid/secure';
|
import { uid as secureUid } from 'uid/secure';
|
||||||
import { uid } from 'uid/single';
|
import { uid } from 'uid/single';
|
||||||
import INTERNAL_CONFIG from '../config/internal-config.js';
|
import INTERNAL_CONFIG from '../config/internal-config.js';
|
||||||
import { MEET_NAME_ID } from '../environment.js';
|
|
||||||
import { MeetRoomHelper, OpenViduComponentsAdapterHelper, UtilsHelper } from '../helpers/index.js';
|
import { MeetRoomHelper, OpenViduComponentsAdapterHelper, UtilsHelper } from '../helpers/index.js';
|
||||||
import { errorInvalidRoomSecret, errorRoomMetadataNotFound, internalError } from '../models/error.model.js';
|
import { errorInvalidRoomSecret, errorRoomMetadataNotFound, internalError } from '../models/error.model.js';
|
||||||
import {
|
import {
|
||||||
@ -98,7 +97,6 @@ export class RoomService {
|
|||||||
const livekitRoomOptions: CreateOptions = {
|
const livekitRoomOptions: CreateOptions = {
|
||||||
name: roomId,
|
name: roomId,
|
||||||
metadata: JSON.stringify({
|
metadata: JSON.stringify({
|
||||||
createdBy: MEET_NAME_ID,
|
|
||||||
roomOptions: MeetRoomHelper.toOpenViduOptions(meetRoom)
|
roomOptions: MeetRoomHelper.toOpenViduOptions(meetRoom)
|
||||||
})
|
})
|
||||||
//TODO: Uncomment this when bug in LiveKit is fixed
|
//TODO: Uncomment this when bug in LiveKit is fixed
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import {
|
|||||||
MEET_ADMIN_SECRET,
|
MEET_ADMIN_SECRET,
|
||||||
MEET_ADMIN_USER,
|
MEET_ADMIN_USER,
|
||||||
MEET_API_KEY,
|
MEET_API_KEY,
|
||||||
MEET_NAME_ID,
|
|
||||||
MEET_SECRET,
|
MEET_SECRET,
|
||||||
MEET_USER
|
MEET_USER
|
||||||
} from '../../src/environment.js';
|
} from '../../src/environment.js';
|
||||||
@ -264,33 +263,10 @@ export const generateParticipantToken = async (
|
|||||||
/**
|
/**
|
||||||
* Adds a fake participant to a LiveKit room for testing purposes.
|
* 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 roomId The ID of the room to join
|
||||||
* @param participantName The name for the fake participant
|
* @param participantName The name for the fake participant
|
||||||
*/
|
*/
|
||||||
export const joinFakeParticipant = async (roomId: string, participantName: string) => {
|
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', [
|
const process = spawn('lk', [
|
||||||
'room',
|
'room',
|
||||||
'join',
|
'join',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user