Browse Source

Replace asmux flag with generic software config option

Tulir Asokan 2 years ago
parent
commit
b8ffe971fc
6 changed files with 10 additions and 9 deletions
  1. 1 1
      config/config.go
  2. 1 1
      config/upgrade.go
  3. 3 2
      example-config.yaml
  4. 2 2
      go.mod
  5. 2 2
      go.sum
  6. 1 1
      user.go

+ 1 - 1
config/config.go

@@ -51,7 +51,7 @@ func (config *Config) CanDoublePuppetBackfill(userID id.UserID) bool {
 	}
 	}
 	_, homeserver, _ := userID.Parse()
 	_, homeserver, _ := userID.Parse()
 	// Batch sending can only use local users, so don't allow double puppets on other servers.
 	// 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 false
 	}
 	}
 	return true
 	return true

+ 1 - 1
config/upgrade.go

@@ -141,7 +141,7 @@ func DoUpgrade(helper *up.Helper) {
 }
 }
 
 
 var SpacedBlocks = [][]string{
 var SpacedBlocks = [][]string{
-	{"homeserver", "asmux"},
+	{"homeserver", "software"},
 	{"appservice"},
 	{"appservice"},
 	{"appservice", "hostname"},
 	{"appservice", "hostname"},
 	{"appservice", "database"},
 	{"appservice", "database"},

+ 3 - 2
example-config.yaml

@@ -5,8 +5,9 @@ homeserver:
     # The domain of the homeserver (for MXIDs, etc).
     # The domain of the homeserver (for MXIDs, etc).
     domain: example.com
     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.
     # 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.
     # 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.
     # The bridge will use the appservice as_token to authorize requests.

+ 2 - 2
go.mod

@@ -3,6 +3,7 @@ module maunium.net/go/mautrix-whatsapp
 go 1.18
 go 1.18
 
 
 require (
 require (
+	github.com/chai2010/webp v1.1.1
 	github.com/gorilla/mux v1.8.0
 	github.com/gorilla/mux v1.8.0
 	github.com/gorilla/websocket v1.5.0
 	github.com/gorilla/websocket v1.5.0
 	github.com/lib/pq v1.10.6
 	github.com/lib/pq v1.10.6
@@ -15,14 +16,13 @@ require (
 	golang.org/x/net v0.0.0-20220812174116-3211cb980234
 	golang.org/x/net v0.0.0-20220812174116-3211cb980234
 	google.golang.org/protobuf v1.28.1
 	google.golang.org/protobuf v1.28.1
 	maunium.net/go/maulogger/v2 v2.3.2
 	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 (
 require (
 	filippo.io/edwards25519 v1.0.0 // indirect
 	filippo.io/edwards25519 v1.0.0 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/cespare/xxhash/v2 v2.1.2 // 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/golang/protobuf v1.5.2 // indirect
 	github.com/mattn/go-colorable v0.1.12 // indirect
 	github.com/mattn/go-colorable v0.1.12 // indirect
 	github.com/mattn/go-isatty v0.0.14 // indirect
 	github.com/mattn/go-isatty v0.0.14 // indirect

+ 2 - 2
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/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 h1:1XmIYmMd3PoQfp9J+PaHhpt80zpfmMqaShzUTC7FwY0=
 maunium.net/go/maulogger/v2 v2.3.2/go.mod h1:TYWy7wKwz/tIXTpsx8G3mZseIRiC5DoMxSZazOHy68A=
 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=

+ 1 - 1
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")
 	user.log.Debugln("Updating m.direct list on homeserver")
 	var err error
 	var err error
-	if user.bridge.Config.Homeserver.Asmux {
+	if user.bridge.Config.Homeserver.Software == "asmux" {
 		urlPath := intent.BuildClientURL("unstable", "com.beeper.asmux", "dms")
 		urlPath := intent.BuildClientURL("unstable", "com.beeper.asmux", "dms")
 		_, err = intent.MakeFullRequest(mautrix.FullRequest{
 		_, err = intent.MakeFullRequest(mautrix.FullRequest{
 			Method:      method,
 			Method:      method,