mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-07-08 01:12:06 +08:00
增加兼容性
This commit is contained in:
21
server.js
21
server.js
@ -294,7 +294,28 @@ async function serveNcmApi(options) {
|
||||
return appExt
|
||||
}
|
||||
|
||||
let obj = {}
|
||||
fs.readdirSync(path.join(__dirname, 'module'))
|
||||
.reverse()
|
||||
.forEach((file) => {
|
||||
if (!file.endsWith('.js')) return
|
||||
let fileModule = require(path.join(__dirname, 'module', file))
|
||||
obj[file.split('.').shift()] = function (data) {
|
||||
if (typeof data.cookie === 'string') {
|
||||
data.cookie = cookieToJson(data.cookie)
|
||||
}
|
||||
return fileModule(
|
||||
{
|
||||
...data,
|
||||
cookie: data.cookie ? data.cookie : {},
|
||||
},
|
||||
request,
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
module.exports = {
|
||||
serveNcmApi,
|
||||
getModulesDefinitions,
|
||||
...obj,
|
||||
}
|
||||
|
Reference in New Issue
Block a user