From cbba786b5cbabe262875af7447af17757f6e642a Mon Sep 17 00:00:00 2001 From: June Date: Sun, 17 Aug 2025 04:38:05 +0200 Subject: [PATCH] properly discover and use the homeserver client API url for the client This makes the program actually work for cases, where the client API is under a different subdomain (like "matrix.hamburg.ccc.de" with the user id having "hamburg.ccc.de"). --- main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 96c1fa0..ff4a8bc 100644 --- a/main.go +++ b/main.go @@ -288,8 +288,15 @@ func main() { if err != nil { log.Fatal(err) } + + clientWellKnown, err := mautrix.DiscoverClientAPI(context.Background(), homeserver) + if err != nil { + log.Fatal(err) + } + homeserverURL := clientWellKnown.Homeserver.BaseURL + client, err := mautrix.NewClient( - homeserver, + homeserverURL, userId, config.Token, )