mirror of https://github.com/certd/certd
pref: 启动输出版本和站点id
parent
4caa2fad9d
commit
50c56d134e
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="access-selector">
|
<div class="access-selector">
|
||||||
<span v-if="target.name" class="mr-5 cd-flex-inline">
|
<span v-if="target.name" class="mr-5 cd-flex-inline">
|
||||||
<span class="mr-5">{{ target.name }}</span>
|
<a-tag class="mr-5" color="green">{{ target.name }}</a-tag>
|
||||||
<fs-icon class="cd-icon-button" icon="ion:close-circle-outline" @click="clear"></fs-icon>
|
<fs-icon class="cd-icon-button" icon="ion:close-circle-outline" @click="clear"></fs-icon>
|
||||||
</span>
|
</span>
|
||||||
<span v-else class="mlr-5 text-gray">{{ placeholder }}</span>
|
<span v-else class="mlr-5 text-gray">{{ placeholder }}</span>
|
||||||
|
|
|
@ -78,7 +78,9 @@ export type CertApplyPluginSysInput = {
|
||||||
googleCommonEabAccessId: number;
|
googleCommonEabAccessId: number;
|
||||||
};
|
};
|
||||||
export type PluginSysSetting<T> = {
|
export type PluginSysSetting<T> = {
|
||||||
input?: T;
|
sysSetting: {
|
||||||
|
input?: T;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
export type CommPluginConfig = {
|
export type CommPluginConfig = {
|
||||||
CertApply?: PluginSysSetting<CertApplyPluginSysInput>;
|
CertApply?: PluginSysSetting<CertApplyPluginSysInput>;
|
||||||
|
|
|
@ -6,9 +6,16 @@
|
||||||
|
|
||||||
<div class="sys-plugin-config settings-form">
|
<div class="sys-plugin-config settings-form">
|
||||||
<a-form :model="formState" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" @finish="onFinish" @finish-failed="onFinishFailed">
|
<a-form :model="formState" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" @finish="onFinish" @finish-failed="onFinishFailed">
|
||||||
<a-form-item label="公共Google EAB授权" :name="['CertApply', 'input', 'googleCommonEabAccessId']">
|
<a-form-item label="公共Google EAB授权" :name="['CertApply', 'sysSetting', 'input', 'googleCommonEabAccessId']">
|
||||||
<access-selector v-model:model-value="formState.CertApply.input.googleCommonEabAccessId" type="eab" from="sys"></access-selector>
|
<access-selector v-model:model-value="formState.CertApply.sysSetting.input.googleCommonEabAccessId" type="eab" from="sys"></access-selector>
|
||||||
<div class="helper">设置公共Google EAB授权给用户使用,避免用户自己去翻墙获取Google EAB授权</div>
|
<div class="helper">
|
||||||
|
<div>设置公共Google EAB授权给用户使用,避免用户自己去翻墙获取Google EAB授权</div>
|
||||||
|
<div>
|
||||||
|
<a href="https://gitee.com/certd/certd/blob/v2/doc/google/google.md#21-%E7%9B%B4%E6%8E%A5%E8%8E%B7%E5%8F%96eab-%E6%8E%A8%E8%8D%90">
|
||||||
|
获取Google EAB授权方法
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item :wrapper-col="{ offset: 8, span: 16 }">
|
<a-form-item :wrapper-col="{ offset: 8, span: 16 }">
|
||||||
|
@ -31,7 +38,11 @@ defineOptions({
|
||||||
});
|
});
|
||||||
const formState = reactive<Partial<CommPluginConfig>>({
|
const formState = reactive<Partial<CommPluginConfig>>({
|
||||||
CertApply: {
|
CertApply: {
|
||||||
input: {}
|
sysSetting: {
|
||||||
|
input: {
|
||||||
|
googleCommonEabAccessId: null
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,10 @@
|
||||||
import { Autoload, Config, Init, Inject, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Autoload, Config, Init, Inject, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { logger } from '@certd/pipeline';
|
import { logger } from '@certd/pipeline';
|
||||||
import { UserService } from '../sys/authority/service/user-service.js';
|
import { UserService } from '../sys/authority/service/user-service.js';
|
||||||
import { PlusService, SysSettingsService } from '@certd/lib-server';
|
import { PlusService, SysInstallInfo, SysPrivateSettings, SysSettingsService } from '@certd/lib-server';
|
||||||
import { nanoid } from 'nanoid';
|
import { nanoid } from 'nanoid';
|
||||||
import { SysInstallInfo, SysPrivateSettings } from '@certd/lib-server';
|
|
||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
|
|
||||||
export type InstallInfo = {
|
|
||||||
installTime: number;
|
|
||||||
instanceId?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
@Autoload()
|
@Autoload()
|
||||||
@Scope(ScopeEnum.Singleton)
|
@Scope(ScopeEnum.Singleton)
|
||||||
export class AutoInitSite {
|
export class AutoInitSite {
|
||||||
|
@ -59,8 +53,6 @@ export class AutoInitSite {
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info('初始化站点完成');
|
logger.info('初始化站点完成');
|
||||||
// const pkg = require('../../../package.json');
|
|
||||||
// logger.info(`当前版本为:${pkg.version}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async startOptimizeDb() {
|
async startOptimizeDb() {
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { Autoload, Init, Inject, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
|
import { logger } from '@certd/pipeline';
|
||||||
|
import { SysInstallInfo, SysSettingsService } from '@certd/lib-server';
|
||||||
|
import { getVersion } from '../../utils/version.js';
|
||||||
|
|
||||||
|
@Autoload()
|
||||||
|
@Scope(ScopeEnum.Singleton)
|
||||||
|
export class AutoZPrint {
|
||||||
|
@Inject()
|
||||||
|
sysSettingsService: SysSettingsService;
|
||||||
|
|
||||||
|
@Init()
|
||||||
|
async init() {
|
||||||
|
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
|
||||||
|
logger.info('=========================================');
|
||||||
|
logger.info('当前站点ID:', installInfo.siteId);
|
||||||
|
const version = await getVersion();
|
||||||
|
logger.info(`当前版本:${version}`);
|
||||||
|
logger.info('服务启动完成');
|
||||||
|
logger.info('=========================================');
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,20 +34,27 @@ export class PluginConfigService {
|
||||||
return configs;
|
return configs;
|
||||||
}
|
}
|
||||||
|
|
||||||
async saveCommPluginConfig(body: CommPluginConfig) {
|
async saveCommPluginConfig(config: CommPluginConfig) {
|
||||||
const certApplyConfig = body.CertApply;
|
await this.savePluginConfig('CertApply', config.CertApply);
|
||||||
const CertApply = await this.pluginService.getRepository().findOne({
|
}
|
||||||
where: { name: 'CertApply' },
|
|
||||||
|
async savePluginConfig(name: string, config: PluginConfig) {
|
||||||
|
const sysSetting = config?.sysSetting;
|
||||||
|
if (!sysSetting) {
|
||||||
|
throw new Error(`${name}.sysSetting is required`);
|
||||||
|
}
|
||||||
|
const pluginEntity = await this.pluginService.getRepository().findOne({
|
||||||
|
where: { name },
|
||||||
});
|
});
|
||||||
if (!CertApply) {
|
if (!pluginEntity) {
|
||||||
await this.pluginService.add({
|
await this.pluginService.add({
|
||||||
name: 'CertApply',
|
name,
|
||||||
sysSetting: JSON.stringify(certApplyConfig),
|
sysSetting: JSON.stringify(sysSetting),
|
||||||
type: 'builtIn',
|
type: 'builtIn',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await this.pluginService.getRepository().update({ name: 'CertApply' }, { sysSetting: JSON.stringify(certApplyConfig) });
|
await this.pluginService.getRepository().update({ name }, { sysSetting: JSON.stringify(sysSetting) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
|
export async function getVersion() {
|
||||||
|
const pkg = await fs.promises.readFile('../../../package.json');
|
||||||
|
const pkgJson = JSON.parse(pkg.toString());
|
||||||
|
return pkgJson.version;
|
||||||
|
}
|
Loading…
Reference in New Issue