Fix url params stripping

This commit is contained in:
Ilya Daynatovich 2017-01-04 19:01:25 +02:00
parent c2757469a5
commit ad9bdf4dd2
3 changed files with 74 additions and 4 deletions

View File

@ -6,7 +6,6 @@ import {
connect, connect,
disconnect disconnect
} from '../../base/connection'; } from '../../base/connection';
import { obtainConfigAndInit } from '../actions';
/** /**
* For legacy reasons, inline style for display none. * For legacy reasons, inline style for display none.
@ -28,7 +27,6 @@ class Conference extends Component {
* @inheritdoc * @inheritdoc
*/ */
componentDidMount() { componentDidMount() {
this.props.dispatch(obtainConfigAndInit());
APP.UI.start(); APP.UI.start();
// XXX Temporary solution until we add React translation. // XXX Temporary solution until we add React translation.

View File

@ -1,5 +1,71 @@
/* global APP */ /* global APP, config */
import HttpConfigFetch from '../../../modules/config/HttpConfigFetch'; import HttpConfigFetch from '../../../modules/config/HttpConfigFetch';
import ConferenceUrl from '../../../modules/URL/ConferenceUrl';
import BoshAddressChoice from '../../../modules/config/BoshAddressChoice';
const logger = require('jitsi-meet-logger').getLogger(__filename);
/**
* If we have an HTTP endpoint for getting config.json configured
* we're going to read it and override properties from config.js and
* interfaceConfig.js. If there is no endpoint we'll just
* continue with initialization.
* Keep in mind that if the endpoint has been configured and we fail
* to obtain the config for any reason then the conference won't
* start and error message will be displayed to the user.
*
* @returns {Function}
*/
export function obtainConfigAndInit() {
// Skip initialization if conference is already initialized
if (!APP.ConferenceUrl) {
const room = APP.conference.roomName;
if (config.configLocation) {
const location = config.configLocation;
obtainConfig(location, room)
.then(_obtainConfigHandler)
.then(_initConference)
.catch(err => {
// Show obtain config error,
// pass the error object for report
APP.UI.messageHandler.openReportDialog(
null, 'dialog.connectError', err);
});
} else {
BoshAddressChoice.chooseAddress(config, room);
_initConference();
}
}
}
/**
* Obtain config handler.
*
* @returns {Promise}
* @private
*/
function _obtainConfigHandler() {
const now = window.performance.now();
APP.connectionTimes['configuration.fetched'] = now;
logger.log('(TIME) configuration fetched:\t', now);
return Promise.resolve();
}
/**
* Initialization of the app.
*
* @returns {void}
* @private
*/
function _initConference() {
setTokenData();
// Initialize the conference URL handler
APP.ConferenceUrl = new ConferenceUrl(window.location);
}
/** /**
* Promise wrapper on obtain config method. * Promise wrapper on obtain config method.

View File

@ -1,11 +1,17 @@
import { RouteRegistry } from '../base/navigator'; import { RouteRegistry } from '../base/navigator';
import { Conference } from './components'; import { Conference } from './components';
import { obtainConfigAndInit } from './functions';
/** /**
* Register route for Conference (page). * Register route for Conference (page).
*/ */
RouteRegistry.register({ RouteRegistry.register({
component: Conference, component: Conference,
path: '/:room' path: '/:room',
onEnter: () => {
// XXX: If config or jwt are set by hash or query parameters
// Getting raw URL before stripping it.
obtainConfigAndInit();
}
}); });