Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

中科大的源发送请求会因缺少 User-Agent 请求头出现 403,导致无法使用 #15

Open
muyiluop opened this issue Sep 2, 2024 · 3 comments

Comments

@muyiluop
Copy link

muyiluop commented Sep 2, 2024

版本地址:https://mirrors.ustc.edu.cn/node/index.json
直接curl请求没问题,使用nodejs插件请求会 403

@muyiluop
Copy link
Author

muyiluop commented Sep 2, 2024

实测是这个源需要 User-Agent 请求头,通过修改 .version-fox/plugin/nodejs/hooks/available.lua 文件,增加 User-Agent 请求头就行了。内容不限制,我给改成了版本号了,例如 vfox-nodejs/0.3.0

@muyiluop muyiluop closed this as completed Sep 2, 2024
@muyiluop
Copy link
Author

muyiluop commented Sep 2, 2024

涉及到发送 http 请求的都有这个问题

@muyiluop muyiluop reopened this Sep 2, 2024
@muyiluop
Copy link
Author

muyiluop commented Sep 2, 2024

pre_install.lua 脚本也需要修改下返回值,增加 User-Agent 请求头,不然无法下载
return { version = version, url = baseUrl .. filename, sha256 = checksum, headers = {["User-Agent"]="vfox-nodejs/0.3.0"} }

@muyiluop muyiluop changed the title 中科大的源请求版本列表会 403 中科大的源发送请求会因缺少 User-Agent 请求头出现 403,导致无法使用 Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant