Skip to content

Commit dd3f252

Browse files
committed
Use bbb-meta-room-handler's value as a prefix for meetingId on BBB
In case this user tag is set, its value will be used as a prefix for the meetingID used on BigBlueButton's meetings.
1 parent a5c1c5e commit dd3f252

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

back/src/Services/SocketManager.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ export class SocketManager {
891891
user: User,
892892
joinBBBMeetingQuery: JoinBBBMeetingQuery
893893
): Promise<JoinBBBMeetingAnswer> {
894-
const meetingId = joinBBBMeetingQuery.meetingId;
894+
let meetingId = joinBBBMeetingQuery.meetingId;
895895
const localMeetingId = joinBBBMeetingQuery.localMeetingId;
896896
const meetingName = joinBBBMeetingQuery.meetingName;
897897
const bbbSettings = gameRoom.getBbbSettings();
@@ -917,6 +917,21 @@ export class SocketManager {
917917
}
918918
}
919919

920+
// Fetch metadata from user tags
921+
const metadata = user.tags
922+
.filter((tag) => tag.startsWith("bbb-meta-"))
923+
.map((tag) => tag.replace("bbb-meta-", "meta_"));
924+
const metadataHash: Record<string, string> = {};
925+
metadata.forEach((item) => {
926+
const [key, value] = item.split("=");
927+
metadataHash[key] = value;
928+
});
929+
930+
// Use the room-handler tag to prefix the meetingId
931+
if (metadataHash["meta_room-handler"]) {
932+
meetingId = `${metadataHash["meta_room-handler"]}-${meetingId}`;
933+
}
934+
920935
const api = BigbluebuttonJs.api(bbbSettings.url, bbbSettings.secret);
921936
// It seems bbb-api is limiting password length to 50 chars
922937
const maxPWLen = 50;
@@ -933,14 +948,6 @@ export class SocketManager {
933948

934949
// This is idempotent, so we call it on each join in order to be sure that the meeting exists.
935950
const createOptions = { attendeePW, moderatorPW, record: true };
936-
const metadata = user.tags
937-
.filter((tag) => tag.startsWith("bbb-meta-"))
938-
.map((tag) => tag.replace("bbb-meta-", "meta_"));
939-
const metadataHash: Record<string, string> = {};
940-
metadata.forEach((item) => {
941-
const [key, value] = item.split("=");
942-
metadataHash[key] = value;
943-
});
944951

945952
const createURL = api.administration.create(meetingName, meetingId, { ...createOptions, ...metadataHash });
946953
await BigbluebuttonJs.http(createURL);

0 commit comments

Comments
 (0)