mirror of
https://github.com/certd/certd.git
synced 2026-05-18 22:57:31 +08:00
perf: 增加邮件发送证书模版配置
This commit is contained in:
@@ -211,6 +211,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any, a
|
|||||||
show: computed(() => {
|
show: computed(() => {
|
||||||
return getAddonTypeDefine(addonType)?.showDefault ?? false;
|
return getAddonTypeDefine(addonType)?.showDefault ?? false;
|
||||||
}),
|
}),
|
||||||
|
columnSetShow: false,
|
||||||
value: false,
|
value: false,
|
||||||
rules: [{ required: true, message: t("certd.selectIsDefault") }],
|
rules: [{ required: true, message: t("certd.selectIsDefault") }],
|
||||||
order: 999,
|
order: 999,
|
||||||
@@ -218,6 +219,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any, a
|
|||||||
column: {
|
column: {
|
||||||
align: "center",
|
align: "center",
|
||||||
width: 100,
|
width: 100,
|
||||||
|
columnSetShow: false,
|
||||||
show: computed(() => {
|
show: computed(() => {
|
||||||
return getAddonTypeDefine(addonType)?.showDefault ?? false;
|
return getAddonTypeDefine(addonType)?.showDefault ?? false;
|
||||||
}),
|
}),
|
||||||
@@ -263,10 +265,11 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any, a
|
|||||||
},
|
},
|
||||||
column: {
|
column: {
|
||||||
show: false,
|
show: false,
|
||||||
|
columnSetShow: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setting: {
|
setting: {
|
||||||
column: { show: false },
|
column: { show: false, columnSetShow: false },
|
||||||
form: {
|
form: {
|
||||||
show: false,
|
show: false,
|
||||||
valueBuilder({ value, form }) {
|
valueBuilder({ value, form }) {
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ export class DeployCertToMailPlugin extends AbstractTaskPlugin {
|
|||||||
throw new Error('证书压缩文件还未生成,重新运行证书任务');
|
throw new Error('证书压缩文件还未生成,重新运行证书任务');
|
||||||
}
|
}
|
||||||
await this.ctx.emailService.sendByTemplate({
|
await this.ctx.emailService.sendByTemplate({
|
||||||
type: "common",
|
type: "sendCert",
|
||||||
data,
|
data,
|
||||||
receivers: this.email,
|
receivers: this.email,
|
||||||
attachments: [
|
attachments: [
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ export * from './plugin-common.js'
|
|||||||
export * from './plugin-register-code.js'
|
export * from './plugin-register-code.js'
|
||||||
export * from './plugin-forgot-password.js'
|
export * from './plugin-forgot-password.js'
|
||||||
export * from './plugin-pipeline-result.js'
|
export * from './plugin-pipeline-result.js'
|
||||||
|
export * from './plugin-send-cert.js'
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
import { AddonInput, IsAddon } from "@certd/lib-server";
|
||||||
|
import { BuildContentReq, EmailContent, ITemplateProvider } from "../api.js";
|
||||||
|
import { BaseEmailTemplateProvider } from "./plugin-base.js";
|
||||||
|
|
||||||
|
@IsAddon({
|
||||||
|
addonType: "emailTemplate",
|
||||||
|
name: 'sendCert',
|
||||||
|
title: '发送证书邮件模版',
|
||||||
|
desc: '邮件发送证书插件的邮件模版',
|
||||||
|
icon: "simple-icons:email:blue",
|
||||||
|
showTest: false,
|
||||||
|
})
|
||||||
|
export class SendCertEmailTemplateProvider extends BaseEmailTemplateProvider implements ITemplateProvider<EmailContent> {
|
||||||
|
@AddonInput({
|
||||||
|
title: "可用参数",
|
||||||
|
component: {
|
||||||
|
name: "ParamsShow",
|
||||||
|
params:[
|
||||||
|
/**
|
||||||
|
* mainDomain,
|
||||||
|
domains,
|
||||||
|
expiresTime: dayjs(certReader.expires).format("YYYY-MM-DD HH:mm:ss"),
|
||||||
|
remark: this.remark || "",
|
||||||
|
crt: this.cert.crt,
|
||||||
|
key: this.cert.key,
|
||||||
|
ic: this.cert.ic,
|
||||||
|
*/
|
||||||
|
{label:"主域名",value:"mainDomain"},
|
||||||
|
{label:"全部域名",value:"domains"},
|
||||||
|
{label:"过期时间",value:"expiresTime"},
|
||||||
|
{label:"备注",value:"remark"},
|
||||||
|
{label:"证书内容",value:"crt"},
|
||||||
|
{label:"私钥内容",value:"key"},
|
||||||
|
{label:"中间证书",value:"ic"},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
col: { span: 24 },
|
||||||
|
})
|
||||||
|
paramIntro = "";
|
||||||
|
|
||||||
|
|
||||||
|
async buildDefaultContent(req:BuildContentReq) {
|
||||||
|
const defaultTemplate = new SendCertEmailTemplateProvider()
|
||||||
|
defaultTemplate.titleTemplate = "${title}"
|
||||||
|
defaultTemplate.contentTemplate = "${content}"
|
||||||
|
defaultTemplate.formatType = "text"
|
||||||
|
return await defaultTemplate.buildContent(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user