Skip to content

Commit

Permalink
fix: LC US has not editorType field
Browse files Browse the repository at this point in the history
  • Loading branch information
j178 committed Jun 8, 2023
1 parent 6f4b233 commit 88d4143
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions leetcode/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ query globalData {
return &userStatus, nil
}

func (c *cnClient) getQuestionData(slug string, query string) (*QuestionData, error) {
func (c *cnClient) getQuestionData(slug string, query string, authType authType) (*QuestionData, error) {
var resp struct {
Data struct {
Question QuestionData `json:"question"`
Expand All @@ -422,7 +422,7 @@ func (c *cnClient) getQuestionData(slug string, query string) (*QuestionData, er
query: query,
operationName: "questionData",
variables: map[string]any{"titleSlug": slug},
authType: withAuth,
authType: authType,
}, &resp, nil,
)
if err != nil {
Expand Down Expand Up @@ -474,7 +474,7 @@ func (c *cnClient) GetQuestionData(slug string) (*QuestionData, error) {
editorType
}
}`
q, err := c.getQuestionData(slug, query)
q, err := c.getQuestionData(slug, query, withAuth)
if err != nil {
return q, err
}
Expand Down
3 changes: 1 addition & 2 deletions leetcode/client_us.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ func (c *usClient) GetQuestionData(slug string) (*QuestionData, error) {
slug
translatedName
}
editorType
}
}`
q, err := c.getQuestionData(slug, query)
q, err := c.getQuestionData(slug, query, withAuth)
if err != nil {
return q, err
}
Expand Down
2 changes: 1 addition & 1 deletion leetcode/credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (b *browserAuth) AddCredentials(req *http.Request) error {
}
}
if session == "" || csrfToken == "" {
log.Debug("no cookie found", "browser", store.Browser())
log.Debug("no cookie found", "browser", store.Browser(), "domain", domain)
continue
}
b.LeetCodeSession = session
Expand Down

0 comments on commit 88d4143

Please sign in to comment.