mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-05-23 22:37:41 +08:00
parent
0ff32acdc1
commit
3e5c052f98
@ -1,4 +1,8 @@
|
|||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
### 4.8.11 | 2023.05.29
|
||||||
|
- 支持headers不携带cookie信息
|
||||||
|
|
||||||
### 4.8.10 | 2023.04.07
|
### 4.8.10 | 2023.04.07
|
||||||
- 补充私信和通知接口
|
- 补充私信和通知接口
|
||||||
|
|
||||||
|
@ -481,6 +481,8 @@ $ sudo docker run -d -p 3000:3000 netease-music-api
|
|||||||
|
|
||||||
!> 分页接口返回字段里有`more`,more 为 true 则为有下一页
|
!> 分页接口返回字段里有`more`,more 为 true 则为有下一页
|
||||||
|
|
||||||
|
!> 如果不需要接口headers携带cookies信息,可以加上noCookie参数,如`?noCookie=true`
|
||||||
|
|
||||||
### 登录
|
### 登录
|
||||||
|
|
||||||
说明 : 登录有三个接口,建议使用`encodeURIComponent`对密码编码或者使用`POST`请求,避免某些特殊字符无法解析,如`#`(`#`在 url 中会被识别为 hash,而不是 query)
|
说明 : 登录有三个接口,建议使用`encodeURIComponent`对密码编码或者使用`POST`请求,避免某些特殊字符无法解析,如`#`(`#`在 url 中会被识别为 hash,而不是 query)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "NeteaseCloudMusicApi",
|
"name": "NeteaseCloudMusicApi",
|
||||||
"version": "4.8.10",
|
"version": "4.8.11",
|
||||||
"description": "网易云音乐 NodeJS 版 API",
|
"description": "网易云音乐 NodeJS 版 API",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node app.js",
|
"start": "node app.js",
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<script>
|
<script>
|
||||||
async function checkStatus(key) {
|
async function checkStatus(key) {
|
||||||
const res = await axios({
|
const res = await axios({
|
||||||
url: `/login/qr/check?key=${key}×tamp=${Date.now()}`,
|
url: `/login/qr/check?key=${key}×tamp=${Date.now()}&noCookie=true`,
|
||||||
})
|
})
|
||||||
return res.data
|
return res.data
|
||||||
}
|
}
|
||||||
|
29
server.js
29
server.js
@ -239,17 +239,19 @@ async function consturctServer(moduleDefs) {
|
|||||||
console.log('[OK]', decode(req.originalUrl))
|
console.log('[OK]', decode(req.originalUrl))
|
||||||
|
|
||||||
const cookies = moduleResponse.cookie
|
const cookies = moduleResponse.cookie
|
||||||
if (Array.isArray(cookies) && cookies.length > 0) {
|
if (!query.noCookie) {
|
||||||
if (req.protocol === 'https') {
|
if (Array.isArray(cookies) && cookies.length > 0) {
|
||||||
// Try to fix CORS SameSite Problem
|
if (req.protocol === 'https') {
|
||||||
res.append(
|
// Try to fix CORS SameSite Problem
|
||||||
'Set-Cookie',
|
res.append(
|
||||||
cookies.map((cookie) => {
|
'Set-Cookie',
|
||||||
return cookie + '; SameSite=None; Secure'
|
cookies.map((cookie) => {
|
||||||
}),
|
return cookie + '; SameSite=None; Secure'
|
||||||
)
|
}),
|
||||||
} else {
|
)
|
||||||
res.append('Set-Cookie', cookies)
|
} else {
|
||||||
|
res.append('Set-Cookie', cookies)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res.status(moduleResponse.status).send(moduleResponse.body)
|
res.status(moduleResponse.status).send(moduleResponse.body)
|
||||||
@ -268,7 +270,10 @@ async function consturctServer(moduleDefs) {
|
|||||||
}
|
}
|
||||||
if (moduleResponse.body.code == '301')
|
if (moduleResponse.body.code == '301')
|
||||||
moduleResponse.body.msg = '需要登录'
|
moduleResponse.body.msg = '需要登录'
|
||||||
res.append('Set-Cookie', moduleResponse.cookie)
|
if (!query.noCookie) {
|
||||||
|
res.append('Set-Cookie', moduleResponse.cookie)
|
||||||
|
}
|
||||||
|
|
||||||
res.status(moduleResponse.status).send(moduleResponse.body)
|
res.status(moduleResponse.status).send(moduleResponse.body)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user