mirror of
https://github.com/certd/certd.git
synced 2026-07-26 22:09:04 +08:00
Compare commits
9 Commits
v1.37.16
...
5b5deac7d9
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b5deac7d9 | |||
| 3f3ee3456e | |||
| 3e2f2fc02e | |||
| c5a3003cf7 | |||
| 4c6dcddf11 | |||
| b314e500cd | |||
| b83e6ad13f | |||
| fee401cfdf | |||
| 5f4469e306 |
@@ -3,6 +3,21 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.37.16](https://github.com/certd/certd/compare/v1.37.15...v1.37.16) (2025-12-15)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 修复ipv6作为证书域名申请证书校验失败的bug ([e4e16bc](https://github.com/certd/certd/commit/e4e16bc6a65bb082c18ca0590226f0987a47d477))
|
||||
* 优化西部数据 500 already exists 的问题 ([2bfad9f](https://github.com/certd/certd/commit/2bfad9fc651da208b610abd921fbfb2fbc04203f))
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* 批量设置定时,支持清除定时 ([63d8bcf](https://github.com/certd/certd/commit/63d8bcf8823f713365042d3c7aee3cf31d44b044))
|
||||
* 新增数据库迁移doc说明文档,优化datetime字段平滑迁移 ([45fbce0](https://github.com/certd/certd/commit/45fbce0c2af5fb3ead6d3dd12a42f8cc1714262f))
|
||||
* 支持彩虹聚合登录 ([6f18693](https://github.com/certd/certd/commit/6f186932ccad4becfdc0087c0539f7b2d0069844))
|
||||
* 支持邮件模版设置 ([a6c0d2c](https://github.com/certd/certd/commit/a6c0d2c6f1fd6b60e6d7af290487c94564fd91ea))
|
||||
* oidc支持使用第三方昵称或账号作为certd用户的用户名 ([b6fea0c](https://github.com/certd/certd/commit/b6fea0c8562abf912daa7d72958ceb2e93575d31))
|
||||
|
||||
## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -40,32 +40,33 @@
|
||||
| 36.| **括彩云cdn授权** | 括彩云CDN,每月免费30G,[注册即领](https://kuocaicdn.com/register?code=8mn536rrzfbf8) |
|
||||
| 37.| **uniCloud** | unicloud授权 |
|
||||
| 38.| **猫云授权** | |
|
||||
| 39.| **西部数码授权** | |
|
||||
| 40.| **多吉云** | |
|
||||
| 41.| **我爱云授权** | 我爱云CDN |
|
||||
| 42.| **CacheFly** | CacheFly |
|
||||
| 43.| **Gcore** | Gcore |
|
||||
| 44.| **亚马逊云aws授权** | |
|
||||
| 45.| **亚马逊云科技(国区)授权** | |
|
||||
| 46.| **dns.la授权** | |
|
||||
| 47.| **又拍云** | |
|
||||
| 48.| **51dns授权** | |
|
||||
| 49.| **FlexCDN授权** | |
|
||||
| 50.| **farcdn授权** | |
|
||||
| 51.| **cloudflare授权** | |
|
||||
| 52.| **Github授权** | |
|
||||
| 53.| **namesilo授权** | |
|
||||
| 54.| **proxmox** | |
|
||||
| 55.| **网宿授权** | |
|
||||
| 56.| **金山云授权** | |
|
||||
| 57.| **APISIX授权** | |
|
||||
| 58.| **Dokploy授权** | |
|
||||
| 59.| **godaddy授权** | |
|
||||
| 60.| **新网授权** | |
|
||||
| 61.| **新网授权(代理方式)** | |
|
||||
| 62.| **新网互联授权** | 仅支持代理账号,ip需要加入白名单 |
|
||||
| 63.| **中国移动CND授权** | |
|
||||
| 64.| **雨云授权** | https://app.rainyun.com/ |
|
||||
| 39.| **授权插件示例** | |
|
||||
| 40.| **西部数码授权** | |
|
||||
| 41.| **多吉云** | |
|
||||
| 42.| **我爱云授权** | 我爱云CDN |
|
||||
| 43.| **CacheFly** | CacheFly |
|
||||
| 44.| **Gcore** | Gcore |
|
||||
| 45.| **亚马逊云aws授权** | |
|
||||
| 46.| **亚马逊云科技(国区)授权** | |
|
||||
| 47.| **dns.la授权** | |
|
||||
| 48.| **又拍云** | |
|
||||
| 49.| **51dns授权** | |
|
||||
| 50.| **FlexCDN授权** | |
|
||||
| 51.| **farcdn授权** | |
|
||||
| 52.| **cloudflare授权** | |
|
||||
| 53.| **Github授权** | |
|
||||
| 54.| **namesilo授权** | |
|
||||
| 55.| **proxmox** | |
|
||||
| 56.| **网宿授权** | |
|
||||
| 57.| **金山云授权** | |
|
||||
| 58.| **APISIX授权** | |
|
||||
| 59.| **Dokploy授权** | |
|
||||
| 60.| **godaddy授权** | |
|
||||
| 61.| **新网授权** | |
|
||||
| 62.| **新网授权(代理方式)** | |
|
||||
| 63.| **新网互联授权** | 仅支持代理账号,ip需要加入白名单 |
|
||||
| 64.| **中国移动CND授权** | |
|
||||
| 65.| **雨云授权** | https://app.rainyun.com/ |
|
||||
|
||||
<style module>
|
||||
table th:first-of-type {
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
| 13.| **cloudflare** | cloudflare dns provider |
|
||||
| 14.| **namesilo** | namesilo dns provider |
|
||||
| 15.| **godaddy** | GoDaddy |
|
||||
| 16.| **51dns** | 51DNS |
|
||||
| 17.| **新网互联** | 新网互联 |
|
||||
| 16.| **Dns提供商Demo** | dns provider示例 |
|
||||
| 17.| **51dns** | 51DNS |
|
||||
| 18.| **新网互联** | 新网互联 |
|
||||
|
||||
<style module>
|
||||
table th:first-of-type {
|
||||
|
||||
@@ -70,5 +70,5 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/publishlab/node-acme-client/issues"
|
||||
},
|
||||
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b"
|
||||
"gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
|
||||
}
|
||||
|
||||
@@ -47,5 +47,5 @@
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b"
|
||||
"gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
|
||||
}
|
||||
|
||||
@@ -45,5 +45,5 @@
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b"
|
||||
"gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@ export type EmailSend = {
|
||||
export type EmailSendByTemplateReq = {
|
||||
type: string;
|
||||
data: any;
|
||||
email: { receivers: string[]; attachments?: any[] };
|
||||
receivers: string[];
|
||||
attachments?: any[];
|
||||
};
|
||||
|
||||
export interface IEmailService {
|
||||
|
||||
@@ -24,5 +24,5 @@
|
||||
"prettier": "^2.8.8",
|
||||
"tslib": "^2.8.1"
|
||||
},
|
||||
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b"
|
||||
"gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
|
||||
}
|
||||
|
||||
@@ -31,5 +31,5 @@
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b"
|
||||
"gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
|
||||
}
|
||||
|
||||
@@ -56,5 +56,5 @@
|
||||
"fetch"
|
||||
]
|
||||
},
|
||||
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b"
|
||||
"gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
|
||||
}
|
||||
|
||||
@@ -32,5 +32,5 @@
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b"
|
||||
"gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
|
||||
}
|
||||
|
||||
@@ -64,5 +64,5 @@
|
||||
"typeorm": "^0.3.11",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b"
|
||||
"gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
|
||||
}
|
||||
|
||||
@@ -46,5 +46,5 @@
|
||||
"typeorm": "^0.3.11",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b"
|
||||
"gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
|
||||
}
|
||||
|
||||
@@ -43,5 +43,5 @@
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b"
|
||||
"gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
|
||||
}
|
||||
|
||||
@@ -53,5 +53,5 @@
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b"
|
||||
"gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
|
||||
}
|
||||
|
||||
@@ -145,6 +145,9 @@ export default function ({ crudExpose, context: { selectedRowKeys } }: CreateCru
|
||||
},
|
||||
},
|
||||
},
|
||||
search: {
|
||||
col: { span: 3 },
|
||||
},
|
||||
form: {
|
||||
afterSubmit({ form, res, mode }) {
|
||||
if (mode === "add") {
|
||||
@@ -262,6 +265,7 @@ export default function ({ crudExpose, context: { selectedRowKeys } }: CreateCru
|
||||
type: "number",
|
||||
search: {
|
||||
show: true,
|
||||
col: { span: 3 },
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
@@ -277,6 +281,7 @@ export default function ({ crudExpose, context: { selectedRowKeys } }: CreateCru
|
||||
show: computed(() => {
|
||||
return userStore.isAdmin && settingStore.sysPublic.managerOtherUserPipeline;
|
||||
}),
|
||||
col: { span: 3 },
|
||||
},
|
||||
form: {
|
||||
show: false,
|
||||
@@ -297,6 +302,7 @@ export default function ({ crudExpose, context: { selectedRowKeys } }: CreateCru
|
||||
component: {
|
||||
name: "a-input",
|
||||
},
|
||||
col: { span: 3 },
|
||||
},
|
||||
form: {
|
||||
rules: [{ required: true, message: t("certd.fields.required") }],
|
||||
|
||||
@@ -33,7 +33,20 @@ export class PipelineController extends CrudController<PipelineService> {
|
||||
async page(@Body(ALL) body) {
|
||||
const isAdmin = await this.authService.isAdmin(this.ctx);
|
||||
const publicSettings = await this.sysSettingsService.getPublicSettings();
|
||||
if (!(publicSettings.managerOtherUserPipeline && isAdmin)) {
|
||||
|
||||
let onlyOther = false
|
||||
if(isAdmin){
|
||||
if(publicSettings.managerOtherUserPipeline){
|
||||
//管理员管理 其他用户
|
||||
if( body.query.userId === -1){
|
||||
//如果只查询其他用户
|
||||
onlyOther = true;
|
||||
delete body.query.userId;
|
||||
}
|
||||
}else{
|
||||
body.query.userId = this.getUserId();
|
||||
}
|
||||
}else{
|
||||
body.query.userId = this.getUserId();
|
||||
}
|
||||
|
||||
@@ -44,6 +57,9 @@ export class PipelineController extends CrudController<PipelineService> {
|
||||
if (title) {
|
||||
qb.andWhere('(title like :title or content like :content)', { title: `%${title}%`, content: `%${title}%` });
|
||||
}
|
||||
if(onlyOther){
|
||||
qb.andWhere('user_id != :userId', { userId: this.getUserId() });
|
||||
}
|
||||
};
|
||||
if (!body.sort || !body.sort?.prop) {
|
||||
body.sort = { prop: 'order', asc: false };
|
||||
@@ -142,26 +158,36 @@ export class PipelineController extends CrudController<PipelineService> {
|
||||
|
||||
@Post('/batchDelete', { summary: Constants.per.authOnly })
|
||||
async batchDelete(@Body('ids') ids: number[]) {
|
||||
await this.service.batchDelete(ids, this.getUserId());
|
||||
const isAdmin = await this.authService.isAdmin(this.ctx);
|
||||
const userId = isAdmin ? undefined : this.getUserId() ;
|
||||
await this.service.batchDelete(ids, userId);
|
||||
return this.ok({});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Post('/batchUpdateGroup', { summary: Constants.per.authOnly })
|
||||
async batchUpdateGroup(@Body('ids') ids: number[], @Body('groupId') groupId: number) {
|
||||
await this.service.batchUpdateGroup(ids, groupId, this.getUserId());
|
||||
const isAdmin = await this.authService.isAdmin(this.ctx);
|
||||
const userId = isAdmin ? undefined : this.getUserId() ;
|
||||
await this.service.batchUpdateGroup(ids, groupId, userId);
|
||||
return this.ok({});
|
||||
}
|
||||
|
||||
|
||||
@Post('/batchUpdateTrigger', { summary: Constants.per.authOnly })
|
||||
async batchUpdateTrigger(@Body('ids') ids: number[], @Body('trigger') trigger: any) {
|
||||
await this.service.batchUpdateTrigger(ids, trigger, this.getUserId());
|
||||
const isAdmin = await this.authService.isAdmin(this.ctx);
|
||||
const userId = isAdmin ? undefined : this.getUserId() ;
|
||||
await this.service.batchUpdateTrigger(ids, trigger, userId);
|
||||
return this.ok({});
|
||||
}
|
||||
|
||||
@Post('/batchUpdateNotification', { summary: Constants.per.authOnly })
|
||||
async batchUpdateNotification(@Body('ids') ids: number[], @Body('notification') notification: any) {
|
||||
await this.service.batchUpdateNotifications(ids, notification, this.getUserId());
|
||||
const isAdmin = await this.authService.isAdmin(this.ctx);
|
||||
const userId = isAdmin ? undefined : this.getUserId() ;
|
||||
await this.service.batchUpdateNotifications(ids, notification, userId);
|
||||
return this.ok({});
|
||||
}
|
||||
|
||||
|
||||
@@ -108,9 +108,7 @@ export class CodeService {
|
||||
await this.emailService.sendByTemplate({
|
||||
type: templateData.notificationType,
|
||||
data: templateData,
|
||||
email:{
|
||||
receivers: [email],
|
||||
},
|
||||
receivers: [email],
|
||||
});
|
||||
|
||||
const key = this.buildEmailCodeKey(email,opts?.verificationType);
|
||||
|
||||
@@ -123,9 +123,7 @@ export class EmailService implements IEmailService {
|
||||
content: '测试邮件,from certd',
|
||||
url:"https://certd.handfree.work",
|
||||
},
|
||||
email: {
|
||||
receivers: [receiver],
|
||||
},
|
||||
receivers: [receiver],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -186,8 +184,9 @@ export class EmailService implements IEmailService {
|
||||
content = await addon.buildDefaultContent({ data: req.data })
|
||||
}
|
||||
return await this.send({
|
||||
...req.email,
|
||||
...content
|
||||
...content,
|
||||
receivers: req.receivers,
|
||||
attachments: req.attachments,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -777,17 +777,29 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
||||
}
|
||||
|
||||
async batchDelete(ids: number[], userId: number) {
|
||||
if (!isPlus()) {
|
||||
throw new NeedVIPException("此功能需要升级专业版");
|
||||
}
|
||||
for (const id of ids) {
|
||||
await this.checkUserId(id, userId);
|
||||
if (userId) {
|
||||
await this.checkUserId(id, userId);
|
||||
}
|
||||
await this.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
async batchUpdateGroup(ids: number[], groupId: number, userId: any) {
|
||||
if (!isPlus()) {
|
||||
throw new NeedVIPException("此功能需要升级专业版");
|
||||
}
|
||||
const query :any = {}
|
||||
if(userId && userId>0){
|
||||
query.userId = userId;
|
||||
}
|
||||
await this.repository.update(
|
||||
{
|
||||
id: In(ids),
|
||||
userId
|
||||
...query
|
||||
},
|
||||
{ groupId }
|
||||
);
|
||||
@@ -795,11 +807,17 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
||||
|
||||
|
||||
async batchUpdateTrigger(ids: number[], trigger: any, userId: any) {
|
||||
|
||||
if (!isPlus()) {
|
||||
throw new NeedVIPException("此功能需要升级专业版");
|
||||
}
|
||||
const query :any = {}
|
||||
if(userId && userId>0){
|
||||
query.userId = userId;
|
||||
}
|
||||
const list = await this.find({
|
||||
where: {
|
||||
id: In(ids),
|
||||
userId
|
||||
...query
|
||||
}
|
||||
});
|
||||
|
||||
@@ -822,11 +840,17 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
||||
}
|
||||
|
||||
async batchUpdateNotifications(ids: number[], notification: Notification, userId: any) {
|
||||
|
||||
if (!isPlus()) {
|
||||
throw new NeedVIPException("此功能需要升级专业版");
|
||||
}
|
||||
const query :any = {}
|
||||
if(userId && userId>0){
|
||||
query.userId = userId;
|
||||
}
|
||||
const list = await this.find({
|
||||
where: {
|
||||
id: In(ids),
|
||||
userId
|
||||
...query
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ export class EmailNotification extends BaseNotification {
|
||||
await this.ctx.emailService.sendByTemplate({
|
||||
type: body.notificationType,
|
||||
data: templateData,
|
||||
email: emailSend
|
||||
...emailSend
|
||||
})
|
||||
|
||||
// await this.ctx.emailService.send({
|
||||
|
||||
+52
-61
@@ -1,5 +1,5 @@
|
||||
import {AbstractTaskPlugin, FileItem, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput} from '@certd/pipeline';
|
||||
import {CertInfo, CertReader} from "@certd/plugin-cert";
|
||||
import { AbstractTaskPlugin, FileItem, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
|
||||
import { CertInfo, CertReader } from "@certd/plugin-cert";
|
||||
import dayjs from "dayjs";
|
||||
import { get } from 'lodash-es';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { get } from 'lodash-es';
|
||||
icon: 'ion:mail-outline',
|
||||
desc: '通过邮件发送证书',
|
||||
group: pluginGroups.other.key,
|
||||
showRunStrategy:false,
|
||||
showRunStrategy: false,
|
||||
default: {
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||
@@ -45,7 +45,7 @@ export class DeployCertToMailPlugin extends AbstractTaskPlugin {
|
||||
component: {
|
||||
name: 'EmailSelector',
|
||||
vModel: 'value',
|
||||
mode:"tags",
|
||||
mode: "tags",
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
@@ -78,40 +78,40 @@ export class DeployCertToMailPlugin extends AbstractTaskPlugin {
|
||||
*/
|
||||
|
||||
|
||||
@TaskInput({
|
||||
title: '邮件标题',
|
||||
component: {
|
||||
name: 'a-input',
|
||||
vModel: 'value',
|
||||
placeholder:`证书申请成功【$\{mainDomain}】`,
|
||||
},
|
||||
helper: '请输入邮件标题否则将使用默认标题\n模板变量:主域名=$\{mainDomain}、全部域名=$\{domains}、过期时间=$\{expiresTime}、备注=$\{remark}、证书PEM=$\{crt}、证书私钥=$\{key}、中间证书/CA证书=$\{ic}',
|
||||
required: false,
|
||||
})
|
||||
title!: string;
|
||||
// @TaskInput({
|
||||
// title: '邮件标题',
|
||||
// component: {
|
||||
// name: 'a-input',
|
||||
// vModel: 'value',
|
||||
// placeholder: `证书申请成功【$\{mainDomain}】`,
|
||||
// },
|
||||
// helper: '请输入邮件标题否则将使用默认标题\n模板变量:主域名=$\{mainDomain}、全部域名=$\{domains}、过期时间=$\{expiresTime}、备注=$\{remark}、证书PEM=$\{crt}、证书私钥=$\{key}、中间证书/CA证书=$\{ic}',
|
||||
// required: false,
|
||||
// })
|
||||
// title!: string;
|
||||
|
||||
@TaskInput({
|
||||
title: '邮件模版',
|
||||
component: {
|
||||
name: 'a-textarea',
|
||||
vModel: 'value',
|
||||
autosize: {
|
||||
minRows: 6,
|
||||
maxRows: 10,
|
||||
},
|
||||
placeholder: `
|
||||
<div>
|
||||
<p>证书申请成功</p>
|
||||
<p>域名:$\{domains}</p>
|
||||
<p>证书有效期:$\{expiresTime}</p>
|
||||
<p>备注:$\{remark}</p>
|
||||
</div>
|
||||
`,
|
||||
},
|
||||
helper: `请输入模版内容否则将使用默认模版,模板变量同上`,
|
||||
required: false,
|
||||
})
|
||||
template!: string;
|
||||
// @TaskInput({
|
||||
// title: '邮件模版',
|
||||
// component: {
|
||||
// name: 'a-textarea',
|
||||
// vModel: 'value',
|
||||
// autosize: {
|
||||
// minRows: 6,
|
||||
// maxRows: 10,
|
||||
// },
|
||||
// placeholder: `
|
||||
// <div>
|
||||
// <p>证书申请成功</p>
|
||||
// <p>域名:$\{domains}</p>
|
||||
// <p>证书有效期:$\{expiresTime}</p>
|
||||
// <p>备注:$\{remark}</p>
|
||||
// </div>
|
||||
// `,
|
||||
// },
|
||||
// helper: `请输入模版内容否则将使用默认模版,模板变量同上`,
|
||||
// required: false,
|
||||
// })
|
||||
// template!: string;
|
||||
|
||||
@TaskInput({
|
||||
title: '备注',
|
||||
@@ -123,7 +123,7 @@ export class DeployCertToMailPlugin extends AbstractTaskPlugin {
|
||||
})
|
||||
remark!: string;
|
||||
|
||||
async onInstance() {}
|
||||
async onInstance() { }
|
||||
async execute(): Promise<void> {
|
||||
|
||||
this.logger.info(`开始发送邮件`);
|
||||
@@ -132,41 +132,32 @@ export class DeployCertToMailPlugin extends AbstractTaskPlugin {
|
||||
const domains = certReader.getAllDomains().join(',');
|
||||
|
||||
|
||||
const data = {
|
||||
const data: any = {
|
||||
mainDomain,
|
||||
domains,
|
||||
expiresTime: dayjs(certReader.expires).format("YYYY-MM-DD HH:mm:ss"),
|
||||
remark:this.remark ||"",
|
||||
remark: this.remark || "",
|
||||
crt: this.cert.crt,
|
||||
key: this.cert.key,
|
||||
ic: this.cert.ic
|
||||
ic: this.cert.ic,
|
||||
url: ""
|
||||
}
|
||||
|
||||
let title = `证书申请成功【${mainDomain}】`;
|
||||
let html = `
|
||||
<div>
|
||||
<p>证书申请成功</p>
|
||||
<p>域名:${domains}</p>
|
||||
<p>证书有效期:${data.expiresTime}</p>
|
||||
<p>备注:${this.remark||""}</p>
|
||||
</div>
|
||||
let content = `证书申请成功
|
||||
域名:${domains}
|
||||
证书有效期:${data.expiresTime}
|
||||
备注:${this.remark || ""}
|
||||
`;
|
||||
|
||||
if (this.title) {
|
||||
const compile = this.compile(this.title);
|
||||
title = compile(data);
|
||||
}
|
||||
if (this.template) {
|
||||
const compile = this.compile(this.template);
|
||||
html = compile(data);
|
||||
}
|
||||
data.content = content;
|
||||
data.title = title
|
||||
const file = this.certZip
|
||||
if (!file) {
|
||||
throw new Error('证书压缩文件还未生成,重新运行证书任务');
|
||||
}
|
||||
await this.ctx.emailService.send({
|
||||
subject:title,
|
||||
html: html,
|
||||
await this.ctx.emailService.sendByTemplate({
|
||||
type: "common",
|
||||
data,
|
||||
receivers: this.email,
|
||||
attachments: [
|
||||
{
|
||||
@@ -178,7 +169,7 @@ export class DeployCertToMailPlugin extends AbstractTaskPlugin {
|
||||
}
|
||||
|
||||
compile(templateString: string) {
|
||||
return function(data) {
|
||||
return function (data) {
|
||||
return templateString.replace(/\${(.*?)}/g, (match, key) => {
|
||||
const value = get(data, key, '');
|
||||
return String(value);
|
||||
|
||||
@@ -29,7 +29,7 @@ export class CommonEmailTemplateProvider extends BaseEmailTemplateProvider imple
|
||||
async buildDefaultContent(req:BuildContentReq) {
|
||||
const defaultTemplate = new CommonEmailTemplateProvider()
|
||||
defaultTemplate.titleTemplate = "${title}"
|
||||
defaultTemplate.contentTemplate = "${content} \n\n 查看详情:${url}"
|
||||
defaultTemplate.contentTemplate = "${content} \n\n ${url?'查看详情:'+url:''}"
|
||||
defaultTemplate.formatType = "text"
|
||||
return await defaultTemplate.buildContent(req)
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import {CertApplyPluginNames, CertInfo, CertReader} from "@certd/plugin-cert";
|
||||
name: 'DeployCertToTencentEO',
|
||||
title: '腾讯云-部署到腾讯云EO',
|
||||
icon: 'svg:icon-tencentcloud',
|
||||
desc: '腾讯云边缘安全加速平台EdgeOne(EO),必须配置上传证书到腾讯云任务',
|
||||
desc: '腾讯云边缘安全加速平台EdgeOne(EO)',
|
||||
group: pluginGroups.tencent.key,
|
||||
default: {
|
||||
strategy: {
|
||||
@@ -126,6 +126,7 @@ export class DeployCertToTencentEO extends AbstractTaskPlugin {
|
||||
},
|
||||
],
|
||||
};
|
||||
this.logger.info('设置腾讯云EO证书参数:', JSON.stringify(params));
|
||||
await this.doRequest(client, params);
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
00:59
|
||||
01:47
|
||||
|
||||
@@ -1 +1 @@
|
||||
01:17
|
||||
07:43
|
||||
|
||||
Reference in New Issue
Block a user