mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-05-23 22:37:41 +08:00
fix: 修复anonymous_token路径异常 #1795
This commit is contained in:
parent
39ad34fa0b
commit
957213bb93
@ -1,5 +1,9 @@
|
|||||||
# 更新日志
|
# 更新日志
|
||||||
### 4.12.0 | 2023.09.10
|
### 4.12.2 | 2023.09.12
|
||||||
|
- 新增 `播客声音列表`接口
|
||||||
|
- 修复anonymous_token路径异常 #1795
|
||||||
|
|
||||||
|
### 4.12.1 | 2023.09.10
|
||||||
- 补充 `get/userids`(根据nickname获取userid) 接口
|
- 补充 `get/userids`(根据nickname获取userid) 接口
|
||||||
|
|
||||||
### 4.12.0 | 2023.09.10
|
### 4.12.0 | 2023.09.10
|
||||||
|
1
app.js
Normal file → Executable file
1
app.js
Normal file → Executable file
@ -8,6 +8,7 @@ async function start() {
|
|||||||
if (!fs.existsSync(path.resolve(tmpPath, 'anonymous_token'))) {
|
if (!fs.existsSync(path.resolve(tmpPath, 'anonymous_token'))) {
|
||||||
fs.writeFileSync(path.resolve(tmpPath, 'anonymous_token'), '', 'utf-8')
|
fs.writeFileSync(path.resolve(tmpPath, 'anonymous_token'), '', 'utf-8')
|
||||||
}
|
}
|
||||||
|
// 启动时更新anonymous_token
|
||||||
const generateConfig = require('./generateConfig')
|
const generateConfig = require('./generateConfig')
|
||||||
await generateConfig()
|
await generateConfig()
|
||||||
require('./server').serveNcmApi({
|
require('./server').serveNcmApi({
|
||||||
|
@ -4280,7 +4280,7 @@ qrCodeStatus:20,detailReason:0 验证成功qrCodeStatus:21,detailReason:0 二
|
|||||||
|
|
||||||
`nicknames`: 用户昵称,多个用分号(;)隔开
|
`nicknames`: 用户昵称,多个用分号(;)隔开
|
||||||
|
|
||||||
**接口地址:** `/user/nickname`
|
**接口地址:** `/get/userids`
|
||||||
|
|
||||||
**调用例子:** `/get/userids?nicknames=binaryify` `/get/userids?nicknames=binaryify;binaryify2`
|
**调用例子:** `/get/userids?nicknames=binaryify` `/get/userids?nicknames=binaryify;binaryify2`
|
||||||
|
|
||||||
|
19
main.js
19
main.js
@ -1,8 +1,13 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const tmpPath = require('os').tmpdir()
|
||||||
const { cookieToJson } = require('./util')
|
const { cookieToJson } = require('./util')
|
||||||
const request = require('./util/request')
|
|
||||||
|
|
||||||
|
if (!fs.existsSync(path.resolve(tmpPath, 'anonymous_token'))) {
|
||||||
|
fs.writeFileSync(path.resolve(tmpPath, 'anonymous_token'), '', 'utf-8')
|
||||||
|
}
|
||||||
|
|
||||||
|
let firstRun = true
|
||||||
/** @type {Record<string, any>} */
|
/** @type {Record<string, any>} */
|
||||||
let obj = {}
|
let obj = {}
|
||||||
fs.readdirSync(path.join(__dirname, 'module'))
|
fs.readdirSync(path.join(__dirname, 'module'))
|
||||||
@ -20,7 +25,17 @@ fs.readdirSync(path.join(__dirname, 'module'))
|
|||||||
...data,
|
...data,
|
||||||
cookie: data.cookie ? data.cookie : {},
|
cookie: data.cookie ? data.cookie : {},
|
||||||
},
|
},
|
||||||
request,
|
async (...args) => {
|
||||||
|
if (firstRun) {
|
||||||
|
firstRun = false
|
||||||
|
const generateConfig = require('./generateConfig')
|
||||||
|
await generateConfig()
|
||||||
|
}
|
||||||
|
// 待优化
|
||||||
|
const request = require('./util/request')
|
||||||
|
|
||||||
|
return request(...args)
|
||||||
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "NeteaseCloudMusicApi",
|
"name": "NeteaseCloudMusicApi",
|
||||||
"version": "4.12.1",
|
"version": "4.12.2",
|
||||||
"description": "网易云音乐 NodeJS 版 API",
|
"description": "网易云音乐 NodeJS 版 API",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node app.js",
|
"start": "node app.js",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user