Skip to content

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

feat: Reduces into state region and shard changes from the lib. (#14546)

Дамян Минков2c6f4e27fc88
diff --git a/package-lock.json b/package-lock.json
index fd4613d66b..d546c27c0b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -61,7 +61,7 @@
"js-md5": "0.6.1",
"js-sha512": "0.8.0",
"jwt-decode": "2.2.0",
- "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1802.0.0+49ff6eb4/lib-jitsi-meet.tgz",
+ "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1803.0.0+5237dbfe/lib-jitsi-meet.tgz",
"lodash": "4.17.21",
"moment": "2.29.4",
"moment-duration-format": "2.2.2",
@@ -12772,8 +12772,8 @@
},
"node_modules/lib-jitsi-meet": {
"version": "0.0.0",
- "resolved": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1802.0.0+49ff6eb4/lib-jitsi-meet.tgz",
- "integrity": "sha512-/BCu2u6XutBEQJkhNtgGy6UREiZGkiCEEfOHekA1KXUNE0q3V/t47AYYDMPQPqZkkuv2gFK/MKLUdI49RaTYUA==",
+ "resolved": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1803.0.0+5237dbfe/lib-jitsi-meet.tgz",
+ "integrity": "sha512-Rbv28RFFz7Y4NgqcTi9oRAxzjrR+jK9djlphybWcIT3o36y8fKogst3y/3AgH58m9wQI53jLGMDznC5bTtflOw==",
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {
@@ -29183,8 +29183,8 @@
}
},
"lib-jitsi-meet": {
- "version": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1802.0.0+49ff6eb4/lib-jitsi-meet.tgz",
- "integrity": "sha512-/BCu2u6XutBEQJkhNtgGy6UREiZGkiCEEfOHekA1KXUNE0q3V/t47AYYDMPQPqZkkuv2gFK/MKLUdI49RaTYUA==",
+ "version": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1803.0.0+5237dbfe/lib-jitsi-meet.tgz",
+ "integrity": "sha512-Rbv28RFFz7Y4NgqcTi9oRAxzjrR+jK9djlphybWcIT3o36y8fKogst3y/3AgH58m9wQI53jLGMDznC5bTtflOw==",
"requires": {
"@jitsi/js-utils": "2.2.1",
"@jitsi/logger": "2.0.2",
diff --git a/package.json b/package.json
index e4be305861..13587f8393 100644
--- a/package.json
+++ b/package.json
@@ -67,7 +67,7 @@
"js-md5": "0.6.1",
"js-sha512": "0.8.0",
"jwt-decode": "2.2.0",
- "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1802.0.0+49ff6eb4/lib-jitsi-meet.tgz",
+ "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1803.0.0+5237dbfe/lib-jitsi-meet.tgz",
"lodash": "4.17.21",
"moment": "2.29.4",
"moment-duration-format": "2.2.2",
diff --git a/react/features/base/config/reducer.ts b/react/features/base/config/reducer.ts
index 2f0abfe3e9..1faca9591e 100644
--- a/react/features/base/config/reducer.ts
+++ b/react/features/base/config/reducer.ts
@@ -3,6 +3,7 @@ import _ from 'lodash';
import { CONFERENCE_INFO } from '../../conference/components/constants';
import { TOOLBAR_BUTTONS } from '../../toolbox/constants';
import { ToolbarButton } from '../../toolbox/types';
+import { CONNECTION_PROPERTIES_UPDATED } from '../connection/actionTypes';
import ReducerRegistry from '../redux/ReducerRegistry';
import { equals } from '../redux/functions';
@@ -94,6 +95,24 @@ ReducerRegistry.register<IConfigState>('features/base/config', (state = _getInit
locationURL: action.locationURL
};
+ case CONNECTION_PROPERTIES_UPDATED: {
+ const { region, shard } = action.properties;
+ const { deploymentInfo } = state;
+
+ if (deploymentInfo?.region === region && deploymentInfo?.shard === shard) {
+ return state;
+ }
+
+ return {
+ ...state,
+ deploymentInfo: JSON.parse(JSON.stringify({
+ ...deploymentInfo,
+ region,
+ shard
+ }))
+ };
+ }
+
case LOAD_CONFIG_ERROR:
// XXX LOAD_CONFIG_ERROR is one of the settlement execution paths of
// the asynchronous "loadConfig procedure/process" started with
diff --git a/react/features/base/connection/actionTypes.ts b/react/features/base/connection/actionTypes.ts
index 5f9df75a0f..f11ac2d3e8 100644
--- a/react/features/base/connection/actionTypes.ts
+++ b/react/features/base/connection/actionTypes.ts
@@ -31,6 +31,16 @@ export const CONNECTION_ESTABLISHED = 'CONNECTION_ESTABLISHED';
*/
export const CONNECTION_FAILED = 'CONNECTION_FAILED';
+/**
+ * The type of (redux) action which signals that connection properties were updated.
+ *
+ * {
+ * type: CONNECTION_PROPERTIES_UPDATED,
+ * properties: Object
+ * }
+ */
+export const CONNECTION_PROPERTIES_UPDATED = 'CONNECTION_PROPERTIES_UPDATED';
+
/**
* The type of (redux) action which signals that a connection will connect.
*
diff --git a/react/features/base/connection/actions.any.ts b/react/features/base/connection/actions.any.ts
index 2d5195c724..3f9313d8e0 100644
--- a/react/features/base/connection/actions.any.ts
+++ b/react/features/base/connection/actions.any.ts
@@ -15,6 +15,7 @@ import {
CONNECTION_DISCONNECTED,
CONNECTION_ESTABLISHED,
CONNECTION_FAILED,
+ CONNECTION_PROPERTIES_UPDATED,
CONNECTION_WILL_CONNECT,
SET_LOCATION_URL,
SET_PREFER_VISITOR
@@ -230,6 +231,9 @@ export function _connectInternal(id?: string, password?: string) {
connection.addEventListener(
JitsiConnectionEvents.CONNECTION_REDIRECTED,
_onConnectionRedirected);
+ connection.addEventListener(
+ JitsiConnectionEvents.PROPERTIES_UPDATED,
+ _onPropertiesUpdate);
/**
* Unsubscribe the connection instance from
@@ -241,6 +245,7 @@ export function _connectInternal(id?: string, password?: string) {
connection.removeEventListener(
JitsiConnectionEvents.CONNECTION_DISCONNECTED, _onConnectionDisconnected);
connection.removeEventListener(JitsiConnectionEvents.CONNECTION_FAILED, _onConnectionFailed);
+ connection.removeEventListener(JitsiConnectionEvents.PROPERTIES_UPDATED, _onPropertiesUpdate);
}
/**
@@ -299,7 +304,7 @@ export function _connectInternal(id?: string, password?: string) {
}
/**
- * Rejects external promise when connection fails.
+ * Connection was redirected.
*
* @param {string|undefined} vnode - The vnode to connect to.
* @param {string} focusJid - The focus jid to use.
@@ -313,6 +318,17 @@ export function _connectInternal(id?: string, password?: string) {
dispatch(redirect(vnode, focusJid, username));
}
+ /**
+ * Connection properties were updated.
+ *
+ * @param {Object} properties - The properties which were updated.
+ * @private
+ * @returns {void}
+ */
+ function _onPropertiesUpdate(properties: object) {
+ dispatch(_propertiesUpdate(properties));
+ }
+
// in case of configured http url for conference request we need the room name
const name = getBackendSafeRoomName(state['features/base/conference'].room);
@@ -343,6 +359,23 @@ function _connectionWillConnect(connection: Object) {
};
}
+/**
+ * Create an action for when connection properties are updated.
+ *
+ * @param {Object} properties - The properties which were updated.
+ * @private
+ * @returns {{
+ * type: CONNECTION_PROPERTIES_UPDATED,
+ * properties: Object
+ * }}
+ */
+function _propertiesUpdate(properties: object) {
+ return {
+ type: CONNECTION_PROPERTIES_UPDATED,
+ properties
+ };
+}
+
/**
* Closes connection.
*