Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(external_api) drop legacy constructor arguments

Saúl Ibarra Corretgé37856e0fdb2e
diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.js
index 0791d82c94..d0b48c38e1 100644
--- a/modules/API/external/external_api.js
+++ b/modules/API/external/external_api.js
@@ -194,80 +194,6 @@ function changeParticipantNumber(APIInstance, number) {
APIInstance._numberOfParticipants += number;
}
-/**
- * Generates the URL for the iframe.
- *
- * @param {string} domain - The domain name of the server that hosts the
- * conference.
- * @param {string} [options] - Another optional parameters.
- * @param {Object} [options.configOverwrite] - Object containing configuration
- * options defined in config.js to be overridden.
- * @param {Object} [options.interfaceConfigOverwrite] - Object containing
- * configuration options defined in interface_config.js to be overridden.
- * @param {string} [options.jwt] - The JWT token if needed by jitsi-meet for
- * authentication.
- * @param {string} [options.lang] - The meeting's default language.
- * @param {string} [options.roomName] - The name of the room to join.
- * @returns {string} The URL.
- */
-function generateURL(domain, options = {}) {
- return urlObjectToString({
- ...options,
- url: `https://${domain}/#jitsi_meet_external_api_id=${id}`
- });
-}
-
-/**
- * Parses the arguments passed to the constructor. If the old format is used
- * the function translates the arguments to the new format.
- *
- * @param {Array} args - The arguments to be parsed.
- * @returns {Object} JS object with properties.
- */
-function parseArguments(args) {
- if (!args.length) {
- return {};
- }
-
- const firstArg = args[0];
-
- switch (typeof firstArg) {
- case 'string': // old arguments format
- case 'undefined': {
- // Not sure which format but we are trying to parse the old
- // format because if the new format is used everything will be undefined
- // anyway.
- const [
- roomName,
- width,
- height,
- parentNode,
- configOverwrite,
- interfaceConfigOverwrite,
- jwt,
- onload,
- lang
- ] = args;
-
- return {
- roomName,
- width,
- height,
- parentNode,
- configOverwrite,
- interfaceConfigOverwrite,
- jwt,
- onload,
- lang
- };
- }
- case 'object': // new arguments format
- return args[0];
- default:
- throw new Error('Can\'t parse the arguments!');
- }
-}
-
/**
* Compute valid values for height and width. If a number is specified it's
* treated as pixel units. If the value is expressed in px, em, pt or
@@ -336,7 +262,7 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
* @param {string} [options.release] - The key used for specifying release if enabled on the backend.
* @param {string} [options.sandbox] - Sandbox directive for the created iframe, if desired.
*/
- constructor(domain, ...args) {
+ constructor(domain, options = {}) {
super();
const {
roomName = '',
@@ -345,21 +271,22 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
parentNode = document.body,
configOverwrite = {},
interfaceConfigOverwrite = {},
- jwt = undefined,
- lang = undefined,
- onload = undefined,
+ jwt,
+ lang,
+ onload,
invitees,
iceServers,
devices,
userInfo,
e2eeKey,
release,
- sandbox = ''
- } = parseArguments(args);
+ sandbox
+ } = options;
const localStorageContent = jitsiLocalStorage.getItem('jitsiLocalStorage');
this._parentNode = parentNode;
- this._url = generateURL(domain, {
+
+ this._url = urlObjectToString({
configOverwrite,
iceServers,
interfaceConfigOverwrite,
@@ -371,7 +298,8 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
appData: {
localStorageContent
},
- release
+ release,
+ url: `https://${domain}/#jitsi_meet_external_api_id=${id}`
});
this._createIFrame(height, width, sandbox);