mirror of https://github.com/certd/certd
Merge remote-tracking branch 'origin/v2-dev' into v2-dev
commit
1b267813c9
|
@ -14,9 +14,6 @@ git clone https://github.com/certd/certd --depth=1
|
|||
#进入项目目录
|
||||
cd certd
|
||||
|
||||
# 切换到最新版本代码【如果v2分支无法编译,请尝试切换到最新版tag】
|
||||
# git checkout v1.27.0 # 这里换成最新版本号
|
||||
|
||||
```
|
||||
|
||||
### 修改pnpm-workspace.yaml文件
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
<a-form :model="testFormState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" @finish="onTestSend">
|
||||
<a-form-item label="测试收件邮箱" name="receiver" :rules="[{ required: true, message: '请输入测试收件邮箱' }]">
|
||||
<a-input v-model:value="testFormState.receiver" />
|
||||
<div class="helper">保存后再点击测试</div>
|
||||
<div class="helper">发送失败???<a href="https://certd.docmirror.cn/guide/use/email/" target="_blank">邮件配置帮助文档</a></div>
|
||||
<div class="helper">您还可以试试使用官方邮件服务器↗↗↗↗↗↗↗↗</div>
|
||||
</a-form-item>
|
||||
|
|
|
@ -3,12 +3,12 @@ import type { EmailSend } from '@certd/pipeline';
|
|||
import { IEmailService } from '@certd/pipeline';
|
||||
|
||||
import { logger } from '@certd/basic';
|
||||
import { isPlus } from '@certd/plus-core';
|
||||
import { isComm, isPlus } from '@certd/plus-core';
|
||||
|
||||
import nodemailer from 'nodemailer';
|
||||
import type SMTPConnection from 'nodemailer/lib/smtp-connection';
|
||||
import { UserSettingsService } from '../../mine/service/user-settings-service.js';
|
||||
import { PlusService, SysSettingsService } from '@certd/lib-server';
|
||||
import { PlusService, SysSettingsService, SysSiteInfo } from '@certd/lib-server';
|
||||
import { getEmailSettings } from '../../sys/settings/fix.js';
|
||||
|
||||
export type EmailConfig = {
|
||||
|
@ -80,8 +80,16 @@ export class EmailService implements IEmailService {
|
|||
|
||||
private async sendByCustom(emailConfig: EmailConfig, email: EmailSend) {
|
||||
const transporter = nodemailer.createTransport(emailConfig);
|
||||
|
||||
let sysTitle = 'Certd';
|
||||
if (isComm()) {
|
||||
const siteInfo = await this.sysSettingsService.getSetting<SysSiteInfo>(SysSiteInfo);
|
||||
if (siteInfo) {
|
||||
sysTitle = siteInfo.title || sysTitle;
|
||||
}
|
||||
}
|
||||
const mailOptions = {
|
||||
from: emailConfig.sender,
|
||||
from: `${sysTitle} <${emailConfig.sender}>`,
|
||||
to: email.receivers.join(', '), // list of receivers
|
||||
subject: email.subject,
|
||||
text: email.content,
|
||||
|
|
|
@ -4,18 +4,21 @@ import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from
|
|||
import { optionsUtils } from '@certd/basic/dist/utils/util.options.js';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'demoTest',
|
||||
//命名规范,插件名称+功能(就是目录plugin-demo中的demo),大写字母开头,驼峰命名
|
||||
name: 'DemoTest',
|
||||
title: 'Demo测试插件',
|
||||
icon: 'clarity:plugin-line',
|
||||
//插件分组
|
||||
group: pluginGroups.other.key,
|
||||
default: {
|
||||
//默认值配置照抄即可
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||
},
|
||||
},
|
||||
})
|
||||
export class DemoTestPlugin extends AbstractTaskPlugin {
|
||||
//类名规范,跟上面插件名称(name)一致
|
||||
export class DemoTest extends AbstractTaskPlugin {
|
||||
//测试参数
|
||||
@TaskInput({
|
||||
title: '属性示例',
|
||||
|
@ -42,6 +45,23 @@ export class DemoTestPlugin extends AbstractTaskPlugin {
|
|||
})
|
||||
select!: string;
|
||||
|
||||
//测试参数
|
||||
@TaskInput({
|
||||
title: '多选框',
|
||||
component: {
|
||||
//前端组件配置,具体配置见组件文档 https://www.antdv.com/components/select-cn
|
||||
name: 'a-select',
|
||||
vModel: 'value',
|
||||
mode: 'tags',
|
||||
multiple: true,
|
||||
options: [
|
||||
{ value: '1', label: '选项1' },
|
||||
{ value: '2', label: '选项2' },
|
||||
],
|
||||
},
|
||||
})
|
||||
multiSelect!: string;
|
||||
|
||||
//测试参数
|
||||
@TaskInput({
|
||||
title: 'switch',
|
||||
|
@ -85,8 +105,7 @@ export class DemoTestPlugin extends AbstractTaskPlugin {
|
|||
createRemoteSelectInputDefine({
|
||||
title: '从后端获取选项',
|
||||
helper: '选择时可以从后端获取选项',
|
||||
typeName: 'demoTest',
|
||||
action: DemoTestPlugin.prototype.onGetSiteList.name,
|
||||
action: DemoTest.prototype.onGetSiteList.name,
|
||||
//当以下参数变化时,触发获取选项
|
||||
watches: ['certDomains', 'accessId'],
|
||||
required: true,
|
||||
|
@ -121,15 +140,15 @@ export class DemoTestPlugin extends AbstractTaskPlugin {
|
|||
this.logger.info('switch:', this.switch);
|
||||
this.logger.info('授权id:', accessId);
|
||||
|
||||
const res = await this.http.request({
|
||||
url: 'https://api.demo.com',
|
||||
method: 'GET',
|
||||
});
|
||||
if (res.code !== 0) {
|
||||
//检查res是否报错,你需要抛异常,来结束插件执行,否则会判定为执行成功,下次执行时会跳过本任务
|
||||
throw new Error(res.message);
|
||||
}
|
||||
this.logger.info('部署成功:', res);
|
||||
// const res = await this.http.request({
|
||||
// url: 'https://api.demo.com',
|
||||
// method: 'GET',
|
||||
// });
|
||||
// if (res.code !== 0) {
|
||||
// //检查res是否报错,你需要抛异常,来结束插件执行,否则会判定为执行成功,下次执行时会跳过本任务
|
||||
// throw new Error(res.message);
|
||||
// }
|
||||
// this.logger.info('部署成功:', res);
|
||||
}
|
||||
|
||||
//此方法演示,如何让前端在添加插件时可以从后端获取选项,这里是后端返回选项的方法
|
||||
|
@ -167,4 +186,4 @@ export class DemoTestPlugin extends AbstractTaskPlugin {
|
|||
}
|
||||
}
|
||||
//实例化一下,注册插件
|
||||
new DemoTestPlugin();
|
||||
new DemoTest();
|
||||
|
|
Loading…
Reference in New Issue