This repository has been archived by the owner on Apr 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15.8k
/utils/crypto.js
浏览器平台改写
#1839
Comments
为啥要在浏览器端调用,有跨域问题,而且浏览器端有些header也不能设置,也没法自定义header里的cookie |
先说我放弃的方案
按我的理解本项目的核心 一是:找到对应的接口地址 二是:破解参数( 在我看分析完相关的源码后我发现只要我改写 我的预计工作流程为:
这个方案的具体实施过程为:
|
明白了,就是不依赖nodejs自带库的方法,我今天试试吧 |
好了 |
ZhaoTonggang
pushed a commit
to ZhaoTonggang/NeteaseCloudMusicApi
that referenced
this issue
Dec 23, 2023
* fix: 修复匿名登录下,部分接口提示网络太拥挤问题 Binaryify#1829 * update: Dockfile * lock文件更新 * 修复 Docker 构建镜像安装依赖速度慢的问题 * update: dockerfile 配置更新 * CI 更新 * ci 更新 * CI 更新 * CI 更新 * CI 更新 * bump to 4.13.8 * chore: update type * docs: sync type definition * fix: error when query.id is number * feat: 播客声音排序 * feat: 播客列表详情 * doc: 更新文档 * feat: crypto.js 重构 Binaryify#1839 * update:lock文件更新 * [fix] removed unnecessary console log in song_url_v1 * update: song upload use up-to-date ip * fix: use variable bucket name * feat:歌曲红心数量,歌曲音质详情,本地歌曲文件匹配网易云歌曲信息 feat:本地歌曲文件匹配网易云歌曲信息 feat:歌曲音质详情 feat:歌曲红心数量 * update: appver更新 * fix: lint error * fix: /artist/detail 登录状态下调用提示网络拥挤的问题 Binaryify#1853 * Update README.MD add Python SDK * Update README.MD * update: 文档更新 * update: 移除多余代码 * bump to 4.14.0 --------- Co-authored-by: binaryify <[email protected]> Co-authored-by: WooMai <[email protected]> Co-authored-by: 龙打野 <[email protected]> Co-authored-by: Unics Yu <[email protected]> Co-authored-by: Akane <[email protected]> Co-authored-by: 5unV <[email protected]> Co-authored-by: 盧瞳 <[email protected]>
Jerry-FaGe
pushed a commit
to Jerry-FaGe/NeteaseCloudMusicApi
that referenced
this issue
Dec 28, 2023
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
环境
系统/平台: windows
nodejs 版本: v18.18.0
API版本: 4.13.8
出现问题
阅读了
/utils/crypto.js
后想将他用浏览器环境下的相关库替换掉node内置的crypto
重现步骤
其中
aesEncrypt
函数已经做到了,但是在处理rsaEncrypt
时(实际上具体是weapi
用到了的secretKey
不是字符串)的时候发现绕不开node
内置的buffer
,而第三方支持的库都要求传入一个字符串值。我尝试将其使用
Uint8Array
并在加密前使用new TextDecoder("ascii")
进行编码(尝试过所有的支持编码)都没有成功。如果可以的话能否额外提示我该如何使用无填充模式,我很难找到一个第三方库支持这种加密方式,我自己尝试修改
jsencrypt.js
的源码将其的填充方法直接注释掉使用jsbn
转换为大数,但由于buffer
相关问题没有处理成功,所以也不能确定这个方式是否有效。期待效果
最终目标是将写一个接口中间层让api运行在安卓本地
如果将
/utils/crypto.js
转换为浏览器环境可以执行的代码后,我就可以在 “ 删除掉request中的axios请求方法,和一些其他的不兼容的库“ 后实现在浏览器中就能运行接口并返回相关的请求信息,之后使用其他android
类工具(如capacitor
)提供的原生请求方法进行请求,从而让整个api都运行在本地。The text was updated successfully, but these errors were encountered: