Skip to content

Commit

Permalink
Update bridge version linkifying
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jul 26, 2024
1 parent f10c8f6 commit e5ad3f9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cmd/bbctl/whoami.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func coloredBridgeState(state status.BridgeStateEvent) string {
}
}

var bridgeImageRegex = regexp.MustCompile(`^docker\.beeper-tools\.com/(?:bridge/)?([a-z]+):([0-9a-f]{40})(?:-amd64)?$`)
var bridgeImageRegex = regexp.MustCompile(`^docker\.beeper-tools\.com/(?:bridge/)?([a-z]+):(v2-)?([0-9a-f]{40})(?:-amd64)?$`)

var dockerToGitRepo = map[string]string{
"hungryserv": "https://github.com/beeper/hungryserv/commit/%s",
Expand All @@ -86,10 +86,13 @@ var dockerToGitRepo = map[string]string{
"facebook": "https://github.com/mautrix/facebook/commit/%s",
"googlechat": "https://github.com/mautrix/googlechat/commit/%s",
"instagram": "https://github.com/mautrix/instagram/commit/%s",
"instagramgo": "https://github.com/mautrix/meta/commit/%s",
"facebookgo": "https://github.com/mautrix/meta/commit/%s",
"linkedin": "https://github.com/beeper/linkedin/commit/%s",
"signal": "https://github.com/mautrix/signal/commit/%s",
"slackgo": "https://github.com/mautrix/slack/commit/%s",
"telegram": "https://github.com/mautrix/telegram/commit/%s",
"telegramgo": "https://github.com/mautrix/telegramgo/commit/%s",
"twitter": "https://github.com/mautrix/twitter/commit/%s",
"whatsapp": "https://github.com/mautrix/whatsapp/commit/%s",
}
Expand All @@ -106,9 +109,9 @@ func parseBridgeImage(bridge, image string, internal bool) string {
return color.YellowString(image)
}
if match[1] == "hungryserv" && !internal {
return match[2][:8]
return match[3][:8]
}
return color.HiBlueString(hyper.Link(match[2][:8], fmt.Sprintf(dockerToGitRepo[match[1]], match[2]), false))
return color.HiBlueString(match[2] + hyper.Link(match[3][:8], fmt.Sprintf(dockerToGitRepo[match[1]], match[3]), false))
}

func formatBridgeRemotes(name string, bridge beeperapi.WhoamiBridge) string {
Expand Down

0 comments on commit e5ad3f9

Please sign in to comment.