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:
Lyubo Marinov
2017-05-26 17:11:33 -05:00
committed by hristoterezov
parent 69f8cf7836
commit 320e67baa1
15 changed files with 160 additions and 126 deletions

View File

@@ -1,9 +1,6 @@
/* @flow */
import Logger from 'jitsi-meet-logger';
import { isRoomValid } from '../base/conference';
import JitsiMeetJS from '../base/lib-jitsi-meet';
import { Platform, RouteRegistry } from '../base/react';
import { Conference } from '../conference';
import {
@@ -14,10 +11,6 @@ import {
} from '../unsupported-browser';
import { WelcomePage } from '../welcome';
import KeyboardShortcut
from '../../../modules/keyboardshortcut/keyboardshortcut';
import JitsiMeetLogStorage from '../../../modules/util/JitsiMeetLogStorage';
declare var APP: Object;
declare var interfaceConfig: Object;
declare var loggingConfig: Object;
@@ -106,46 +99,6 @@ export function _getRouteToRender(stateOrGetState: Object | Function) {
return route;
}
/**
* Temporary solution. Later we'll get rid of global APP and set its properties
* in redux store.
*
* @param {Object} state - Snapshot of current state of redux store.
* @returns {void}
*/
export function init(state: Object) {
_initLogging();
APP.keyboardshortcut = KeyboardShortcut;
const { jwt } = state['features/jwt'];
// Force enable the API if jwt token is passed because most probably
// jitsi meet is displayed inside of wrapper that will need to communicate
// with jitsi meet.
APP.API.init(jwt ? { forceEnable: true } : undefined);
APP.translation.init();
}
/**
* Initializes logging in the app.
*
* @private
* @returns {void}
*/
function _initLogging() {
// Create the LogCollector and register it as the global log transport. It
// is done early to capture as much logs as possible. Captured logs will be
// cached, before the JitsiMeetLogStorage gets ready (statistics module is
// initialized).
if (!APP.logCollector && !loggingConfig.disableLogCollector) {
APP.logCollector = new Logger.LogCollector(new JitsiMeetLogStorage());
Logger.addGlobalTransport(APP.logCollector);
JitsiMeetJS.addGlobalLogTransport(APP.logCollector);
}
}
/**
* Intercepts route components based on a {@link _INTERCEPT_COMPONENT_RULES}.
*