mirror of
https://github.com/certd/certd.git
synced 2026-04-16 05:50:50 +08:00
chore:
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user