config: drop configLocation and getroomnode options
They never worked on mobile and pose an impediment for makinf config.js more future proof. Specially if we want to move to a non-executable form of configuration.
This commit is contained in:
parent
1010f53a84
commit
1feff9709c
10
config.js
10
config.js
|
@ -1,16 +1,6 @@
|
|||
/* eslint-disable no-unused-vars, no-var */
|
||||
|
||||
var config = {
|
||||
// Configuration
|
||||
//
|
||||
|
||||
// Alternative location for the configuration.
|
||||
// configLocation: './config.json',
|
||||
|
||||
// Custom function which given the URL path should return a room name.
|
||||
// getroomnode: function (path) { return 'someprefixpossiblybasedonpath'; },
|
||||
|
||||
|
||||
// Connection
|
||||
//
|
||||
|
||||
|
|
|
@ -8,8 +8,6 @@ import INTERFACE_CONFIG_WHITELIST from './interfaceConfigWhitelist';
|
|||
import parseURLParams from './parseURLParams';
|
||||
import logger from './logger';
|
||||
|
||||
declare var $: Object;
|
||||
|
||||
// XXX The functions getRoomName and parseURLParams are split out of
|
||||
// functions.js because they are bundled in both app.bundle and
|
||||
// do_external_connect, webpack 1 does not support tree shaking, and we don't
|
||||
|
@ -40,69 +38,6 @@ export function createFakeConfig(baseURL: string) {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Promise wrapper on obtain config method. When HttpConfigFetch will be moved
|
||||
* to React app it's better to use load config instead.
|
||||
*
|
||||
* @param {string} location - URL of the domain from which the config is to be
|
||||
* obtained.
|
||||
* @param {string} room - Room name.
|
||||
* @private
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export function obtainConfig(location: string, room: string): Promise<void> {
|
||||
return new Promise((resolve, reject) =>
|
||||
_obtainConfig(location, room, (success, error) => {
|
||||
success ? resolve() : reject(error);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends HTTP POST request to specified {@code endpoint}. In request the name
|
||||
* of the room is included in JSON format:
|
||||
* {
|
||||
* "rooomName": "someroom12345"
|
||||
* }.
|
||||
*
|
||||
* @param {string} endpoint - The name of HTTP endpoint to which to send
|
||||
* the HTTP POST request.
|
||||
* @param {string} roomName - The name of the conference room for which config
|
||||
* is requested.
|
||||
* @param {Function} complete - The callback to invoke upon success or failure.
|
||||
* @returns {void}
|
||||
*/
|
||||
function _obtainConfig(endpoint: string, roomName: string, complete: Function) {
|
||||
logger.info(`Send config request to ${endpoint} for room: ${roomName}`);
|
||||
$.ajax(
|
||||
endpoint,
|
||||
{
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({ roomName }),
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
|
||||
error(jqXHR, textStatus, errorThrown) {
|
||||
logger.error('Get config error: ', jqXHR, errorThrown);
|
||||
complete(false, `Get config response status: ${textStatus}`);
|
||||
},
|
||||
success(data) {
|
||||
const { config, interfaceConfig, loggingConfig } = window;
|
||||
|
||||
try {
|
||||
overrideConfigJSON(
|
||||
config, interfaceConfig, loggingConfig,
|
||||
data);
|
||||
complete(true);
|
||||
} catch (e) {
|
||||
logger.error('Parse config error: ', e);
|
||||
complete(false, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/* eslint-disable max-params, no-shadow */
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,29 +1,17 @@
|
|||
/* @flow */
|
||||
// @flow
|
||||
|
||||
import { getBackendSafeRoomName } from '../util';
|
||||
|
||||
declare var config: Object;
|
||||
|
||||
/**
|
||||
* Builds and returns the room name.
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
export default function getRoomName(): ?string {
|
||||
const { getroomnode } = config;
|
||||
const path = window.location.pathname;
|
||||
let roomName;
|
||||
|
||||
// Determine the room node from the URL.
|
||||
if (getroomnode && typeof getroomnode === 'function') {
|
||||
roomName = getroomnode.call(config, path);
|
||||
} else {
|
||||
// Fall back to the default strategy of making assumptions about how the
|
||||
// URL maps to the room (name). It currently assumes a deployment in
|
||||
// which the last non-directory component of the path (name) is the
|
||||
// room.
|
||||
roomName = path.substring(path.lastIndexOf('/') + 1) || undefined;
|
||||
}
|
||||
// The last non-directory component of the path (name) is the room.
|
||||
const roomName = path.substring(path.lastIndexOf('/') + 1) || undefined;
|
||||
|
||||
return getBackendSafeRoomName(roomName);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import React from 'react';
|
|||
|
||||
import VideoLayout from '../../../../../modules/UI/videolayout/VideoLayout';
|
||||
|
||||
import { obtainConfig } from '../../../base/config';
|
||||
import { connect, disconnect } from '../../../base/connection';
|
||||
import { translate } from '../../../base/i18n';
|
||||
import { connect as reactReduxConnect } from '../../../base/redux';
|
||||
|
@ -23,7 +22,6 @@ import {
|
|||
} from '../../../toolbox';
|
||||
|
||||
import { maybeShowSuboptimalExperienceNotification } from '../../functions';
|
||||
import logger from '../../logger';
|
||||
|
||||
import Labels from './Labels';
|
||||
import { default as Notice } from './Notice';
|
||||
|
@ -123,31 +121,7 @@ class Conference extends AbstractConference<Props, *> {
|
|||
*/
|
||||
componentDidMount() {
|
||||
document.title = interfaceConfig.APP_NAME;
|
||||
|
||||
const { configLocation } = config;
|
||||
|
||||
if (configLocation) {
|
||||
obtainConfig(configLocation, this.props._room)
|
||||
.then(() => {
|
||||
const now = window.performance.now();
|
||||
|
||||
APP.connectionTimes['configuration.fetched'] = now;
|
||||
logger.log('(TIME) configuration fetched:\t', now);
|
||||
|
||||
this._start();
|
||||
})
|
||||
.catch(err => {
|
||||
logger.log(err);
|
||||
|
||||
// Show obtain config error.
|
||||
APP.UI.messageHandler.showError({
|
||||
descriptionKey: 'dialog.connectError',
|
||||
titleKey: 'connection.CONNFAIL'
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this._start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue