Skip to content

Commit

Permalink
fix(ilanzou): add referer to request header (close AlistGo#6171)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe authored and EtherealAO committed Apr 12, 2024
1 parent 7e023b2 commit 75bb3a5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion drivers/ilanzou/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ func (d *ILanZou) Link(ctx context.Context, file model.Obj, args model.LinkArgs)
u.RawQuery = query.Encode()
realURL := u.String()
// get the url after redirect
res, err := base.NoRedirectClient.R().Get(realURL)
res, err := base.NoRedirectClient.R().SetHeaders(map[string]string{
//"Origin": d.conf.site,
"Referer": d.conf.site + "/",
}).Get(realURL)
if err != nil {
return nil, err
}
Expand Down
5 changes: 4 additions & 1 deletion drivers/ilanzou/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type Conf struct {
unproved string
proved string
devVersion string
site string
}

func init() {
Expand All @@ -45,7 +46,8 @@ func init() {
bucket: "wpanstore-lanzou",
unproved: "unproved",
proved: "proved",
devVersion: "120",
devVersion: "122",
site: "https://www.ilanzou.com",
},
}
})
Expand All @@ -71,6 +73,7 @@ func init() {
unproved: "ws",
proved: "app",
devVersion: "121",
site: "https://www.feijipan.com",
},
}
})
Expand Down
6 changes: 5 additions & 1 deletion drivers/ilanzou/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ func (d *ILanZou) request(pathname, method string, callback base.ReqCallback, pr
"devType": "6",
"devCode": d.UUID,
"devModel": "chrome",
"devVersion": "120",
"devVersion": d.conf.devVersion,
"appVersion": "",
"timestamp": ts,
//"appToken": d.Token,
"extra": "2",
})
req.SetHeaders(map[string]string{
"Origin": d.conf.site,
"Referer": d.conf.site + "/",
})
if proved {
req.SetQueryParam("appToken", d.Token)
}
Expand Down

0 comments on commit 75bb3a5

Please sign in to comment.