From 1224597edeed30fc7d6b4fbcd99777909a5d36e6 Mon Sep 17 00:00:00 2001 From: tmoldovan8x8 <62697631+tmoldovan8x8@users.noreply.github.com> Date: Thu, 1 Apr 2021 12:34:01 +0300 Subject: [PATCH] feat(e2ee): auto turns on e2ee when one participant enabled it --- package-lock.json | 4 ++-- package.json | 2 +- .../features/base/participants/middleware.js | 21 +++++++------------ react/features/e2ee/middleware.js | 2 +- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index cf4e149d1..5c1c1a0f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10513,8 +10513,8 @@ } }, "lib-jitsi-meet": { - "version": "github:jitsi/lib-jitsi-meet#43c589f4096e0e123f92eca46d4c317f731ebc18", - "from": "github:jitsi/lib-jitsi-meet#43c589f4096e0e123f92eca46d4c317f731ebc18", + "version": "github:jitsi/lib-jitsi-meet#2b94da12e81626c7b9deb24dd95f8ca2038a2f5a", + "from": "github:jitsi/lib-jitsi-meet#2b94da12e81626c7b9deb24dd95f8ca2038a2f5a", "requires": { "@jitsi/js-utils": "1.0.2", "@jitsi/sdp-interop": "1.0.3", diff --git a/package.json b/package.json index c07c8bed1..eb3825eb1 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "jquery-i18next": "1.2.1", "js-md5": "0.6.1", "jwt-decode": "2.2.0", - "lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#43c589f4096e0e123f92eca46d4c317f731ebc18", + "lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#2b94da12e81626c7b9deb24dd95f8ca2038a2f5a", "libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d", "lodash": "4.17.21", "moment": "2.29.1", diff --git a/react/features/base/participants/middleware.js b/react/features/base/participants/middleware.js index 91448cd75..e787108d6 100644 --- a/react/features/base/participants/middleware.js +++ b/react/features/base/participants/middleware.js @@ -1,6 +1,7 @@ // @flow import UIEvents from '../../../../service/UI/UIEvents'; +import { toggleE2EE } from '../../e2ee/actions'; import { NOTIFICATION_TIMEOUT, showNotification } from '../../notifications'; import { CALLING, INVITED } from '../../presence-status'; import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app'; @@ -207,7 +208,7 @@ StateListenerRegistry.register( (conference, store) => { if (conference) { const propertyHandlers = { - 'e2eeEnabled': (participant, value) => _e2eeUpdated(store, conference, participant.getId(), value), + 'e2ee.enabled': (participant, value) => _e2eeUpdated(store, conference, participant.getId(), value), 'features_e2ee': (participant, value) => store.dispatch(participantUpdated({ conference, @@ -270,12 +271,16 @@ StateListenerRegistry.register( * @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. + * @param {boolean} newValue - The new value of the E2EE enabled status. * @returns {void} */ function _e2eeUpdated({ dispatch }, conference, participantId, newValue) { const e2eeEnabled = newValue === 'true'; + if (e2eeEnabled) { + dispatch(toggleE2EE(e2eeEnabled)); + } + dispatch(participantUpdated({ conference, id: participantId, @@ -383,7 +388,7 @@ function _maybePlaySounds({ getState, dispatch }, action) { */ function _participantJoinedOrUpdated(store, next, action) { const { dispatch, getState } = store; - const { participant: { avatarURL, e2eeEnabled, email, id, local, name, raisedHand } } = action; + const { participant: { avatarURL, 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. @@ -398,16 +403,6 @@ function _participantJoinedOrUpdated(store, 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); diff --git a/react/features/e2ee/middleware.js b/react/features/e2ee/middleware.js index e0301dd5c..1941f7c92 100644 --- a/react/features/e2ee/middleware.js +++ b/react/features/e2ee/middleware.js @@ -38,7 +38,7 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { case TOGGLE_E2EE: { const conference = getCurrentConference(getState); - if (conference) { + if (conference && conference.isE2EEEnabled() !== action.enabled) { logger.debug(`E2EE will be ${action.enabled ? 'enabled' : 'disabled'}`); conference.toggleE2EE(action.enabled);