Browse Source

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.
master
Дамян Минков 5 years ago
parent
commit
50f4796144
No account linked to committer's email address

+ 7
- 3
conference.js View File

1205
 
1205
 
1206
     _getConferenceOptions() {
1206
     _getConferenceOptions() {
1207
         const options = config;
1207
         const options = config;
1208
+        const { email, name: nick } = getLocalParticipant(APP.store.getState());
1208
 
1209
 
1209
-        const nick = APP.store.getState()['features/base/settings'].displayName;
1210
         const { locationURL } = APP.store.getState()['features/base/connection'];
1210
         const { locationURL } = APP.store.getState()['features/base/connection'];
1211
 
1211
 
1212
-        if (nick) {
1213
-            options.displayName = nick;
1212
+        if (options.enableDisplayNameInStats && nick) {
1213
+            options.statisticsDisplayName = nick;
1214
+        }
1215
+
1216
+        if (options.enableEmailInStats && email) {
1217
+            options.statisticsId = email;
1214
         }
1218
         }
1215
 
1219
 
1216
         options.applicationName = interfaceConfig.APP_NAME;
1220
         options.applicationName = interfaceConfig.APP_NAME;

+ 2
- 4
config.js View File

292
     // callStatsID: '',
292
     // callStatsID: '',
293
     // callStatsSecret: '',
293
     // callStatsSecret: '',
294
 
294
 
295
-    // enables callstatsUsername to be reported as statsId and used
296
-    // by callstats as repoted remote id
297
-    // enableStatsID: false
298
-
299
     // enables sending participants display name to callstats
295
     // enables sending participants display name to callstats
300
     // enableDisplayNameInStats: false
296
     // enableDisplayNameInStats: false
301
 
297
 
298
+    // enables sending participants email if available to callstats and other analytics
299
+    // enableEmailInStats: false
302
 
300
 
303
     // Privacy
301
     // Privacy
304
     //
302
     //

+ 14
- 0
doc/api.md View File

30
     * **onload**: (optional) handler for the iframe onload event.
30
     * **onload**: (optional) handler for the iframe onload event.
31
     * **invitees**: (optional) Array of objects containing information about new participants that will be invited in the call.
31
     * **invitees**: (optional) Array of objects containing information about new participants that will be invited in the call.
32
     * **devices**: (optional) A map containing information about the initial devices that will be used in the call.
32
     * **devices**: (optional) A map containing information about the initial devices that will be used in the call.
33
+    * **userInfo**: (optional) JS object containing information about the participant opening the meeting, such as `email`.
33
 
34
 
34
 Example:
35
 Example:
35
 
36
 
84
 const api = new JitsiMeetExternalAPI(domain, options);
85
 const api = new JitsiMeetExternalAPI(domain, options);
85
  ```
86
  ```
86
 
87
 
88
+You can set the userInfo(email) for the call:
89
+
90
+```javascript
91
+var domain = "meet.jit.si";
92
+var options = {
93
+    ...
94
+    userInfo: {
95
+        email: 'email@jitsiexamplemail.com'
96
+    }
97
+}
98
+var api = new JitsiMeetExternalAPI(domain, options);
99
+```
100
+
87
 ### Controlling the embedded Jitsi Meet Conference
101
 ### Controlling the embedded Jitsi Meet Conference
88
 
102
 
89
 Device management `JitsiMeetExternalAPI` methods:
103
 Device management `JitsiMeetExternalAPI` methods:

+ 6
- 2
modules/API/external/external_api.js View File

232
      * information about new participants that will be invited in the call.
232
      * information about new participants that will be invited in the call.
233
      * @param {Array<Object>} [options.devices] - Array of objects containing
233
      * @param {Array<Object>} [options.devices] - Array of objects containing
234
      * information about the initial devices that will be used in the call.
234
      * information about the initial devices that will be used in the call.
235
+     * @param {Object} [options.userInfo] - Object containing information about
236
+     * the participant opening the meeting.
235
      */
237
      */
236
     constructor(domain, ...args) {
238
     constructor(domain, ...args) {
237
         super();
239
         super();
246
             jwt = undefined,
248
             jwt = undefined,
247
             onload = undefined,
249
             onload = undefined,
248
             invitees,
250
             invitees,
249
-            devices
251
+            devices,
252
+            userInfo
250
         } = parseArguments(args);
253
         } = parseArguments(args);
251
 
254
 
252
         this._parentNode = parentNode;
255
         this._parentNode = parentNode;
256
             jwt,
259
             jwt,
257
             noSSL,
260
             noSSL,
258
             roomName,
261
             roomName,
259
-            devices
262
+            devices,
263
+            userInfo
260
         });
264
         });
261
         this._createIFrame(height, width, onload);
265
         this._createIFrame(height, width, onload);
262
         this._transport = new Transport({
266
         this._transport = new Transport({

+ 2
- 2
package-lock.json View File

10931
       }
10931
       }
10932
     },
10932
     },
10933
     "lib-jitsi-meet": {
10933
     "lib-jitsi-meet": {
10934
-      "version": "github:jitsi/lib-jitsi-meet#1de69abe22aa632c9a4255ee9f6ae48dab9be756",
10935
-      "from": "github:jitsi/lib-jitsi-meet#1de69abe22aa632c9a4255ee9f6ae48dab9be756",
10934
+      "version": "github:jitsi/lib-jitsi-meet#dd31f0aff0a38b3cfd8e808e457a2e3a0f966514",
10935
+      "from": "github:jitsi/lib-jitsi-meet#dd31f0aff0a38b3cfd8e808e457a2e3a0f966514",
10936
       "requires": {
10936
       "requires": {
10937
         "@jitsi/sdp-interop": "0.1.14",
10937
         "@jitsi/sdp-interop": "0.1.14",
10938
         "@jitsi/sdp-simulcast": "0.2.2",
10938
         "@jitsi/sdp-simulcast": "0.2.2",

+ 1
- 1
package.json View File

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

+ 7
- 2
react/features/base/conference/actions.js View File

14
 import { setAudioMuted, setVideoMuted } from '../media';
14
 import { setAudioMuted, setVideoMuted } from '../media';
15
 import {
15
 import {
16
     dominantSpeakerChanged,
16
     dominantSpeakerChanged,
17
+    getLocalParticipant,
17
     getNormalizedDisplayName,
18
     getNormalizedDisplayName,
18
     participantConnectionStatusChanged,
19
     participantConnectionStatusChanged,
19
     participantKicked,
20
     participantKicked,
393
             throw new Error('Cannot join a conference without a room name!');
394
             throw new Error('Cannot join a conference without a room name!');
394
         }
395
         }
395
 
396
 
397
+        const config = state['features/base/config'];
398
+        const { email, name: nick } = getLocalParticipant(state);
396
         const conference
399
         const conference
397
             = connection.initJitsiConference(
400
             = connection.initJitsiConference(
398
 
401
 
399
                 getBackendSafeRoomName(room), {
402
                 getBackendSafeRoomName(room), {
400
-                    ...state['features/base/config'],
403
+                    ...config,
401
                     applicationName: getName(),
404
                     applicationName: getName(),
402
                     getWiFiStatsMethod: getJitsiMeetGlobalNS().getWiFiStats,
405
                     getWiFiStatsMethod: getJitsiMeetGlobalNS().getWiFiStats,
403
-                    confID: `${locationURL.host}${locationURL.pathname}`
406
+                    confID: `${locationURL.host}${locationURL.pathname}`,
407
+                    statisticsDisplayName: config.enableDisplayNameInStats ? nick : undefined,
408
+                    statisticsId: config.enableEmailInStats ? email : undefined
404
                 });
409
                 });
405
 
410
 
406
         connection[JITSI_CONNECTION_CONFERENCE_KEY] = conference;
411
         connection[JITSI_CONNECTION_CONFERENCE_KEY] = conference;

+ 1
- 1
react/features/base/config/configWhitelist.js View File

91
     'displayJids',
91
     'displayJids',
92
     'e2eping',
92
     'e2eping',
93
     'enableDisplayNameInStats',
93
     'enableDisplayNameInStats',
94
+    'enableEmailInStats',
94
     'enableLayerSuspension',
95
     'enableLayerSuspension',
95
     'enableLipSync',
96
     'enableLipSync',
96
     'disableLocalVideoFlip',
97
     'disableLocalVideoFlip',
97
     'enableRemb',
98
     'enableRemb',
98
-    'enableStatsID',
99
     'enableTalkWhileMuted',
99
     'enableTalkWhileMuted',
100
     'enableTcc',
100
     'enableTcc',
101
     'etherpad_base',
101
     'etherpad_base',

+ 33
- 0
react/features/base/settings/middleware.js View File

1
 // @flow
1
 // @flow
2
+import _ from 'lodash';
2
 
3
 
3
 import { APP_WILL_MOUNT } from '../app';
4
 import { APP_WILL_MOUNT } from '../app';
4
 import { setAudioOnly } from '../audio-only';
5
 import { setAudioOnly } from '../audio-only';
6
+import parseURLParams from '../config/parseURLParams'; // minimize imports to avoid circular imports
7
+import { SET_LOCATION_URL } from '../connection/actionTypes'; // minimize imports to avoid circular imports
5
 import { getLocalParticipant, participantUpdated } from '../participants';
8
 import { getLocalParticipant, participantUpdated } from '../participants';
6
 import { MiddlewareRegistry } from '../redux';
9
 import { MiddlewareRegistry } from '../redux';
7
 
10
 
28
         _maybeSetAudioOnly(store, action);
31
         _maybeSetAudioOnly(store, action);
29
         _updateLocalParticipant(store, action);
32
         _updateLocalParticipant(store, action);
30
         break;
33
         break;
34
+    case SET_LOCATION_URL:
35
+        _updateLocalParticipantFromUrl(store);
36
+        break;
31
     }
37
     }
32
 
38
 
33
     return result;
39
     return result;
118
 
124
 
119
     dispatch(participantUpdated(newLocalParticipant));
125
     dispatch(participantUpdated(newLocalParticipant));
120
 }
126
 }
127
+
128
+
129
+/**
130
+ * Returns the userInfo set in the URL.
131
+ *
132
+ * @param {Store} store - The redux store.
133
+ * @private
134
+ * @returns {void}
135
+ */
136
+function _updateLocalParticipantFromUrl({ dispatch, getState }) {
137
+    const urlParams
138
+        = parseURLParams(getState()['features/base/connection'].locationURL);
139
+    const urlEmail = urlParams['userInfo.email'];
140
+
141
+    if (!urlEmail) {
142
+        return;
143
+    }
144
+
145
+    const localParticipant = getLocalParticipant(getState());
146
+
147
+    if (localParticipant) {
148
+        dispatch(participantUpdated({
149
+            ...localParticipant,
150
+            email: _.escape(urlEmail)
151
+        }));
152
+    }
153
+}

+ 1
- 1
react/features/base/util/uri.js View File

510
 
510
 
511
     let { hash } = url;
511
     let { hash } = url;
512
 
512
 
513
-    for (const urlPrefix of [ 'config', 'interfaceConfig', 'devices' ]) {
513
+    for (const urlPrefix of [ 'config', 'interfaceConfig', 'devices', 'userInfo' ]) {
514
         const urlParamsArray
514
         const urlParamsArray
515
             = _objectToURLParamsArray(
515
             = _objectToURLParamsArray(
516
                 o[`${urlPrefix}Overwrite`]
516
                 o[`${urlPrefix}Overwrite`]

Loading…
Cancel
Save