This commit is contained in:
xiaojunnuo
2024-10-12 18:30:40 +08:00
parent 67ba17286c
commit 5601bc4ab2
4 changed files with 55 additions and 5 deletions

View File

@@ -35,10 +35,6 @@ export class AutoInitSite {
installInfo.siteId = nanoid();
await this.sysSettingsService.saveSetting(installInfo);
}
if (!installInfo.siteId) {
installInfo.siteId = nanoid();
await this.sysSettingsService.saveSetting(installInfo);
}
//private信息
const privateInfo = await this.sysSettingsService.getSetting<SysPrivateSettings>(SysPrivateSettings);

View File

@@ -5,6 +5,7 @@ import * as _ from 'lodash-es';
import { PipelineService } from '../../../pipeline/service/pipeline-service.js';
import { UserSettingsService } from '../../../mine/service/user-settings-service.js';
import { getEmailSettings } from '../fix.js';
import { http, logger } from '@certd/pipeline';
/**
*/
@@ -101,4 +102,38 @@ export class SysSettingsController extends CrudController<SysSettingsService> {
await this.pipelineService.stopOtherUserPipeline(1);
return this.ok({});
}
@Post('/testProxy', { summary: 'sys:settings:view' })
async testProxy(@Body(ALL) body) {
const google = 'https://www.google.com/';
const baidu = 'https://www.baidu.com/';
let googleRes = false;
try {
await http.request({
url: google,
method: 'GET',
timeout: 4000,
});
googleRes = true;
} catch (e) {
googleRes = e.message;
logger.info('test google error:', e);
}
let baiduRes = false;
try {
await http.request({
url: baidu,
method: 'GET',
timeout: 4000,
});
baiduRes = true;
} catch (e) {
baiduRes = e.message;
logger.info('test baidu error:', e);
}
return this.ok({
google: googleRes,
baidu: baiduRes,
});
}
}