Add feature flag for disabling encryption in Element Call (#11837)

* add feature flag for disabling encryption

Signed-off-by: Timo K <toger5@hotmail.de>

* prettier

Signed-off-by: Timo K <toger5@hotmail.de>

* Update src/i18n/strings/en_EN.json

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>

* add tests and make url flags explicit

Signed-off-by: Timo K <toger5@hotmail.de>

* remove unnecessary braces

Signed-off-by: Timo K <toger5@hotmail.de>

---------

Signed-off-by: Timo K <toger5@hotmail.de>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
Timo 2023-11-10 17:46:02 +01:00 committed by GitHub
parent cfd5165cd8
commit 62f41f0961
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 3 deletions

View file

@ -1398,6 +1398,7 @@
"element_call_video_rooms": "Element Call video rooms", "element_call_video_rooms": "Element Call video rooms",
"experimental_description": "Feeling experimental? Try out our latest ideas in development. These features are not finalised; they may be unstable, may change, or may be dropped altogether. <a>Learn more</a>.", "experimental_description": "Feeling experimental? Try out our latest ideas in development. These features are not finalised; they may be unstable, may change, or may be dropped altogether. <a>Learn more</a>.",
"experimental_section": "Early previews", "experimental_section": "Early previews",
"feature_disable_call_per_sender_encryption": "Disable per-sender encryption for Element Call",
"feature_wysiwyg_composer_description": "Use rich text instead of Markdown in the message composer.", "feature_wysiwyg_composer_description": "Use rich text instead of Markdown in the message composer.",
"group_calls": "New group call experience", "group_calls": "New group call experience",
"group_developer": "Developer", "group_developer": "Developer",

View file

@ -661,9 +661,11 @@ export class ElementCall extends Call {
analyticsID, analyticsID,
}); });
if (client.isRoomEncrypted(roomId)) params.append("perParticipantE2EE", ""); if (client.isRoomEncrypted(roomId) && !SettingsStore.getValue("feature_disable_call_per_sender_encryption"))
if (SettingsStore.getValue("fallbackICEServerAllowed")) params.append("allowIceFallback", ""); params.append("perParticipantE2EE", "true");
if (SettingsStore.getValue("feature_allow_screen_share_only_mode")) params.append("allowVoipWithNoMedia", ""); if (SettingsStore.getValue("fallbackICEServerAllowed")) params.append("allowIceFallback", "true");
if (SettingsStore.getValue("feature_allow_screen_share_only_mode"))
params.append("allowVoipWithNoMedia", "true");
// Set custom fonts // Set custom fonts
if (SettingsStore.getValue("useSystemFont")) { if (SettingsStore.getValue("useSystemFont")) {

View file

@ -404,6 +404,13 @@ export const SETTINGS: { [setting: string]: ISetting } = {
controller: new ReloadOnChangeController(), controller: new ReloadOnChangeController(),
default: false, default: false,
}, },
"feature_disable_call_per_sender_encryption": {
isFeature: true,
supportedLevels: LEVELS_FEATURE,
labsGroup: LabGroup.VoiceAndVideo,
displayName: _td("labs|feature_disable_call_per_sender_encryption"),
default: false,
},
"feature_allow_screen_share_only_mode": { "feature_allow_screen_share_only_mode": {
isFeature: true, isFeature: true,
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG, supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,

View file

@ -925,6 +925,30 @@ describe("ElementCall", () => {
call.destroy(); call.destroy();
expect(destroyPersistentWidgetSpy).toHaveBeenCalled(); expect(destroyPersistentWidgetSpy).toHaveBeenCalled();
}); });
it("the perParticipantE2EE url flag is used in encrypted rooms while respecting the feature_disable_call_per_sender_encryption flag", async () => {
// We destroy the call created in beforeEach because we test the call creation process.
call.destroy();
const addWidgetSpy = jest.spyOn(WidgetStore.instance, "addVirtualWidget");
// If a room is not encrypted we will never add the perParticipantE2EE flag.
client.isRoomEncrypted.mockReturnValue(true);
// should create call with perParticipantE2EE flag
ElementCall.create(room);
expect(addWidgetSpy.mock.calls[0][0].url).toContain("perParticipantE2EE=true");
ElementCall.get(room)?.destroy();
// should create call without perParticipantE2EE flag
enabledSettings.add("feature_disable_call_per_sender_encryption");
await ElementCall.create(room);
enabledSettings.delete("feature_disable_call_per_sender_encryption");
expect(addWidgetSpy.mock.calls[1][0].url).not.toContain("perParticipantE2EE=true");
client.isRoomEncrypted.mockClear();
addWidgetSpy.mockRestore();
});
}); });
describe("instance in a video room", () => { describe("instance in a video room", () => {