Merge pull request #1755 from vector-im/dbkr/remove_e2ee_setting
Remove E2EE setting
This commit is contained in:
@@ -36,10 +36,8 @@
|
|||||||
"Developer Settings": "Developer Settings",
|
"Developer Settings": "Developer Settings",
|
||||||
"Display name": "Display name",
|
"Display name": "Display name",
|
||||||
"Element Call Home": "Element Call Home",
|
"Element Call Home": "Element Call Home",
|
||||||
"Enable end-to-end encryption (password protected calls)": "Enable end-to-end encryption (password protected calls)",
|
|
||||||
"Encrypted": "Encrypted",
|
"Encrypted": "Encrypted",
|
||||||
"End call": "End call",
|
"End call": "End call",
|
||||||
"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",
|
"Exit full screen": "Exit full screen",
|
||||||
"Expose developer settings in the settings window.": "Expose developer settings in the settings window.",
|
"Expose developer settings in the settings window.": "Expose developer settings in the settings window.",
|
||||||
"Feedback": "Feedback",
|
"Feedback": "Feedback",
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ limitations under the License.
|
|||||||
|
|
||||||
import { useEffect, useMemo } from "react";
|
import { useEffect, useMemo } from "react";
|
||||||
|
|
||||||
import { useEnableE2EE } from "../settings/useSetting";
|
|
||||||
import { setLocalStorageItem, useLocalStorage } from "../useLocalStorage";
|
import { setLocalStorageItem, useLocalStorage } from "../useLocalStorage";
|
||||||
import { useClient } from "../ClientContext";
|
import { useClient } from "../ClientContext";
|
||||||
import { useUrlParams } from "../UrlParams";
|
import { useUrlParams } from "../UrlParams";
|
||||||
@@ -27,10 +26,9 @@ export const getRoomSharedKeyLocalStorageKey = (roomId: string): string =>
|
|||||||
|
|
||||||
const useInternalRoomSharedKey = (roomId: string): string | null => {
|
const useInternalRoomSharedKey = (roomId: string): string | null => {
|
||||||
const key = getRoomSharedKeyLocalStorageKey(roomId);
|
const key = getRoomSharedKeyLocalStorageKey(roomId);
|
||||||
const [e2eeEnabled] = useEnableE2EE();
|
|
||||||
const roomSharedKey = useLocalStorage(key)[0];
|
const roomSharedKey = useLocalStorage(key)[0];
|
||||||
|
|
||||||
return e2eeEnabled ? roomSharedKey : null;
|
return roomSharedKey;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import { UserMenuContainer } from "../UserMenuContainer";
|
|||||||
import { JoinExistingCallModal } from "./JoinExistingCallModal";
|
import { JoinExistingCallModal } from "./JoinExistingCallModal";
|
||||||
import { Caption } from "../typography/Typography";
|
import { Caption } from "../typography/Typography";
|
||||||
import { Form } from "../form/Form";
|
import { Form } from "../form/Form";
|
||||||
import { useEnableE2EE, useOptInAnalytics } from "../settings/useSetting";
|
import { useOptInAnalytics } from "../settings/useSetting";
|
||||||
import { AnalyticsNotice } from "../analytics/AnalyticsNotice";
|
import { AnalyticsNotice } from "../analytics/AnalyticsNotice";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -57,7 +57,6 @@ export const RegisteredView: FC<Props> = ({ client }) => {
|
|||||||
() => setJoinExistingCallModalOpen(false),
|
() => setJoinExistingCallModalOpen(false),
|
||||||
[setJoinExistingCallModalOpen],
|
[setJoinExistingCallModalOpen],
|
||||||
);
|
);
|
||||||
const [e2eeEnabled] = useEnableE2EE();
|
|
||||||
|
|
||||||
const onSubmit: FormEventHandler<HTMLFormElement> = useCallback(
|
const onSubmit: FormEventHandler<HTMLFormElement> = useCallback(
|
||||||
(e: FormEvent) => {
|
(e: FormEvent) => {
|
||||||
@@ -73,11 +72,7 @@ export const RegisteredView: FC<Props> = ({ client }) => {
|
|||||||
setError(undefined);
|
setError(undefined);
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
||||||
const createRoomResult = await createRoom(
|
const createRoomResult = await createRoom(client, roomName, true);
|
||||||
client,
|
|
||||||
roomName,
|
|
||||||
e2eeEnabled ?? false,
|
|
||||||
);
|
|
||||||
|
|
||||||
history.push(
|
history.push(
|
||||||
getRelativeRoomUrl(
|
getRelativeRoomUrl(
|
||||||
@@ -101,7 +96,7 @@ export const RegisteredView: FC<Props> = ({ client }) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[client, history, setJoinExistingCallModalOpen, e2eeEnabled],
|
[client, history, setJoinExistingCallModalOpen],
|
||||||
);
|
);
|
||||||
|
|
||||||
const recentRooms = useGroupCallRooms(client);
|
const recentRooms = useGroupCallRooms(client);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import styles from "./UnauthenticatedView.module.css";
|
|||||||
import commonStyles from "./common.module.css";
|
import commonStyles from "./common.module.css";
|
||||||
import { generateRandomName } from "../auth/generateRandomName";
|
import { generateRandomName } from "../auth/generateRandomName";
|
||||||
import { AnalyticsNotice } from "../analytics/AnalyticsNotice";
|
import { AnalyticsNotice } from "../analytics/AnalyticsNotice";
|
||||||
import { useEnableE2EE, useOptInAnalytics } from "../settings/useSetting";
|
import { useOptInAnalytics } from "../settings/useSetting";
|
||||||
import { Config } from "../config/Config";
|
import { Config } from "../config/Config";
|
||||||
|
|
||||||
export const UnauthenticatedView: FC = () => {
|
export const UnauthenticatedView: FC = () => {
|
||||||
@@ -62,8 +62,6 @@ export const UnauthenticatedView: FC = () => {
|
|||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const [e2eeEnabled] = useEnableE2EE();
|
|
||||||
|
|
||||||
const onSubmit: FormEventHandler<HTMLFormElement> = useCallback(
|
const onSubmit: FormEventHandler<HTMLFormElement> = useCallback(
|
||||||
(e) => {
|
(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -86,11 +84,7 @@ export const UnauthenticatedView: FC = () => {
|
|||||||
|
|
||||||
let createRoomResult;
|
let createRoomResult;
|
||||||
try {
|
try {
|
||||||
createRoomResult = await createRoom(
|
createRoomResult = await createRoom(client, roomName, true);
|
||||||
client,
|
|
||||||
roomName,
|
|
||||||
e2eeEnabled ?? false,
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (!setClient) {
|
if (!setClient) {
|
||||||
throw error;
|
throw error;
|
||||||
@@ -142,7 +136,6 @@ export const UnauthenticatedView: FC = () => {
|
|||||||
history,
|
history,
|
||||||
setJoinExistingCallModalOpen,
|
setJoinExistingCallModalOpen,
|
||||||
setClient,
|
setClient,
|
||||||
e2eeEnabled,
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ import { useMatrixRTCSessionMemberships } from "../useMatrixRTCSessionMembership
|
|||||||
import { enterRTCSession, leaveRTCSession } from "../rtcSessionHelpers";
|
import { enterRTCSession, leaveRTCSession } from "../rtcSessionHelpers";
|
||||||
import { useMatrixRTCSessionJoinState } from "../useMatrixRTCSessionJoinState";
|
import { useMatrixRTCSessionJoinState } from "../useMatrixRTCSessionJoinState";
|
||||||
import { useIsRoomE2EE, useRoomSharedKey } from "../e2ee/sharedKeyManagement";
|
import { useIsRoomE2EE, useRoomSharedKey } from "../e2ee/sharedKeyManagement";
|
||||||
import { useEnableE2EE } from "../settings/useSetting";
|
|
||||||
import { useRoomAvatar } from "./useRoomAvatar";
|
import { useRoomAvatar } from "./useRoomAvatar";
|
||||||
import { useRoomName } from "./useRoomName";
|
import { useRoomName } from "./useRoomName";
|
||||||
import { useJoinRule } from "./useJoinRule";
|
import { useJoinRule } from "./useJoinRule";
|
||||||
@@ -256,8 +255,6 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
}
|
}
|
||||||
}, [isJoined, rtcSession]);
|
}, [isJoined, rtcSession]);
|
||||||
|
|
||||||
const [e2eeEnabled] = useEnableE2EE();
|
|
||||||
|
|
||||||
const e2eeConfig = useMemo(
|
const e2eeConfig = useMemo(
|
||||||
() => (e2eeSharedKey ? { sharedKey: e2eeSharedKey } : undefined),
|
() => (e2eeSharedKey ? { sharedKey: e2eeSharedKey } : undefined),
|
||||||
[e2eeSharedKey],
|
[e2eeSharedKey],
|
||||||
@@ -293,7 +290,7 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
if (e2eeEnabled && isRoomE2EE && !e2eeSharedKey) {
|
if (isRoomE2EE && !e2eeSharedKey) {
|
||||||
return (
|
return (
|
||||||
<ErrorView
|
<ErrorView
|
||||||
error={
|
error={
|
||||||
@@ -317,8 +314,6 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
</Link>
|
</Link>
|
||||||
</FullScreenView>
|
</FullScreenView>
|
||||||
);
|
);
|
||||||
} else if (!e2eeEnabled && isRoomE2EE) {
|
|
||||||
return <ErrorView error={new Error("You need to enable E2EE to join.")} />;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const shareModal = (
|
const shareModal = (
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession";
|
|||||||
|
|
||||||
import type { Room } from "matrix-js-sdk/src/models/room";
|
import type { Room } from "matrix-js-sdk/src/models/room";
|
||||||
import type { GroupCall } from "matrix-js-sdk/src/webrtc/groupCall";
|
import type { GroupCall } from "matrix-js-sdk/src/webrtc/groupCall";
|
||||||
import { useEnableE2EE } from "../settings/useSetting";
|
|
||||||
|
|
||||||
export type GroupCallLoaded = {
|
export type GroupCallLoaded = {
|
||||||
kind: "loaded";
|
kind: "loaded";
|
||||||
@@ -57,8 +56,6 @@ export const useLoadGroupCall = (
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [state, setState] = useState<GroupCallStatus>({ kind: "loading" });
|
const [state, setState] = useState<GroupCallStatus>({ kind: "loading" });
|
||||||
|
|
||||||
const [e2eeEnabled] = useEnableE2EE();
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchOrCreateRoom = async (): Promise<Room> => {
|
const fetchOrCreateRoom = async (): Promise<Room> => {
|
||||||
let room: Room | null = null;
|
let room: Room | null = null;
|
||||||
@@ -129,7 +126,7 @@ export const useLoadGroupCall = (
|
|||||||
.then(fetchOrCreateGroupCall)
|
.then(fetchOrCreateGroupCall)
|
||||||
.then((rtcSession) => setState({ kind: "loaded", rtcSession }))
|
.then((rtcSession) => setState({ kind: "loaded", rtcSession }))
|
||||||
.catch((error) => setState({ kind: "failed", error }));
|
.catch((error) => setState({ kind: "failed", error }));
|
||||||
}, [client, roomIdOrAlias, viaServers, t, e2eeEnabled]);
|
}, [client, roomIdOrAlias, viaServers, t]);
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import {
|
|||||||
useOptInAnalytics,
|
useOptInAnalytics,
|
||||||
useDeveloperSettingsTab,
|
useDeveloperSettingsTab,
|
||||||
useShowConnectionStats,
|
useShowConnectionStats,
|
||||||
useEnableE2EE,
|
|
||||||
isFirefox,
|
isFirefox,
|
||||||
} from "./useSetting";
|
} from "./useSetting";
|
||||||
import { FieldRow, InputField } from "../input/Input";
|
import { FieldRow, InputField } from "../input/Input";
|
||||||
@@ -64,7 +63,6 @@ export const SettingsModal: FC<Props> = (props) => {
|
|||||||
useDeveloperSettingsTab();
|
useDeveloperSettingsTab();
|
||||||
const [showConnectionStats, setShowConnectionStats] =
|
const [showConnectionStats, setShowConnectionStats] =
|
||||||
useShowConnectionStats();
|
useShowConnectionStats();
|
||||||
const [enableE2EE, setEnableE2EE] = useEnableE2EE();
|
|
||||||
|
|
||||||
// Generate a `SelectInput` with a list of devices for a given device kind.
|
// Generate a `SelectInput` with a list of devices for a given device kind.
|
||||||
const generateDeviceSelection = (
|
const generateDeviceSelection = (
|
||||||
@@ -243,23 +241,6 @@ export const SettingsModal: FC<Props> = (props) => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</FieldRow>
|
</FieldRow>
|
||||||
<FieldRow>
|
|
||||||
<InputField
|
|
||||||
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 ?? undefined}
|
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>): void =>
|
|
||||||
setEnableE2EE?.(e.target.checked)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</FieldRow>
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { useCallback, useMemo } from "react";
|
import { useCallback, useMemo } from "react";
|
||||||
import { isE2EESupported } from "livekit-client";
|
|
||||||
|
|
||||||
import { PosthogAnalytics } from "../analytics/PosthogAnalytics";
|
import { PosthogAnalytics } from "../analytics/PosthogAnalytics";
|
||||||
import {
|
import {
|
||||||
@@ -91,16 +90,6 @@ export const useOptInAnalytics = (): DisableableSetting<boolean | null> => {
|
|||||||
return [false, null];
|
return [false, null];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useEnableE2EE = (): DisableableSetting<boolean | null> => {
|
|
||||||
const settingVal = useSetting<boolean | null>(
|
|
||||||
"enable-end-to-end-encryption",
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
if (isE2EESupported()) return settingVal;
|
|
||||||
|
|
||||||
return [false, null];
|
|
||||||
};
|
|
||||||
|
|
||||||
export const useDeveloperSettingsTab = (): Setting<boolean> =>
|
export const useDeveloperSettingsTab = (): Setting<boolean> =>
|
||||||
useSetting("developer-settings-tab", false);
|
useSetting("developer-settings-tab", false);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user