mirror of https://github.com/jitsi/jitsi-meet
commit
d17cc9fa86
@ -1,30 +0,0 @@ |
||||
/* global $ */ |
||||
|
||||
function enterRoom() { |
||||
const $enterRoomField = $("#enter_room_field"); |
||||
|
||||
var val = $enterRoomField.val(); |
||||
if(!val) { |
||||
val = $enterRoomField.data("room-name"); |
||||
} |
||||
if (val) { |
||||
window.location.pathname = "/" + val; |
||||
} |
||||
} |
||||
|
||||
function setupWelcomePage() { |
||||
// XXX: We left only going to conference page here because transitions via
|
||||
// React Router isn't implemented yet.
|
||||
|
||||
$("#enter_room_button").click(function() { |
||||
enterRoom(); |
||||
}); |
||||
|
||||
$("#enter_room_field").keydown(function (event) { |
||||
if (event.keyCode === 13 /* enter */) { |
||||
enterRoom(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
module.exports = setupWelcomePage; |
||||
@ -0,0 +1,84 @@ |
||||
/* global APP, JitsiMeetJS, loggingConfig */ |
||||
|
||||
import URLProcessor from '../../../modules/config/URLProcessor'; |
||||
import KeyboardShortcut |
||||
from '../../../modules/keyboardshortcut/keyboardshortcut'; |
||||
import settings from '../../../modules/settings/Settings'; |
||||
import getTokenData from '../../../modules/tokendata/TokenData'; |
||||
import JitsiMeetLogStorage from '../../../modules/util/JitsiMeetLogStorage'; |
||||
|
||||
const Logger = require('jitsi-meet-logger'); |
||||
|
||||
export * from './functions.native'; |
||||
|
||||
/** |
||||
* Temporary solution. Later we'll get rid of global APP and set its properties |
||||
* in redux store. |
||||
* |
||||
* @returns {void} |
||||
*/ |
||||
export function init() { |
||||
URLProcessor.setConfigParametersFromUrl(); |
||||
_initLogging(); |
||||
|
||||
APP.keyboardshortcut = KeyboardShortcut; |
||||
APP.tokenData = getTokenData(); |
||||
APP.API.init(APP.tokenData.externalAPISettings); |
||||
|
||||
APP.translation.init(settings.getLanguage()); |
||||
} |
||||
|
||||
/** |
||||
* Adjusts the logging levels. |
||||
* |
||||
* @private |
||||
* @returns {void} |
||||
*/ |
||||
function _configureLoggingLevels() { |
||||
// NOTE The library Logger is separated from the app loggers, so the levels
|
||||
// have to be set in two places
|
||||
|
||||
// Set default logging level
|
||||
const defaultLogLevel |
||||
= loggingConfig.defaultLogLevel || JitsiMeetJS.logLevels.TRACE; |
||||
|
||||
Logger.setLogLevel(defaultLogLevel); |
||||
JitsiMeetJS.setLogLevel(defaultLogLevel); |
||||
|
||||
// NOTE console was used on purpose here to go around the logging and always
|
||||
// print the default logging level to the console
|
||||
console.info(`Default logging level set to: ${defaultLogLevel}`); |
||||
|
||||
// Set log level for each logger
|
||||
if (loggingConfig) { |
||||
Object.keys(loggingConfig).forEach(loggerName => { |
||||
if (loggerName !== 'defaultLogLevel') { |
||||
const level = loggingConfig[loggerName]; |
||||
|
||||
Logger.setLogLevelById(level, loggerName); |
||||
JitsiMeetJS.setLogLevelById(level, loggerName); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Initializes logging in the app. |
||||
* |
||||
* @private |
||||
* @returns {void} |
||||
*/ |
||||
function _initLogging() { |
||||
// Adjust logging level
|
||||
_configureLoggingLevels(); |
||||
|
||||
// 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); |
||||
} |
||||
} |
||||
@ -0,0 +1,94 @@ |
||||
/* global APP, JitsiMeetJS */ |
||||
|
||||
import UIEvents from '../../../../service/UI/UIEvents'; |
||||
|
||||
import { SET_DOMAIN } from './actionTypes'; |
||||
import './reducer'; |
||||
|
||||
const JitsiConferenceEvents = JitsiMeetJS.events.conference; |
||||
const logger = require('jitsi-meet-logger').getLogger(__filename); |
||||
|
||||
/** |
||||
* Opens new connection. |
||||
* |
||||
* @returns {Promise<JitsiConnection>} |
||||
*/ |
||||
export function connect() { |
||||
return (dispatch, getState) => { |
||||
const state = getState(); |
||||
const room = state['features/base/conference'].room; |
||||
|
||||
// XXX For web based version we use conference initialization logic
|
||||
// from the old app (at the moment of writing).
|
||||
return APP.conference.init({ roomName: room }).then(() => { |
||||
if (APP.logCollector) { |
||||
// Start the LogCollector's periodic "store logs" task
|
||||
APP.logCollector.start(); |
||||
APP.logCollectorStarted = true; |
||||
|
||||
// Make an attempt to flush in case a lot of logs have been
|
||||
// cached, before the collector was started.
|
||||
APP.logCollector.flush(); |
||||
|
||||
// This event listener will flush the logs, before
|
||||
// the statistics module (CallStats) is stopped.
|
||||
//
|
||||
// NOTE The LogCollector is not stopped, because this event can
|
||||
// be triggered multiple times during single conference
|
||||
// (whenever statistics module is stopped). That includes
|
||||
// the case when Jicofo terminates the single person left in the
|
||||
// room. It will then restart the media session when someone
|
||||
// eventually join the room which will start the stats again.
|
||||
APP.conference.addConferenceListener( |
||||
JitsiConferenceEvents.BEFORE_STATISTICS_DISPOSED, |
||||
() => { |
||||
if (APP.logCollector) { |
||||
APP.logCollector.flush(); |
||||
} |
||||
} |
||||
); |
||||
} |
||||
|
||||
APP.UI.initConference(); |
||||
|
||||
APP.UI.addListener(UIEvents.LANG_CHANGED, language => { |
||||
APP.translation.setLanguage(language); |
||||
APP.settings.setLanguage(language); |
||||
}); |
||||
|
||||
APP.keyboardshortcut.init(); |
||||
}) |
||||
.catch(err => { |
||||
APP.UI.hideRingOverLay(); |
||||
APP.API.notifyConferenceLeft(APP.conference.roomName); |
||||
logger.error(err); |
||||
}); |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* Closes connection. |
||||
* |
||||
* @returns {Function} |
||||
*/ |
||||
export function disconnect() { |
||||
// XXX For web based version we use conference hanging up logic from the old
|
||||
// app.
|
||||
return () => APP.conference.hangup(); |
||||
} |
||||
|
||||
/** |
||||
* Sets connection domain. |
||||
* |
||||
* @param {string} domain - Domain name. |
||||
* @returns {{ |
||||
* type: SET_DOMAIN, |
||||
* domain: string |
||||
* }} |
||||
*/ |
||||
export function setDomain(domain) { |
||||
return { |
||||
type: SET_DOMAIN, |
||||
domain |
||||
}; |
||||
} |
||||
@ -1,11 +1,126 @@ |
||||
/* global APP, config */ |
||||
|
||||
import BoshAddressChoice from '../../../modules/config/BoshAddressChoice'; |
||||
import HttpConfigFetch from '../../../modules/config/HttpConfigFetch'; |
||||
import ConferenceUrl from '../../../modules/URL/ConferenceUrl'; |
||||
|
||||
import { RouteRegistry } from '../base/navigator'; |
||||
|
||||
import { Conference } from './components'; |
||||
|
||||
const logger = require('jitsi-meet-logger').getLogger(__filename); |
||||
|
||||
/** |
||||
* Register route for Conference (page). |
||||
*/ |
||||
RouteRegistry.register({ |
||||
component: Conference, |
||||
onEnter: () => { |
||||
// XXX If config or jwt are set by hash or query parameters
|
||||
// Getting raw URL before stripping it.
|
||||
_obtainConfigAndInit(); |
||||
}, |
||||
path: '/:room' |
||||
}); |
||||
|
||||
/** |
||||
* Initialization of the app. |
||||
* |
||||
* @private |
||||
* @returns {void} |
||||
*/ |
||||
function _initConference() { |
||||
_setTokenData(); |
||||
|
||||
// Initialize the conference URL handler
|
||||
APP.ConferenceUrl = new ConferenceUrl(window.location); |
||||
} |
||||
|
||||
/** |
||||
* 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. |
||||
* @param {string} room - Room name. |
||||
* @private |
||||
* @returns {Promise} |
||||
*/ |
||||
function _obtainConfig(location, room) { |
||||
return new Promise((resolve, reject) => { |
||||
HttpConfigFetch.obtainConfig(location, room, (success, error) => { |
||||
if (success) { |
||||
resolve(); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 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. |
||||
* |
||||
* @private |
||||
* @returns {void} |
||||
*/ |
||||
function _obtainConfigAndInit() { |
||||
// Skip initialization if conference is initialized already.
|
||||
if (typeof APP !== 'undefined' && !APP.ConferenceUrl) { |
||||
const location = config.configLocation; |
||||
const room = APP.conference.roomName; |
||||
|
||||
if (location) { |
||||
_obtainConfig(location, room) |
||||
.then(() => { |
||||
_obtainConfigHandler(); |
||||
_initConference(); |
||||
}) |
||||
.catch(err => { |
||||
// Show obtain config error.
|
||||
APP.UI.messageHandler.openReportDialog( |
||||
null, 'dialog.connectError', err); |
||||
}); |
||||
} else { |
||||
BoshAddressChoice.chooseAddress(config, room); |
||||
_initConference(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Obtain config handler. |
||||
* |
||||
* @private |
||||
* @returns {Promise} |
||||
*/ |
||||
function _obtainConfigHandler() { |
||||
const now = window.performance.now(); |
||||
|
||||
APP.connectionTimes['configuration.fetched'] = now; |
||||
logger.log('(TIME) configuration fetched:\t', now); |
||||
} |
||||
|
||||
/** |
||||
* If JWT token data it will be used for local user settings. |
||||
* |
||||
* @private |
||||
* @returns {void} |
||||
*/ |
||||
function _setTokenData() { |
||||
const localUser = APP.tokenData.caller; |
||||
|
||||
if (localUser) { |
||||
const email = localUser.getEmail(); |
||||
const avatarUrl = localUser.getAvatarUrl(); |
||||
const name = localUser.getName(); |
||||
|
||||
APP.settings.setEmail((email || '').trim(), true); |
||||
APP.settings.setAvatarUrl((avatarUrl || '').trim()); |
||||
APP.settings.setDisplayName((name || '').trim(), true); |
||||
} |
||||
} |
||||
|
||||
Loading…
Reference in new issue