feat: Customise JITSI Url path (#8835)
* Closes #1847 - adds an environment variable `JITSI_HOST_URL` to configure the Host URL for self hosted instances * Closes #1847 - adds an environment variable `JITSI_HOST_URL` to configure the Host URL for self hosted instances * Closes #1847 - adds an environment variable `JITSI_HOST_URL` to configure the Host URL for self hosted instances * Replace Tab with spaces * Add JITSI_HOST_URL env * Remote Tabs for Spaces * Support jitsi_host key * Remove ENV, add Interface jitsi host URL and fallback * Fix linting issues * Clean code * add missing await * Add configurable meeting slug * Refactor to jitsiHost, remove slug generator * zod default doesnt work right now. So remove it * Add replacement values and url encoding * Change Placeholder to unified values. --------- Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Hariom Balhara <hariombalhara@gmail.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com>
This commit is contained in:
parent
7a9b893931
commit
d6644bc232
|
@ -1,5 +1,6 @@
|
|||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
import type { CalendarEvent } from "@calcom/types/Calendar";
|
||||
import type { PartialReference } from "@calcom/types/EventManager";
|
||||
import type { VideoApiAdapter, VideoCallData } from "@calcom/types/VideoApiAdapter";
|
||||
|
||||
|
@ -11,19 +12,28 @@ const JitsiVideoApiAdapter = (): VideoApiAdapter => {
|
|||
getAvailability: () => {
|
||||
return Promise.resolve([]);
|
||||
},
|
||||
createMeeting: async (): Promise<VideoCallData> => {
|
||||
createMeeting: async (eventData: CalendarEvent): Promise<VideoCallData> => {
|
||||
const appKeys = await getAppKeysFromSlug(metadata.slug);
|
||||
|
||||
const meetingID = uuidv4();
|
||||
const meetingPattern = (appKeys.jitsiPathPattern as string) || "{uuid}";
|
||||
const hostUrl = (appKeys.jitsiHost as string) || "https://meet.jit.si/cal";
|
||||
|
||||
// Default Value
|
||||
const hostUrl = appKeys.jitsiHost || "https://meet.jit.si/cal";
|
||||
//Allows "/{Type}-with-{Attendees}" slug
|
||||
const meetingID = meetingPattern
|
||||
.replaceAll("{uuid}", uuidv4())
|
||||
.replaceAll("{Title}", eventData.title)
|
||||
.replaceAll("{Event Type Title}", eventData.type)
|
||||
.replaceAll("{Scheduler}", eventData.attendees.map((a) => a.name).join("-"))
|
||||
.replaceAll("{Organizer}", eventData.organizer.name)
|
||||
.replaceAll("{Location}", eventData.location || "")
|
||||
.replaceAll("{Team}", eventData.team?.name || "")
|
||||
.replaceAll(" ", "-"); //Last Rule! - Replace all blanks (%20) with dashes;
|
||||
|
||||
return Promise.resolve({
|
||||
type: metadata.type,
|
||||
id: meetingID,
|
||||
password: "",
|
||||
url: hostUrl + "/" + meetingID,
|
||||
url: hostUrl + "/" + encodeURIComponent(meetingID),
|
||||
});
|
||||
},
|
||||
deleteMeeting: async (): Promise<void> => {
|
||||
|
|
|
@ -2,6 +2,7 @@ import { z } from "zod";
|
|||
|
||||
export const appKeysSchema = z.object({
|
||||
jitsiHost: z.string().optional(),
|
||||
jitsiPathPattern: z.string().optional(),
|
||||
});
|
||||
|
||||
export const appDataSchema = z.object({});
|
||||
|
|
Loading…
Reference in New Issue
Block a user