Make WhatsApp device name configurable
This commit is contained in:
parent
d0ccc85522
commit
3460d7b6e8
@ -66,6 +66,11 @@ type Config struct {
|
|||||||
Listen string `yaml:"listen"`
|
Listen string `yaml:"listen"`
|
||||||
} `yaml:"metrics"`
|
} `yaml:"metrics"`
|
||||||
|
|
||||||
|
WhatsApp struct {
|
||||||
|
DeviceName string `yaml:"device_name"`
|
||||||
|
ShortName string `yaml:"short_name"`
|
||||||
|
} `yaml:"whatsapp"`
|
||||||
|
|
||||||
Bridge BridgeConfig `yaml:"bridge"`
|
Bridge BridgeConfig `yaml:"bridge"`
|
||||||
|
|
||||||
Logging appservice.LogConfig `yaml:"logging"`
|
Logging appservice.LogConfig `yaml:"logging"`
|
||||||
@ -74,6 +79,8 @@ type Config struct {
|
|||||||
func (config *Config) setDefaults() {
|
func (config *Config) setDefaults() {
|
||||||
config.AppService.Database.MaxOpenConns = 20
|
config.AppService.Database.MaxOpenConns = 20
|
||||||
config.AppService.Database.MaxIdleConns = 2
|
config.AppService.Database.MaxIdleConns = 2
|
||||||
|
config.WhatsApp.DeviceName = "Mautrix-WhatsApp bridge"
|
||||||
|
config.WhatsApp.ShortName = "mx-wa"
|
||||||
config.Bridge.setDefaults()
|
config.Bridge.setDefaults()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,11 @@ metrics:
|
|||||||
# IP and port where the metrics listener should be. The path is always /metrics
|
# IP and port where the metrics listener should be. The path is always /metrics
|
||||||
listen: 127.0.0.1:8001
|
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
|
||||||
|
|
||||||
# Bridge config
|
# Bridge config
|
||||||
bridge:
|
bridge:
|
||||||
# Localpart template of MXIDs for WhatsApp users.
|
# Localpart template of MXIDs for WhatsApp users.
|
||||||
|
2
user.go
2
user.go
@ -236,7 +236,7 @@ func (user *User) Connect(evenIfNoSession bool) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
user.Conn = whatsappExt.ExtendConn(conn)
|
user.Conn = whatsappExt.ExtendConn(conn)
|
||||||
_ = user.Conn.SetClientName("Mautrix-WhatsApp bridge", "mx-wa", WAVersion)
|
_ = user.Conn.SetClientName(user.bridge.Config.WhatsApp.DeviceName, user.bridge.Config.WhatsApp.ShortName, WAVersion)
|
||||||
user.log.Debugln("WhatsApp connection successful")
|
user.log.Debugln("WhatsApp connection successful")
|
||||||
user.Conn.AddHandler(user)
|
user.Conn.AddHandler(user)
|
||||||
return user.RestoreSession()
|
return user.RestoreSession()
|
||||||
|
Loading…
Reference in New Issue
Block a user