Ver código fonte

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.
j8
Дамян Минков 5 anos atrás
pai
commit
50f4796144
Nenhuma conta vinculada ao e-mail do autor do commit

+ 7
- 3
conference.js Ver arquivo

@@ -1205,12 +1205,16 @@ export default {
1205 1205
 
1206 1206
     _getConferenceOptions() {
1207 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 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 1220
         options.applicationName = interfaceConfig.APP_NAME;

+ 2
- 4
config.js Ver arquivo

@@ -292,13 +292,11 @@ var config = {
292 292
     // callStatsID: '',
293 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 295
     // enables sending participants display name to callstats
300 296
     // enableDisplayNameInStats: false
301 297
 
298
+    // enables sending participants email if available to callstats and other analytics
299
+    // enableEmailInStats: false
302 300
 
303 301
     // Privacy
304 302
     //

+ 14
- 0
doc/api.md Ver arquivo

@@ -30,6 +30,7 @@ Its constructor gets a number of options:
30 30
     * **onload**: (optional) handler for the iframe onload event.
31 31
     * **invitees**: (optional) Array of objects containing information about new participants that will be invited in the call.
32 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 35
 Example:
35 36
 
@@ -84,6 +85,19 @@ const options = {
84 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 101
 ### Controlling the embedded Jitsi Meet Conference
88 102
 
89 103
 Device management `JitsiMeetExternalAPI` methods:

+ 6
- 2
modules/API/external/external_api.js Ver arquivo

@@ -232,6 +232,8 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
232 232
      * information about new participants that will be invited in the call.
233 233
      * @param {Array<Object>} [options.devices] - Array of objects containing
234 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 238
     constructor(domain, ...args) {
237 239
         super();
@@ -246,7 +248,8 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
246 248
             jwt = undefined,
247 249
             onload = undefined,
248 250
             invitees,
249
-            devices
251
+            devices,
252
+            userInfo
250 253
         } = parseArguments(args);
251 254
 
252 255
         this._parentNode = parentNode;
@@ -256,7 +259,8 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
256 259
             jwt,
257 260
             noSSL,
258 261
             roomName,
259
-            devices
262
+            devices,
263
+            userInfo
260 264
         });
261 265
         this._createIFrame(height, width, onload);
262 266
         this._transport = new Transport({

+ 2
- 2
package-lock.json Ver arquivo

@@ -10931,8 +10931,8 @@
10931 10931
       }
10932 10932
     },
10933 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 10936
       "requires": {
10937 10937
         "@jitsi/sdp-interop": "0.1.14",
10938 10938
         "@jitsi/sdp-simulcast": "0.2.2",

+ 1
- 1
package.json Ver arquivo

@@ -57,7 +57,7 @@
57 57
     "js-utils": "github:jitsi/js-utils#192b1c996e8c05530eb1f19e82a31069c3021e31",
58 58
     "jsrsasign": "8.0.12",
59 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 61
     "libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d",
62 62
     "lodash": "4.17.13",
63 63
     "moment": "2.19.4",

+ 7
- 2
react/features/base/conference/actions.js Ver arquivo

@@ -14,6 +14,7 @@ import { JitsiConferenceEvents } from '../lib-jitsi-meet';
14 14
 import { setAudioMuted, setVideoMuted } from '../media';
15 15
 import {
16 16
     dominantSpeakerChanged,
17
+    getLocalParticipant,
17 18
     getNormalizedDisplayName,
18 19
     participantConnectionStatusChanged,
19 20
     participantKicked,
@@ -393,14 +394,18 @@ export function createConference() {
393 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 399
         const conference
397 400
             = connection.initJitsiConference(
398 401
 
399 402
                 getBackendSafeRoomName(room), {
400
-                    ...state['features/base/config'],
403
+                    ...config,
401 404
                     applicationName: getName(),
402 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 411
         connection[JITSI_CONNECTION_CONFERENCE_KEY] = conference;

+ 1
- 1
react/features/base/config/configWhitelist.js Ver arquivo

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

+ 33
- 0
react/features/base/settings/middleware.js Ver arquivo

@@ -1,7 +1,10 @@
1 1
 // @flow
2
+import _ from 'lodash';
2 3
 
3 4
 import { APP_WILL_MOUNT } from '../app';
4 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 8
 import { getLocalParticipant, participantUpdated } from '../participants';
6 9
 import { MiddlewareRegistry } from '../redux';
7 10
 
@@ -28,6 +31,9 @@ MiddlewareRegistry.register(store => next => action => {
28 31
         _maybeSetAudioOnly(store, action);
29 32
         _updateLocalParticipant(store, action);
30 33
         break;
34
+    case SET_LOCATION_URL:
35
+        _updateLocalParticipantFromUrl(store);
36
+        break;
31 37
     }
32 38
 
33 39
     return result;
@@ -118,3 +124,30 @@ function _updateLocalParticipant({ dispatch, getState }, action) {
118 124
 
119 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 Ver arquivo

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

Carregando…
Cancelar
Salvar