From 1df5dfe99af2cfff1f6990b49bea6a2a3ab4ccd2 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 23 Feb 2024 14:53:19 +0200 Subject: [PATCH] Add network field to auth data --- libgm/client.go | 8 ++++++++ libgm/longpoll.go | 1 + libgm/session_handler.go | 1 + 3 files changed, 10 insertions(+) diff --git a/libgm/client.go b/libgm/client.go index d7e8bab..0bb6cdc 100644 --- a/libgm/client.go +++ b/libgm/client.go @@ -38,6 +38,13 @@ type AuthData struct { Cookies map[string]string `json:"cookies,omitempty"` } +func (ad *AuthData) AuthNetwork() string { + if ad.Cookies != nil { + return util.GoogleNetwork + } + return "" +} + const RefreshTachyonBuffer = 1 * time.Hour type Proxy func(*http.Request) (*url.URL, error) @@ -292,6 +299,7 @@ func (c *Client) refreshAuthToken() error { MessageAuth: &gmproto.AuthMessage{ RequestID: requestID, TachyonAuthToken: c.AuthData.TachyonAuthToken, + Network: c.AuthData.AuthNetwork(), ConfigVersion: util.ConfigMessage, }, CurrBrowserDevice: c.AuthData.Browser, diff --git a/libgm/longpoll.go b/libgm/longpoll.go index 60c36ce..47b05d4 100644 --- a/libgm/longpoll.go +++ b/libgm/longpoll.go @@ -122,6 +122,7 @@ func (c *Client) doLongPoll(loggedIn bool) { Auth: &gmproto.AuthMessage{ RequestID: listenReqID, TachyonAuthToken: c.AuthData.TachyonAuthToken, + Network: c.AuthData.AuthNetwork(), ConfigVersion: util.ConfigMessage, }, Unknown: &gmproto.ReceiveMessagesRequest_UnknownEmptyObject2{ diff --git a/libgm/session_handler.go b/libgm/session_handler.go index f6265c4..e4760d2 100644 --- a/libgm/session_handler.go +++ b/libgm/session_handler.go @@ -280,6 +280,7 @@ func (s *SessionHandler) sendAckRequest() { AuthData: &gmproto.AuthMessage{ RequestID: uuid.NewString(), TachyonAuthToken: s.client.AuthData.TachyonAuthToken, + Network: s.client.AuthData.AuthNetwork(), ConfigVersion: util.ConfigMessage, }, EmptyArr: &gmproto.EmptyArr{},