Adds an option to set email through iframe API init and to stats. (#4842)

* Adds an option to set email through iframe API init and to stats.

* Simplifies configuring email and displayName in stats.

Removes enableStatsID as not needed as when off we are sending as callstats id xmpp resource which is unique per call and id must be something that sticks between calls (callstatsUsername).

* Adds email and displayName in stats config for mobile.

* chore(deps): Updates lib-jitsi-meet to latest dd31f0a.

* Removes enableStatsID from config and whitelist.
This commit is contained in:
Дамян Минков 2019-11-12 13:37:54 +00:00 committed by GitHub
parent 5bdfae377f
commit 50f4796144
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 74 additions and 16 deletions

View File

@ -1205,12 +1205,16 @@ export default {
_getConferenceOptions() { _getConferenceOptions() {
const options = config; const options = config;
const { email, name: nick } = getLocalParticipant(APP.store.getState());
const nick = APP.store.getState()['features/base/settings'].displayName;
const { locationURL } = APP.store.getState()['features/base/connection']; const { locationURL } = APP.store.getState()['features/base/connection'];
if (nick) { if (options.enableDisplayNameInStats && nick) {
options.displayName = nick; options.statisticsDisplayName = nick;
}
if (options.enableEmailInStats && email) {
options.statisticsId = email;
} }
options.applicationName = interfaceConfig.APP_NAME; options.applicationName = interfaceConfig.APP_NAME;

View File

@ -292,13 +292,11 @@ var config = {
// callStatsID: '', // callStatsID: '',
// callStatsSecret: '', // callStatsSecret: '',
// enables callstatsUsername to be reported as statsId and used
// by callstats as repoted remote id
// enableStatsID: false
// enables sending participants display name to callstats // enables sending participants display name to callstats
// enableDisplayNameInStats: false // enableDisplayNameInStats: false
// enables sending participants email if available to callstats and other analytics
// enableEmailInStats: false
// Privacy // Privacy
// //

View File

@ -30,6 +30,7 @@ Its constructor gets a number of options:
* **onload**: (optional) handler for the iframe onload event. * **onload**: (optional) handler for the iframe onload event.
* **invitees**: (optional) Array of objects containing information about new participants that will be invited in the call. * **invitees**: (optional) Array of objects containing information about new participants that will be invited in the call.
* **devices**: (optional) A map containing information about the initial devices that will be used in the call. * **devices**: (optional) A map containing information about the initial devices that will be used in the call.
* **userInfo**: (optional) JS object containing information about the participant opening the meeting, such as `email`.
Example: Example:
@ -84,6 +85,19 @@ const options = {
const api = new JitsiMeetExternalAPI(domain, options); const api = new JitsiMeetExternalAPI(domain, options);
``` ```
You can set the userInfo(email) for the call:
```javascript
var domain = "meet.jit.si";
var options = {
...
userInfo: {
email: 'email@jitsiexamplemail.com'
}
}
var api = new JitsiMeetExternalAPI(domain, options);
```
### Controlling the embedded Jitsi Meet Conference ### Controlling the embedded Jitsi Meet Conference
Device management `JitsiMeetExternalAPI` methods: Device management `JitsiMeetExternalAPI` methods:

View File

@ -232,6 +232,8 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
* information about new participants that will be invited in the call. * information about new participants that will be invited in the call.
* @param {Array<Object>} [options.devices] - Array of objects containing * @param {Array<Object>} [options.devices] - Array of objects containing
* information about the initial devices that will be used in the call. * information about the initial devices that will be used in the call.
* @param {Object} [options.userInfo] - Object containing information about
* the participant opening the meeting.
*/ */
constructor(domain, ...args) { constructor(domain, ...args) {
super(); super();
@ -246,7 +248,8 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
jwt = undefined, jwt = undefined,
onload = undefined, onload = undefined,
invitees, invitees,
devices devices,
userInfo
} = parseArguments(args); } = parseArguments(args);
this._parentNode = parentNode; this._parentNode = parentNode;
@ -256,7 +259,8 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
jwt, jwt,
noSSL, noSSL,
roomName, roomName,
devices devices,
userInfo
}); });
this._createIFrame(height, width, onload); this._createIFrame(height, width, onload);
this._transport = new Transport({ this._transport = new Transport({

4
package-lock.json generated
View File

@ -10931,8 +10931,8 @@
} }
}, },
"lib-jitsi-meet": { "lib-jitsi-meet": {
"version": "github:jitsi/lib-jitsi-meet#1de69abe22aa632c9a4255ee9f6ae48dab9be756", "version": "github:jitsi/lib-jitsi-meet#dd31f0aff0a38b3cfd8e808e457a2e3a0f966514",
"from": "github:jitsi/lib-jitsi-meet#1de69abe22aa632c9a4255ee9f6ae48dab9be756", "from": "github:jitsi/lib-jitsi-meet#dd31f0aff0a38b3cfd8e808e457a2e3a0f966514",
"requires": { "requires": {
"@jitsi/sdp-interop": "0.1.14", "@jitsi/sdp-interop": "0.1.14",
"@jitsi/sdp-simulcast": "0.2.2", "@jitsi/sdp-simulcast": "0.2.2",

View File

@ -57,7 +57,7 @@
"js-utils": "github:jitsi/js-utils#192b1c996e8c05530eb1f19e82a31069c3021e31", "js-utils": "github:jitsi/js-utils#192b1c996e8c05530eb1f19e82a31069c3021e31",
"jsrsasign": "8.0.12", "jsrsasign": "8.0.12",
"jwt-decode": "2.2.0", "jwt-decode": "2.2.0",
"lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#1de69abe22aa632c9a4255ee9f6ae48dab9be756", "lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#dd31f0aff0a38b3cfd8e808e457a2e3a0f966514",
"libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d", "libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d",
"lodash": "4.17.13", "lodash": "4.17.13",
"moment": "2.19.4", "moment": "2.19.4",

View File

@ -14,6 +14,7 @@ import { JitsiConferenceEvents } from '../lib-jitsi-meet';
import { setAudioMuted, setVideoMuted } from '../media'; import { setAudioMuted, setVideoMuted } from '../media';
import { import {
dominantSpeakerChanged, dominantSpeakerChanged,
getLocalParticipant,
getNormalizedDisplayName, getNormalizedDisplayName,
participantConnectionStatusChanged, participantConnectionStatusChanged,
participantKicked, participantKicked,
@ -393,14 +394,18 @@ export function createConference() {
throw new Error('Cannot join a conference without a room name!'); throw new Error('Cannot join a conference without a room name!');
} }
const config = state['features/base/config'];
const { email, name: nick } = getLocalParticipant(state);
const conference const conference
= connection.initJitsiConference( = connection.initJitsiConference(
getBackendSafeRoomName(room), { getBackendSafeRoomName(room), {
...state['features/base/config'], ...config,
applicationName: getName(), applicationName: getName(),
getWiFiStatsMethod: getJitsiMeetGlobalNS().getWiFiStats, getWiFiStatsMethod: getJitsiMeetGlobalNS().getWiFiStats,
confID: `${locationURL.host}${locationURL.pathname}` confID: `${locationURL.host}${locationURL.pathname}`,
statisticsDisplayName: config.enableDisplayNameInStats ? nick : undefined,
statisticsId: config.enableEmailInStats ? email : undefined
}); });
connection[JITSI_CONNECTION_CONFERENCE_KEY] = conference; connection[JITSI_CONNECTION_CONFERENCE_KEY] = conference;

View File

@ -91,11 +91,11 @@ export default [
'displayJids', 'displayJids',
'e2eping', 'e2eping',
'enableDisplayNameInStats', 'enableDisplayNameInStats',
'enableEmailInStats',
'enableLayerSuspension', 'enableLayerSuspension',
'enableLipSync', 'enableLipSync',
'disableLocalVideoFlip', 'disableLocalVideoFlip',
'enableRemb', 'enableRemb',
'enableStatsID',
'enableTalkWhileMuted', 'enableTalkWhileMuted',
'enableTcc', 'enableTcc',
'etherpad_base', 'etherpad_base',

View File

@ -1,7 +1,10 @@
// @flow // @flow
import _ from 'lodash';
import { APP_WILL_MOUNT } from '../app'; import { APP_WILL_MOUNT } from '../app';
import { setAudioOnly } from '../audio-only'; import { setAudioOnly } from '../audio-only';
import parseURLParams from '../config/parseURLParams'; // minimize imports to avoid circular imports
import { SET_LOCATION_URL } from '../connection/actionTypes'; // minimize imports to avoid circular imports
import { getLocalParticipant, participantUpdated } from '../participants'; import { getLocalParticipant, participantUpdated } from '../participants';
import { MiddlewareRegistry } from '../redux'; import { MiddlewareRegistry } from '../redux';
@ -28,6 +31,9 @@ MiddlewareRegistry.register(store => next => action => {
_maybeSetAudioOnly(store, action); _maybeSetAudioOnly(store, action);
_updateLocalParticipant(store, action); _updateLocalParticipant(store, action);
break; break;
case SET_LOCATION_URL:
_updateLocalParticipantFromUrl(store);
break;
} }
return result; return result;
@ -118,3 +124,30 @@ function _updateLocalParticipant({ dispatch, getState }, action) {
dispatch(participantUpdated(newLocalParticipant)); dispatch(participantUpdated(newLocalParticipant));
} }
/**
* Returns the userInfo set in the URL.
*
* @param {Store} store - The redux store.
* @private
* @returns {void}
*/
function _updateLocalParticipantFromUrl({ dispatch, getState }) {
const urlParams
= parseURLParams(getState()['features/base/connection'].locationURL);
const urlEmail = urlParams['userInfo.email'];
if (!urlEmail) {
return;
}
const localParticipant = getLocalParticipant(getState());
if (localParticipant) {
dispatch(participantUpdated({
...localParticipant,
email: _.escape(urlEmail)
}));
}
}

View File

@ -510,7 +510,7 @@ export function urlObjectToString(o: Object): ?string {
let { hash } = url; let { hash } = url;
for (const urlPrefix of [ 'config', 'interfaceConfig', 'devices' ]) { for (const urlPrefix of [ 'config', 'interfaceConfig', 'devices', 'userInfo' ]) {
const urlParamsArray const urlParamsArray
= _objectToURLParamsArray( = _objectToURLParamsArray(
o[`${urlPrefix}Overwrite`] o[`${urlPrefix}Overwrite`]