mirror of
https://github.com/certd/certd.git
synced 2026-05-16 05:07:32 +08:00
Merge remote-tracking branch 'origin/v2-dev' into v2-dev
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Provide } from '@midwayjs/core';
|
||||
import { IWebMiddleware, IMidwayKoaContext, NextFunction } from '@midwayjs/koa';
|
||||
import { IMidwayKoaContext, IWebMiddleware, NextFunction } from '@midwayjs/koa';
|
||||
import { logger } from '@certd/basic';
|
||||
import { BaseException, Result } from '@certd/lib-server';
|
||||
import { Result } from '@certd/lib-server';
|
||||
|
||||
@Provide()
|
||||
export class GlobalExceptionMiddleware implements IWebMiddleware {
|
||||
@@ -14,11 +14,7 @@ export class GlobalExceptionMiddleware implements IWebMiddleware {
|
||||
await next();
|
||||
logger.info('请求完成:', url, Date.now() - startTime + 'ms');
|
||||
} catch (err) {
|
||||
logger.error('请求异常:', url, Date.now() - startTime + 'ms', err.message);
|
||||
if (!(err instanceof BaseException)) {
|
||||
logger.error(err);
|
||||
}
|
||||
|
||||
logger.error('请求异常:', url, Date.now() - startTime + 'ms', err);
|
||||
ctx.status = 200;
|
||||
if (err.code == null || typeof err.code !== 'number') {
|
||||
err.code = 1;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { optionsUtils } from '@certd/basic/dist/utils/util.options.js';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'DeployCertToAliyunCDN',
|
||||
title: '部署证书至阿里云CDN',
|
||||
title: '阿里云-部署证书至CDN',
|
||||
icon: 'ant-design:aliyun-outlined',
|
||||
group: pluginGroups.aliyun.key,
|
||||
desc: '自动部署域名证书至阿里云CDN',
|
||||
|
||||
@@ -5,7 +5,7 @@ import { CertInfo } from '@certd/plugin-cert';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'DeployCertToAliyunDCDN',
|
||||
title: '部署证书至阿里云DCDN',
|
||||
title: '阿里云-部署证书至DCDN',
|
||||
icon: 'ant-design:aliyun-outlined',
|
||||
group: pluginGroups.aliyun.key,
|
||||
desc: '依赖证书申请前置任务,自动部署域名证书至阿里云DCDN',
|
||||
|
||||
@@ -3,7 +3,7 @@ import { AliyunAccess } from '@certd/plugin-lib';
|
||||
import { CertInfo } from '@certd/plugin-cert';
|
||||
@IsTaskPlugin({
|
||||
name: 'DeployCertToAliyunOSS',
|
||||
title: '部署证书至阿里云OSS',
|
||||
title: '阿里云-部署证书至OSS',
|
||||
icon: 'ant-design:aliyun-outlined',
|
||||
group: pluginGroups.aliyun.key,
|
||||
desc: '自动部署域名证书至阿里云OSS',
|
||||
|
||||
@@ -5,7 +5,7 @@ import { AbstractPlusTaskPlugin } from '@certd/plugin-plus';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'AliyunDeployCertToWaf',
|
||||
title: '部署至阿里云WAF',
|
||||
title: '阿里云-部署至阿里云WAF',
|
||||
icon: 'ant-design:aliyun-outlined',
|
||||
group: pluginGroups.aliyun.key,
|
||||
desc: '部署证书到阿里云WAF',
|
||||
|
||||
@@ -23,7 +23,7 @@ const regionDict = [
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'uploadCertToAliyun',
|
||||
title: '上传证书到阿里云',
|
||||
title: '阿里云-上传证书到阿里云',
|
||||
icon: 'ant-design:aliyun-outlined',
|
||||
group: pluginGroups.aliyun.key,
|
||||
desc: '如果不想在阿里云上同一份证书上传多次,可以把此任务作为前置任务,其他阿里云任务证书那一项选择此任务的输出',
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import { AbstractPlusTaskPlugin } from '@certd/plugin-plus';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'AwsDeployToCloudFront',
|
||||
title: '部署证书到 AWS CloudFront',
|
||||
title: 'AWS-部署证书到CloudFront',
|
||||
desc: '部署证书到 AWS CloudFront',
|
||||
icon: 'clarity:plugin-line',
|
||||
group: pluginGroups.aws.key,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { AwsAcmClient } from '../libs/aws-acm-client.js';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'AwsUploadToACM',
|
||||
title: '上传证书 AWS ACM',
|
||||
title: 'AWS-上传证书到ACM',
|
||||
desc: '上传证书 AWS ACM',
|
||||
icon: 'clarity:plugin-line',
|
||||
group: pluginGroups.aws.key,
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import { CacheflyAccess } from '../access.js';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'CacheFly',
|
||||
title: '部署证书到 CacheFly',
|
||||
title: 'CacheFly-部署证书到CacheFly',
|
||||
desc: '部署证书到 CacheFly',
|
||||
icon: 'clarity:plugin-line',
|
||||
group: pluginGroups.cdn.key,
|
||||
|
||||
@@ -6,7 +6,7 @@ import { optionsUtils } from '@certd/basic/dist/utils/util.options.js';
|
||||
@IsTaskPlugin({
|
||||
//命名规范,插件名称+功能(就是目录plugin-demo中的demo),大写字母开头,驼峰命名
|
||||
name: 'DemoTest',
|
||||
title: 'Demo测试插件',
|
||||
title: 'Demo-测试插件',
|
||||
icon: 'clarity:plugin-line',
|
||||
//插件分组
|
||||
group: pluginGroups.other.key,
|
||||
|
||||
@@ -5,7 +5,7 @@ import dayjs from 'dayjs';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'DogeCloudDeployToCDN',
|
||||
title: '部署证书到多吉云CDN',
|
||||
title: '多吉云-部署到多吉云CDN',
|
||||
icon: 'svg:icon-dogecloud',
|
||||
group: pluginGroups.cdn.key,
|
||||
default: {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { GcoreAccess } from '../access.js';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'Gcoreflush',
|
||||
title: '刷新证书 Gcore',
|
||||
title: 'Gcore-刷新Gcore证书',
|
||||
desc: '刷新现有的证书',
|
||||
icon: 'clarity:plugin-line',
|
||||
group: pluginGroups.cdn.key,
|
||||
|
||||
@@ -4,7 +4,7 @@ import { GcoreAccess } from '../access.js';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'Gcoreupload',
|
||||
title: '部署证书到 Gcore',
|
||||
title: 'Gcore-部署证书到Gcore',
|
||||
desc: '仅上传 并不会部署到cdn',
|
||||
icon: 'clarity:plugin-line',
|
||||
group: pluginGroups.cdn.key,
|
||||
|
||||
@@ -6,7 +6,7 @@ import path from 'path';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'CopyToLocal',
|
||||
title: '复制到本机',
|
||||
title: '主机-复制到本机',
|
||||
icon: 'solar:copy-bold-duotone',
|
||||
desc: '【仅管理员使用】实际上是复制证书到docker容器内的某个路径,需要做目录映射到宿主机',
|
||||
group: pluginGroups.host.key,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { SshClient } from '@certd/plugin-lib';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'hostShellExecute',
|
||||
title: '执行远程主机脚本命令',
|
||||
title: '主机-执行远程主机脚本命令',
|
||||
icon: 'tabler:brand-powershell',
|
||||
group: pluginGroups.host.key,
|
||||
desc: '可以执行重启nginx等操作让证书生效',
|
||||
|
||||
@@ -6,7 +6,7 @@ import { SshAccess, SshClient } from '@certd/plugin-lib';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'uploadCertToHost',
|
||||
title: '部署证书到主机',
|
||||
title: '主机-部署证书到主机',
|
||||
icon: 'line-md:uploading-loop',
|
||||
group: pluginGroups.host.key,
|
||||
desc: '上传证书到主机,然后执行部署脚本命令',
|
||||
|
||||
@@ -6,7 +6,7 @@ import { resetLogConfigure } from '@certd/basic';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'HauweiDeployCertToCDN',
|
||||
title: '部署证书至华为云CDN',
|
||||
title: '华为云-部署证书至CDN',
|
||||
icon: 'svg:icon-huawei',
|
||||
group: pluginGroups.huawei.key,
|
||||
desc: '',
|
||||
|
||||
@@ -30,6 +30,19 @@ export class QywxNotification extends BaseNotification {
|
||||
})
|
||||
mentionedList!: string[];
|
||||
|
||||
@NotificationInput({
|
||||
title: '提醒指定手机号成员',
|
||||
component: {
|
||||
name: 'a-select',
|
||||
vModel: 'value',
|
||||
mode: 'tags',
|
||||
open: false,
|
||||
},
|
||||
required: false,
|
||||
helper: '填写成员手机号,@all 为提醒所有人',
|
||||
})
|
||||
mentionedMobileList!: string[];
|
||||
|
||||
async send(body: NotificationBody) {
|
||||
if (!this.webhook) {
|
||||
throw new Error('webhook地址不能为空');
|
||||
@@ -47,10 +60,11 @@ export class QywxNotification extends BaseNotification {
|
||||
url: this.webhook,
|
||||
method: 'POST',
|
||||
data: {
|
||||
msgtype: 'markdown',
|
||||
markdown: {
|
||||
content: `# ${body.title}\n\n${body.content}\n\n[查看详情](${body.url})`,
|
||||
msgtype: 'text',
|
||||
text: {
|
||||
content: `· ${body.title}\n· ${body.content}\n· 查看详情: ${body.url}`,
|
||||
mentioned_list: this.mentionedList,
|
||||
mentioned_mobile_list: this.mentionedMobileList,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ import { QiniuAccess, QiniuClient } from '@certd/plugin-plus';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'QiniuDeployCertToCDN',
|
||||
title: '部署证书至七牛云CDN',
|
||||
title: '七牛云-部署证书至CDN',
|
||||
icon: 'svg:icon-qiniuyun',
|
||||
group: pluginGroups.qiniu.key,
|
||||
desc: '自动部署域名证书至七牛云CDN',
|
||||
|
||||
@@ -4,7 +4,7 @@ import { CertInfo } from '@certd/plugin-cert';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'QiniuCertUpload',
|
||||
title: '上传到七牛云',
|
||||
title: '七牛云-上传证书到七牛云',
|
||||
icon: 'svg:icon-qiniuyun',
|
||||
group: pluginGroups.qiniu.key,
|
||||
desc: '上传到七牛云',
|
||||
|
||||
@@ -7,7 +7,7 @@ import { SshAccess, SshClient } from '@certd/plugin-lib';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'QnapDeploy',
|
||||
title: '部署证书到威联通',
|
||||
title: '威联通-部署证书到威联通',
|
||||
icon: 'simple-icons:qnap',
|
||||
group: pluginGroups.panel.key,
|
||||
desc: '部署证书到qnap',
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import { remove } from 'lodash-es';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'TencentDeleteExpiringCert',
|
||||
title: '删除腾讯云即将过期证书',
|
||||
title: '腾讯云-删除即将过期证书',
|
||||
icon: 'svg:icon-tencentcloud',
|
||||
group: pluginGroups.tencent.key,
|
||||
desc: '仅删除未使用的证书',
|
||||
|
||||
@@ -3,7 +3,7 @@ import { AbstractPlusTaskPlugin } from '@certd/plugin-plus';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'DeployCertToTencentAll',
|
||||
title: '部署证书到腾讯云任意云资源',
|
||||
title: '腾讯云-部署证书到任意云资源',
|
||||
needPlus: true,
|
||||
icon: 'svg:icon-tencentcloud',
|
||||
group: pluginGroups.tencent.key,
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import { createRemoteSelectInputDefine } from '@certd/plugin-lib';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'TencentDeployCertToCDNv2',
|
||||
title: '部署到腾讯云CDN-v2',
|
||||
title: '腾讯云-部署到CDN-v2',
|
||||
icon: 'svg:icon-tencentcloud',
|
||||
group: pluginGroups.tencent.key,
|
||||
desc: '推荐使用',
|
||||
|
||||
@@ -4,7 +4,7 @@ import { CertInfo } from '@certd/plugin-cert';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'DeployCertToTencentCDN',
|
||||
title: '部署到腾讯云CDN',
|
||||
title: '腾讯云-部署到CDN(废弃)',
|
||||
icon: 'svg:icon-tencentcloud',
|
||||
group: pluginGroups.tencent.key,
|
||||
desc: '已废弃,请使用v2版',
|
||||
|
||||
@@ -4,7 +4,7 @@ import dayjs from 'dayjs';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'DeployCertToTencentCLB',
|
||||
title: '部署到腾讯云CLB',
|
||||
title: '腾讯云-部署到CLB',
|
||||
icon: 'svg:icon-tencentcloud',
|
||||
group: pluginGroups.tencent.key,
|
||||
desc: '暂时只支持单向认证证书,暂时只支持通用负载均衡,必须开启sni',
|
||||
|
||||
@@ -5,7 +5,7 @@ import { TencentSslClient } from '../../lib/index.js';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'DeployCertToTencentCosPlugin',
|
||||
title: '部署证书到腾讯云COS',
|
||||
title: '腾讯云-部署证书到COS',
|
||||
needPlus: false,
|
||||
icon: 'svg:icon-tencentcloud',
|
||||
group: pluginGroups.tencent.key,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { TencentAccess } from '@certd/plugin-plus';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'DeployCertToTencentEO',
|
||||
title: '部署到腾讯云EO',
|
||||
title: '腾讯云-部署到腾讯云EO',
|
||||
icon: 'svg:icon-tencentcloud',
|
||||
desc: '腾讯云边缘安全加速平台EO,必须配置上传证书到腾讯云任务',
|
||||
group: pluginGroups.tencent.key,
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import { AbstractPlusTaskPlugin } from '@certd/plugin-plus';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'DeployCertToTencentTKEIngress',
|
||||
title: '部署到腾讯云TKE-ingress',
|
||||
title: '腾讯云-部署到TKE-ingress',
|
||||
needPlus: true,
|
||||
icon: 'svg:icon-tencentcloud',
|
||||
group: pluginGroups.tencent.key,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { createRemoteSelectInputDefine } from '@certd/plugin-lib';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'TencentActionInstancesPlugin',
|
||||
title: '腾讯云实例开关机',
|
||||
title: '腾讯云-实例开关机',
|
||||
icon: 'svg:icon-tencentcloud',
|
||||
group: pluginGroups.tencent.key,
|
||||
desc: '腾讯云实例开关机',
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import dayjs from 'dayjs';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'UploadCertToTencent',
|
||||
title: '上传证书到腾讯云',
|
||||
title: '腾讯云-上传证书到腾讯云',
|
||||
icon: 'svg:icon-tencentcloud',
|
||||
desc: '上传成功后输出:tencentCertId',
|
||||
group: pluginGroups.tencent.key,
|
||||
|
||||
@@ -4,7 +4,7 @@ import { WoaiAccess } from '../access.js';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'WoaiCDN',
|
||||
title: '部署证书到我爱云 CDN',
|
||||
title: '我爱云-部署证书到我爱云CDN',
|
||||
desc: '部署证书到我爱云CDN',
|
||||
icon: 'clarity:plugin-line',
|
||||
group: pluginGroups.cdn.key,
|
||||
|
||||
Reference in New Issue
Block a user