#475 Config option: Scan QR code on white terminal
This commit is contained in:
@@ -88,6 +88,16 @@ func (b *Bridge) GetBool(key string) bool {
|
||||
return val
|
||||
}
|
||||
|
||||
func (b *Bridge) GetBoolOrDefault(key string, thedefault bool) bool {
|
||||
val, ok := b.Config.GetBool(b.Account + "." + key)
|
||||
if !ok {
|
||||
if val, ok = b.Config.GetBool("general." + key); !ok {
|
||||
return thedefault
|
||||
}
|
||||
}
|
||||
return val
|
||||
}
|
||||
|
||||
func (b *Bridge) GetInt(key string) int {
|
||||
val, ok := b.Config.GetInt(b.Account + "." + key)
|
||||
if !ok {
|
||||
|
||||
@@ -159,8 +159,8 @@ func (b *Bwhatsapp) Login() error {
|
||||
|
||||
// TODO qrCode, err := qrcode.Encode(code, qrcode.Low, 256) to encode as image/png
|
||||
// and possibly send it to connected channels (to admin) to authorize the app
|
||||
// TODO invert configured in settings
|
||||
qrChan := qrFromTerminal(true)
|
||||
invert := b.GetBoolOrDefault("QrOnWhiteTerminal", false)
|
||||
qrChan := qrFromTerminal(invert)
|
||||
|
||||
session, err := b.conn.Login(qrChan)
|
||||
if err != nil {
|
||||
|
||||
@@ -1162,6 +1162,10 @@ Number="+48111222333"
|
||||
# optional (by default the session is stored only in memory, till restarting matterbridge)
|
||||
SessionFile="session-48111222333.gob"
|
||||
|
||||
# If your terminal is white we need to invert QR code in order for it to be scanned properly
|
||||
# optional (default false)
|
||||
QrOnWhiteTerminal=true
|
||||
|
||||
# Messages will be seen by other WhatsApp contacts as coming from the bridge. Original nick will be part of the message.
|
||||
RemoteNickFormat="@{NICK}: "
|
||||
|
||||
|
||||
Reference in New Issue
Block a user