From df6c4c80c22c3109f108c44b6f4beaeb7b3b78cc Mon Sep 17 00:00:00 2001 From: Andy Hsu Date: Fri, 14 Jul 2023 14:17:29 +0800 Subject: [PATCH] fix(123): update app-version (close #4758) --- drivers/123/driver.go | 3 +++ drivers/123/util.go | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/123/driver.go b/drivers/123/driver.go index 8f8fcfea..e5e7578e 100644 --- a/drivers/123/driver.go +++ b/drivers/123/driver.go @@ -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 } diff --git a/drivers/123/util.go b/drivers/123/util.go index b9d27cf3..0d0a2b63 100644 --- a/drivers/123/util.go +++ b/drivers/123/util.go @@ -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" @@ -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 @@ -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)