cluster

Infrastructure files for Nordgedanken and Midnightthoughts.
git clone git://archive.git.mtrnord.blog/MTRNord/cluster.git
Log | Files | Refs | README

commit db9b74c827bc85665a3773979d9ed516b5845059
parent 01d05cd6afb7758e46c33d76ca4ec10727e5366b
Author: MTRNord <MTRNord@users.noreply.github.com>
Date:   Sat,  4 Apr 2026 10:42:23 +0200

fix a few issues

Signed-off-by: MTRNord <MTRNord@users.noreply.github.com>

Diffstat:
Aapps/talos_cluster/matrix-backup/backup-tool/.gitignore | 2++
Mapps/talos_cluster/matrix-backup/backup-tool/go.mod | 1+
Mapps/talos_cluster/matrix-backup/backup-tool/go.sum | 1+
Mapps/talos_cluster/matrix-backup/backup-tool/main.go | 42+++++++++++++++++++++++++++++++-----------
4 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/apps/talos_cluster/matrix-backup/backup-tool/.gitignore b/apps/talos_cluster/matrix-backup/backup-tool/.gitignore @@ -0,0 +1,2 @@ +decrypt/ +decrypted/ diff --git a/apps/talos_cluster/matrix-backup/backup-tool/go.mod b/apps/talos_cluster/matrix-backup/backup-tool/go.mod @@ -40,4 +40,5 @@ require ( golang.org/x/net v0.52.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/apps/talos_cluster/matrix-backup/backup-tool/go.sum b/apps/talos_cluster/matrix-backup/backup-tool/go.sum @@ -84,6 +84,7 @@ golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= maunium.net/go/mautrix v0.26.4 h1:enHSnkf0L2V9+VnfJfNhKSReSW6pBKS/x3Su+v+Vovs= diff --git a/apps/talos_cluster/matrix-backup/backup-tool/main.go b/apps/talos_cluster/matrix-backup/backup-tool/main.go @@ -807,17 +807,6 @@ func calcRoomName( } } - heroName := func(uid id.UserID) string { - if n, ok := memberNames[uid]; ok { - return n - } - local, _, _ := uid.Parse() - if local != "" { - return local - } - return string(uid) - } - // Spec says heroes should already exclude self, but filter just in case. var filtered []id.UserID for _, h := range heroes { @@ -826,6 +815,37 @@ func calcRoomName( } } + // Build tentative names for each hero, then disambiguate duplicates by + // appending the server part (e.g. "mtrnord (mtrnord.blog)"). + tentativeNames := make(map[id.UserID]string, len(filtered)) + for _, h := range filtered { + if n, ok := memberNames[h]; ok { + tentativeNames[h] = n + } else { + local, _, _ := h.Parse() + if local != "" { + tentativeNames[h] = local + } else { + tentativeNames[h] = string(h) + } + } + } + nameCounts := make(map[string]int, len(filtered)) + for _, n := range tentativeNames { + nameCounts[n]++ + } + heroName := func(uid id.UserID) string { + n := tentativeNames[uid] + if nameCounts[n] > 1 { + _, server, err := uid.Parse() + if err == nil && server != "" { + return n + " (" + server + ")" + } + return string(uid) + } + return n + } + // Total other members in the room (everyone except self). others := joinedCount + invitedCount - 1 if others < 0 {