Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
e2ee: broadcast e2ee enabled status using presnce
Saúl Ibarra Corretgé2ad6bfbc2029
diff --git a/react/features/base/participants/middleware.js b/react/features/base/participants/middleware.jsindex 9edb6ce7d6..9886b6219a 100644--- a/react/features/base/participants/middleware.js+++ b/react/features/base/participants/middleware.js@@ -196,6 +196,9 @@ StateListenerRegistry.register(JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,(participant, propertyName, oldValue, newValue) => {switch (propertyName) {+ case 'e2eeEnabled':+ _e2eeUpdated(store, conference, participant.getId(), newValue);+ break;case 'features_e2ee':store.dispatch(participantUpdated({conference,@@ -218,8 +221,7 @@ StateListenerRegistry.register(}));break;case 'raisedHand': {- _raiseHandUpdated(- store, conference, participant.getId(), newValue);+ _raiseHandUpdated(store, conference, participant.getId(), newValue);break;}default:@@ -229,13 +231,34 @@ StateListenerRegistry.register(});} else {- // We left the conference, raise hand of the local participant must be updated.- _raiseHandUpdated(- store, conference, undefined, false);+ const localParticipantId = getLocalParticipant(store.getState).getId();++ // We left the conference, the local participant must be updated.+ _e2eeUpdated(store, conference, localParticipantId, false);+ _raiseHandUpdated(store, conference, localParticipantId, false);}});+/**+ * Handles a E2EE enabled status update.+ *+ * @param {Function} dispatch - The Redux dispatch function.+ * @param {Object} conference - The conference for which we got an update.+ * @param {string} participantId - The ID of the participant from which we got an update.+ * @param {boolean} newValue - The new value of the E2EE enabled status.+ * @returns {void}+ */+function _e2eeUpdated({ dispatch }, conference, participantId, newValue) {+ const e2eeEnabled = newValue === 'true';++ dispatch(participantUpdated({+ conference,+ id: participantId,+ e2eeEnabled+ }));+}+/*** Initializes the local participant and signals that it joined.*@@ -331,7 +354,7 @@ function _maybePlaySounds({ getState, dispatch }, action) {* @returns {Object} The value returned by {@code next(action)}.*/function _participantJoinedOrUpdated({ dispatch, getState }, next, action) {- const { participant: { avatarURL, email, id, local, name, raisedHand } } = action;+ const { participant: { avatarURL, e2eeEnabled, email, id, local, name, raisedHand } } = action;// Send an external update of the local participant's raised hand state// if a new raised hand state is defined in the action.@@ -346,6 +369,16 @@ function _participantJoinedOrUpdated({ dispatch, getState }, next, action) {}}+ // Send an external update of the local participant's E2EE enabled state+ // if a new state is defined in the action.+ if (typeof e2eeEnabled !== 'undefined') {+ if (local) {+ const { conference } = getState()['features/base/conference'];++ conference && conference.setLocalParticipantProperty('e2eeEnabled', e2eeEnabled);+ }+ }+// Allow the redux update to go through and compare the old avatar// to the new avatar and emit out change events if necessary.const result = next(action);@@ -378,25 +411,23 @@ function _participantJoinedOrUpdated({ dispatch, getState }, next, action) {** @param {Function} dispatch - The Redux dispatch function.* @param {Object} conference - The conference for which we got an update.- * @param {string?} participantId - The ID of the participant from which we got an update. If undefined,- * we update the local participant.+ * @param {string} participantId - The ID of the participant from which we got an update.* @param {boolean} newValue - The new value of the raise hand status.* @returns {void}*/function _raiseHandUpdated({ dispatch, getState }, conference, participantId, newValue) {const raisedHand = newValue === 'true';- const pid = participantId || getLocalParticipant(getState()).id;dispatch(participantUpdated({conference,- id: pid,+ id: participantId,raisedHand}));if (raisedHand) {dispatch(showNotification({titleArguments: {- name: getParticipantDisplayName(getState, pid)+ name: getParticipantDisplayName(getState, participantId)},titleKey: 'notify.raisedHand'}, NOTIFICATION_TIMEOUT));diff --git a/react/features/e2ee/middleware.js b/react/features/e2ee/middleware.jsindex dce19e8ad6..1d1f9d4b15 100644--- a/react/features/e2ee/middleware.js+++ b/react/features/e2ee/middleware.js@@ -1,6 +1,7 @@// @flowimport { getCurrentConference } from '../base/conference';+import { getLocalParticipant, participantUpdated } from '../base/participants';import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';import { SET_E2EE_KEY } from './actionTypes';@@ -13,7 +14,7 @@ import logger from './logger';* @param {Store} store - The redux store.* @returns {Function}*/-MiddlewareRegistry.register(({ getState }) => next => action => {+MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {switch (action.type) {case SET_E2EE_KEY: {const conference = getCurrentConference(getState);@@ -21,6 +22,15 @@ MiddlewareRegistry.register(({ getState }) => next => action => {if (conference) {logger.debug(`New E2EE key: ${action.key}`);conference.setE2EEKey(action.key);++ // Broadccast that we enabled / disabled E2EE.+ const participant = getLocalParticipant(getState);++ dispatch(participantUpdated({+ e2eeEnabled: Boolean(action.key),+ id: participant.id,+ local: true+ }));}break;