From 451832954384dce565daa9a360948ab7eb70df90 Mon Sep 17 00:00:00 2001 From: "Rosy.iso" Date: Wed, 4 Mar 2026 00:43:42 +0100 Subject: [PATCH] finally fix this --- src/app/features/settings/about/About.tsx | 50 ++++++++++++++++++++--- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/src/app/features/settings/about/About.tsx b/src/app/features/settings/about/About.tsx index c75622f8..d51cae0d 100644 --- a/src/app/features/settings/about/About.tsx +++ b/src/app/features/settings/about/About.tsx @@ -1,4 +1,4 @@ -import { Box, Text, IconButton, Icon, Icons, Scroll, Button, config, toRem } from 'folds'; +import { Box, Text, IconButton, Icon, Icons, Scroll, Button, config, toRem, Spinner } from 'folds'; import { Page, PageContent, PageHeader } from '$components/page'; import { SequenceCard } from '$components/sequence-card'; import { SettingTile } from '$components/setting-tile'; @@ -11,13 +11,36 @@ import { useState } from 'react'; export function HomeserverInfo() { const mx = useMatrixClient(); + const [federationUrl, setFederationUrl] = useState(mx.baseUrl); const [version, setVersion] = useState(undefined); + // By default assume the federationUrl is the same as the baseUrl. if (!version) mx.http - .request(Method.Get, '/version', undefined, undefined, { prefix: '/_matrix/federation/v1' }) + .request(Method.Get, '/version', undefined, undefined, { + prefix: '/_matrix/federation/v1', + baseUrl: federationUrl, + }) .then((fetched_version) => setVersion(fetched_version)) - .catch((error) => setVersion({ error })); + .catch((error) => { + if (federationUrl === mx.baseUrl) { + // Maybe they are *not* the same actually. + mx.http + .request(Method.Get, '/server', undefined, undefined, { + prefix: '/.well-known/matrix', + baseUrl: `https://${mx.getSafeUserId().split(':')[1]}`, + }) + .then((well_known: any) => { + const newUrl = `https://${well_known['m.server'].split(':')[0]}`; + if (newUrl !== federationUrl) { + setFederationUrl(newUrl); + } + }) + .catch((error2) => setVersion({ error: error2 })); + } else { + setVersion({ error }); + } + }); return ( @@ -37,7 +60,7 @@ export function HomeserverInfo() { gap="400" > {mx.baseUrl} @@ -45,6 +68,23 @@ export function HomeserverInfo() { } /> + {federationUrl !== mx.baseUrl && ( + + + {federationUrl} + + } + /> + + )} {version ? ( <> {version.error && ( @@ -95,7 +135,7 @@ export function HomeserverInfo() { direction="Column" gap="400" > - Loading... + )}