From 03784bbdcc776bb8f7b6c1719066a7a4bcff4cc0 Mon Sep 17 00:00:00 2001 From: Toni Spets Date: Wed, 26 Jun 2024 10:26:47 +0300 Subject: [PATCH] Use stable address for Hungryserv Removes the requirement to update bridge config if it moves. --- cmd/bbctl/whoami.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/bbctl/whoami.go b/cmd/bbctl/whoami.go index f5767b9..0b11d5a 100644 --- a/cmd/bbctl/whoami.go +++ b/cmd/bbctl/whoami.go @@ -3,6 +3,7 @@ package main import ( "encoding/json" "fmt" + "net/url" "regexp" "sort" "strings" @@ -169,8 +170,13 @@ func getCachedWhoami(ctx *cli.Context) (*beeperapi.RespWhoami, error) { ec.ClusterID = resp.UserInfo.BridgeClusterID changed = true } - if ec.HungryAddress != resp.UserInfo.HungryURL { - ec.HungryAddress = resp.UserInfo.HungryURL + publicHungryURL := url.URL{ + Scheme: "https", + Host: "matrix." + ctx.String("homeserver"), + Path: "/_hungryserv/" + resp.UserInfo.Username, + } + if ec.HungryAddress != publicHungryURL.String() { + ec.HungryAddress = publicHungryURL.String() changed = true } if changed {