This commit is contained in:
unitwk 2023-05-23 20:21:52 +08:00
commit cd20dce278
2 changed files with 53 additions and 2 deletions

53
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "mcsmanager-daemon",
"version": "3.3.0",
"version": "3.4.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -456,6 +456,15 @@
"@types/koa": "*"
}
},
"@types/koa-send": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/@types/koa-send/-/koa-send-4.1.3.tgz",
"integrity": "sha512-daaTqPZlgjIJycSTNjKpHYuKhXYP30atFc1pBcy6HHqB9+vcymDgYTguPdx9tO4HMOqNyz6bz/zqpxt5eLR+VA==",
"dev": true,
"requires": {
"@types/koa": "*"
}
},
"@types/koa__router": {
"version": "8.0.7",
"resolved": "https://registry.npmjs.org/@types/koa__router/-/koa__router-8.0.7.tgz",
@ -2411,6 +2420,16 @@
}
}
},
"koa-send": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/koa-send/-/koa-send-5.0.1.tgz",
"integrity": "sha512-tmcyQ/wXXuxpDxyNXv5yNNkdAMdFRqwtegBXUaowiQzUKqJehttS0x2j0eOZDQAyloAth5w6wwBImnFzkUz3pQ==",
"requires": {
"debug": "^4.1.1",
"http-errors": "^1.7.3",
"resolve-path": "^1.4.0"
}
},
"lazystream": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz",
@ -3093,6 +3112,38 @@
"integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
"dev": true
},
"resolve-path": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/resolve-path/-/resolve-path-1.4.0.tgz",
"integrity": "sha512-i1xevIst/Qa+nA9olDxLWnLk8YZbi8R/7JPbCMcgyWaFR6bKWaexgJgEB5oc2PKMjYdrHynyz0NY+if+H98t1w==",
"requires": {
"http-errors": "~1.6.2",
"path-is-absolute": "1.0.1"
},
"dependencies": {
"http-errors": {
"version": "1.6.3",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
"integrity": "sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==",
"requires": {
"depd": "~1.1.2",
"inherits": "2.0.3",
"setprototypeof": "1.1.0",
"statuses": ">= 1.4.0 < 2"
}
},
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw=="
},
"setprototypeof": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
"integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
}
}
},
"rfdc": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz",

View File

@ -72,7 +72,7 @@ export default class FileManager {
list(page: 0, pageSize = 40, searchFileName?: string) {
if (pageSize > 100 || pageSize <= 0 || page < 0) throw new Error("Beyond the value limit");
let fileNames = fs.readdirSync(this.toAbsolutePath());
if (searchFileName) fileNames = fileNames.filter((name) => name.includes(searchFileName));
if (searchFileName) fileNames = fileNames.filter((name) => name.toLowerCase().includes(searchFileName.toLowerCase()));
const total = fileNames.length;
const sliceStart = page * pageSize;