mirror of
https://github.com/certd/certd.git
synced 2026-04-24 12:27:25 +08:00
perf: 新增代理设置功能
This commit is contained in:
@@ -53,6 +53,8 @@ export class AutoInitSite {
|
||||
await this.sysSettingsService.saveSetting(privateInfo);
|
||||
}
|
||||
|
||||
await this.sysSettingsService.reloadPrivateSettings();
|
||||
|
||||
// 授权许可
|
||||
try {
|
||||
await this.plusService.verify();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ALL, Body, Controller, Get, Inject, Post, Provide } from '@midwayjs/core';
|
||||
import { BaseController, Constants, PlusService, SysInstallInfo, SysSettingsService } from '@certd/lib-server';
|
||||
import { AppKey, logger, PlusRequestService, verify } from '@certd/pipeline';
|
||||
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
||||
import { BaseController, PlusService, SysInstallInfo, SysSettingsService } from '@certd/lib-server';
|
||||
import { AppKey, logger } from '@certd/pipeline';
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -51,42 +51,42 @@ export class SysPlusController extends BaseController {
|
||||
|
||||
return this.ok(true);
|
||||
}
|
||||
|
||||
@Get('/test', { summary: Constants.per.guest })
|
||||
async test() {
|
||||
const subjectId = 'vpyoZb6fDBjzzSZp67OBP';
|
||||
const license = '';
|
||||
const timestamps = 1728365013899;
|
||||
const bindUrl = 'http://89.21.0.171:7001/';
|
||||
const service = new PlusRequestService({
|
||||
subjectId: subjectId,
|
||||
plusServerBaseUrls: ['https://api.ai.handsfree.work'],
|
||||
});
|
||||
const body = { subjectId, appKey: 'kQth6FHM71IPV3qdWc', url: bindUrl };
|
||||
|
||||
async function test() {
|
||||
await verify({
|
||||
subjectId: subjectId,
|
||||
license: license,
|
||||
plusRequestService: service,
|
||||
});
|
||||
|
||||
const res = await service.sign(body, timestamps);
|
||||
console.log('sign:', res);
|
||||
|
||||
const res2 = await service.request({
|
||||
url: '/activation/subject/vip/check',
|
||||
data: {
|
||||
url: 'http://127.0.0.1:7001/',
|
||||
},
|
||||
});
|
||||
|
||||
console.log('res2:', res2);
|
||||
}
|
||||
console.log('2222');
|
||||
await test();
|
||||
console.log('3333');
|
||||
|
||||
return this.ok(true);
|
||||
}
|
||||
//
|
||||
// @Get('/test', { summary: Constants.per.guest })
|
||||
// async test() {
|
||||
// const subjectId = 'xxxxxx';
|
||||
// const license = '';
|
||||
// const timestamps = 1728365013899;
|
||||
// const bindUrl = 'http://127.0.0.1:7001/';
|
||||
// const service = new PlusRequestService({
|
||||
// subjectId: subjectId,
|
||||
// plusServerBaseUrls: ['https://api.ai.handsfree.work'],
|
||||
// });
|
||||
// const body = { subjectId, appKey: 'kQth6FHM71IPV3qdWc', url: bindUrl };
|
||||
//
|
||||
// async function test() {
|
||||
// await verify({
|
||||
// subjectId: subjectId,
|
||||
// license: license,
|
||||
// plusRequestService: service,
|
||||
// });
|
||||
//
|
||||
// const res = await service.sign(body, timestamps);
|
||||
// console.log('sign:', res);
|
||||
//
|
||||
// const res2 = await service.request({
|
||||
// url: '/activation/subject/vip/check',
|
||||
// data: {
|
||||
// url: 'http://127.0.0.1:7001/',
|
||||
// },
|
||||
// });
|
||||
//
|
||||
// console.log('res2:', res2);
|
||||
// }
|
||||
// console.log('2222');
|
||||
// await test();
|
||||
// console.log('3333');
|
||||
//
|
||||
// return this.ok(true);
|
||||
// }
|
||||
}
|
||||
|
||||
+17
-6
@@ -1,5 +1,5 @@
|
||||
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
||||
import { CrudController, SysPublicSettings, SysSettingsService } from '@certd/lib-server';
|
||||
import { CrudController, SysPrivateSettings, SysPublicSettings, SysSettingsService } from '@certd/lib-server';
|
||||
import { SysSettingsEntity } from '../entity/sys-settings.js';
|
||||
import * as _ from 'lodash-es';
|
||||
import { PipelineService } from '../../../pipeline/service/pipeline-service.js';
|
||||
@@ -77,12 +77,23 @@ export class SysSettingsController extends CrudController<SysSettingsService> {
|
||||
return this.ok(conf);
|
||||
}
|
||||
|
||||
@Post('/getSysSettings', { summary: 'sys:settings:edit' })
|
||||
async getSysSettings() {
|
||||
const publicSettings = await this.service.getPublicSettings();
|
||||
const privateSettings = await this.service.getPrivateSettings();
|
||||
privateSettings.removeSecret();
|
||||
return this.ok({ public: publicSettings, private: privateSettings });
|
||||
}
|
||||
|
||||
// savePublicSettings
|
||||
@Post('/savePublicSettings', { summary: 'sys:settings:edit' })
|
||||
async savePublicSettings(@Body(ALL) body) {
|
||||
const setting = new SysPublicSettings();
|
||||
_.merge(setting, body);
|
||||
await this.service.savePublicSettings(setting);
|
||||
@Post('/saveSysSettings', { summary: 'sys:settings:edit' })
|
||||
async saveSysSettings(@Body(ALL) body: { public: SysPublicSettings; private: SysPrivateSettings }) {
|
||||
const publicSettings = await this.service.getPublicSettings();
|
||||
const privateSettings = await this.service.getPrivateSettings();
|
||||
_.merge(publicSettings, body.public);
|
||||
_.merge(privateSettings, body.private);
|
||||
await this.service.savePublicSettings(publicSettings);
|
||||
await this.service.savePrivateSettings(privateSettings);
|
||||
return this.ok({});
|
||||
}
|
||||
@Post('/stopOtherUserTimer', { summary: 'sys:settings:edit' })
|
||||
|
||||
Reference in New Issue
Block a user