perf: 支持ftp上传

This commit is contained in:
xiaojunnuo
2024-09-01 04:49:26 +08:00
parent ee617095ef
commit b9bddbfabb
8 changed files with 105 additions and 48 deletions
+4 -3
View File
@@ -29,7 +29,7 @@
"@certd/pipeline": "^1.24.0",
"@certd/plugin-cert": "^1.24.0",
"@certd/plugin-plus": "^1.24.0",
"@koa/cors": "^3.4.3",
"@koa/cors": "^5.0.0",
"@midwayjs/bootstrap": "^3.16.2",
"@midwayjs/cache": "^3.14.0",
"@midwayjs/core": "^3.16.2",
@@ -41,6 +41,7 @@
"@midwayjs/typeorm": "^3.16.4",
"@midwayjs/validate": "^3.16.4",
"axios": "^1.7.2",
"basic-ftp": "^5.0.5",
"bcryptjs": "^2.4.3",
"better-sqlite3": "^11.1.2",
"cache-manager": "^3.6.3",
@@ -50,7 +51,7 @@
"https-proxy-agent": "^7.0.4",
"iconv-lite": "^0.6.3",
"js-yaml": "^4.1.0",
"jsonwebtoken": "^8.5.1",
"jsonwebtoken": "^9.0.0",
"koa-send": "^5.0.1",
"kubernetes-client": "^9.0.0",
"lodash-es": "^4.17.21",
@@ -65,7 +66,7 @@
"ssh2": "^1.15.0",
"svg-captcha": "^1.4.0",
"tencentcloud-sdk-nodejs": "^4.0.44",
"typeorm": "^0.3.11"
"typeorm": "0.3.15"
},
"devDependencies": {
"@midwayjs/mock": "^3.16.4",
@@ -75,7 +75,8 @@ export class AccessService extends BaseService<AccessEntity> implements IAccessS
//星号保护
const length = value.length;
const subIndex = Math.min(2, length);
const starLength = length - subIndex * 2;
let starLength = length - subIndex * 2;
starLength = Math.max(2, starLength);
const starString = '*'.repeat(starLength);
json[key] = value.substring(0, subIndex) + starString + value.substring(value.length - subIndex);
encryptSetting[key] = {
@@ -74,14 +74,15 @@ export class SysSettingsService extends BaseService<SysSettingsEntity> {
async getSetting<T>(type: any): Promise<T> {
const key = type.__key__;
const cacheKey = type.getCacheKey();
let settings: T = await this.cache.get(cacheKey);
let settingInstance: T = new type();
if (settings == null) {
settings = await this.getSettingByKey(key);
settingInstance = _.merge(settingInstance, settings);
await this.cache.set(key, settingInstance);
const settings: T = await this.cache.get(cacheKey);
if (settings) {
return settings;
}
return settingInstance;
let newSetting: T = new type();
const savedSettings = await this.getSettingByKey(key);
newSetting = _.merge(newSetting, savedSettings);
await this.cache.set(cacheKey, newSetting);
return newSetting;
}
async saveSetting<T extends BaseSettings>(bean: T) {