Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(authentication): group config options inside an object param
Calin-Teodorb09574f62f6e
diff --git a/react/features/app/actions.any.ts b/react/features/app/actions.any.tsindex 51e8db23b0..b72e08195c 100644--- a/react/features/app/actions.any.ts+++ b/react/features/app/actions.any.ts@@ -128,14 +128,16 @@ export function maybeRedirectToTokenAuthUrl(const { tenant } = parseURIString(locationURL.href) || {};getTokenAuthUrl(- audioMuted,- audioOnlyEnabled || startAudioOnly,config,- room,- tenant,- true,locationURL,- videoMuted+ {+ audioMuted,+ audioOnlyEnabled: audioOnlyEnabled || startAudioOnly,+ skipPrejoin: true,+ videoMuted+ },+ room,+ tenant).then((tokenAuthServiceUrl: string | undefined) => {if (!tokenAuthServiceUrl) {diff --git a/react/features/app/getRouteToRender.web.ts b/react/features/app/getRouteToRender.web.tsindex 8745b1f122..4b354718e2 100644--- a/react/features/app/getRouteToRender.web.ts+++ b/react/features/app/getRouteToRender.web.ts@@ -57,7 +57,18 @@ function _getWebConferenceRoute(state: IReduxState) {const { tenant } = parseURIString(locationURL.href) || {};const { startAudioOnly } = config;- return getTokenAuthUrl(false, startAudioOnly, config, room, tenant, false, locationURL, false)+ return getTokenAuthUrl(+ config,+ locationURL,+ {+ audioMuted: false,+ audioOnlyEnabled: startAudioOnly,+ skipPrejoin: false,+ videoMuted: false+ },+ room,+ tenant+ ).then((url: string | undefined) => {route.href = url;diff --git a/react/features/authentication/functions.any.ts b/react/features/authentication/functions.any.tsindex d35778bf9b..1025e4b4d7 100644--- a/react/features/authentication/functions.any.ts+++ b/react/features/authentication/functions.any.ts@@ -13,30 +13,41 @@ export const isTokenAuthEnabled = (config: IConfig): boolean =>/*** Returns the state that we can add as a parameter to the tokenAuthUrl.*- * @param {boolean} audioMuted - Start conference with audio muted.- * @param {boolean} audioOnlyEnabled - Join conference audio only.+ * @param {URL} locationURL - The location URL.+ * @param {Object} options: - Config options {+ * audioMuted: boolean | undefined+ * audioOnlyEnabled: boolean | undefined,+ * skipPrejoin: boolean | undefined,+ * videoMuted: boolean | undefined+ * }.* @param {string?} roomName - The room name.* @param {string?} tenant - The tenant name if any.- * @param {boolean} skipPrejoin - Whether to skip pre-join page.- * @param {URL} locationURL - The location URL.- * @param {boolean} videoMuted - Start conference with video muted.+ ** @returns {Object} The state object.*/export const _getTokenAuthState = (- audioMuted: boolean | undefined = false,- audioOnlyEnabled: boolean | undefined = false,- roomName: string | undefined,- tenant: string | undefined,- skipPrejoin: boolean | undefined = false,locationURL: URL,- // eslint-disable-next-line max-params- videoMuted: boolean | undefined = false): object => {+ options: {+ audioMuted: boolean | undefined;+ audioOnlyEnabled: boolean | undefined;+ skipPrejoin: boolean | undefined;+ videoMuted: boolean | undefined;+ },+ roomName: string | undefined,+ tenant: string | undefined): object => {const state = {room: roomName,roomSafe: getBackendSafeRoomName(roomName),tenant};+ const {+ audioMuted = false,+ audioOnlyEnabled = false,+ skipPrejoin = false,+ videoMuted = false+ } = options;+if (audioMuted) {// @ts-ignorediff --git a/react/features/authentication/functions.native.ts b/react/features/authentication/functions.native.tsindex 7ea0e8a733..64e17d4bcd 100644--- a/react/features/authentication/functions.native.ts+++ b/react/features/authentication/functions.native.ts@@ -13,29 +13,40 @@ export * from './functions.any';* '{room}' - name of the conference room passed as <tt>roomName</tt>* argument to this method.*- * @param {boolean} audioMuted - Start conference with audio muted.- * @param {boolean} audioOnlyEnabled - Join conference audio only.* @param {Object} config - Configuration state object from store. A URL pattern pointing to the login service.- * @param {string} roomName - The name of the conference room for which the user will be authenticated.- * @param {string} tenant - The name of the conference tenant.- * @param {boolean} skipPrejoin - Whether to skip pre-join page.* @param {URL} locationURL - The location URL.- * @param {boolean} videoMuted - Start conference with video muted.+ * @param {Object} options: - Config options {+ * audioMuted: boolean | undefined+ * audioOnlyEnabled: boolean | undefined,+ * skipPrejoin: boolean | undefined,+ * videoMuted: boolean | undefined+ * }.+ * @param {string?} roomName - The room name.+ * @param {string?} tenant - The tenant name if any.** @returns {Promise<string|undefined>} - The URL pointing to JWT login service or* <tt>undefined</tt> if the pattern stored in config is not a string and the URL can not be* constructed.*/export const getTokenAuthUrl = (- audioMuted: boolean | undefined = false,- audioOnlyEnabled: boolean | undefined = false,config: IConfig,- roomName: string | undefined,- tenant: string | undefined,- skipPrejoin: boolean | undefined = false,locationURL: URL,+ options: {+ audioMuted: boolean | undefined;+ audioOnlyEnabled: boolean | undefined;+ skipPrejoin: boolean | undefined;+ videoMuted: boolean | undefined;+ },+ roomName: string | undefined,// eslint-disable-next-line max-params- videoMuted: boolean | undefined = false): Promise<string | undefined> => {+ tenant: string | undefined): Promise<string | undefined> => {++ const {+ audioMuted = false,+ audioOnlyEnabled = false,+ skipPrejoin = false,+ videoMuted = false+ } = options;let url = config.tokenAuthUrl;@@ -45,13 +56,15 @@ export const getTokenAuthUrl = (if (url.indexOf('{state}')) {const state = _getTokenAuthState(- audioMuted,- audioOnlyEnabled,- roomName,- tenant,- skipPrejoin,locationURL,- videoMuted+ {+ audioMuted,+ audioOnlyEnabled,+ skipPrejoin,+ videoMuted+ },+ roomName,+ tenant);// Append ios=true or android=true to the token URL.diff --git a/react/features/authentication/functions.web.ts b/react/features/authentication/functions.web.tsindex d385b985b2..d94b154bde 100644--- a/react/features/authentication/functions.web.ts+++ b/react/features/authentication/functions.web.ts@@ -31,29 +31,40 @@ function _cryptoRandom() {* '{room}' - name of the conference room passed as <tt>roomName</tt>* argument to this method.*- * @param {boolean} audioMuted - Start conference with audio muted.- * @param {boolean} audioOnlyEnabled - Join conference audio only.* @param {Object} config - Configuration state object from store. A URL pattern pointing to the login service.- * @param {string} roomName - The name of the conference room for which the user will be authenticated.- * @param {string} tenant - The name of the conference tenant.- * @param {boolean} skipPrejoin - Whether to skip pre-join page.- * @param {URL} locationURL - The current location URL.- * @param {boolean} videoMuted - Start conference with video muted.+ * @param {URL} locationURL - The location URL.+ * @param {Object} options: - Config options {+ * audioMuted: boolean | undefined+ * audioOnlyEnabled: boolean | undefined,+ * skipPrejoin: boolean | undefined,+ * videoMuted: boolean | undefined+ * }.+ * @param {string?} roomName - The room name.+ * @param {string?} tenant - The tenant name if any.** @returns {Promise<string|undefined>} - The URL pointing to JWT login service or* <tt>undefined</tt> if the pattern stored in config is not a string and the URL can not be* constructed.*/export const getTokenAuthUrl = (- audioMuted: boolean | undefined = false,- audioOnlyEnabled: boolean | undefined = false,config: IConfig,- roomName: string | undefined,- tenant: string | undefined,- skipPrejoin: boolean | undefined = false,locationURL: URL,+ options: {+ audioMuted: boolean | undefined;+ audioOnlyEnabled: boolean | undefined;+ skipPrejoin: boolean | undefined;+ videoMuted: boolean | undefined;+ },+ roomName: string | undefined,// eslint-disable-next-line max-params- videoMuted: boolean | undefined = false): Promise<string | undefined> => {+ tenant: string | undefined): Promise<string | undefined> => {++ const {+ audioMuted = false,+ audioOnlyEnabled = false,+ skipPrejoin = false,+ videoMuted = false+ } = options;let url = config.tokenAuthUrl;@@ -63,13 +74,15 @@ export const getTokenAuthUrl = (if (url.indexOf('{state}')) {const state = _getTokenAuthState(- audioMuted,- audioOnlyEnabled,- roomName,- tenant,- skipPrejoin,locationURL,- videoMuted+ {+ audioMuted,+ audioOnlyEnabled,+ skipPrejoin,+ videoMuted+ },+ roomName,+ tenant);if (browser.isElectron()) {diff --git a/react/features/authentication/middleware.ts b/react/features/authentication/middleware.tsindex be954bebb9..75a4597d5c 100644--- a/react/features/authentication/middleware.ts+++ b/react/features/authentication/middleware.ts@@ -275,7 +275,18 @@ function _handleLogin({ dispatch, getState }: IStore) {return;}- getTokenAuthUrl(audioMuted, audioOnlyEnabled, config, room, tenant, true, locationURL, videoMuted)+ getTokenAuthUrl(+ config,+ locationURL,+ {+ audioMuted,+ audioOnlyEnabled,+ skipPrejoin: true,+ videoMuted+ },+ room,+ tenant+ ).then((tokenAuthServiceUrl: string | undefined) => {if (!tokenAuthServiceUrl) {logger.warn('Cannot handle login, token service URL is not set');