Skip to content

Commit

Permalink
Use stable address for Hungryserv
Browse files Browse the repository at this point in the history
Removes the requirement to update bridge config if it moves.
  • Loading branch information
hifi committed Jun 26, 2024
1 parent e2b4b94 commit 03784bb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/bbctl/whoami.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"fmt"
"net/url"
"regexp"
"sort"
"strings"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 03784bb

Please sign in to comment.