feat(e2ee): auto turns on e2ee when one participant enabled it

This commit is contained in:
tmoldovan8x8 2021-04-01 12:34:01 +03:00 committed by GitHub
parent 58b7663a97
commit 1224597ede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 17 deletions

4
package-lock.json generated
View File

@ -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",

View File

@ -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",

View File

@ -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);

View File

@ -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);