mirror of
https://github.com/vector-im/element-call.git
synced 2026-10-16 23:45:50 +00:00
Get SFU tokens and delegate delayed leaves through the MSC4195 CS API
src/livekit/auth now fronts two flows. For a transport with a LiveKit SFU `url`, tokens come from our own homeserver's MSC4195 get_token endpoint and delayed leaves are delegated through delegate_delayed_leave, both via the js-sdk's unstable client methods. Transports with only a livekit_service_url keep using the OpenID flow against the JWT service. A transport advertising both shapes lets a subscriber fall back to the OpenID flow when the homeserver answers get_token with a 404 (Synapse reports M_UNRECOGNIZED for unknown routes rather than M_NOT_FOUND), so a client can still join calls hosted on servers that have not deployed MSC4195 yet. Publishers never fall back: a homeserver that advertises a `url` but does not implement the endpoints is misconfigured and the admin should hear about it, so they get NoMatrix2AuthorizationService. Delegation uses the same flow as the token so that the participant identity the service computes matches. The local member only probes a transport's delegate_delayed_leave endpoint when it has a service URL. The developer settings tab validates a custom service URL through the same facade.
This commit is contained in:
@@ -133,6 +133,7 @@ describe("DeveloperSettingsTab", () => {
|
||||
getCrypto: () => ({ getVersion: (): string => "x" }),
|
||||
getUserId: () => "@u:hs",
|
||||
getDeviceId: () => "DEVICE",
|
||||
getDomain: () => "hs",
|
||||
} as unknown as MatrixClient;
|
||||
it("will not update custom livekit url without roomId", async () => {
|
||||
const user = userEvent.setup();
|
||||
@@ -228,7 +229,10 @@ describe("DeveloperSettingsTab", () => {
|
||||
await user.click(saveButton);
|
||||
expect(getSFUConfig).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
serviceUrl: "wss://example.livekit.valid",
|
||||
transport: {
|
||||
type: "livekit",
|
||||
livekit_service_url: "wss://example.livekit.valid",
|
||||
},
|
||||
roomId: "#testRoom",
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -521,7 +521,11 @@ export const DeveloperSettingsTab: FC<Props> = ({
|
||||
await getSFUConfig({
|
||||
client,
|
||||
membership: { userId, deviceId, memberId: "" },
|
||||
serviceUrl: customLivekitUrlTextBuffer,
|
||||
transport: {
|
||||
type: "livekit",
|
||||
livekit_service_url: customLivekitUrlTextBuffer,
|
||||
},
|
||||
serverName: client.getDomain()!,
|
||||
roomId,
|
||||
slotId: "org.example.fake-slot#room",
|
||||
role: "publisher",
|
||||
|
||||
Reference in New Issue
Block a user