From 6f21016ccf165c4b5e274041184c403a50d78e7e Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 24 Aug 2023 11:16:08 +0300 Subject: [PATCH] Fix device type field and default to tablet. Fixes #8 --- config/config.go | 1 + example-config.yaml | 4 + libgm/gmproto/authentication.pb.go | 178 ++++++++++++++++++---------- libgm/gmproto/authentication.pb.raw | Bin 3461 -> 3562 bytes libgm/gmproto/authentication.proto | 9 +- libgm/gmproto/rpc.pb.go | 93 +++++++-------- libgm/gmproto/rpc.pb.raw | Bin 3373 -> 3343 bytes libgm/util/config.go | 4 +- main.go | 6 + 9 files changed, 182 insertions(+), 113 deletions(-) diff --git a/config/config.go b/config/config.go index 33a7aea..25d9123 100644 --- a/config/config.go +++ b/config/config.go @@ -35,6 +35,7 @@ type Config struct { GoogleMessages struct { OS string `yaml:"os"` Browser string `yaml:"browser"` + Device string `yaml:"device"` AggressiveReconnect bool `yaml:"aggressive_reconnect"` } `yaml:"google_messages"` diff --git a/example-config.yaml b/example-config.yaml index 9d11fca..2092473 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -94,6 +94,10 @@ google_messages: # Browser type to tell the phone. This decides which icon is shown. # Valid types: OTHER, CHROME, FIREFOX, SAFARI, OPERA, IE, EDGE browser: OTHER + # Device type to tell the phone. This also affects the icon, as well as how many sessions are allowed simultaneously. + # One web, two tablets and one PWA should be able to connect at the same time. + # Valid types: WEB, TABLET, PWA + device: TABLET # Should the bridge aggressively set itself as the active device if the user opens Google Messages in a browser? # If this is disabled, the user must manually use the `set-active` command to reactivate the bridge. diff --git a/libgm/gmproto/authentication.pb.go b/libgm/gmproto/authentication.pb.go index d32c940..ea74a5b 100644 --- a/libgm/gmproto/authentication.pb.go +++ b/libgm/gmproto/authentication.pb.go @@ -86,6 +86,58 @@ func (BrowserType) EnumDescriptor() ([]byte, []int) { return file_authentication_proto_rawDescGZIP(), []int{0} } +type DeviceType int32 + +const ( + DeviceType_UNKNOWN_DEVICE_TYPE DeviceType = 0 + DeviceType_WEB DeviceType = 1 + DeviceType_TABLET DeviceType = 2 + DeviceType_PWA DeviceType = 3 +) + +// Enum value maps for DeviceType. +var ( + DeviceType_name = map[int32]string{ + 0: "UNKNOWN_DEVICE_TYPE", + 1: "WEB", + 2: "TABLET", + 3: "PWA", + } + DeviceType_value = map[string]int32{ + "UNKNOWN_DEVICE_TYPE": 0, + "WEB": 1, + "TABLET": 2, + "PWA": 3, + } +) + +func (x DeviceType) Enum() *DeviceType { + p := new(DeviceType) + *p = x + return p +} + +func (x DeviceType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DeviceType) Descriptor() protoreflect.EnumDescriptor { + return file_authentication_proto_enumTypes[1].Descriptor() +} + +func (DeviceType) Type() protoreflect.EnumType { + return &file_authentication_proto_enumTypes[1] +} + +func (x DeviceType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DeviceType.Descriptor instead. +func (DeviceType) EnumDescriptor() ([]byte, []int) { + return file_authentication_proto_rawDescGZIP(), []int{1} +} + type BrowserDetails struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -94,7 +146,7 @@ type BrowserDetails struct { UserAgent string `protobuf:"bytes,1,opt,name=userAgent,proto3" json:"userAgent,omitempty"` BrowserType BrowserType `protobuf:"varint,2,opt,name=browserType,proto3,enum=authentication.BrowserType" json:"browserType,omitempty"` OS string `protobuf:"bytes,3,opt,name=OS,proto3" json:"OS,omitempty"` - SomeBool bool `protobuf:"varint,6,opt,name=someBool,proto3" json:"someBool,omitempty"` + DeviceType DeviceType `protobuf:"varint,6,opt,name=deviceType,proto3,enum=authentication.DeviceType" json:"deviceType,omitempty"` } func (x *BrowserDetails) Reset() { @@ -150,11 +202,11 @@ func (x *BrowserDetails) GetOS() string { return "" } -func (x *BrowserDetails) GetSomeBool() bool { +func (x *BrowserDetails) GetDeviceType() DeviceType { if x != nil { - return x.SomeBool + return x.DeviceType } - return false + return DeviceType_UNKNOWN_DEVICE_TYPE } type Device struct { @@ -1576,69 +1628,71 @@ func file_authentication_proto_rawDescGZIP() []byte { return file_authentication_proto_rawDescData } -var file_authentication_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_authentication_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_authentication_proto_msgTypes = make([]protoimpl.MessageInfo, 24) var file_authentication_proto_goTypes = []interface{}{ (BrowserType)(0), // 0: authentication.BrowserType - (*BrowserDetails)(nil), // 1: authentication.BrowserDetails - (*Device)(nil), // 2: authentication.Device - (*ConfigVersion)(nil), // 3: authentication.ConfigVersion - (*AuthenticationContainer)(nil), // 4: authentication.AuthenticationContainer - (*AuthMessage)(nil), // 5: authentication.AuthMessage - (*RevokeRelayPairingRequest)(nil), // 6: authentication.RevokeRelayPairingRequest - (*RevokeRelayPairingResponse)(nil), // 7: authentication.RevokeRelayPairingResponse - (*RegisterRefreshRequest)(nil), // 8: authentication.RegisterRefreshRequest - (*RegisterRefreshResponse)(nil), // 9: authentication.RegisterRefreshResponse - (*RegisterPhoneRelayResponse)(nil), // 10: authentication.RegisterPhoneRelayResponse - (*CoordinateMessage)(nil), // 11: authentication.CoordinateMessage - (*RefreshPhoneRelayResponse)(nil), // 12: authentication.RefreshPhoneRelayResponse - (*WebEncryptionKeyResponse)(nil), // 13: authentication.WebEncryptionKeyResponse - (*ECDSAKeys)(nil), // 14: authentication.ECDSAKeys - (*CurrentDeviceData)(nil), // 15: authentication.CurrentDeviceData - (*KeyData)(nil), // 16: authentication.KeyData - (*WebAuthKey)(nil), // 17: authentication.WebAuthKey - (*URLData)(nil), // 18: authentication.URLData - (*TokenData)(nil), // 19: authentication.TokenData - (*PairedData)(nil), // 20: authentication.PairedData - (*RevokePairData)(nil), // 21: authentication.RevokePairData - (*RegisterRefreshRequest_NestedEmptyArr)(nil), // 22: authentication.RegisterRefreshRequest.NestedEmptyArr - (*RegisterRefreshResponse_AuthKeyData)(nil), // 23: authentication.RegisterRefreshResponse.AuthKeyData - (*RegisterPhoneRelayResponse_AuthKeyData)(nil), // 24: authentication.RegisterPhoneRelayResponse.AuthKeyData - (*EmptyArr)(nil), // 25: util.EmptyArr + (DeviceType)(0), // 1: authentication.DeviceType + (*BrowserDetails)(nil), // 2: authentication.BrowserDetails + (*Device)(nil), // 3: authentication.Device + (*ConfigVersion)(nil), // 4: authentication.ConfigVersion + (*AuthenticationContainer)(nil), // 5: authentication.AuthenticationContainer + (*AuthMessage)(nil), // 6: authentication.AuthMessage + (*RevokeRelayPairingRequest)(nil), // 7: authentication.RevokeRelayPairingRequest + (*RevokeRelayPairingResponse)(nil), // 8: authentication.RevokeRelayPairingResponse + (*RegisterRefreshRequest)(nil), // 9: authentication.RegisterRefreshRequest + (*RegisterRefreshResponse)(nil), // 10: authentication.RegisterRefreshResponse + (*RegisterPhoneRelayResponse)(nil), // 11: authentication.RegisterPhoneRelayResponse + (*CoordinateMessage)(nil), // 12: authentication.CoordinateMessage + (*RefreshPhoneRelayResponse)(nil), // 13: authentication.RefreshPhoneRelayResponse + (*WebEncryptionKeyResponse)(nil), // 14: authentication.WebEncryptionKeyResponse + (*ECDSAKeys)(nil), // 15: authentication.ECDSAKeys + (*CurrentDeviceData)(nil), // 16: authentication.CurrentDeviceData + (*KeyData)(nil), // 17: authentication.KeyData + (*WebAuthKey)(nil), // 18: authentication.WebAuthKey + (*URLData)(nil), // 19: authentication.URLData + (*TokenData)(nil), // 20: authentication.TokenData + (*PairedData)(nil), // 21: authentication.PairedData + (*RevokePairData)(nil), // 22: authentication.RevokePairData + (*RegisterRefreshRequest_NestedEmptyArr)(nil), // 23: authentication.RegisterRefreshRequest.NestedEmptyArr + (*RegisterRefreshResponse_AuthKeyData)(nil), // 24: authentication.RegisterRefreshResponse.AuthKeyData + (*RegisterPhoneRelayResponse_AuthKeyData)(nil), // 25: authentication.RegisterPhoneRelayResponse.AuthKeyData + (*EmptyArr)(nil), // 26: util.EmptyArr } var file_authentication_proto_depIdxs = []int32{ 0, // 0: authentication.BrowserDetails.browserType:type_name -> authentication.BrowserType - 5, // 1: authentication.AuthenticationContainer.authMessage:type_name -> authentication.AuthMessage - 1, // 2: authentication.AuthenticationContainer.browserDetails:type_name -> authentication.BrowserDetails - 16, // 3: authentication.AuthenticationContainer.keyData:type_name -> authentication.KeyData - 15, // 4: authentication.AuthenticationContainer.deviceData:type_name -> authentication.CurrentDeviceData - 3, // 5: authentication.AuthMessage.configVersion:type_name -> authentication.ConfigVersion - 5, // 6: authentication.RevokeRelayPairingRequest.authMessage:type_name -> authentication.AuthMessage - 2, // 7: authentication.RevokeRelayPairingRequest.browser:type_name -> authentication.Device - 5, // 8: authentication.RegisterRefreshRequest.messageAuth:type_name -> authentication.AuthMessage - 2, // 9: authentication.RegisterRefreshRequest.currBrowserDevice:type_name -> authentication.Device - 22, // 10: authentication.RegisterRefreshRequest.emptyRefreshArr:type_name -> authentication.RegisterRefreshRequest.NestedEmptyArr - 23, // 11: authentication.RegisterRefreshResponse.tokenData:type_name -> authentication.RegisterRefreshResponse.AuthKeyData - 11, // 12: authentication.RegisterPhoneRelayResponse.coordinates:type_name -> authentication.CoordinateMessage - 2, // 13: authentication.RegisterPhoneRelayResponse.browser:type_name -> authentication.Device - 24, // 14: authentication.RegisterPhoneRelayResponse.authKeyData:type_name -> authentication.RegisterPhoneRelayResponse.AuthKeyData - 11, // 15: authentication.RefreshPhoneRelayResponse.coordinates:type_name -> authentication.CoordinateMessage - 11, // 16: authentication.WebEncryptionKeyResponse.coordinates:type_name -> authentication.CoordinateMessage - 2, // 17: authentication.CurrentDeviceData.browser:type_name -> authentication.Device - 2, // 18: authentication.KeyData.mobile:type_name -> authentication.Device - 14, // 19: authentication.KeyData.ecdsaKeys:type_name -> authentication.ECDSAKeys - 17, // 20: authentication.KeyData.webAuthKeyData:type_name -> authentication.WebAuthKey - 2, // 21: authentication.KeyData.browser:type_name -> authentication.Device - 2, // 22: authentication.PairedData.mobile:type_name -> authentication.Device - 19, // 23: authentication.PairedData.tokenData:type_name -> authentication.TokenData - 2, // 24: authentication.PairedData.browser:type_name -> authentication.Device - 2, // 25: authentication.RevokePairData.revokedDevice:type_name -> authentication.Device - 25, // 26: authentication.RegisterRefreshRequest.NestedEmptyArr.emptyArr:type_name -> util.EmptyArr - 27, // [27:27] is the sub-list for method output_type - 27, // [27:27] is the sub-list for method input_type - 27, // [27:27] is the sub-list for extension type_name - 27, // [27:27] is the sub-list for extension extendee - 0, // [0:27] is the sub-list for field type_name + 1, // 1: authentication.BrowserDetails.deviceType:type_name -> authentication.DeviceType + 6, // 2: authentication.AuthenticationContainer.authMessage:type_name -> authentication.AuthMessage + 2, // 3: authentication.AuthenticationContainer.browserDetails:type_name -> authentication.BrowserDetails + 17, // 4: authentication.AuthenticationContainer.keyData:type_name -> authentication.KeyData + 16, // 5: authentication.AuthenticationContainer.deviceData:type_name -> authentication.CurrentDeviceData + 4, // 6: authentication.AuthMessage.configVersion:type_name -> authentication.ConfigVersion + 6, // 7: authentication.RevokeRelayPairingRequest.authMessage:type_name -> authentication.AuthMessage + 3, // 8: authentication.RevokeRelayPairingRequest.browser:type_name -> authentication.Device + 6, // 9: authentication.RegisterRefreshRequest.messageAuth:type_name -> authentication.AuthMessage + 3, // 10: authentication.RegisterRefreshRequest.currBrowserDevice:type_name -> authentication.Device + 23, // 11: authentication.RegisterRefreshRequest.emptyRefreshArr:type_name -> authentication.RegisterRefreshRequest.NestedEmptyArr + 24, // 12: authentication.RegisterRefreshResponse.tokenData:type_name -> authentication.RegisterRefreshResponse.AuthKeyData + 12, // 13: authentication.RegisterPhoneRelayResponse.coordinates:type_name -> authentication.CoordinateMessage + 3, // 14: authentication.RegisterPhoneRelayResponse.browser:type_name -> authentication.Device + 25, // 15: authentication.RegisterPhoneRelayResponse.authKeyData:type_name -> authentication.RegisterPhoneRelayResponse.AuthKeyData + 12, // 16: authentication.RefreshPhoneRelayResponse.coordinates:type_name -> authentication.CoordinateMessage + 12, // 17: authentication.WebEncryptionKeyResponse.coordinates:type_name -> authentication.CoordinateMessage + 3, // 18: authentication.CurrentDeviceData.browser:type_name -> authentication.Device + 3, // 19: authentication.KeyData.mobile:type_name -> authentication.Device + 15, // 20: authentication.KeyData.ecdsaKeys:type_name -> authentication.ECDSAKeys + 18, // 21: authentication.KeyData.webAuthKeyData:type_name -> authentication.WebAuthKey + 3, // 22: authentication.KeyData.browser:type_name -> authentication.Device + 3, // 23: authentication.PairedData.mobile:type_name -> authentication.Device + 20, // 24: authentication.PairedData.tokenData:type_name -> authentication.TokenData + 3, // 25: authentication.PairedData.browser:type_name -> authentication.Device + 3, // 26: authentication.RevokePairData.revokedDevice:type_name -> authentication.Device + 26, // 27: authentication.RegisterRefreshRequest.NestedEmptyArr.emptyArr:type_name -> util.EmptyArr + 28, // [28:28] is the sub-list for method output_type + 28, // [28:28] is the sub-list for method input_type + 28, // [28:28] is the sub-list for extension type_name + 28, // [28:28] is the sub-list for extension extendee + 0, // [0:28] is the sub-list for field type_name } func init() { file_authentication_proto_init() } @@ -1947,7 +2001,7 @@ func file_authentication_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_authentication_proto_rawDesc, - NumEnums: 1, + NumEnums: 2, NumMessages: 24, NumExtensions: 0, NumServices: 0, diff --git a/libgm/gmproto/authentication.pb.raw b/libgm/gmproto/authentication.pb.raw index 8a7d6b5ce468a9b8b2dd3a06a57aeffe8195c989..a3f2d2a61c271394df1c4a0b1668ebe52e9ab456 100644 GIT binary patch delta 132 zcmZpbekDD@m~rPslX_7rF0Pc+vdrYvkjjEo2{r{r4L&2O$p=`(1V92oNRk`RE#z_4 za^~W4fvXo1=MoO}^Y-%(_ltLN4fAw%jSqV&`HGcXbkA6yoAy3vqPvaSah* Q0tp6$I|?vQ&gT^a0Ak-GnE(I) delta 66 zcmaDQ-6}o7m~rMrlX__>E{@{-+*GIh{2U231x5{yAUJ>HyM;VrPCQXudV2clxdlb} LCHYBgV9FQ(x{(!4 diff --git a/libgm/gmproto/authentication.proto b/libgm/gmproto/authentication.proto index 710c413..f78130b 100644 --- a/libgm/gmproto/authentication.proto +++ b/libgm/gmproto/authentication.proto @@ -16,11 +16,18 @@ enum BrowserType { EDGE = 7; } +enum DeviceType { + UNKNOWN_DEVICE_TYPE = 0; + WEB = 1; + TABLET = 2; + PWA = 3; +} + message BrowserDetails { string userAgent = 1; BrowserType browserType = 2; string OS = 3; - bool someBool = 6; + DeviceType deviceType = 6; } message Device { diff --git a/libgm/gmproto/rpc.pb.go b/libgm/gmproto/rpc.pb.go index 3bdb6a5..b62ec52 100644 --- a/libgm/gmproto/rpc.pb.go +++ b/libgm/gmproto/rpc.pb.go @@ -76,7 +76,6 @@ type ActionType int32 const ( ActionType_UNSPECIFIED ActionType = 0 ActionType_LIST_CONVERSATIONS ActionType = 1 - ActionType_LIST_CONVERSATIONS_SYNC ActionType = 1111 // fake value ActionType_LIST_MESSAGES ActionType = 2 ActionType_SEND_MESSAGE ActionType = 3 ActionType_MESSAGE_UPDATES ActionType = 4 @@ -125,57 +124,55 @@ const ( // Enum value maps for ActionType. var ( ActionType_name = map[int32]string{ - 0: "UNSPECIFIED", - 1: "LIST_CONVERSATIONS", - 1111: "LIST_CONVERSATIONS_SYNC", - 2: "LIST_MESSAGES", - 3: "SEND_MESSAGE", - 4: "MESSAGE_UPDATES", - 6: "LIST_CONTACTS", - 7: "CONVERSATION_UPDATES", - 9: "GET_OR_CREATE_CONVERSATION", - 10: "MESSAGE_READ", - 11: "BROWSER_PRESENCE_CHECK", - 12: "TYPING_UPDATES", - 13: "SETTINGS_UPDATE", - 14: "USER_ALERT", - 15: "UPDATE_CONVERSATION", - 16: "GET_UPDATES", - 17: "ACK_BROWSER_PRESENCE", - 18: "LIST_STICKER_SETS", - 19: "LEAVE_RCS_GROUP", - 20: "ADD_PARTICIPANT_TO_RCS_GROUP", - 21: "GET_CONVERSATION_TYPE", - 22: "NOTIFY_DITTO_ACTIVITY", - 23: "DELETE_MESSAGE", - 24: "INSTALL_STICKER_SET", - 25: "RESEND_MESSAGE", - 26: "GET_CONTACT_RCS_GROUP_STATUS", - 27: "DOWNLOAD_MESSAGE", - 28: "LIST_TOP_CONTACTS", - 29: "GET_CONTACTS_THUMBNAIL", - 30: "CHANGE_PARTICIPANT_COLOR", - 31: "IS_BUGLE_DEFAULT", - 32: "STICKER_USER_CONTEXT", - 33: "FAVORITE_STICKER_PACKS", - 34: "RECENT_STICKERS", - 35: "UPDATE_RECENT_STICKERS", - 36: "GET_FULL_SIZE_IMAGE", - 37: "GET_PARTICIPANTS_THUMBNAIL", - 38: "SEND_REACTION", - 39: "SEND_REPLY", - 40: "GET_BLOB_FOR_ATTACHMENT", - 41: "GET_DEVICES_AVAILABLE_FOR_GAIA_PAIRING", - 42: "CREATE_GAIA_PAIRING", - 43: "GET_CONVERSATION", - 44: "CREATE_GAIA_PAIRING_CLIENT_INIT", - 45: "CREATE_GAIA_PAIRING_CLIENT_FINISHED", - 46: "UNPAIR_GAIA_PAIRING", + 0: "UNSPECIFIED", + 1: "LIST_CONVERSATIONS", + 2: "LIST_MESSAGES", + 3: "SEND_MESSAGE", + 4: "MESSAGE_UPDATES", + 6: "LIST_CONTACTS", + 7: "CONVERSATION_UPDATES", + 9: "GET_OR_CREATE_CONVERSATION", + 10: "MESSAGE_READ", + 11: "BROWSER_PRESENCE_CHECK", + 12: "TYPING_UPDATES", + 13: "SETTINGS_UPDATE", + 14: "USER_ALERT", + 15: "UPDATE_CONVERSATION", + 16: "GET_UPDATES", + 17: "ACK_BROWSER_PRESENCE", + 18: "LIST_STICKER_SETS", + 19: "LEAVE_RCS_GROUP", + 20: "ADD_PARTICIPANT_TO_RCS_GROUP", + 21: "GET_CONVERSATION_TYPE", + 22: "NOTIFY_DITTO_ACTIVITY", + 23: "DELETE_MESSAGE", + 24: "INSTALL_STICKER_SET", + 25: "RESEND_MESSAGE", + 26: "GET_CONTACT_RCS_GROUP_STATUS", + 27: "DOWNLOAD_MESSAGE", + 28: "LIST_TOP_CONTACTS", + 29: "GET_CONTACTS_THUMBNAIL", + 30: "CHANGE_PARTICIPANT_COLOR", + 31: "IS_BUGLE_DEFAULT", + 32: "STICKER_USER_CONTEXT", + 33: "FAVORITE_STICKER_PACKS", + 34: "RECENT_STICKERS", + 35: "UPDATE_RECENT_STICKERS", + 36: "GET_FULL_SIZE_IMAGE", + 37: "GET_PARTICIPANTS_THUMBNAIL", + 38: "SEND_REACTION", + 39: "SEND_REPLY", + 40: "GET_BLOB_FOR_ATTACHMENT", + 41: "GET_DEVICES_AVAILABLE_FOR_GAIA_PAIRING", + 42: "CREATE_GAIA_PAIRING", + 43: "GET_CONVERSATION", + 44: "CREATE_GAIA_PAIRING_CLIENT_INIT", + 45: "CREATE_GAIA_PAIRING_CLIENT_FINISHED", + 46: "UNPAIR_GAIA_PAIRING", } ActionType_value = map[string]int32{ "UNSPECIFIED": 0, "LIST_CONVERSATIONS": 1, - "LIST_CONVERSATIONS_SYNC": 1111, "LIST_MESSAGES": 2, "SEND_MESSAGE": 3, "MESSAGE_UPDATES": 4, diff --git a/libgm/gmproto/rpc.pb.raw b/libgm/gmproto/rpc.pb.raw index 51bf571d0a9f9ae662d58338961b852272f1cf9d..3ff6ff3f5c86f8eaa19817790909833debc365f5 100644 GIT binary patch delta 19 acmZ20)i1Tdf`jQT$7CxGv(0@R^H~5v#0F0Q delta 49 zcmeB|S}V1|f`h4>bFvkOnXC+#xQ}OWNW8PZUzlr9uw#g)zh7{CaHOBJz;%wz`5X&a E09H8;J^%m! diff --git a/libgm/util/config.go b/libgm/util/config.go index e04dc4c..90dbffe 100644 --- a/libgm/util/config.go +++ b/libgm/util/config.go @@ -7,7 +7,7 @@ import ( var ConfigMessage = &gmproto.ConfigVersion{ Year: 2023, Month: 8, - Day: 10, + Day: 17, V1: 4, V2: 6, } @@ -16,5 +16,5 @@ var BrowserDetailsMessage = &gmproto.BrowserDetails{ UserAgent: UserAgent, BrowserType: gmproto.BrowserType_OTHER, OS: "libgm", - SomeBool: true, + DeviceType: gmproto.DeviceType_TABLET, } diff --git a/main.go b/main.go index 751a1c1..11f5919 100644 --- a/main.go +++ b/main.go @@ -73,6 +73,12 @@ func (br *GMBridge) Init() { } else { util.BrowserDetailsMessage.BrowserType = gmproto.BrowserType(browserVal) } + deviceVal, ok := gmproto.DeviceType_value[br.Config.GoogleMessages.Device] + if !ok { + br.ZLog.Error().Str("device_value", br.Config.GoogleMessages.Device).Msg("Invalid device value") + } else { + util.BrowserDetailsMessage.DeviceType = gmproto.DeviceType(deviceVal) + } Segment.log = br.ZLog.With().Str("component", "segment").Logger() Segment.key = br.Config.SegmentKey