diff --git a/src/home/CallList.tsx b/src/home/CallList.tsx index c3d5a6ae..f93e2ff8 100644 --- a/src/home/CallList.tsx +++ b/src/home/CallList.tsx @@ -25,6 +25,7 @@ import styles from "./CallList.module.css"; import { getRoomUrl } from "../matrix-utils"; import { Body, Caption } from "../typography/Typography"; import { GroupCallRoom } from "./useGroupCallRooms"; +import { useRoomSharedKey } from "../e2ee/sharedKeyManagement"; interface CallListProps { rooms: GroupCallRoom[]; @@ -35,13 +36,14 @@ export function CallList({ rooms, client, disableFacepile }: CallListProps) { return ( <>
- {rooms.map(({ roomAlias, roomName, avatarUrl, participants }) => ( + {rooms.map(({ room, roomAlias, roomName, avatarUrl, participants }) => ( @@ -60,6 +62,7 @@ interface CallTileProps { name: string; avatarUrl: string; roomAlias: string; + roomId: string; participants: RoomMember[]; client: MatrixClient; disableFacepile?: boolean; @@ -68,10 +71,13 @@ function CallTile({ name, avatarUrl, roomAlias, + roomId, participants, client, disableFacepile, }: CallTileProps) { + const [roomSharedKey] = useRoomSharedKey(roomId); + return (
); diff --git a/src/matrix-utils.ts b/src/matrix-utils.ts index 5f672c57..454082f7 100644 --- a/src/matrix-utils.ts +++ b/src/matrix-utils.ts @@ -32,7 +32,7 @@ import { import type { MatrixClient } from "matrix-js-sdk/src/client"; import type { Room } from "matrix-js-sdk/src/models/room"; import IndexedDBWorker from "./IndexedDBWorker?worker"; -import { getUrlParams } from "./UrlParams"; +import { getUrlParams, PASSWORD_STRING } from "./UrlParams"; import { loadOlm } from "./olm"; import { Config } from "./config/Config"; @@ -343,13 +343,20 @@ export async function createRoom( } // Returns a URL to that will load Element Call with the given room -export function getRoomUrl(roomIdOrAlias: string): string { +export function getRoomUrl( + roomIdOrAlias: string, + password: string = "" +): string { if (roomIdOrAlias.startsWith("#")) { return `${window.location.protocol}//${window.location.host}/${ roomIdOrAlias.substring(1).split(":")[0] - }`; + }${password === "" ? "" : PASSWORD_STRING + password}`; } else { - return `${window.location.protocol}//${window.location.host}/room?roomId=${roomIdOrAlias}`; + return `${window.location.protocol}//${ + window.location.host + }/room?roomId=${roomIdOrAlias}${ + password === "" ? "" : "#" + PASSWORD_STRING + password + }`; } } diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index d8a9ef17..fa1c1754 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -462,9 +462,8 @@ export function InCallView({ )} {inviteModalState.isOpen && ( )} diff --git a/src/room/InviteModal.tsx b/src/room/InviteModal.tsx index 781f2ed6..b807d26f 100644 --- a/src/room/InviteModal.tsx +++ b/src/room/InviteModal.tsx @@ -1,5 +1,5 @@ /* -Copyright 2022 New Vector Ltd +Copyright 2022 - 2023 New Vector Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,13 +21,16 @@ import { Modal, ModalContent, ModalProps } from "../Modal"; import { CopyButton } from "../button"; import { getRoomUrl } from "../matrix-utils"; import styles from "./InviteModal.module.css"; +import { useRoomSharedKey } from "../e2ee/sharedKeyManagement"; interface Props extends Omit { - roomIdOrAlias: string; + roomAlias?: string; + roomId: string; } -export const InviteModal: FC = ({ roomIdOrAlias, ...rest }) => { +export const InviteModal: FC = ({ roomAlias, roomId, ...rest }) => { const { t } = useTranslation(); + const [roomSharedKey] = useRoomSharedKey(roomId); return ( = ({ roomIdOrAlias, ...rest }) => {

{t("Copy and share this call link")}

diff --git a/src/room/LobbyView.tsx b/src/room/LobbyView.tsx index d77f4d1d..3f985d79 100644 --- a/src/room/LobbyView.tsx +++ b/src/room/LobbyView.tsx @@ -26,6 +26,7 @@ import { Body, Link } from "../typography/Typography"; import { useLocationNavigation } from "../useLocationNavigation"; import { MatrixInfo, VideoPreview } from "./VideoPreview"; import { MuteStates } from "./MuteStates"; +import { useRoomSharedKey } from "../e2ee/sharedKeyManagement"; interface Props { matrixInfo: MatrixInfo; @@ -43,6 +44,7 @@ export const LobbyView: FC = ({ hideHeader, }) => { const { t } = useTranslation(); + const [roomSharedKey] = useRoomSharedKey(matrixInfo.roomId); useLocationNavigation(); const joinCallButtonRef = useRef(null); @@ -80,7 +82,10 @@ export const LobbyView: FC = ({ Or