Skip to content

Commit 010c3df

Browse files
committed
Add BigBlueButton adapter documentation
1 parent bf5c548 commit 010c3df

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

packages/app-store/bigbluebutton/api/add.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import type { NextApiRequest, NextApiResponse } from "next";
55
import getInstalledAppPath from "../../_utils/getInstalledAppPath";
66
import { metadata } from "../_metadata";
77

8+
/**
9+
* Installs the BigBlueButton conferencing app for the current user or team.
10+
*/
811
export default async function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
912
if (!req.session?.user?.id) {
1013
res.status(401).json({ message: "You must be logged in to do this" });

packages/app-store/bigbluebutton/lib/VideoApiAdapter.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@ type BigBlueButtonKeys = {
1515
const ATTENDEE_PASSWORD = "attendee";
1616
const MODERATOR_PASSWORD = "moderator";
1717

18+
/**
19+
* Reads and validates the configured BigBlueButton server URL and shared secret.
20+
*/
1821
const getBigBlueButtonKeys = async (): Promise<BigBlueButtonKeys> =>
1922
appKeysSchema.parse(await getAppKeysFromSlug(metadata.slug));
2023

24+
/**
25+
* Ensures a configured BigBlueButton host points at its API endpoint.
26+
*/
2127
const normalizeServerUrl = (serverUrl: string): URL => {
2228
const url = new URL(serverUrl);
2329

@@ -28,9 +34,15 @@ const normalizeServerUrl = (serverUrl: string): URL => {
2834
return url;
2935
};
3036

37+
/**
38+
* Builds the SHA-1 checksum required by BigBlueButton API calls.
39+
*/
3140
const createChecksum = (callName: string, query: string, sharedSecret: string): string =>
3241
createHash("sha1").update(`${callName}${query}${sharedSecret}`).digest("hex");
3342

43+
/**
44+
* Creates a signed BigBlueButton API URL for the given call and parameters.
45+
*/
3446
const createApiUrl = ({
3547
callName,
3648
params,
@@ -52,6 +64,9 @@ const createApiUrl = ({
5264
return apiUrl.toString();
5365
};
5466

67+
/**
68+
* Calls BigBlueButton and treats non-success API responses as failures.
69+
*/
5570
const callBigBlueButtonApi = async (url: string): Promise<void> => {
5671
const response = await fetch(url);
5772
const body = await response.text();
@@ -61,10 +76,19 @@ const callBigBlueButtonApi = async (url: string): Promise<void> => {
6176
}
6277
};
6378

79+
/**
80+
* Reuses an existing booking reference when updating or creates a stable booking meeting id.
81+
*/
6482
const getMeetingId = (eventData: CalendarEvent, bookingRef?: PartialReference): string =>
6583
String(bookingRef?.meetingId || eventData.uid || randomUUID());
6684

85+
/**
86+
* Creates the Cal.com video adapter used to manage BigBlueButton meetings.
87+
*/
6788
const BigBlueButtonVideoApiAdapter = (): VideoApiAdapter => {
89+
/**
90+
* Creates or updates a BigBlueButton meeting and returns the attendee join link.
91+
*/
6892
const createOrUpdateMeeting = async (
6993
eventData: CalendarEvent,
7094
bookingRef?: PartialReference

0 commit comments

Comments
 (0)