Replace asmux flag with generic software config option

This commit is contained in:
Tulir Asokan 2022-08-25 12:04:42 +03:00
parent 46a48541aa
commit b8ffe971fc
6 changed files with 10 additions and 9 deletions

View file

@ -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

View file

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

View file

@ -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.

4
go.mod
View file

@ -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

4
go.sum
View file

@ -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=

View file

@ -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,