Files
certd/packages/ui/certd-server/src/modules/basic/controller/settings-controller.ts
T

54 lines
1.6 KiB
TypeScript
Raw Normal View History

2024-10-05 01:46:25 +08:00
import { ALL, Body, Config, Controller, Get, Inject, Provide } from '@midwayjs/core';
2024-10-10 18:38:22 +08:00
import { BaseController, Constants, SysInstallInfo, SysPublicSettings, SysSettingsService, SysSiteEnv, SysSiteInfo } from '@certd/lib-server';
2024-10-05 01:46:25 +08:00
import { AppKey, getPlusInfo } from '@certd/pipeline';
/**
*/
@Provide()
@Controller('/api/basic/settings')
export class BasicSettingsController extends BaseController {
@Inject()
sysSettingsService: SysSettingsService;
2024-09-24 02:42:08 +08:00
@Config('account.server.baseUrl')
accountServerBaseUrl: any;
2024-10-10 18:38:22 +08:00
@Config('agent')
agentConfig: SysSiteEnv['agent'];
@Get('/public', { summary: Constants.per.guest })
public async getSysPublic() {
2024-08-02 23:59:08 +08:00
const settings = await this.sysSettingsService.getSetting(SysPublicSettings);
return this.ok(settings);
}
2024-08-25 01:55:34 +08:00
@Get('/install', { summary: Constants.per.guest })
public async getInstallInfo() {
2024-09-24 02:42:08 +08:00
const settings: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
settings.accountServerBaseUrl = this.accountServerBaseUrl;
settings.appKey = AppKey;
2024-08-25 01:55:34 +08:00
return this.ok(settings);
}
2024-09-23 11:27:53 +08:00
@Get('/siteInfo', { summary: Constants.per.guest })
public async getSiteInfo() {
2024-09-24 02:42:08 +08:00
const settings: SysSiteInfo = await this.sysSettingsService.getSetting(SysSiteInfo);
2024-09-23 11:27:53 +08:00
return this.ok(settings);
}
2024-10-05 01:46:25 +08:00
2024-10-10 18:38:22 +08:00
@Get('/siteEnv', { summary: Constants.per.guest })
public async getSiteEnv() {
const env: SysSiteEnv = {
agent: this.agentConfig,
};
return this.ok(env);
}
2024-10-05 01:46:25 +08:00
@Get('/plusInfo', { summary: Constants.per.guest })
async plusInfo(@Body(ALL) body: any) {
const info = getPlusInfo();
return this.ok({
...info,
});
}
}