Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

callstats: add siteID passing; sanitize confID path

Gabriel Imre444e2b90df70
diff --git a/conference.js b/conference.js
index 95ec73918c..d8968c02af 100644
--- a/conference.js
+++ b/conference.js
@@ -101,7 +101,10 @@ import {
trackAdded,
trackRemoved
} from './react/features/base/tracks';
-import { getJitsiMeetGlobalNS } from './react/features/base/util';
+import {
+ getBackendSafePath,
+ getJitsiMeetGlobalNS
+} from './react/features/base/util';
import { showDesktopPicker } from './react/features/desktop-picker';
import { appendSuffix } from './react/features/display-name';
import { setE2EEKey } from './react/features/e2ee';
@@ -1364,7 +1367,13 @@ export default {
const options = config;
const { email, name: nick } = getLocalParticipant(APP.store.getState());
- const { locationURL } = APP.store.getState()['features/base/connection'];
+ const state = APP.store.getState();
+ const { locationURL } = state['features/base/connection'];
+ const { tenant } = state['features/base/jwt'];
+
+ if (tenant) {
+ options.siteID = tenant;
+ }
if (options.enableDisplayNameInStats && nick) {
options.statisticsDisplayName = nick;
@@ -1376,7 +1385,7 @@ export default {
options.applicationName = interfaceConfig.APP_NAME;
options.getWiFiStatsMethod = this._getWiFiStatsMethod;
- options.confID = `${locationURL.host}${locationURL.pathname}`;
+ options.confID = `${locationURL.host}${getBackendSafePath(locationURL.pathname)}`;
options.createVADProcessor = createRnnoiseProcessorPromise;
// Disable CallStats, if requessted.
diff --git a/react/features/base/conference/actions.js b/react/features/base/conference/actions.js
index 61d3e8ac77..ffdb23fc53 100644
--- a/react/features/base/conference/actions.js
+++ b/react/features/base/conference/actions.js
@@ -24,6 +24,7 @@ import {
} from '../participants';
import { getLocalTracks, trackAdded, trackRemoved } from '../tracks';
import {
+ getBackendSafePath,
getBackendSafeRoomName,
getJitsiMeetGlobalNS
} from '../util';
@@ -417,7 +418,9 @@ export function createConference() {
}
const config = state['features/base/config'];
+ const { tenant } = state['features/base/jwt'];
const { email, name: nick } = getLocalParticipant(state);
+
const conference
= connection.initJitsiConference(
@@ -425,7 +428,8 @@ export function createConference() {
...config,
applicationName: getName(),
getWiFiStatsMethod: getJitsiMeetGlobalNS().getWiFiStats,
- confID: `${locationURL.host}${locationURL.pathname}`,
+ confID: `${locationURL.host}${getBackendSafePath(locationURL.pathname)}`,
+ siteID: tenant,
statisticsDisplayName: config.enableDisplayNameInStats ? nick : undefined,
statisticsId: config.enableEmailInStats ? email : undefined
});
diff --git a/react/features/base/jwt/middleware.js b/react/features/base/jwt/middleware.js
index 3b8285b0bf..bcfb0c63f6 100644
--- a/react/features/base/jwt/middleware.js
+++ b/react/features/base/jwt/middleware.js
@@ -146,6 +146,7 @@ function _setJWT(store, next, action) {
action.callee = context.callee;
action.group = context.group;
action.server = context.server;
+ action.tenant = context.tenant;
action.user = user;
user && _overwriteLocalParticipant(
diff --git a/react/features/base/util/uri.js b/react/features/base/util/uri.js
index 142afe80fa..4ecaa85894 100644
--- a/react/features/base/util/uri.js
+++ b/react/features/base/util/uri.js
@@ -99,6 +99,24 @@ function _fixURIStringScheme(uri: string) {
return uri;
}
+/**
+ * Converts a path to a backend-safe format, by splitting the path '/' processing each part.
+ * Properly lowercased and url encoded.
+ *
+ * @param {string?} path - The path to convert.
+ * @returns {string?}
+ */
+export function getBackendSafePath(path: ?string): ?string {
+ if (!path) {
+ return path;
+ }
+
+ return path
+ .split('/')
+ .map(getBackendSafeRoomName)
+ .join('/');
+}
+
/**
* Converts a room name to a backend-safe format. Properly lowercased and url encoded.
*