Skip to content

Commit

Permalink
Add network field to auth data
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Feb 23, 2024
1 parent e3f965e commit 1df5dfe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libgm/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions libgm/longpoll.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
1 change: 1 addition & 0 deletions libgm/session_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
Expand Down

0 comments on commit 1df5dfe

Please sign in to comment.