-
Notifications
You must be signed in to change notification settings - Fork 13.9k
feat: add BigBlueButton video integration #29483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
rjnevins
wants to merge
6
commits into
calcom:main
Choose a base branch
from
rjnevins:bounty/calcom-bigbluebutton-worktree
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3cd6df2
feat: add BigBlueButton conferencing app
b6058b0
fix: harden BigBlueButton app install flow
fe8170c
fix: clean BigBlueButton app file endings
1495b00
fix: address CodeRabbit review comments on BigBlueButton integration
f719611
fix: use ErrorWithCode in VideoApiAdapter updateMeeting guard
cbba79f
fix: pre-push review findings — join URL, deleteMeeting idempotency, …
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| BigBlueButton is an open-source web conferencing system built for online learning and webinars. | ||
|
|
||
| This integration lets Cal.com create a BigBlueButton meeting URL for bookings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import type { AppMeta } from "@calcom/types/App"; | ||
|
|
||
| export const metadata = { | ||
| name: "BigBlueButton", | ||
| description: "Open-source video conferencing for online learning and webinars.", | ||
| installed: true, | ||
| type: "bigbluebutton_video", | ||
| variant: "conferencing", | ||
| categories: ["conferencing"], | ||
| logo: "icon.svg", | ||
| publisher: "Cal.diy", | ||
| url: "https://bigbluebutton.org/", | ||
| slug: "bigbluebutton", | ||
| title: "BigBlueButton", | ||
| isGlobal: false, | ||
| email: "help@cal.com", | ||
| appData: { | ||
| location: { | ||
| linkType: "dynamic", | ||
| type: "integrations:bigbluebutton", | ||
| label: "BigBlueButton", | ||
| }, | ||
| }, | ||
| dirName: "bigbluebutton", | ||
| concurrentMeetings: true, | ||
| isOAuth: false, | ||
| } as AppMeta; | ||
|
|
||
| export default metadata; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| import { throwIfNotHaveAdminAccessToTeam } from "@calcom/app-store/_utils/throwIfNotHaveAdminAccessToTeam"; | ||
| import { ErrorCode } from "@calcom/lib/errorCodes"; | ||
| import { ErrorWithCode } from "@calcom/lib/errors"; | ||
| import { getServerErrorFromUnknown } from "@calcom/lib/server/getServerErrorFromUnknown"; | ||
| import prisma from "@calcom/prisma"; | ||
| import type { NextApiRequest, NextApiResponse } from "next"; | ||
| import getInstalledAppPath from "../../_utils/getInstalledAppPath"; | ||
|
|
||
| const getSingleQueryValue = (value: string | string[] | undefined) => | ||
| Array.isArray(value) ? value[0] : value; | ||
|
|
||
| const getTeamId = (value: string | string[] | undefined) => { | ||
| const rawTeamId = getSingleQueryValue(value); | ||
| if (!rawTeamId) { | ||
| return null; | ||
| } | ||
|
|
||
| if (!/^\d+$/.test(rawTeamId)) { | ||
| throw new ErrorWithCode(ErrorCode.BadRequest, "Invalid teamId"); | ||
| } | ||
|
|
||
| return Number(rawTeamId); | ||
| }; | ||
|
|
||
| const getSafeReturnTo = (value: string | string[] | undefined) => { | ||
| const returnTo = getSingleQueryValue(value); | ||
| if ( | ||
| !returnTo || | ||
| !returnTo.startsWith("/") || | ||
| returnTo.startsWith("//") || | ||
| /^[a-z][a-z\d+.-]*:/i.test(returnTo) | ||
| ) { | ||
| return getInstalledAppPath({ | ||
| variant: "conferencing", | ||
| slug: "bigbluebutton", | ||
| }); | ||
| } | ||
|
|
||
| return returnTo; | ||
| }; | ||
|
|
||
| export default async function handler( | ||
| req: NextApiRequest, | ||
| res: NextApiResponse, | ||
| ) { | ||
| if (req.method !== "POST") { | ||
| return res.status(405).json({ message: "Method Not Allowed" }); | ||
| } | ||
|
|
||
| if (!req.session?.user?.id) { | ||
| return res | ||
| .status(401) | ||
| .json({ message: "You must be logged in to do this" }); | ||
| } | ||
|
|
||
| const { teamId, returnTo } = req.query; | ||
|
|
||
| try { | ||
| const teamIdNumber = getTeamId(teamId); | ||
|
|
||
| await throwIfNotHaveAdminAccessToTeam({ | ||
| teamId: teamIdNumber, | ||
| userId: req.session.user.id, | ||
| }); | ||
|
|
||
| const installForObject = teamIdNumber | ||
| ? { teamId: teamIdNumber } | ||
| : { userId: req.session.user.id }; | ||
| const appType = "bigbluebutton_video"; | ||
|
|
||
| const alreadyInstalled = await prisma.credential.findFirst({ | ||
| where: { | ||
| type: appType, | ||
| ...installForObject, | ||
| }, | ||
| select: { | ||
| id: true, | ||
| }, | ||
| }); | ||
|
|
||
| if (alreadyInstalled) { | ||
| throw new ErrorWithCode(ErrorCode.BookingConflict, "Already installed"); | ||
| } | ||
|
|
||
| const installation = await prisma.credential.create({ | ||
| data: { | ||
| type: appType, | ||
| key: {}, | ||
| ...installForObject, | ||
| appId: "bigbluebutton", | ||
| }, | ||
| select: { | ||
| id: true, | ||
| }, | ||
| }); | ||
|
|
||
| if (!installation) { | ||
| throw new ErrorWithCode( | ||
| ErrorCode.InternalServerError, | ||
| "Unable to create user credential for bigbluebutton", | ||
| ); | ||
| } | ||
| } catch (error: unknown) { | ||
| const httpError = getServerErrorFromUnknown(error); | ||
| return res | ||
| .status(httpError.statusCode) | ||
| .json({ message: httpError.message }); | ||
| } | ||
|
|
||
| return res.status(200).json({ | ||
| url: getSafeReturnTo(returnTo), | ||
| }); | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { default as add } from "./add"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export { metadata } from "./_metadata"; | ||
| export * as api from "./api"; | ||
| export * as lib from "./lib"; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Localize the location label.
appData.location.labelis a user-facing string, so hardcoding"BigBlueButton"here skips the app’s i18n flow. Please add it topackages/i18n/locales/en/common.jsonand reference the translated value instead.As per coding guidelines, "
**/*.{ts,tsx,jsx}: Add translations topackages/i18n/locales/en/common.jsonfor all UI strings".🤖 Prompt for AI Agents