Browse Source

callstats: add siteID passing; sanitize confID path

master
Gabriel Imre 4 years ago
parent
commit
444e2b90df

+ 12
- 3
conference.js View File

@@ -101,7 +101,10 @@ import {
101 101
     trackAdded,
102 102
     trackRemoved
103 103
 } from './react/features/base/tracks';
104
-import { getJitsiMeetGlobalNS } from './react/features/base/util';
104
+import {
105
+    getBackendSafePath,
106
+    getJitsiMeetGlobalNS
107
+} from './react/features/base/util';
105 108
 import { showDesktopPicker } from './react/features/desktop-picker';
106 109
 import { appendSuffix } from './react/features/display-name';
107 110
 import { setE2EEKey } from './react/features/e2ee';
@@ -1364,7 +1367,13 @@ export default {
1364 1367
         const options = config;
1365 1368
         const { email, name: nick } = getLocalParticipant(APP.store.getState());
1366 1369
 
1367
-        const { locationURL } = APP.store.getState()['features/base/connection'];
1370
+        const state = APP.store.getState();
1371
+        const { locationURL } = state['features/base/connection'];
1372
+        const { tenant } = state['features/base/jwt'];
1373
+
1374
+        if (tenant) {
1375
+            options.siteID = tenant;
1376
+        }
1368 1377
 
1369 1378
         if (options.enableDisplayNameInStats && nick) {
1370 1379
             options.statisticsDisplayName = nick;
@@ -1376,7 +1385,7 @@ export default {
1376 1385
 
1377 1386
         options.applicationName = interfaceConfig.APP_NAME;
1378 1387
         options.getWiFiStatsMethod = this._getWiFiStatsMethod;
1379
-        options.confID = `${locationURL.host}${locationURL.pathname}`;
1388
+        options.confID = `${locationURL.host}${getBackendSafePath(locationURL.pathname)}`;
1380 1389
         options.createVADProcessor = createRnnoiseProcessorPromise;
1381 1390
 
1382 1391
         // Disable CallStats, if requessted.

+ 5
- 1
react/features/base/conference/actions.js View File

@@ -24,6 +24,7 @@ import {
24 24
 } from '../participants';
25 25
 import { getLocalTracks, trackAdded, trackRemoved } from '../tracks';
26 26
 import {
27
+    getBackendSafePath,
27 28
     getBackendSafeRoomName,
28 29
     getJitsiMeetGlobalNS
29 30
 } from '../util';
@@ -417,7 +418,9 @@ export function createConference() {
417 418
         }
418 419
 
419 420
         const config = state['features/base/config'];
421
+        const { tenant } = state['features/base/jwt'];
420 422
         const { email, name: nick } = getLocalParticipant(state);
423
+
421 424
         const conference
422 425
             = connection.initJitsiConference(
423 426
 
@@ -425,7 +428,8 @@ export function createConference() {
425 428
                     ...config,
426 429
                     applicationName: getName(),
427 430
                     getWiFiStatsMethod: getJitsiMeetGlobalNS().getWiFiStats,
428
-                    confID: `${locationURL.host}${locationURL.pathname}`,
431
+                    confID: `${locationURL.host}${getBackendSafePath(locationURL.pathname)}`,
432
+                    siteID: tenant,
429 433
                     statisticsDisplayName: config.enableDisplayNameInStats ? nick : undefined,
430 434
                     statisticsId: config.enableEmailInStats ? email : undefined
431 435
                 });

+ 1
- 0
react/features/base/jwt/middleware.js View File

@@ -146,6 +146,7 @@ function _setJWT(store, next, action) {
146 146
                     action.callee = context.callee;
147 147
                     action.group = context.group;
148 148
                     action.server = context.server;
149
+                    action.tenant = context.tenant;
149 150
                     action.user = user;
150 151
 
151 152
                     user && _overwriteLocalParticipant(

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

@@ -99,6 +99,24 @@ function _fixURIStringScheme(uri: string) {
99 99
     return uri;
100 100
 }
101 101
 
102
+/**
103
+ * Converts a path to a backend-safe format, by splitting the path '/' processing each part.
104
+ * Properly lowercased and url encoded.
105
+ *
106
+ * @param {string?} path - The path to convert.
107
+ * @returns {string?}
108
+ */
109
+export function getBackendSafePath(path: ?string): ?string {
110
+    if (!path) {
111
+        return path;
112
+    }
113
+
114
+    return path
115
+        .split('/')
116
+        .map(getBackendSafeRoomName)
117
+        .join('/');
118
+}
119
+
102 120
 /**
103 121
  * Converts a room name to a backend-safe format. Properly lowercased and url encoded.
104 122
  *

Loading…
Cancel
Save