Skip to content

Commit

Permalink
Add support for Bluesky
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Nov 29, 2024
1 parent 5bb553d commit f038eb7
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ used with the `--type` flag.
| [mautrix-meta] | meta, instagram, facebook |
| [mautrix-googlechat] | googlechat, gchat |
| [mautrix-twitter] | twitter |
| [mautrix-bluesky] | bluesky |
| [mautrix-imessage] | imessage |
| [beeper-imessage] | imessagego |
| [linkedin-matrix] | linkedin |
Expand All @@ -107,6 +108,7 @@ used with the `--type` flag.
[mautrix-instagram]: https://github.com/mautrix/instagram
[mautrix-googlechat]: https://github.com/mautrix/googlechat
[mautrix-twitter]: https://github.com/mautrix/twitter
[mautrix-bluesky]: https://github.com/mautrix/bluesky
[mautrix-imessage]: https://github.com/mautrix/imessage
[beeper-imessage]: https://github.com/beeper/imessage
[linkedin-matrix]: https://github.com/beeper/linkedin
Expand Down
4 changes: 2 additions & 2 deletions api/gitlab/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func getRefFromBridge(bridge string) (string, error) {
switch bridge {
case "imessage":
return "master", nil
case "whatsapp", "discord", "slack", "gmessages", "gvoice", "signal", "imessagego", "meta", "twitter":
case "whatsapp", "discord", "slack", "gmessages", "gvoice", "signal", "imessagego", "meta", "twitter", "bluesky":
return "main", nil
default:
return "", fmt.Errorf("unknown bridge %s", bridge)
Expand Down Expand Up @@ -165,7 +165,7 @@ func downloadFile(ctx context.Context, artifactURL, path string) error {

func needsLibolmDylib(bridge string) bool {
switch bridge {
case "imessage", "whatsapp", "discord", "slack", "gmessages", "gvoice", "signal", "imessagego", "meta", "twitter":
case "imessage", "whatsapp", "discord", "slack", "gmessages", "gvoice", "signal", "imessagego", "meta", "twitter", "bluesky":
return runtime.GOOS == "darwin"
default:
return false
Expand Down
14 changes: 14 additions & 0 deletions bridgeconfig/bluesky.tpl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Network-specific config options
network:
# Displayname template for Bluesky users. Available variables:
# .DisplayName - displayname set by the user. Not required, may be empty.
# .Handle - username (domain) of the user. Always present.
# .DID - internal user ID starting with `did:`. Always present.
displayname_template: {{ `"{{or .DisplayName .Handle}}"` }}

{{ setfield . "CommandPrefix" "!bsky" -}}
{{ setfield . "DatabaseFileName" "mautrix-bluesky" -}}
{{ setfield . "BridgeTypeName" "Bluesky" -}}
{{ setfield . "BridgeTypeIcon" "mxc://maunium.net/ezAjjDxhiJWGEohmhkpfeHYf" -}}
{{ setfield . "DefaultPickleKey" "go.mau.fi/mautrix-bluesky" -}}
{{ template "bridgev2.tpl.yaml" . }}
2 changes: 2 additions & 0 deletions cmd/bbctl/bridgeutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ var officialBridges = []bridgeTypeToNames{
{"heisenbridge", []string{"irc", "heisenbridge"}},
{"gmessages", []string{"gmessages", "googlemessages", "rcs", "sms"}},
{"gvoice", []string{"gvoice", "googlevoice"}},
{"bluesky", []string{"bluesky", "bsky"}},
}

var websocketBridges = map[string]bool{
Expand All @@ -50,6 +51,7 @@ var websocketBridges = map[string]bool{
"bridgev2": true,
"meta": true,
"twitter": true,
"bluesky": true,
}

func doOutputFile(ctx *cli.Context, name, data string) error {
Expand Down
3 changes: 2 additions & 1 deletion cmd/bbctl/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ var bridgeIPSuffix = map[string]string{
"gmessages": "36",
"imessagego": "37",
"gvoice": "38",
"bluesky": "40",
}

func doGenerateBridgeConfig(ctx *cli.Context, bridge string) (*generatedBridgeConfig, error) {
Expand Down Expand Up @@ -344,7 +345,7 @@ func generateBridgeConfig(ctx *cli.Context) error {
}
var startupCommand, installInstructions string
switch cfg.BridgeType {
case "imessage", "whatsapp", "discord", "slack", "gmessages", "gvoice", "signal", "meta", "twitter":
case "imessage", "whatsapp", "discord", "slack", "gmessages", "gvoice", "signal", "meta", "twitter", "bluesky":
startupCommand = fmt.Sprintf("mautrix-%s", cfg.BridgeType)
if outputPath != "config.yaml" && outputPath != "<config file>" {
startupCommand += " -c " + outputPath
Expand Down
2 changes: 1 addition & 1 deletion cmd/bbctl/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func runBridge(ctx *cli.Context) error {
var bridgeArgs []string
var needsWebsocketProxy bool
switch cfg.BridgeType {
case "imessage", "imessagego", "whatsapp", "discord", "slack", "gmessages", "gvoice", "signal", "meta", "twitter":
case "imessage", "imessagego", "whatsapp", "discord", "slack", "gmessages", "gvoice", "signal", "meta", "twitter", "bluesky":
binaryName := fmt.Sprintf("mautrix-%s", cfg.BridgeType)
ciV2 := false
switch cfg.BridgeType {
Expand Down
1 change: 1 addition & 0 deletions cmd/bbctl/whoami.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ var dockerToGitRepo = map[string]string{
"telegram": "https://github.com/mautrix/telegram/commit/%s",
"telegramgo": "https://github.com/mautrix/telegramgo/commit/%s",
"twitter": "https://github.com/mautrix/twitter/commit/%s",
"bluesky": "https://github.com/mautrix/bluesky/commit/%s",
"whatsapp": "https://github.com/mautrix/whatsapp/commit/%s",
}

Expand Down

0 comments on commit f038eb7

Please sign in to comment.