Make Jitsi Host configurable (#8636)

* 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

---------

Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
This commit is contained in:
Jakob 2023-05-10 16:46:14 +02:00 committed by GitHub
parent f5a38c3f89
commit 203a36e2b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 4 deletions

View File

@ -9,6 +9,7 @@ import { appKeysSchema as giphy_zod_ts } from "./giphy/zod";
import { appKeysSchema as googlecalendar_zod_ts } from "./googlecalendar/zod";
import { appKeysSchema as gtm_zod_ts } from "./gtm/zod";
import { appKeysSchema as hubspot_zod_ts } from "./hubspot/zod";
import { appKeysSchema as jitsivideo_zod_ts } from "./jitsivideo/zod";
import { appKeysSchema as larkcalendar_zod_ts } from "./larkcalendar/zod";
import { appKeysSchema as metapixel_zod_ts } from "./metapixel/zod";
import { appKeysSchema as office365calendar_zod_ts } from "./office365calendar/zod";
@ -37,6 +38,7 @@ export const appKeysSchemas = {
googlecalendar: googlecalendar_zod_ts,
gtm: gtm_zod_ts,
hubspot: hubspot_zod_ts,
jitsivideo: jitsivideo_zod_ts,
larkcalendar: larkcalendar_zod_ts,
metapixel: metapixel_zod_ts,
office365calendar: office365calendar_zod_ts,

View File

@ -9,6 +9,7 @@ import { appDataSchema as giphy_zod_ts } from "./giphy/zod";
import { appDataSchema as googlecalendar_zod_ts } from "./googlecalendar/zod";
import { appDataSchema as gtm_zod_ts } from "./gtm/zod";
import { appDataSchema as hubspot_zod_ts } from "./hubspot/zod";
import { appDataSchema as jitsivideo_zod_ts } from "./jitsivideo/zod";
import { appDataSchema as larkcalendar_zod_ts } from "./larkcalendar/zod";
import { appDataSchema as metapixel_zod_ts } from "./metapixel/zod";
import { appDataSchema as office365calendar_zod_ts } from "./office365calendar/zod";
@ -37,6 +38,7 @@ export const appDataSchemas = {
googlecalendar: googlecalendar_zod_ts,
gtm: gtm_zod_ts,
hubspot: hubspot_zod_ts,
jitsivideo: jitsivideo_zod_ts,
larkcalendar: larkcalendar_zod_ts,
metapixel: metapixel_zod_ts,
office365calendar: office365calendar_zod_ts,

View File

@ -3,4 +3,4 @@ items:
- jitsi1.jpg
---
Jitsi is a free open-source video conferencing software for web and mobile. Make a call, launch on your own servers, integrate into your app, and more.
Jitsi is a free open-source video conferencing software for web and mobile. Make a call, launch on your own servers, integrate into your app, and more.

View File

@ -3,18 +3,27 @@ import { v4 as uuidv4 } from "uuid";
import type { PartialReference } from "@calcom/types/EventManager";
import type { VideoApiAdapter, VideoCallData } from "@calcom/types/VideoApiAdapter";
import getAppKeysFromSlug from "../../_utils/getAppKeysFromSlug";
import { metadata } from "../_metadata";
const JitsiVideoApiAdapter = (): VideoApiAdapter => {
return {
getAvailability: () => {
return Promise.resolve([]);
},
createMeeting: async (): Promise<VideoCallData> => {
const appKeys = await getAppKeysFromSlug(metadata.slug);
const meetingID = uuidv4();
// Default Value
const hostUrl = appKeys.jitsiHost || "https://meet.jit.si/cal";
return Promise.resolve({
type: "jitsi_video",
type: metadata.type,
id: meetingID,
password: "",
url: "https://meet.jit.si/cal/" + meetingID,
url: hostUrl + "/" + meetingID,
});
},
deleteMeeting: async (): Promise<void> => {

View File

@ -0,0 +1,7 @@
import { z } from "zod";
export const appKeysSchema = z.object({
jitsiHost: z.string().optional(),
});
export const appDataSchema = z.object({});

View File

@ -67,7 +67,7 @@ export const listLocalHandler = async ({ ctx, input }: ListLocalOptions) => {
// `typeof val === 'undefined'` is always slower than !== undefined comparison
// it is important to avoid string to string comparisons as much as we can
if (keysSchema !== undefined) {
// TODO: Remove the Object.values and reduce to improve the performance.
// TODO: Why don't we parse with schema here? Not doing it makes default() not work in schema.
Object.values(keysSchema.keyof()._def.values).reduce((keysObject, key) => {
keys[key as string] = "";
return keysObject;