From 7bee0de014d9ac202f8f0e0d29d9bdadb15d962f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Wed, 26 Jul 2023 15:46:08 +0200 Subject: [PATCH 1/2] Disable E2EE settings on unsupported browsers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/settings/SettingsModal.tsx | 9 +++++++-- src/settings/useSetting.ts | 14 +++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/settings/SettingsModal.tsx b/src/settings/SettingsModal.tsx index 3ebb215c..b88d99b8 100644 --- a/src/settings/SettingsModal.tsx +++ b/src/settings/SettingsModal.tsx @@ -262,10 +262,15 @@ export const SettingsModal = (props: Props) => { id="enableE2EE" name="end-to-end-encryption" label={t("Enable end-to-end encryption (password protected calls)")} + description={ + !setEnableE2EE && + t("End-to-end encryption isn't supported on your browser.") + } + disabled={!setEnableE2EE} type="checkbox" - checked={enableE2EE} + checked={enableE2EE ?? undefined} onChange={(e: ChangeEvent) => - setEnableE2EE(e.target.checked) + setEnableE2EE?.(e.target.checked) } /> diff --git a/src/settings/useSetting.ts b/src/settings/useSetting.ts index 8d3f074f..8fe85b12 100644 --- a/src/settings/useSetting.ts +++ b/src/settings/useSetting.ts @@ -16,6 +16,7 @@ limitations under the License. import { EventEmitter } from "events"; import { useMemo, useState, useEffect, useCallback } from "react"; +import { isE2EESupported } from "livekit-client"; import { PosthogAnalytics } from "../analytics/PosthogAnalytics"; @@ -98,15 +99,22 @@ export const useOptInAnalytics = (): DisableableSetting => { return [false, null]; }; +export const useEnableE2EE = (): DisableableSetting => { + const settingVal = useSetting( + "enable-end-to-end-encryption", + false + ); + if (isE2EESupported()) return settingVal; + + return [false, null]; +}; + export const useDeveloperSettingsTab = () => useSetting("developer-settings-tab", false); export const useShowConnectionStats = () => useSetting("show-connection-stats", false); -export const useEnableE2EE = () => - useSetting("enable-end-to-end-encryption", false); - export const useDefaultDevices = () => useSetting("defaultDevices", { audioinput: "", From 7a3e64972fc9e09a9effa9d440212c109fdbe112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Wed, 26 Jul 2023 15:52:53 +0200 Subject: [PATCH 2/2] i18n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- public/locales/en-GB/app.json | 1 + 1 file changed, 1 insertion(+) diff --git a/public/locales/en-GB/app.json b/public/locales/en-GB/app.json index 34d84534..fb9ebfe9 100644 --- a/public/locales/en-GB/app.json +++ b/public/locales/en-GB/app.json @@ -40,6 +40,7 @@ "Element Call Home": "Element Call Home", "Element Call is temporarily not end-to-end encrypted while we test scalability.": "Element Call is temporarily not end-to-end encrypted while we test scalability.", "Enable end-to-end encryption (password protected calls)": "Enable end-to-end encryption (password protected calls)", + "End-to-end encryption isn't supported on your browser.": "End-to-end encryption isn't supported on your browser.", "Exit full screen": "Exit full screen", "Expose developer settings in the settings window.": "Expose developer settings in the settings window.", "Feedback": "Feedback",