Skip to content

Commit db8a7e8

Browse files
authored
feat(123): allow modification of the platform header (#1542)
* feat(drivers/123): Allow modification of the platform field * feat(drivers/123): Set login platfrom as web * fix(drivers/123): update platform field help value
1 parent 8f18e34 commit db8a7e8

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

drivers/123/driver.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ func (d *Pan123) GetAddition() driver.Additional {
4141
}
4242

4343
func (d *Pan123) Init(ctx context.Context) error {
44-
_, err := d.Request(UserInfo, http.MethodGet, nil, nil)
44+
_, err := d.Request(UserInfo, http.MethodGet, func(req *resty.Request) {
45+
req.SetHeader("platform", "web")
46+
}, nil)
4547
return err
4648
}
4749

drivers/123/meta.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ type Addition struct {
1212
//OrderBy string `json:"order_by" type:"select" options:"file_id,file_name,size,update_at" default:"file_name"`
1313
//OrderDirection string `json:"order_direction" type:"select" options:"asc,desc" default:"asc"`
1414
AccessToken string
15-
UploadThread int `json:"UploadThread" type:"number" default:"3" help:"the threads of upload"`
15+
UploadThread int `json:"UploadThread" type:"number" default:"3" help:"the threads of upload"`
16+
Platform string `json:"platform" type:"string" default:"web" help:"the platform header value, sent with API requests"`
1617
}
1718

1819
var config = driver.Config{

drivers/123/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ do:
203203
"referer": "https://www.123pan.com/",
204204
"authorization": "Bearer " + d.AccessToken,
205205
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) openlist-client",
206-
"platform": "web",
206+
"platform": d.Platform,
207207
"app-version": "3",
208208
//"user-agent": base.UserAgent,
209209
})

0 commit comments

Comments
 (0)