From b40db8a89b1f1126baa7feda3b726d9fe2d81d5d Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 15 Feb 2024 17:03:19 +0000 Subject: [PATCH] Improve client metadata used for OIDC dynamic registration Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/vector/platform/ElectronPlatform.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/vector/platform/ElectronPlatform.tsx b/src/vector/platform/ElectronPlatform.tsx index c096bdc7d3..8fb45f85dc 100644 --- a/src/vector/platform/ElectronPlatform.tsx +++ b/src/vector/platform/ElectronPlatform.tsx @@ -43,6 +43,7 @@ import { BreadcrumbsStore } from "matrix-react-sdk/src/stores/BreadcrumbsStore"; import { UPDATE_EVENT } from "matrix-react-sdk/src/stores/AsyncStore"; import { avatarUrlForRoom, getInitialLetter } from "matrix-react-sdk/src/Avatar"; import DesktopCapturerSourcePicker from "matrix-react-sdk/src/components/views/elements/DesktopCapturerSourcePicker"; +import { OidcRegistrationClientMetadata } from "matrix-js-sdk/src/matrix"; import VectorBasePlatform from "./VectorBasePlatform"; import { SeshatIndexManager } from "./SeshatIndexManager"; @@ -435,4 +436,19 @@ export default class ElectronPlatform extends VectorBasePlatform { await this.ipc.call("clearStorage"); } catch (e) {} } + + public get baseUrl(): string { + // This configuration is element-desktop specific so the types here do not know about it + return (SdkConfig.get() as unknown as Record)["web_base_url"] ?? "https://app.element.io"; + } + + public async getOidcClientMetadata(): Promise { + const baseMetadata = await super.getOidcClientMetadata(); + return { + ...baseMetadata, + applicationType: "native", + // XXX: This should be overridable in config + clientUri: "https://element.io", + }; + } }