Initial support for getting SFO config using OIDC

* Change `jwt_service_url` to `livekit_service_url`
 * Make it a POST so we can send the openID token sensibly
 * Get an OIDC token & pass it with the request
 * Read the SFU URL from there too

and convert the auth server accordingly, althugh with no actual OIDC
support yet, it just issues tokens blindly just as before and ignores
the openid token completely.

We'll need to update configs & the JWT service before merging this.
This commit is contained in:
David Baker
2023-06-28 16:35:56 +01:00
parent 2a819b95e2
commit 8996aa772c
5 changed files with 74 additions and 70 deletions

View File

@@ -70,7 +70,6 @@ import { MatrixInfo } from "./VideoPreview";
import { useJoinRule } from "./useJoinRule";
import { ParticipantInfo } from "./useGroupCall";
import { ItemData, TileContent } from "../video-grid/VideoTile";
import { Config } from "../config/Config";
import { NewVideoGrid } from "../video-grid/NewVideoGrid";
import { OTelGroupCallMembership } from "../otel/OTelGroupCallMembership";
import { SettingsModal } from "../settings/SettingsModal";
@@ -80,6 +79,7 @@ import { RageshakeRequestModal } from "./RageshakeRequestModal";
import { VideoTile } from "../video-grid/VideoTile";
import { UserChoices, useLiveKit } from "../livekit/useLiveKit";
import { useMediaDevices } from "../livekit/useMediaDevices";
import { SFUConfig } from "../livekit/openIDSFU";
const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {});
// There is currently a bug in Safari our our code with cloning and sending MediaStreams
@@ -87,23 +87,18 @@ const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {});
// For now we can disable screensharing in Safari.
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
interface ActiveCallProps extends Omit<Props, "livekitRoom"> {
export interface ActiveCallProps extends Omit<InCallViewProps, "livekitRoom"> {
userChoices: UserChoices;
sfuConfig: SFUConfig;
}
export function ActiveCall(props: ActiveCallProps) {
const livekitRoom = useLiveKit(props.userChoices, {
sfuUrl: Config.get().livekit!.server_url,
jwtUrl: `${Config.get().livekit!.jwt_service_url}/token`,
roomName: props.matrixInfo.roomName,
userDisplayName: props.matrixInfo.displayName,
userIdentity: `${props.client.getUserId()}:${props.client.getDeviceId()}`,
});
const livekitRoom = useLiveKit(props.userChoices, props.sfuConfig);
return livekitRoom && <InCallView {...props} livekitRoom={livekitRoom} />;
}
interface Props {
export interface InCallViewProps {
client: MatrixClient;
groupCall: GroupCall;
livekitRoom: Room;
@@ -125,7 +120,7 @@ export function InCallView({
hideHeader,
matrixInfo,
otelGroupCallMembership,
}: Props) {
}: InCallViewProps) {
const { t } = useTranslation();
usePreventScroll();