Update 403 error message

Apparently it happens when switching phones, not only when banned
This commit is contained in:
Tulir Asokan 2022-04-28 20:09:42 +03:00
parent 387148849a
commit 66f505303d
4 changed files with 7 additions and 7 deletions

View file

@ -47,7 +47,7 @@ type BridgeErrorCode string
const (
WALoggedOut BridgeErrorCode = "wa-logged-out"
WAAccountBanned BridgeErrorCode = "wa-account-banned"
WAMainDeviceGone BridgeErrorCode = "wa-main-device-gone"
WAUnknownLogout BridgeErrorCode = "wa-unknown-logout"
WANotConnected BridgeErrorCode = "wa-not-connected"
WAConnecting BridgeErrorCode = "wa-connecting"
@ -58,7 +58,7 @@ const (
var bridgeHumanErrors = map[BridgeErrorCode]string{
WALoggedOut: "You were logged out from another device. Relogin to continue using the bridge.",
WAAccountBanned: "Your account was banned from WhatsApp. You can contact support from the WhatsApp mobile app on your phone.",
WAMainDeviceGone: "Your phone was logged out from WhatsApp. Relogin to continue using the bridge.",
WAUnknownLogout: "You were logged out for an unknown reason. Relogin to continue using the bridge.",
WANotConnected: "You're not connected to WhatsApp",
WAConnecting: "Reconnecting to WhatsApp...",

2
go.mod
View file

@ -10,7 +10,7 @@ require (
github.com/prometheus/client_golang v1.11.1
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/tidwall/gjson v1.14.1
go.mau.fi/whatsmeow v0.0.0-20220425142103-46b439456742
go.mau.fi/whatsmeow v0.0.0-20220428170557-dafd80811aec
golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4
google.golang.org/protobuf v1.28.0

4
go.sum
View file

@ -120,8 +120,8 @@ github.com/yuin/goldmark v1.4.12 h1:6hffw6vALvEDqJ19dOJvJKOoAOKe4NDaTqvd2sktGN0=
github.com/yuin/goldmark v1.4.12/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.mau.fi/libsignal v0.0.0-20220425070825-c40c839ee6a0 h1:3IQF2bgAyibdo77hTejwuJe4jlypj9QaE4xCQuxrThM=
go.mau.fi/libsignal v0.0.0-20220425070825-c40c839ee6a0/go.mod h1:kBOXTvYyDG/q1Ihgvd4J6WenGPh7wtEGvPKF6vmf5ak=
go.mau.fi/whatsmeow v0.0.0-20220425142103-46b439456742 h1:0DFoHvUhQJf+X8pzgXFvCaEfv/nxO0yb2fn5JpCovjY=
go.mau.fi/whatsmeow v0.0.0-20220425142103-46b439456742/go.mod h1:iUBgOLNaqShLrR17u0kIiRptIGFH+nbT1tRhaWBEX/c=
go.mau.fi/whatsmeow v0.0.0-20220428170557-dafd80811aec h1:uiWnHE3Vv8FiyRyOEMH21k8azkw8u8UHgadfmEWWCo0=
go.mau.fi/whatsmeow v0.0.0-20220428170557-dafd80811aec/go.mod h1:iUBgOLNaqShLrR17u0kIiRptIGFH+nbT1tRhaWBEX/c=
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-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=

View file

@ -914,8 +914,8 @@ func (user *User) handleLoggedOut(onConnect bool, reason events.ConnectFailureRe
errorCode := WAUnknownLogout
if reason == events.ConnectFailureLoggedOut {
errorCode = WALoggedOut
} else if reason == events.ConnectFailureBanned {
errorCode = WAAccountBanned
} else if reason == events.ConnectFailureMainDeviceGone {
errorCode = WAMainDeviceGone
}
user.removeFromJIDMap(BridgeState{StateEvent: StateBadCredentials, Error: errorCode})
user.DeleteConnection()