Fix the initialization of the (external) API
The counterpart of the external API in the Jitsi Meet Web app uses the search URL param jwt to heuristically detect that the Web app is very likely embedded (as an iframe) and, consequently, needs to forcefully enable itself. It was looking at whether there was a JSON Web Token (JWT) but that logic got broken when the JWT support was rewritten because the check started happening before the search URL param jwt was parsed.
This commit is contained in:
committed by
hristoterezov
parent
69f8cf7836
commit
320e67baa1
+12
-5
@@ -1,4 +1,5 @@
|
||||
import * as JitsiMeetConferenceEvents from '../../ConferenceEvents';
|
||||
import { parseJWTFromURLParams } from '../../react/features/jwt';
|
||||
import { getJitsiMeetTransport } from '../transport';
|
||||
|
||||
import { API_ID } from './constants';
|
||||
@@ -74,7 +75,15 @@ function onDesktopSharingEnabledChanged(enabled = false) {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function shouldBeEnabled() {
|
||||
return typeof API_ID === 'number';
|
||||
return (
|
||||
typeof API_ID === 'number'
|
||||
|
||||
// XXX Enable the API when a JSON Web Token (JWT) is specified in
|
||||
// the location/URL because then it is very likely that the Jitsi
|
||||
// Meet (Web) app is being used by an external/wrapping (Web) app
|
||||
// and, consequently, the latter will need to communicate with the
|
||||
// former. (The described logic is merely a heuristic though.)
|
||||
|| parseJWTFromURLParams());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,12 +111,10 @@ class API {
|
||||
* sends a message to the external application that API is initialized.
|
||||
*
|
||||
* @param {Object} options - Optional parameters.
|
||||
* @param {boolean} options.forceEnable - True to forcefully enable the
|
||||
* module.
|
||||
* @returns {void}
|
||||
*/
|
||||
init({ forceEnable } = {}) {
|
||||
if (!shouldBeEnabled() && !forceEnable) {
|
||||
init() {
|
||||
if (!shouldBeEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user