mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
过滤scripts目录下的子目录
This commit is contained in:
parent
aef57d94d6
commit
e44a7aca1a
|
@ -18,9 +18,13 @@ export default (app: Router) => {
|
|||
const fileList = fs.readdirSync(config.scriptPath, 'utf-8');
|
||||
res.send({
|
||||
code: 200,
|
||||
data: fileList.map((x) => {
|
||||
return { title: x, value: x, key: x };
|
||||
}),
|
||||
data: fileList
|
||||
.filter((x) => {
|
||||
return !fs.lstatSync(config.scriptPath + x).isDirectory();
|
||||
})
|
||||
.map((x) => {
|
||||
return { title: x, value: x, key: x };
|
||||
}),
|
||||
});
|
||||
} catch (e) {
|
||||
logger.error('🔥 error: %o', e);
|
||||
|
|
Loading…
Reference in New Issue
Block a user