Skip to content

Commit

Permalink
fix(provider/kuwo): rework csrf generator
Browse files Browse the repository at this point in the history
Co-authored-by: Shaowen Yin <yinshaowen241@gmail.com>
Signed-off-by: Tianling Shen <i@cnsztl.eu.org>
  • Loading branch information
1715173329 and cosven committed Jul 15, 2023
1 parent 2e8d7b3 commit f24cad0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ module.exports = {
.once('finish', () => resolve(digest.read()));
}),
},
sha1: {
digest: (value) =>
crypto.createHash('sha1').update(value).digest('hex'),
},
random: {
hex: (length) =>
crypto
Expand Down
2 changes: 1 addition & 1 deletion src/provider/kuwo.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const search = (info) => {
const token = crypto.random.hex(32).toUpperCase();
return request('GET', url, {
referer: `http://www.kuwo.cn/search/list?key=${keyword}`,
cross: crypto.md5.digest(token),
cross: crypto.md5.digest(crypto.sha1.digest(token)),
cookie: `Hm_token=${token}`,
})
.then((response) => response.json())
Expand Down

0 comments on commit f24cad0

Please sign in to comment.