From 0210106be2a7c2019ac7c6e26cbf5f655a9cb811 Mon Sep 17 00:00:00 2001 From: Timo <16718859+toger5@users.noreply.github.com> Date: Wed, 26 Jun 2024 11:29:11 +0200 Subject: [PATCH] Add fetching the well known in embedded mode. (#4259) * Add fetching the well known in embedded mode. This is used to load the focus from the well known in elment-call. * revert what we dont want in this PR. * Update src/client.ts Co-authored-by: Andrew Ferrazzutti --------- Co-authored-by: Andrew Ferrazzutti --- src/client.ts | 2 +- src/embedded.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/client.ts b/src/client.ts index d1f089d37ee..4b91a35f84d 100644 --- a/src/client.ts +++ b/src/client.ts @@ -7410,7 +7410,7 @@ export class MatrixClient extends TypedEventEmitter { + protected 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");