mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 21:28:06 +00:00
refactor: rename napi to netease_api
This commit is contained in:
parent
e030647720
commit
fe8b3261ca
228 changed files with 1 additions and 1 deletions
26
netease_api/main.js
Normal file
26
netease_api/main.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const request = require('./util/request');
|
||||
const { cookieToJson } = require('./util/index');
|
||||
|
||||
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 = obj;
|
||||
Loading…
Add table
Add a link
Reference in a new issue