review (docstrings) and remove unused artifacts.

This commit is contained in:
Timo K
2026-01-07 15:47:44 +01:00
parent dd562bdaf5
commit d814f60f23
3 changed files with 8 additions and 14 deletions

View File

@@ -431,6 +431,7 @@ export function createCallViewModel$(
const useOldJwtEndpoint$ = scope.behavior( const useOldJwtEndpoint$ = scope.behavior(
matrixRTCMode$.pipe(map((v) => v !== MatrixRTCMode.Matrix_2_0)), matrixRTCMode$.pipe(map((v) => v !== MatrixRTCMode.Matrix_2_0)),
); );
const localTransport$ = createLocalTransport$({ const localTransport$ = createLocalTransport$({
scope: scope, scope: scope,
memberships$: memberships$, memberships$: memberships$,

View File

@@ -68,11 +68,10 @@ interface Props {
* @prop useOldestMember Whether to use the same transport as the oldest member. * @prop useOldestMember Whether to use the same transport as the oldest member.
* This will only update once the first oldest member appears. Will not recompute if the oldest member leaves. * This will only update once the first oldest member appears. Will not recompute if the oldest member leaves.
* *
* @prop useOldJwtEndpoint$ Whether to set forceOldJwtEndpoint the use the old JWT endpoint. * @prop useOldJwtEndpoint$ Whether to set forceOldJwtEndpoint on the returned transport and to use the old JWT endpoint.
* This is used when the connection manager needs to know if it has to use the legacy endpoint which implies a string concatenated rtcBackendIdentity. * This is used when the connection manager needs to know if it has to use the legacy endpoint which implies a string concatenated rtcBackendIdentity.
* (which is expected for non sticky event based rtc member events) * (which is expected for non sticky event based rtc member events)
* @returns Behavior<(LivekitTransport & { forceOldJwtEndpoint: boolean }) | null> The `forceOldJwtEndpoint` field is added to let the connection EncryptionManager * @returns The local transport. It will be created using the correct sfu endpoint based on the useOldJwtEndpoint$ value.
* know that this transport is for the local member and it IS RELEVANT which jwt endpoint to use. (for the local member transport, we need to know which jwt endpoint to use)
* @throws MatrixRTCTransportMissingError | FailToGetOpenIdToken * @throws MatrixRTCTransportMissingError | FailToGetOpenIdToken
*/ */
export const createLocalTransport$ = ({ export const createLocalTransport$ = ({
@@ -84,9 +83,7 @@ export const createLocalTransport$ = ({
useOldestMember$, useOldestMember$,
useOldJwtEndpoint$, useOldJwtEndpoint$,
delayId$, delayId$,
}: Props): Behavior< }: Props): Behavior<LivekitTransport | null> => {
(LivekitTransport & { forceOldJwtEndpoint: boolean }) | null
> => {
/** /**
* The transport over which we should be actively publishing our media. * The transport over which we should be actively publishing our media.
* undefined when not joined. * undefined when not joined.
@@ -97,7 +94,7 @@ export const createLocalTransport$ = ({
const oldestMember = memberships.value[0]; const oldestMember = memberships.value[0];
const transport = oldestMember?.getTransport(memberships.value[0]); const transport = oldestMember?.getTransport(memberships.value[0]);
if (!transport) return null; if (!transport) return null;
return { ...transport, forceOldJwtEndpoint }; return transport;
}), }),
first((t) => t != null && isLivekitTransport(t)), first((t) => t != null && isLivekitTransport(t)),
), ),
@@ -181,12 +178,10 @@ async function makeTransport(
urlFromDevSettings: string | null, urlFromDevSettings: string | null,
forceOldJwtEndpoint: boolean, forceOldJwtEndpoint: boolean,
delayId?: string, delayId?: string,
): Promise<LivekitTransport & { forceOldJwtEndpoint: boolean }> { ): Promise<LivekitTransport> {
logger.trace("Searching for a preferred transport"); logger.trace("Searching for a preferred transport");
async function doOpenIdAndJWTFromUrl( async function doOpenIdAndJWTFromUrl(url: string): Promise<LivekitTransport> {
url: string,
): Promise<LivekitTransport & { forceOldJwtEndpoint: boolean }> {
const { livekitAlias } = await getSFUConfigWithOpenID( const { livekitAlias } = await getSFUConfigWithOpenID(
client, client,
membership, membership,
@@ -201,7 +196,6 @@ async function makeTransport(
type: "livekit", type: "livekit",
livekit_service_url: url, livekit_service_url: url,
livekit_alias: livekitAlias, livekit_alias: livekitAlias,
forceOldJwtEndpoint,
}; };
} }
// We will call `getSFUConfigWithOpenID` once per transport here as it's our // We will call `getSFUConfigWithOpenID` once per transport here as it's our
@@ -223,7 +217,7 @@ async function makeTransport(
async function getFirstUsableTransport( async function getFirstUsableTransport(
transports: Transport[], transports: Transport[],
): Promise<(LivekitTransport & { forceOldJwtEndpoint: boolean }) | null> { ): Promise<LivekitTransport | null> {
for (const potentialTransport of transports) { for (const potentialTransport of transports) {
if (isLivekitTransportConfig(potentialTransport)) { if (isLivekitTransportConfig(potentialTransport)) {
try { try {

View File

@@ -55,7 +55,6 @@ const livekitFocus: LivekitTransport = {
livekit_alias: "!roomID:example.org", livekit_alias: "!roomID:example.org",
livekit_service_url: "https://matrix-rtc.example.org/livekit/jwt", livekit_service_url: "https://matrix-rtc.example.org/livekit/jwt",
type: "livekit", type: "livekit",
useMatrix2: false,
}; };
function setupTest(): void { function setupTest(): void {