Parcourir la source

Update whatsmeow

Tulir Asokan il y a 3 ans
Parent
commit
d1698b0e9a
3 fichiers modifiés avec 11 ajouts et 10 suppressions
  1. 1 1
      go.mod
  2. 2 2
      go.sum
  3. 8 7
      main.go

+ 1 - 1
go.mod

@@ -10,7 +10,7 @@ require (
 	github.com/prometheus/client_golang v1.12.2-0.20220514081015-5d584e2717ef
 	github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
 	github.com/tidwall/gjson v1.14.1
-	go.mau.fi/whatsmeow v0.0.0-20220519090423-468ee95de7e7
+	go.mau.fi/whatsmeow v0.0.0-20220523210036-5bdf3d4640af
 	golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9
 	golang.org/x/net v0.0.0-20220513224357-95641704303c
 	google.golang.org/protobuf v1.28.0

+ 2 - 2
go.sum

@@ -62,8 +62,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-20220519090423-468ee95de7e7 h1:08FioJlQ6/50fAp+hRkTWhDuoBeg1UFt3yrNnsWPKuM=
-go.mau.fi/whatsmeow v0.0.0-20220519090423-468ee95de7e7/go.mod h1:iUBgOLNaqShLrR17u0kIiRptIGFH+nbT1tRhaWBEX/c=
+go.mau.fi/whatsmeow v0.0.0-20220523210036-5bdf3d4640af h1:8NCovyS9FJRliRnOM89WOLfNVszoa8Hl4K1I+P0mY0w=
+go.mau.fi/whatsmeow v0.0.0-20220523210036-5bdf3d4640af/go.mod h1:iUBgOLNaqShLrR17u0kIiRptIGFH+nbT1tRhaWBEX/c=
 golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
 golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9 h1:NUzdAbFtCJSXU20AOXgeqaUwg8Ypg4MPYmL+d+rsB5c=
 golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=

+ 8 - 7
main.go

@@ -25,12 +25,13 @@ import (
 	"sync"
 	"time"
 
+	"google.golang.org/protobuf/proto"
+
 	"go.mau.fi/whatsmeow"
 	waProto "go.mau.fi/whatsmeow/binary/proto"
 	"go.mau.fi/whatsmeow/store"
 	"go.mau.fi/whatsmeow/store/sqlstore"
 	"go.mau.fi/whatsmeow/types"
-	"google.golang.org/protobuf/proto"
 
 	"maunium.net/go/mautrix/bridge"
 	"maunium.net/go/mautrix/bridge/commands"
@@ -106,20 +107,20 @@ func (br *WABridge) Init() {
 
 	store.BaseClientPayload.UserAgent.OsVersion = proto.String(br.WAVersion)
 	store.BaseClientPayload.UserAgent.OsBuildNumber = proto.String(br.WAVersion)
-	store.CompanionProps.Os = proto.String(br.Config.WhatsApp.OSName)
-	store.CompanionProps.RequireFullSync = proto.Bool(br.Config.Bridge.HistorySync.RequestFullSync)
+	store.DeviceProps.Os = proto.String(br.Config.WhatsApp.OSName)
+	store.DeviceProps.RequireFullSync = proto.Bool(br.Config.Bridge.HistorySync.RequestFullSync)
 	versionParts := strings.Split(br.WAVersion, ".")
 	if len(versionParts) > 2 {
 		primary, _ := strconv.Atoi(versionParts[0])
 		secondary, _ := strconv.Atoi(versionParts[1])
 		tertiary, _ := strconv.Atoi(versionParts[2])
-		store.CompanionProps.Version.Primary = proto.Uint32(uint32(primary))
-		store.CompanionProps.Version.Secondary = proto.Uint32(uint32(secondary))
-		store.CompanionProps.Version.Tertiary = proto.Uint32(uint32(tertiary))
+		store.DeviceProps.Version.Primary = proto.Uint32(uint32(primary))
+		store.DeviceProps.Version.Secondary = proto.Uint32(uint32(secondary))
+		store.DeviceProps.Version.Tertiary = proto.Uint32(uint32(tertiary))
 	}
 	platformID, ok := waProto.CompanionProps_CompanionPropsPlatformType_value[strings.ToUpper(br.Config.WhatsApp.BrowserName)]
 	if ok {
-		store.CompanionProps.PlatformType = waProto.CompanionProps_CompanionPropsPlatformType(platformID).Enum()
+		store.DeviceProps.PlatformType = waProto.CompanionProps_CompanionPropsPlatformType(platformID).Enum()
 	}
 }