Skip to content

Commit

Permalink
fix(123&123share): remove X-Forwarded-For header
Browse files Browse the repository at this point in the history
  • Loading branch information
xrgzs committed Nov 16, 2024
1 parent eda0033 commit 4a6c760
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
10 changes: 1 addition & 9 deletions drivers/123/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ func (d *Pan123) List(ctx context.Context, dir model.Obj, args model.ListArgs) (
func (d *Pan123) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error) {
if f, ok := file.(File); ok {
//var resp DownResp
var headers map[string]string
if !utils.IsLocalIPAddr(args.IP) {
headers = map[string]string{
//"X-Real-IP": "1.1.1.1",
"X-Forwarded-For": args.IP,
}
}
data := base.Json{
"driveId": 0,
"etag": f.Etag,
Expand All @@ -102,8 +95,7 @@ func (d *Pan123) Link(ctx context.Context, file model.Obj, args model.LinkArgs)
"type": f.Type,
}
resp, err := d.request(DownloadInfo, http.MethodPost, func(req *resty.Request) {

req.SetBody(data).SetHeaders(headers)
req.SetBody(data)
}, nil)
if err != nil {
return nil, err
Expand Down
9 changes: 1 addition & 8 deletions drivers/123_share/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,6 @@ func (d *Pan123Share) Link(ctx context.Context, file model.Obj, args model.LinkA
// TODO return link of file, required
if f, ok := file.(File); ok {
//var resp DownResp
var headers map[string]string
if !utils.IsLocalIPAddr(args.IP) {
headers = map[string]string{
//"X-Real-IP": "1.1.1.1",
"X-Forwarded-For": args.IP,
}
}
data := base.Json{
"driveId": "0",
"shareKey": d.ShareKey,
Expand All @@ -96,7 +89,7 @@ func (d *Pan123Share) Link(ctx context.Context, file model.Obj, args model.LinkA
"size": f.Size,
}
resp, err := d.request(DownloadInfo, http.MethodPost, func(req *resty.Request) {
req.SetBody(data).SetHeaders(headers)
req.SetBody(data)
}, nil)
if err != nil {
return nil, err
Expand Down

0 comments on commit 4a6c760

Please sign in to comment.