mirror of
https://github.com/vector-im/element-call.git
synced 2026-10-16 23:45:50 +00:00
Make the auth choice mode independent again
This commit is contained in:
@@ -54,21 +54,20 @@ const cases: {
|
||||
guestFlows: ["cs-api"],
|
||||
},
|
||||
{
|
||||
// In compatibility mode both publish a membership state event, so both
|
||||
// must keep the legacy participant identity that clients predating MSC4195
|
||||
// expect, which only the JWT service assigns.
|
||||
// Publishers keep the legacy participant identity that clients predating
|
||||
// MSC4195 expect, which only the JWT service assigns.
|
||||
hostShape: "both",
|
||||
guestShape: "both",
|
||||
hostFlows: ["service-legacy"],
|
||||
guestFlows: ["service-legacy"],
|
||||
},
|
||||
{
|
||||
// In Matrix 2.0 mode nobody expects a legacy identity, so the CS API wins.
|
||||
// The MatrixRTC mode has no bearing on the choice.
|
||||
hostShape: "both",
|
||||
guestShape: "both",
|
||||
mode: "2_0",
|
||||
hostFlows: ["cs-api"],
|
||||
guestFlows: ["cs-api"],
|
||||
hostFlows: ["service-legacy"],
|
||||
guestFlows: ["service-legacy"],
|
||||
},
|
||||
{
|
||||
hostShape: "url",
|
||||
|
||||
@@ -21,7 +21,6 @@ import { delegateDelayedLeave, getSFUConfig } from ".";
|
||||
import { mocked } from "storybook/test";
|
||||
import { ConnectionError, MatrixError } from "matrix-js-sdk";
|
||||
import { NoMatrix2AuthorizationService } from "../../utils/errors";
|
||||
import { MatrixRTCMode } from "../../config/ConfigOptions";
|
||||
import { type CallMembershipIdentityParts } from "matrix-js-sdk/lib/matrixrtc/EncryptionManager";
|
||||
|
||||
vi.mock("./openID", () => ({ getSFUConfig: vi.fn() }));
|
||||
@@ -84,7 +83,6 @@ describe("getSFUConfig", () => {
|
||||
membership,
|
||||
serverName: "example.org",
|
||||
role: "subscriber" as const,
|
||||
matrixRTCMode: MatrixRTCMode.Matrix_2_0,
|
||||
roomId,
|
||||
slotId,
|
||||
logger,
|
||||
@@ -186,12 +184,24 @@ describe("getSFUConfig", () => {
|
||||
expect(openID.getSFUConfig).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uses CS API when publishing with url transport", async () => {
|
||||
expect(
|
||||
await getSFUConfig({
|
||||
...defaultParams,
|
||||
transport: urlTransport,
|
||||
role: "publisher",
|
||||
}),
|
||||
).toEqual(expect.objectContaining({ jwt: csApiJWTToken }));
|
||||
expect(client._unstable_getLivekitToken).toHaveBeenCalled();
|
||||
expect(openID.getSFUConfig).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not fall back to OpenID when publishing", async () => {
|
||||
client._unstable_getLivekitToken.mockRejectedValueOnce(unsupportedError);
|
||||
await expect(
|
||||
getSFUConfig({
|
||||
...defaultParams,
|
||||
transport: urlAndServiceUrlTransport,
|
||||
transport: urlTransport,
|
||||
role: "publisher",
|
||||
}),
|
||||
).rejects.toThrow(expect.any(NoMatrix2AuthorizationService));
|
||||
@@ -199,7 +209,7 @@ describe("getSFUConfig", () => {
|
||||
expect(openID.getSFUConfig).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uses OpenID when publishing in compatibility mode with url + livekit_service_url transport", async () => {
|
||||
it("uses OpenID when publishing with url + livekit_service_url transport", async () => {
|
||||
// Subscribers predating MSC4195 expect a legacy participant identity from
|
||||
// anyone advertising a state event, which only the JWT service assigns
|
||||
expect(
|
||||
@@ -207,7 +217,6 @@ describe("getSFUConfig", () => {
|
||||
...defaultParams,
|
||||
transport: urlAndServiceUrlTransport,
|
||||
role: "publisher",
|
||||
matrixRTCMode: MatrixRTCMode.Compatibility,
|
||||
}),
|
||||
).toEqual(
|
||||
expect.objectContaining({
|
||||
@@ -221,31 +230,6 @@ describe("getSFUConfig", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("uses CS API when publishing in compatibility mode with url transport", async () => {
|
||||
expect(
|
||||
await getSFUConfig({
|
||||
...defaultParams,
|
||||
transport: urlTransport,
|
||||
role: "publisher",
|
||||
matrixRTCMode: MatrixRTCMode.Compatibility,
|
||||
}),
|
||||
).toEqual(expect.objectContaining({ jwt: csApiJWTToken }));
|
||||
expect(client._unstable_getLivekitToken).toHaveBeenCalled();
|
||||
expect(openID.getSFUConfig).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uses CS API when subscribing in compatibility mode with url + livekit_service_url transport", async () => {
|
||||
expect(
|
||||
await getSFUConfig({
|
||||
...defaultParams,
|
||||
transport: urlAndServiceUrlTransport,
|
||||
matrixRTCMode: MatrixRTCMode.Compatibility,
|
||||
}),
|
||||
).toEqual(expect.objectContaining({ jwt: csApiJWTToken }));
|
||||
expect(client._unstable_getLivekitToken).toHaveBeenCalled();
|
||||
expect(openID.getSFUConfig).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not fall back to OpenID on connection error", async () => {
|
||||
const client_ = {
|
||||
...client,
|
||||
@@ -275,7 +259,6 @@ describe("delegateDelayedLeave", () => {
|
||||
roomId,
|
||||
slotId,
|
||||
delayId: "delay123",
|
||||
matrixRTCMode: MatrixRTCMode.Matrix_2_0,
|
||||
logger,
|
||||
};
|
||||
|
||||
@@ -305,21 +288,11 @@ describe("delegateDelayedLeave", () => {
|
||||
expect(openID.getSFUConfig).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uses CS API with url + livekit_service_url transport", async () => {
|
||||
await delegateDelayedLeave({
|
||||
...defaultParams,
|
||||
transport: urlAndServiceUrlTransport,
|
||||
});
|
||||
expect(client._unstable_delegateDelayedLeave).toHaveBeenCalled();
|
||||
expect(openID.getSFUConfig).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uses OpenID in compatibility mode with url + livekit_service_url transport", async () => {
|
||||
it("uses OpenID with url + livekit_service_url transport", async () => {
|
||||
// Must match the flow that got the token, so the identities line up
|
||||
await delegateDelayedLeave({
|
||||
...defaultParams,
|
||||
transport: urlAndServiceUrlTransport,
|
||||
matrixRTCMode: MatrixRTCMode.Compatibility,
|
||||
});
|
||||
expect(client._unstable_delegateDelayedLeave).not.toHaveBeenCalled();
|
||||
expect(openID.getSFUConfig).toHaveBeenCalledWith(
|
||||
@@ -330,18 +303,4 @@ describe("delegateDelayedLeave", () => {
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("does not fall back to OpenID with url + livekit_service_url transport", async () => {
|
||||
client._unstable_delegateDelayedLeave.mockRejectedValueOnce(
|
||||
unsupportedError,
|
||||
);
|
||||
await expect(
|
||||
delegateDelayedLeave({
|
||||
...defaultParams,
|
||||
transport: urlAndServiceUrlTransport,
|
||||
}),
|
||||
).rejects.toThrow();
|
||||
expect(client._unstable_delegateDelayedLeave).toHaveBeenCalled();
|
||||
expect(openID.getSFUConfig).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,7 +14,6 @@ import * as openID from "./openID";
|
||||
import * as csApi from "./csApi";
|
||||
import { type SFUConfig } from "./types";
|
||||
import { NoMatrix2AuthorizationService } from "../../utils/errors";
|
||||
import { MatrixRTCMode } from "../../config/ConfigOptions";
|
||||
|
||||
export type { ClientOpenIDParts } from "./openID";
|
||||
export type { ClientGetTokenParts, ClientDelegationParts } from "./csApi";
|
||||
@@ -80,11 +79,6 @@ export interface GetSFUConfigParams {
|
||||
* Whether we want to publish or only subscribe on the {@link transport}.
|
||||
*/
|
||||
role: "publisher" | "subscriber";
|
||||
/**
|
||||
* The MatrixRTC mode, which decides the format of our membership event and
|
||||
* so the participant identity a publisher must have.
|
||||
*/
|
||||
matrixRTCMode: MatrixRTCMode;
|
||||
logger: Logger;
|
||||
}
|
||||
|
||||
@@ -99,7 +93,6 @@ export async function getSFUConfig({
|
||||
roomId,
|
||||
slotId,
|
||||
role,
|
||||
matrixRTCMode,
|
||||
logger,
|
||||
}: GetSFUConfigParams): Promise<SFUConfig> {
|
||||
const viaOpenID = async (serviceUrl: string): Promise<SFUConfig> =>
|
||||
@@ -113,7 +106,7 @@ export async function getSFUConfig({
|
||||
logger,
|
||||
});
|
||||
|
||||
const flow = chooseAuthFlow(transport, role, matrixRTCMode);
|
||||
const flow = chooseAuthFlow(transport, role);
|
||||
if (flow.kind === "openID") return await viaOpenID(flow.serviceUrl);
|
||||
|
||||
try {
|
||||
@@ -174,10 +167,6 @@ export interface DelegateDelayedLeaveParams {
|
||||
* The delay ID of the leave event to be delegated.
|
||||
*/
|
||||
delayId: string;
|
||||
/**
|
||||
* The MatrixRTC mode, which decides the format of our membership event.
|
||||
*/
|
||||
matrixRTCMode: MatrixRTCMode;
|
||||
logger: Logger;
|
||||
}
|
||||
|
||||
@@ -192,13 +181,12 @@ export async function delegateDelayedLeave({
|
||||
roomId,
|
||||
slotId,
|
||||
delayId,
|
||||
matrixRTCMode,
|
||||
logger,
|
||||
}: DelegateDelayedLeaveParams): Promise<void> {
|
||||
// It's important that we use the same flow (CS API or OpenID) as whatever we
|
||||
// would've used to get a JWT token for this transport, since the participant
|
||||
// identity computed by the service needs to match.
|
||||
const flow = chooseAuthFlow(transport, "publisher", matrixRTCMode);
|
||||
const flow = chooseAuthFlow(transport, "publisher");
|
||||
if (flow.kind === "csApi") {
|
||||
try {
|
||||
await csApi.delegateDelayedLeave({
|
||||
@@ -246,25 +234,19 @@ export type AuthFlow =
|
||||
*
|
||||
* Only the JWT service's `/sfu/get` endpoint assigns the legacy participant
|
||||
* identity that clients predating MSC4195 expect from anyone advertising a
|
||||
* membership state event, which is what compatibility mode sends. So a
|
||||
* publisher in compatibility mode keeps using the JWT service wherever the
|
||||
* transport still offers one, even if it also has a `url`. Subscribers may use
|
||||
* the CS API regardless, as nobody matches their identity.
|
||||
* membership state event. So a publisher keeps using the JWT service wherever
|
||||
* the transport still offers one, even if it also has a `url`. Subscribers may
|
||||
* use the CS API regardless, as nobody matches their identity.
|
||||
* @param transport The transport to authenticate against.
|
||||
* @param role Whether we want to publish or only subscribe on the transport.
|
||||
* @param matrixRTCMode The MatrixRTC mode, which decides the format of our
|
||||
* membership event.
|
||||
*/
|
||||
export function chooseAuthFlow(
|
||||
transport: UnstableLivekitTransport,
|
||||
role: "publisher" | "subscriber",
|
||||
matrixRTCMode: MatrixRTCMode,
|
||||
): AuthFlow {
|
||||
if ("url" in transport) {
|
||||
const useCsApi =
|
||||
!("livekit_service_url" in transport) ||
|
||||
role === "subscriber" ||
|
||||
matrixRTCMode === MatrixRTCMode.Matrix_2_0;
|
||||
!("livekit_service_url" in transport) || role === "subscriber";
|
||||
if (useCsApi) return { kind: "csApi", url: transport.url };
|
||||
}
|
||||
return { kind: "openID", serviceUrl: transport.livekit_service_url };
|
||||
|
||||
@@ -531,7 +531,6 @@ export const DeveloperSettingsTab: FC<Props> = ({
|
||||
roomId,
|
||||
slotId: "org.example.fake-slot#room",
|
||||
role: "publisher",
|
||||
matrixRTCMode: effectiveMatrixRTCMode,
|
||||
logger,
|
||||
});
|
||||
setCustomLivekitUrlUpdateError(null);
|
||||
@@ -542,13 +541,7 @@ export const DeveloperSettingsTab: FC<Props> = ({
|
||||
);
|
||||
}
|
||||
},
|
||||
[
|
||||
customTransportTextBuffer,
|
||||
setCustomTransport,
|
||||
client,
|
||||
roomId,
|
||||
effectiveMatrixRTCMode,
|
||||
],
|
||||
[customTransportTextBuffer, setCustomTransport, client, roomId],
|
||||
)}
|
||||
value={customTransportTextBuffer ?? ""}
|
||||
onChange={useCallback(
|
||||
|
||||
@@ -575,7 +575,6 @@ export function createCallViewModel$(
|
||||
client,
|
||||
matrixRoom.roomId,
|
||||
matrixRTCSession.slotId,
|
||||
matrixRTCMode,
|
||||
mediaDevices,
|
||||
trackProcessorState$,
|
||||
livekitKeyProvider,
|
||||
@@ -666,7 +665,6 @@ export function createCallViewModel$(
|
||||
).pipe(map(([delayId]) => delayId ?? null)),
|
||||
matrixRTCSession.delayId ?? null,
|
||||
),
|
||||
matrixRTCMode,
|
||||
logger: logger.getChild(`[${Date.now()}]`),
|
||||
});
|
||||
|
||||
|
||||
@@ -230,7 +230,6 @@ export function withCallViewModel(mode: MatrixRTCMode) {
|
||||
client: room.client,
|
||||
roomId: room.roomId,
|
||||
slotId: "m.call#ROOM",
|
||||
matrixRTCMode: mode,
|
||||
livekitRoomFactory,
|
||||
},
|
||||
logger,
|
||||
|
||||
@@ -346,27 +346,31 @@ describe("LocalMembership", () => {
|
||||
.mockResolvedValue();
|
||||
afterEach(() => delegationSpy.mockClear());
|
||||
|
||||
// The transport has both a `url` and a `livekit_service_url`. In Matrix 2.0
|
||||
// mode we publish through the CS API, so the homeserver delegates; in
|
||||
// compatibility mode we publish through the JWT service, so that delegates.
|
||||
const urlOnlyTransport: UnstableLivekitTransport = {
|
||||
type: "livekit",
|
||||
url: "https://sfu.example.org",
|
||||
};
|
||||
|
||||
// With a `url` only we publish through the CS API, so the homeserver
|
||||
// delegates. With a `livekit_service_url` we publish through the JWT
|
||||
// service, so that delegates.
|
||||
it.each([
|
||||
["no", MatrixRTCMode.Compatibility, null, timings],
|
||||
["no", MatrixRTCMode.Matrix_2_0, null, timings],
|
||||
["no", mockTransport, null, timings],
|
||||
[
|
||||
"homeserver",
|
||||
MatrixRTCMode.Matrix_2_0,
|
||||
urlOnlyTransport,
|
||||
"https://matrix.example.org/_matrix/client/unstable/io.element.msc4195/rtc/livekit/delegate_delayed_leave",
|
||||
delegatedTimings,
|
||||
],
|
||||
[
|
||||
"transport",
|
||||
MatrixRTCMode.Compatibility,
|
||||
mockTransport,
|
||||
"https://jwt.example.org/delegate_delayed_leave",
|
||||
delegatedTimings,
|
||||
],
|
||||
])(
|
||||
"joins session with %s delegation support in %s mode",
|
||||
async (_serviceName, matrixRTCMode, delegationUrl, delayedLeaveTimings) => {
|
||||
"joins session with %s delegation support",
|
||||
async (_serviceName, transport, delegationUrl, delayedLeaveTimings) => {
|
||||
const scope = testScope();
|
||||
const joinMatrixRTC = vi.fn();
|
||||
const delayId$ = new BehaviorSubject<string | null>(null);
|
||||
@@ -375,15 +379,17 @@ describe("LocalMembership", () => {
|
||||
fetchMock.post(delegationUrl, () => ({ status: 401, body: {} }));
|
||||
|
||||
const connectionMap = new ConnectionMap();
|
||||
connectionMap.add(connectionTransportAConnected, []);
|
||||
connectionMap.add(
|
||||
{ ...connectionTransportAConnected, transport } as Connection,
|
||||
[],
|
||||
);
|
||||
const localMembership = createLocalMembership$({
|
||||
scope,
|
||||
...defaultCreateLocalMemberValues,
|
||||
connectionMap$: constant(new Epoch(connectionMap)),
|
||||
joinMatrixRTC,
|
||||
localTransport$: constant(mockTransportLocator),
|
||||
localTransport$: constant({ transport, serverName: "example.org" }),
|
||||
delayId$,
|
||||
matrixRTCMode,
|
||||
});
|
||||
|
||||
localMembership.requestJoinAndPublish();
|
||||
@@ -391,7 +397,7 @@ describe("LocalMembership", () => {
|
||||
await flushPromises();
|
||||
// Joins with timings appropriate for the level of delegation support
|
||||
expect(joinMatrixRTC).toHaveBeenCalledWith(
|
||||
mockTransport,
|
||||
transport,
|
||||
delayedLeaveTimings,
|
||||
);
|
||||
|
||||
@@ -407,10 +413,9 @@ describe("LocalMembership", () => {
|
||||
expect(delegationSpy).toHaveBeenLastCalledWith({
|
||||
client: mockedClient,
|
||||
membership: ownMemberMock,
|
||||
transport: mockTransport,
|
||||
transport,
|
||||
roomId: "!test-room-id:example.org",
|
||||
delayId,
|
||||
matrixRTCMode,
|
||||
logger: expect.anything(),
|
||||
});
|
||||
|
||||
|
||||
@@ -165,8 +165,6 @@ interface Props {
|
||||
hostBridge: HostBridge;
|
||||
baseUrl: string;
|
||||
delayId$: Behavior<string | null>;
|
||||
/** The MatrixRTC mode, which decides the format of our membership event. */
|
||||
matrixRTCMode: MatrixRTCMode;
|
||||
logger: Logger;
|
||||
}
|
||||
|
||||
@@ -214,7 +212,6 @@ export const createLocalMembership$ = ({
|
||||
hostBridge,
|
||||
ownMembershipIdentity,
|
||||
delayId$,
|
||||
matrixRTCMode,
|
||||
}: Props): {
|
||||
/**
|
||||
* This request to start audio and video tracks.
|
||||
@@ -318,7 +315,7 @@ export const createLocalMembership$ = ({
|
||||
switchMap(async ({ transport }) => {
|
||||
// Delegation goes through whichever service authenticates us as a
|
||||
// publisher, so only that service's support counts
|
||||
const flow = chooseAuthFlow(transport, "publisher", matrixRTCMode);
|
||||
const flow = chooseAuthFlow(transport, "publisher");
|
||||
const delegationSupported =
|
||||
flow.kind === "openID"
|
||||
? await checkDelegationSupport(
|
||||
@@ -735,7 +732,6 @@ export const createLocalMembership$ = ({
|
||||
slotId: matrixRTCSession.slotId,
|
||||
roomId,
|
||||
delayId,
|
||||
matrixRTCMode,
|
||||
logger,
|
||||
});
|
||||
logger.info("Delayed leave successfully delegated");
|
||||
|
||||
@@ -42,7 +42,6 @@ import {
|
||||
} from "./Connection.ts";
|
||||
import { ObservableScope } from "../../ObservableScope.ts";
|
||||
import { FailToGetOpenIdToken } from "../../../utils/errors.ts";
|
||||
import { MatrixRTCMode } from "../../../config/ConfigOptions.ts";
|
||||
import { testJWTToken } from "../../../utils/test-fixtures.ts";
|
||||
import { mockRemoteParticipant, ownMemberMock } from "../../../utils/test.ts";
|
||||
import {
|
||||
@@ -124,7 +123,6 @@ function setupRemoteConnection(): Connection {
|
||||
client,
|
||||
roomId: ROOM_ID,
|
||||
slotId: SLOT_ID,
|
||||
matrixRTCMode: MatrixRTCMode.Matrix_2_0,
|
||||
role: "subscriber",
|
||||
transport,
|
||||
serverName: "m.localhost",
|
||||
@@ -174,7 +172,6 @@ describe("Start connection states", () => {
|
||||
client,
|
||||
roomId: ROOM_ID,
|
||||
slotId: SLOT_ID,
|
||||
matrixRTCMode: MatrixRTCMode.Matrix_2_0,
|
||||
role: "subscriber",
|
||||
transport,
|
||||
serverName: "m.localhost",
|
||||
@@ -195,7 +192,6 @@ describe("Start connection states", () => {
|
||||
client,
|
||||
roomId: ROOM_ID,
|
||||
slotId: SLOT_ID,
|
||||
matrixRTCMode: MatrixRTCMode.Matrix_2_0,
|
||||
role: "subscriber",
|
||||
transport,
|
||||
serverName: "m.localhost",
|
||||
@@ -251,7 +247,6 @@ describe("Start connection states", () => {
|
||||
client,
|
||||
roomId: ROOM_ID,
|
||||
slotId: SLOT_ID,
|
||||
matrixRTCMode: MatrixRTCMode.Matrix_2_0,
|
||||
role: "subscriber",
|
||||
transport,
|
||||
serverName: "m.localhost",
|
||||
@@ -316,7 +311,6 @@ describe("Start connection states", () => {
|
||||
client,
|
||||
roomId: ROOM_ID,
|
||||
slotId: SLOT_ID,
|
||||
matrixRTCMode: MatrixRTCMode.Matrix_2_0,
|
||||
role: "subscriber",
|
||||
transport,
|
||||
serverName: "m.localhost",
|
||||
@@ -567,7 +561,6 @@ describe("remote track logging", () => {
|
||||
client,
|
||||
roomId: ROOM_ID,
|
||||
slotId: SLOT_ID,
|
||||
matrixRTCMode: MatrixRTCMode.Matrix_2_0,
|
||||
role: "subscriber",
|
||||
transport,
|
||||
serverName: "m.localhost",
|
||||
|
||||
@@ -44,15 +44,12 @@ import {
|
||||
type ClientOpenIDParts,
|
||||
type SFUConfig,
|
||||
} from "../../../livekit/auth";
|
||||
import { type MatrixRTCMode } from "../../../config/ConfigOptions.ts";
|
||||
|
||||
export interface ConnectionOpts {
|
||||
/** The identity parts to use on this connection */
|
||||
ownMembershipIdentity: CallMembershipIdentityParts;
|
||||
/** Whether we want to publish or only subscribe on this connection. */
|
||||
role: "publisher" | "subscriber";
|
||||
/** The MatrixRTC mode, which decides the format of our membership event. */
|
||||
matrixRTCMode: MatrixRTCMode;
|
||||
/** The media transport to connect to. */
|
||||
transport: UnstableLivekitTransport;
|
||||
/** The name of the homeserver to which the {@link transport} belongs. */
|
||||
@@ -141,7 +138,6 @@ export class Connection {
|
||||
private readonly client: ClientGetTokenParts & ClientOpenIDParts;
|
||||
private readonly roomId: string;
|
||||
private readonly slotId: string;
|
||||
private readonly matrixRTCMode: MatrixRTCMode;
|
||||
private readonly logger: Logger;
|
||||
private readonly ownMembershipIdentity: CallMembershipIdentityParts;
|
||||
/**
|
||||
@@ -155,7 +151,6 @@ export class Connection {
|
||||
this.ownMembershipIdentity = opts.ownMembershipIdentity;
|
||||
this.roomId = opts.roomId;
|
||||
this.slotId = opts.slotId;
|
||||
this.matrixRTCMode = opts.matrixRTCMode;
|
||||
this.logger = logger.getChild(
|
||||
`[Connection ${JSON.stringify(opts.transport)}]`,
|
||||
);
|
||||
@@ -399,7 +394,6 @@ export class Connection {
|
||||
serverName: this.serverName,
|
||||
roomId: this.roomId,
|
||||
slotId: this.slotId,
|
||||
matrixRTCMode: this.matrixRTCMode,
|
||||
logger: this.logger,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ import {
|
||||
type ClientGetTokenParts,
|
||||
type ClientOpenIDParts,
|
||||
} from "../../../livekit/auth";
|
||||
import { type MatrixRTCMode } from "../../../config/ConfigOptions.ts";
|
||||
|
||||
// TODO evaluate if this should be done like the Publisher Factory
|
||||
export interface ConnectionFactory {
|
||||
@@ -62,7 +61,6 @@ export class ECConnectionFactory implements ConnectionFactory {
|
||||
* @param client - The OpenID client parts for authentication, needed to get openID and JWT tokens.
|
||||
* @param roomId - The ID of the Matrix room in which the session takes place.
|
||||
* @param slotId - The ID of the MatrixRTC slot in which the session takes place.
|
||||
* @param matrixRTCMode - The MatrixRTC mode, which decides the format of our membership event.
|
||||
* @param devices - Used for video/audio out/in capture options.
|
||||
* @param processorState$ - Effects like background blur (only for publishing connection?)
|
||||
* @param livekitKeyProvider - Optional key provider for end-to-end encryption.
|
||||
@@ -73,7 +71,6 @@ export class ECConnectionFactory implements ConnectionFactory {
|
||||
private client: ClientGetTokenParts & ClientOpenIDParts,
|
||||
private readonly roomId: string,
|
||||
private readonly slotId: string,
|
||||
private readonly matrixRTCMode: MatrixRTCMode,
|
||||
private devices: MediaDevices,
|
||||
private processorState$: Behavior<ProcessorState>,
|
||||
livekitKeyProvider: BaseKeyProvider | undefined,
|
||||
@@ -120,7 +117,6 @@ export class ECConnectionFactory implements ConnectionFactory {
|
||||
{
|
||||
roomId: this.roomId,
|
||||
slotId: this.slotId,
|
||||
matrixRTCMode: this.matrixRTCMode,
|
||||
role,
|
||||
transport,
|
||||
serverName,
|
||||
|
||||
@@ -36,7 +36,6 @@ import {
|
||||
cameraCodec,
|
||||
} from "../../../settings/settings.ts";
|
||||
import { testJWTToken } from "../../../utils/test-fixtures.ts";
|
||||
import { MatrixRTCMode } from "../../../config/ConfigOptions.ts";
|
||||
|
||||
// At the top of your test file, after imports
|
||||
vi.mock("livekit-client", async (importOriginal) => {
|
||||
@@ -85,7 +84,6 @@ describe("ECConnectionFactory - Audio inputs options", () => {
|
||||
mockClient,
|
||||
"!roomid:example.org",
|
||||
"m.call#ROOM",
|
||||
MatrixRTCMode.Matrix_2_0,
|
||||
mockMediaDevices({}),
|
||||
new BehaviorSubject<ProcessorState>({
|
||||
supported: true,
|
||||
@@ -131,7 +129,6 @@ describe("ECConnectionFactory - ControlledAudioDevice", () => {
|
||||
mockClient,
|
||||
"!roomid:example.org",
|
||||
"m.call#ROOM",
|
||||
MatrixRTCMode.Matrix_2_0,
|
||||
mockMediaDevices({
|
||||
audioOutput: {
|
||||
available$: constant(new Map<never, never>()),
|
||||
@@ -176,7 +173,6 @@ describe("ECConnectionFactory - Camera quality settings", () => {
|
||||
mockClient,
|
||||
"!roomid:example.org",
|
||||
"m.call#ROOM",
|
||||
MatrixRTCMode.Matrix_2_0,
|
||||
mockMediaDevices({}),
|
||||
new BehaviorSubject<ProcessorState>({
|
||||
supported: true,
|
||||
@@ -217,7 +213,6 @@ describe("ECConnectionFactory - Camera quality settings", () => {
|
||||
mockClient,
|
||||
"!roomid:example.org",
|
||||
"m.call#ROOM",
|
||||
MatrixRTCMode.Matrix_2_0,
|
||||
mockMediaDevices({}),
|
||||
new BehaviorSubject<ProcessorState>({
|
||||
supported: true,
|
||||
@@ -259,7 +254,6 @@ describe("ECConnectionFactory - Camera quality settings", () => {
|
||||
mockClient,
|
||||
"!roomid:example.org",
|
||||
"m.call#ROOM",
|
||||
MatrixRTCMode.Matrix_2_0,
|
||||
mockMediaDevices({}),
|
||||
new BehaviorSubject<ProcessorState>({
|
||||
supported: true,
|
||||
|
||||
@@ -38,7 +38,6 @@ import { createConnectionMap$ } from "./ConnectionMap.ts";
|
||||
import { membershipsAndTransports$ } from "../../SessionBehaviors.ts";
|
||||
import { localRtcMember, testJWTToken } from "../../../utils/test-fixtures.ts";
|
||||
import { deepCompare } from "matrix-js-sdk/lib/utils";
|
||||
import { MatrixRTCMode } from "../../../config/ConfigOptions.ts";
|
||||
|
||||
// Test the integration of ConnectionMap and MatrixLivekitMembers
|
||||
|
||||
@@ -76,7 +75,6 @@ beforeEach(() => {
|
||||
mockClient,
|
||||
"!roomid:example.org",
|
||||
"m.call#ROOM",
|
||||
MatrixRTCMode.Matrix_2_0,
|
||||
mockMediaDevices({}),
|
||||
new BehaviorSubject<ProcessorState>({
|
||||
supported: true,
|
||||
|
||||
Reference in New Issue
Block a user