From b8ffe971fc67ffbf5844fb297a3f3794b91ce3ae Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 25 Aug 2022 12:04:42 +0300 Subject: [PATCH] Replace asmux flag with generic software config option --- config/config.go | 2 +- config/upgrade.go | 2 +- example-config.yaml | 5 +++-- go.mod | 4 ++-- go.sum | 4 ++-- user.go | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/config/config.go b/config/config.go index 2379f2e..0f63bca 100644 --- a/config/config.go +++ b/config/config.go @@ -51,7 +51,7 @@ func (config *Config) CanDoublePuppetBackfill(userID id.UserID) bool { } _, homeserver, _ := userID.Parse() // Batch sending can only use local users, so don't allow double puppets on other servers. - if homeserver != config.Homeserver.Domain { + if homeserver != config.Homeserver.Domain && config.Homeserver.Software != "hungry" { return false } return true diff --git a/config/upgrade.go b/config/upgrade.go index d3042c7..77a7891 100644 --- a/config/upgrade.go +++ b/config/upgrade.go @@ -141,7 +141,7 @@ func DoUpgrade(helper *up.Helper) { } var SpacedBlocks = [][]string{ - {"homeserver", "asmux"}, + {"homeserver", "software"}, {"appservice"}, {"appservice", "hostname"}, {"appservice", "database"}, diff --git a/example-config.yaml b/example-config.yaml index d857f34..eef9649 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -5,8 +5,9 @@ homeserver: # The domain of the homeserver (for MXIDs, etc). domain: example.com - # Is the homeserver actually mautrix-asmux? - asmux: false + # What software is the homeserver running? + # Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here. + software: standard # The URL to push real-time bridge status to. # If set, the bridge will make POST requests to this URL whenever a user's whatsapp connection state changes. # The bridge will use the appservice as_token to authorize requests. diff --git a/go.mod b/go.mod index 8f75671..f6f47e6 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module maunium.net/go/mautrix-whatsapp go 1.18 require ( + github.com/chai2010/webp v1.1.1 github.com/gorilla/mux v1.8.0 github.com/gorilla/websocket v1.5.0 github.com/lib/pq v1.10.6 @@ -15,14 +16,13 @@ require ( golang.org/x/net v0.0.0-20220812174116-3211cb980234 google.golang.org/protobuf v1.28.1 maunium.net/go/maulogger/v2 v2.3.2 - maunium.net/go/mautrix v0.12.1-0.20220822105214-a9d9c9ba569d + maunium.net/go/mautrix v0.12.1-0.20220825085831-88c1e0dc4593 ) require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect - github.com/chai2010/webp v1.1.1 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.14 // indirect diff --git a/go.sum b/go.sum index 1834ca9..0382dda 100644 --- a/go.sum +++ b/go.sum @@ -100,5 +100,5 @@ maunium.net/go/mauflag v1.0.0 h1:YiaRc0tEI3toYtJMRIfjP+jklH45uDHtT80nUamyD4M= maunium.net/go/mauflag v1.0.0/go.mod h1:nLivPOpTpHnpzEh8jEdSL9UqO9+/KBJFmNRlwKfkPeA= maunium.net/go/maulogger/v2 v2.3.2 h1:1XmIYmMd3PoQfp9J+PaHhpt80zpfmMqaShzUTC7FwY0= maunium.net/go/maulogger/v2 v2.3.2/go.mod h1:TYWy7wKwz/tIXTpsx8G3mZseIRiC5DoMxSZazOHy68A= -maunium.net/go/mautrix v0.12.1-0.20220822105214-a9d9c9ba569d h1:1i3bbcEPfPT0zu0N4vRVxcUOx6j5qX34s60NM31vTnQ= -maunium.net/go/mautrix v0.12.1-0.20220822105214-a9d9c9ba569d/go.mod h1:/jxQFIipObSsjZPH6o3xyUi8uoULz3Hfr/8p9loqpYE= +maunium.net/go/mautrix v0.12.1-0.20220825085831-88c1e0dc4593 h1:HsTKCkpyDnJg0rOjzynChCAgK9NrICXEqMRaRiz43fI= +maunium.net/go/mautrix v0.12.1-0.20220825085831-88c1e0dc4593/go.mod h1:/jxQFIipObSsjZPH6o3xyUi8uoULz3Hfr/8p9loqpYE= diff --git a/user.go b/user.go index 58e260e..998e101 100644 --- a/user.go +++ b/user.go @@ -1072,7 +1072,7 @@ func (user *User) UpdateDirectChats(chats map[id.UserID][]id.RoomID) { } user.log.Debugln("Updating m.direct list on homeserver") var err error - if user.bridge.Config.Homeserver.Asmux { + if user.bridge.Config.Homeserver.Software == "asmux" { urlPath := intent.BuildClientURL("unstable", "com.beeper.asmux", "dms") _, err = intent.MakeFullRequest(mautrix.FullRequest{ Method: method,