Add network field to auth data

This commit is contained in:
Tulir Asokan 2024-02-23 14:53:19 +02:00
parent e3f965eff6
commit 1df5dfe99a
3 changed files with 10 additions and 0 deletions

View file

@ -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,

View file

@ -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{

View file

@ -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{},