提交 077a347d 编写于 作者: B binaryify

手机登录增加验证码登录方式 #1328, #1075 #1227

上级 ced76896
# 更新日志
### 4.0.20 | 2021.8.20
- 手机登录增加验证码登录方式 [#1328](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1328)
### 4.0.19 | 2021.8.10
- 修复若干问题
......
......@@ -426,11 +426,13 @@ $ sudo docker run -d -p 3000:3000 netease-music-api
**可选参数 :**
`countrycode`: 国家码,用于国外手机号登录,例如美国传入:`1`
`md5_password`: md5加密后的密码,传入后 `password` 将失效
`md5_password`: md5加密后的密码,传入后 `password` 参数将失效
`captcha`: 验证码,使用 [`/captcha/sent`](#发送验证码)接口传入手机号获取验证码,调用此接口传入验证码,可使用验证码登录,传入后 `password` 参数将失效
**接口地址 :** `/login/cellphone`
**调用例子 :** `/login/cellphone?phone=xxx&password=yyy` `/login/cellphone?phone=xxx&md5_password=yyy`
**调用例子 :** `/login/cellphone?phone=xxx&password=yyy` `/login/cellphone?phone=xxx&md5_password=yyy` `/login/cellphone?phone=xxx&captcha=1234`
#### 2. 邮箱登录
......
......@@ -694,6 +694,14 @@ export function login_cellphone(
} & RequestBaseConfig,
): Promise<Response>
export function login_cellphone(
params: {
phone: number | string
countrycode?: number | string
captcha: number | string
} & RequestBaseConfig,
): Promise<Response>
export function login_refresh(params: RequestBaseConfig): Promise<Response>
export function login_status(params: RequestBaseConfig): Promise<Response>
......
......@@ -7,9 +7,11 @@ module.exports = async (query, request) => {
const data = {
phone: query.phone,
countrycode: query.countrycode || '86',
password:
query.md5_password ||
crypto.createHash('md5').update(query.password).digest('hex'),
captcha: query.captcha,
[query.captcha ? 'captcha' : 'password']: query.captcha
? query.captcha
: query.md5_password ||
crypto.createHash('md5').update(query.password).digest('hex'),
rememberLogin: 'true',
}
let result = await request(
......
{
"name": "NeteaseCloudMusicApi",
"version": "4.0.19",
"version": "4.0.20",
"description": "网易云音乐 NodeJS 版 API",
"scripts": {
"start": "node app.js",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册