mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2026-10-23 08:01:23 +08:00
fix: 修复anonymous_token路径异常 #1795
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const tmpPath = require('os').tmpdir()
|
||||
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>} */
|
||||
let obj = {}
|
||||
fs.readdirSync(path.join(__dirname, 'module'))
|
||||
@@ -20,7 +25,17 @@ fs.readdirSync(path.join(__dirname, 'module'))
|
||||
...data,
|
||||
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)
|
||||
},
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user