From 5c0e7191d04a87264a0f6865b60e32a5bd97e412 Mon Sep 17 00:00:00 2001 From: Timo Date: Wed, 19 Jun 2024 14:55:25 +0200 Subject: [PATCH] Add fetching the well known in embedded mode. This is used to load the focus from the well known in elment-call. --- src/client.ts | 2 +- src/embedded.ts | 8 ++++++++ src/matrixrtc/MatrixRTCSession.ts | 5 +++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/client.ts b/src/client.ts index 300b5903399..6ce934f1b47 100644 --- a/src/client.ts +++ b/src/client.ts @@ -7410,7 +7410,7 @@ export class MatrixClient extends TypedEventEmitter { + public async fetchClientWellKnown(): Promise { // `getRawClientConfig` does not throw or reject on network errors, instead // it absorbs errors and returns `{}`. this.clientWellKnownPromise = AutoDiscovery.getRawClientConfig(this.getDomain() ?? undefined); diff --git a/src/embedded.ts b/src/embedded.ts index 8730c22ee3f..d1b84ce2fa1 100644 --- a/src/embedded.ts +++ b/src/embedded.ts @@ -218,6 +218,14 @@ export class RoomWidgetClient extends MatrixClient { }); }) ?? [], ); + + if (opts.clientWellKnownPollPeriod !== undefined) { + this.clientWellKnownIntervalID = setInterval(() => { + this.fetchClientWellKnown(); + }, 1000 * opts.clientWellKnownPollPeriod); + this.fetchClientWellKnown(); + } + this.setSyncState(SyncState.Syncing); logger.info("Finished backfilling events"); diff --git a/src/matrixrtc/MatrixRTCSession.ts b/src/matrixrtc/MatrixRTCSession.ts index e7fbd7a48bf..9f2601aa81e 100644 --- a/src/matrixrtc/MatrixRTCSession.ts +++ b/src/matrixrtc/MatrixRTCSession.ts @@ -825,7 +825,8 @@ export class MatrixRTCSession extends TypedEventEmitter 0) || this.useLegacyMemberEvents; let newContent: {} | ExperimentalGroupCallRoomMemberState | SessionMembershipData = {}; if (legacy) { let myPrevMembership: CallMembership | undefined; @@ -866,7 +867,7 @@ export class MatrixRTCSession extends TypedEventEmitter