Update go-whatsapp and rename device name config fields

This commit is contained in:
Tulir Asokan 2020-08-27 01:14:54 +03:00
parent 1edf8bb9e1
commit 075689dacf
5 changed files with 16 additions and 10 deletions

View file

@ -68,8 +68,8 @@ type Config struct {
} `yaml:"metrics"`
WhatsApp struct {
DeviceName string `yaml:"device_name"`
ShortName string `yaml:"short_name"`
OSName string `yaml:"os_name"`
BrowserName string `yaml:"browser_name"`
} `yaml:"whatsapp"`
Bridge BridgeConfig `yaml:"bridge"`
@ -80,8 +80,8 @@ type Config struct {
func (config *Config) setDefaults() {
config.AppService.Database.MaxOpenConns = 20
config.AppService.Database.MaxIdleConns = 2
config.WhatsApp.DeviceName = "Mautrix-WhatsApp bridge"
config.WhatsApp.ShortName = "mx-wa"
config.WhatsApp.OSName = "Mautrix-WhatsApp bridge"
config.WhatsApp.BrowserName = "mx-wa"
config.Bridge.setDefaults()
}

View file

@ -56,9 +56,11 @@ metrics:
listen: 127.0.0.1:8001
whatsapp:
# Device name that's shown in the "WhatsApp Web" section in the mobile app
device_name: Mautrix-WhatsApp bridge
short_name: mx-wa
# Device name that's shown in the "WhatsApp Web" section in the mobile app.
os_name: Mautrix-WhatsApp bridge
# Browser name that determines the logo shown in the mobile app. If the name is unrecognized, a generic icon is shown.
# Use the name of an actual browser (Chrome, Firefox, Safari, IE, Edge, Opera) if you want a specific icon.
browser_name: mx-wa
# Bridge config
bridge:

4
go.mod
View file

@ -16,7 +16,7 @@ require (
gopkg.in/yaml.v2 v2.3.0
maunium.net/go/mauflag v1.0.0
maunium.net/go/maulogger/v2 v2.1.1
maunium.net/go/mautrix v0.7.2
maunium.net/go/mautrix v0.7.4
)
replace github.com/Rhymen/go-whatsapp => github.com/tulir/go-whatsapp v0.3.7
replace github.com/Rhymen/go-whatsapp => github.com/tulir/go-whatsapp v0.3.8

4
go.sum
View file

@ -123,6 +123,8 @@ github.com/tulir/go-whatsapp v0.3.6 h1:RtyNh8TFX48ClMvi2J8oS3qmH7b1t9SIKA5jucG2l
github.com/tulir/go-whatsapp v0.3.6/go.mod h1:7yGOBdWidM6gsmbAFwgkwHEIhzVrm01+6UbImpMWfTM=
github.com/tulir/go-whatsapp v0.3.7 h1:6YoHsAlO+Y1SnU0bOntDmuvJQziEnBjFKO+1fOH2VIw=
github.com/tulir/go-whatsapp v0.3.7/go.mod h1:7yGOBdWidM6gsmbAFwgkwHEIhzVrm01+6UbImpMWfTM=
github.com/tulir/go-whatsapp v0.3.8 h1:cRPyYhtgokUyeE2wsSlRpsw9qddi0Giun+kn9fGsl/M=
github.com/tulir/go-whatsapp v0.3.8/go.mod h1:7yGOBdWidM6gsmbAFwgkwHEIhzVrm01+6UbImpMWfTM=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 h1:vEg9joUBmeBcK9iSJftGNf3coIG4HqZElCPehJsfAYM=
@ -223,3 +225,5 @@ maunium.net/go/mautrix v0.7.0 h1:9Wxs5S4Wl4S99dbBwfLZYAe/sP7VKaFikw9Ocf88kfk=
maunium.net/go/mautrix v0.7.0/go.mod h1:Va/74MijqaS0DQ3aUqxmFO54/PMfr1LVsCOcGRHbYmo=
maunium.net/go/mautrix v0.7.2 h1:ru//jj7Y5Xj9CXBpeNyWCoxjq8iT0d+a2lNeSiN9P/o=
maunium.net/go/mautrix v0.7.2/go.mod h1:Va/74MijqaS0DQ3aUqxmFO54/PMfr1LVsCOcGRHbYmo=
maunium.net/go/mautrix v0.7.4 h1:MDjrvDyHcu5ozKAa80ohcXmYAXZTHgHxrhiERtvkEdY=
maunium.net/go/mautrix v0.7.4/go.mod h1:Va/74MijqaS0DQ3aUqxmFO54/PMfr1LVsCOcGRHbYmo=

View file

@ -240,7 +240,7 @@ func (user *User) Connect(evenIfNoSession bool) bool {
return false
}
user.Conn = whatsappExt.ExtendConn(conn)
_ = user.Conn.SetClientName(user.bridge.Config.WhatsApp.DeviceName, user.bridge.Config.WhatsApp.ShortName, WAVersion)
_ = user.Conn.SetClientName(user.bridge.Config.WhatsApp.OSName, user.bridge.Config.WhatsApp.BrowserName, WAVersion)
user.log.Debugln("WhatsApp connection successful")
user.Conn.AddHandler(user)
return user.RestoreSession()