mirror of https://github.com/jitsi/jitsi-meet
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.pull/1617/head jitsi-meet_2121
parent
69f8cf7836
commit
320e67baa1
@ -0,0 +1,48 @@ |
||||
/* @flow */ |
||||
|
||||
import { SET_CONFIG } from '../config'; |
||||
import { MiddlewareRegistry } from '../redux'; |
||||
|
||||
declare var APP: Object; |
||||
|
||||
/** |
||||
* The redux middleware of the feature base/i18n. |
||||
* |
||||
* @param {Store} store - The redux store. |
||||
* @returns {Function} |
||||
* @private |
||||
*/ |
||||
MiddlewareRegistry.register(store => next => action => { |
||||
switch (action.type) { |
||||
case SET_CONFIG: |
||||
return _setConfig(store, next, action); |
||||
} |
||||
|
||||
return next(action); |
||||
}); |
||||
|
||||
/** |
||||
* Notifies the feature base/i18n that the action SET_CONFIG is being dispatched |
||||
* within a specific redux store. |
||||
* |
||||
* @param {Store} store - The redux store in which the specified action is being |
||||
* dispatched. |
||||
* @param {Dispatch} next - The redux dispatch function to dispatch the |
||||
* specified action to the specified store. |
||||
* @param {Action} action - The redux action SET_CONFIG which is being |
||||
* dispatched in the specified store. |
||||
* @private |
||||
* @returns {Object} The new state that is the result of the reduction of the |
||||
* specified action. |
||||
*/ |
||||
function _setConfig({ dispatch, getState }, next, action) { |
||||
const oldValue = getState()['features/base/config']; |
||||
const result = next(action); |
||||
const newValue = getState()['features/base/config']; |
||||
|
||||
if (oldValue !== newValue && typeof APP === 'object') { |
||||
APP.translation.init(); |
||||
} |
||||
|
||||
return result; |
||||
} |
@ -0,0 +1,16 @@ |
||||
/* @flow */ |
||||
|
||||
import { parseURLParams } from '../base/config'; |
||||
|
||||
/** |
||||
* Retrieves the JSON Web Token (JWT), if any, defined by a specific |
||||
* {@link URL}. |
||||
* |
||||
* @param {URL} url - The {@code URL} to parse and retrieve the JSON Web Token |
||||
* (JWT), if any, from. |
||||
* @returns {string} The JSON Web Token (JWT), if any, defined by the specified |
||||
* {@code url}; otherwise, {@code undefined}. |
||||
*/ |
||||
export function parseJWTFromURLParams(url: URL = window.location) { |
||||
return parseURLParams(url, true, 'search').jwt; |
||||
} |
@ -1,4 +1,5 @@ |
||||
export * from './actions'; |
||||
export * from './functions'; |
||||
|
||||
import './middleware'; |
||||
import './reducer'; |
||||
|
Loading…
Reference in new issue