Skip to content

Commit

Permalink
fix(123): update app-version (close #4758)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Jul 14, 2023
1 parent d2ff040 commit df6c4c8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions drivers/123/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ func (d *Pan123) Init(ctx context.Context) error {
}

func (d *Pan123) Drop(ctx context.Context) error {
_, _ = d.request(Logout, http.MethodPost, func(req *resty.Request) {
req.SetBody(base.Json{})
}, nil)
return nil
}

Expand Down
11 changes: 10 additions & 1 deletion drivers/123/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const (
BApi = "https://www.123pan.com/b/api"
MainApi = AApi
SignIn = MainApi + "/user/sign_in"
Logout = MainApi + "/user/logout"
UserInfo = MainApi + "/user/info"
FileList = MainApi + "/file/list/new"
DownloadInfo = MainApi + "/file/download_info"
Expand Down Expand Up @@ -50,6 +51,13 @@ func (d *Pan123) login() error {
}
}
res, err := base.RestyClient.R().
SetHeaders(map[string]string{
"origin": "https://www.123pan.com",
"referer": "https://www.123pan.com/",
"platform": "web",
"app-version": "3",
"user-agent": base.UserAgent,
}).
SetBody(body).Post(SignIn)
if err != nil {
return err
Expand All @@ -69,7 +77,8 @@ func (d *Pan123) request(url string, method string, callback base.ReqCallback, r
"referer": "https://www.123pan.com/",
"authorization": "Bearer " + d.AccessToken,
"platform": "web",
"app-version": "1.2",
"app-version": "3",
"user-agent": base.UserAgent,
})
if callback != nil {
callback(req)
Expand Down

0 comments on commit df6c4c8

Please sign in to comment.