Merge remote-tracking branch 'origin/v2-dev' into v2-dev

This commit is contained in:
xiaojunnuo
2025-09-08 14:45:21 +08:00
54 changed files with 952 additions and 233 deletions

View File

@@ -3,6 +3,29 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.19](https://github.com/certd/certd/compare/v1.36.18...v1.36.19) (2025-09-05)
### Bug Fixes
* 前置任务输出不存在时输出警告提示 ([b59052c](https://github.com/certd/certd/commit/b59052cc43b7b070fabd8b8e914e4c2a5e0ad61c))
* 修复批量流水线执行时日志显示错乱的问题 ([4372adc](https://github.com/certd/certd/commit/4372adc703b9a4c785664054ab2a533626d815a8))
* 修复远程数据选择无法过滤的bug ([6cbb073](https://github.com/certd/certd/commit/6cbb0739f8428d51b0712f718fe4d236cc087cf9))
* 修复mysql下购买套餐加量包无效的bug ([c26ad4c](https://github.com/certd/certd/commit/c26ad4c8075f0606d45b8da13915737968d6191a))
### Performance Improvements
* 创建证书时支持选择通知时机 ([0e96bfd](https://github.com/certd/certd/commit/0e96bfdfa377824d204e72923d1176408ae6b300))
* 创建k8s secret 时设置type为tls ([79ebabf](https://github.com/certd/certd/commit/79ebabfcfb9e5a534049c84f5f1a642b357fc856))
* 去掉宝塔url后面的斜杠 ([8a0c2b9](https://github.com/certd/certd/commit/8a0c2b9b13628da750c25757e0cb8ed3038775ba))
* 商业版隐藏文档相关链接 ([4443a1c](https://github.com/certd/certd/commit/4443a1c0308fa6b95a05efd73d15d24b65d641c9))
* 商业版隐藏文档相关链接 ([db89561](https://github.com/certd/certd/commit/db8956148083bc4f988226ccf719940d08158a27))
* 增加健康检查探针 /health/liveliness 和 /health/readiness ([44019e1](https://github.com/certd/certd/commit/44019e104289fedd32a867db00e9c6cb71b389cc))
* 支持根据id更新证书证书Id不变接口不过该接口为白名单功能普通腾讯云账户无法使用 ([fe9c4f3](https://github.com/certd/certd/commit/fe9c4f3391ff07c01dd9a252225f69a129c39050))
* 支持godaddy ([b7980aa](https://github.com/certd/certd/commit/b7980aad5ab50f58662eaddf5d84aa82876a98eb))
* 支持ssl.com证书颁发机构 ([27b6dfa](https://github.com/certd/certd/commit/27b6dfa4d2ab3bddd284c3a34511a72e1a513a4c))
* 子域名托管说明 ([39a0223](https://github.com/certd/certd/commit/39a02235cf4416bb5bd1acd3831241efeaa2f602))
* ssh 增加超时断开连接默认10分钟超时 ([c24a040](https://github.com/certd/certd/commit/c24a040c19cacafc79228d7a7649af93837d94a1))
## [1.36.18](https://github.com/certd/certd/compare/v1.36.17...v1.36.18) (2025-08-28)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
# Certd
[English](./README_en.md) | [中文](./README.md)
中文 | [English](./README_en.md)
Certd® 是一个免费的全自动证书管理系统,让你的网站证书永不过期。
后缀d取自linux守护进程的命名风格意为证书守护进程

View File

@@ -1,6 +1,6 @@
# Certd
[English](./README_en.md) | [中文](./README.md)
[中文](./README.md) | English
Certd® is a free, fully automated certificate management system that ensures your website certificates never expire. The suffix 'd' is inspired by the naming convention of Linux daemons, representing a certificate daemon.

View File

@@ -1 +1 @@
00:43
00:34

View File

@@ -3,6 +3,29 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.19](https://github.com/certd/certd/compare/v1.36.18...v1.36.19) (2025-09-05)
### Bug Fixes
* 前置任务输出不存在时输出警告提示 ([b59052c](https://github.com/certd/certd/commit/b59052cc43b7b070fabd8b8e914e4c2a5e0ad61c))
* 修复批量流水线执行时日志显示错乱的问题 ([4372adc](https://github.com/certd/certd/commit/4372adc703b9a4c785664054ab2a533626d815a8))
* 修复远程数据选择无法过滤的bug ([6cbb073](https://github.com/certd/certd/commit/6cbb0739f8428d51b0712f718fe4d236cc087cf9))
* 修复mysql下购买套餐加量包无效的bug ([c26ad4c](https://github.com/certd/certd/commit/c26ad4c8075f0606d45b8da13915737968d6191a))
### Performance Improvements
* 创建证书时支持选择通知时机 ([0e96bfd](https://github.com/certd/certd/commit/0e96bfdfa377824d204e72923d1176408ae6b300))
* 创建k8s secret 时设置type为tls ([79ebabf](https://github.com/certd/certd/commit/79ebabfcfb9e5a534049c84f5f1a642b357fc856))
* 去掉宝塔url后面的斜杠 ([8a0c2b9](https://github.com/certd/certd/commit/8a0c2b9b13628da750c25757e0cb8ed3038775ba))
* 商业版隐藏文档相关链接 ([4443a1c](https://github.com/certd/certd/commit/4443a1c0308fa6b95a05efd73d15d24b65d641c9))
* 商业版隐藏文档相关链接 ([db89561](https://github.com/certd/certd/commit/db8956148083bc4f988226ccf719940d08158a27))
* 增加健康检查探针 /health/liveliness 和 /health/readiness ([44019e1](https://github.com/certd/certd/commit/44019e104289fedd32a867db00e9c6cb71b389cc))
* 支持根据id更新证书证书Id不变接口不过该接口为白名单功能普通腾讯云账户无法使用 ([fe9c4f3](https://github.com/certd/certd/commit/fe9c4f3391ff07c01dd9a252225f69a129c39050))
* 支持godaddy ([b7980aa](https://github.com/certd/certd/commit/b7980aad5ab50f58662eaddf5d84aa82876a98eb))
* 支持ssl.com证书颁发机构 ([27b6dfa](https://github.com/certd/certd/commit/27b6dfa4d2ab3bddd284c3a34511a72e1a513a4c))
* 子域名托管说明 ([39a0223](https://github.com/certd/certd/commit/39a02235cf4416bb5bd1acd3831241efeaa2f602))
* ssh 增加超时断开连接默认10分钟超时 ([c24a040](https://github.com/certd/certd/commit/c24a040c19cacafc79228d7a7649af93837d94a1))
## [1.36.18](https://github.com/certd/certd/compare/v1.36.17...v1.36.18) (2025-08-28)
### Bug Fixes

View File

@@ -9,5 +9,5 @@
}
},
"npmClient": "pnpm",
"version": "1.36.18"
"version": "1.36.19"
}

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.19](https://github.com/publishlab/node-acme-client/compare/v1.36.18...v1.36.19) (2025-09-05)
### Performance Improvements
* 支持ssl.com证书颁发机构 ([27b6dfa](https://github.com/publishlab/node-acme-client/commit/27b6dfa4d2ab3bddd284c3a34511a72e1a513a4c))
## [1.36.18](https://github.com/publishlab/node-acme-client/compare/v1.36.17...v1.36.18) (2025-08-28)
**Note:** Version bump only for package @certd/acme-client

View File

@@ -3,7 +3,7 @@
"description": "Simple and unopinionated ACME client",
"private": false,
"author": "nmorsman",
"version": "1.36.18",
"version": "1.36.19",
"type": "module",
"module": "scr/index.js",
"main": "src/index.js",
@@ -18,7 +18,7 @@
"types"
],
"dependencies": {
"@certd/basic": "^1.36.18",
"@certd/basic": "^1.36.19",
"@peculiar/x509": "^1.11.0",
"asn1js": "^3.0.5",
"axios": "^1.7.2",
@@ -69,5 +69,5 @@
"bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues"
},
"gitHead": "ea18a5ad151b296fda54fb5bcbe64c7d80cdff2f"
"gitHead": "6d8981479517b5de9634e242c1ebf22e70527ec4"
}

View File

@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.19](https://github.com/certd/certd/compare/v1.36.18...v1.36.19) (2025-09-05)
### Bug Fixes
* 修复批量流水线执行时日志显示错乱的问题 ([4372adc](https://github.com/certd/certd/commit/4372adc703b9a4c785664054ab2a533626d815a8))
### Performance Improvements
* 去掉宝塔url后面的斜杠 ([8a0c2b9](https://github.com/certd/certd/commit/8a0c2b9b13628da750c25757e0cb8ed3038775ba))
## [1.36.18](https://github.com/certd/certd/compare/v1.36.17...v1.36.18) (2025-08-28)
**Note:** Version bump only for package @certd/basic

View File

@@ -1 +1 @@
00:39
00:30

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/basic",
"private": false,
"version": "1.36.18",
"version": "1.36.19",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@@ -45,5 +45,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "ea18a5ad151b296fda54fb5bcbe64c7d80cdff2f"
"gitHead": "6d8981479517b5de9634e242c1ebf22e70527ec4"
}

View File

@@ -1,4 +1,4 @@
import log4js, { CallStack, Level, Logger } from "log4js";
import log4js, { CallStack, Level } from "log4js";
let logFilePath = "./logs/app.log";
export function resetLogConfigure() {
@@ -28,7 +28,56 @@ export function buildLogger(write: (text: string) => void) {
return new PipelineLogger("pipeline", write);
}
export type ILogger = Logger;
export type ILogger = {
readonly category: string;
level: Level | string;
log(level: Level | string, ...args: any[]): void;
isLevelEnabled(level?: string): boolean;
isTraceEnabled(): boolean;
isDebugEnabled(): boolean;
isInfoEnabled(): boolean;
isWarnEnabled(): boolean;
isErrorEnabled(): boolean;
isFatalEnabled(): boolean;
_log(level: Level, data: any): void;
addContext(key: string, value: any): void;
removeContext(key: string): void;
clearContext(): void;
/**
* Replace the basic parse function with a new custom one
* - Note that linesToSkip will be based on the origin of the Error object in addition to the callStackLinesToSkip (at least 1)
* @param parseFunction the new parseFunction. Use `undefined` to reset to the base implementation
*/
setParseCallStackFunction(parseFunction: (error: Error, linesToSkip: number) => CallStack | undefined): void;
/**
* Adjust the value of linesToSkip when the parseFunction is called.
*
* Cannot be less than 0.
*/
callStackLinesToSkip: number;
trace(message: any, ...args: any[]): void;
debug(message: any, ...args: any[]): void;
info(message: any, ...args: any[]): void;
warn(message: any, ...args: any[]): void;
error(message: any, ...args: any[]): void;
fatal(message: any, ...args: any[]): void;
mark(message: any, ...args: any[]): void;
};
const locale = Intl.DateTimeFormat().resolvedOptions().locale;
const formatter = new Intl.DateTimeFormat(locale, {

View File

@@ -1,6 +1,5 @@
import axios, { AxiosHeaders, AxiosRequestConfig } from "axios";
import { ILogger, logger } from "./util.log.js";
import { Logger } from "log4js";
import { HttpProxyAgent } from "http-proxy-agent";
import { HttpsProxyAgent } from "https-proxy-agent";
import nodeHttp from "http";
@@ -84,7 +83,7 @@ export function getGlobalAgents() {
/**
* @description 创建请求实例
*/
export function createAxiosService({ logger }: { logger: Logger }) {
export function createAxiosService({ logger }: { logger: ILogger }) {
// 创建一个 axios 实例
const service = axios.create();

View File

@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.19](https://github.com/certd/certd/compare/v1.36.18...v1.36.19) (2025-09-05)
### Bug Fixes
* 前置任务输出不存在时输出警告提示 ([b59052c](https://github.com/certd/certd/commit/b59052cc43b7b070fabd8b8e914e4c2a5e0ad61c))
### Performance Improvements
* 支持godaddy ([b7980aa](https://github.com/certd/certd/commit/b7980aad5ab50f58662eaddf5d84aa82876a98eb))
* 支持ssl.com证书颁发机构 ([27b6dfa](https://github.com/certd/certd/commit/27b6dfa4d2ab3bddd284c3a34511a72e1a513a4c))
## [1.36.18](https://github.com/certd/certd/compare/v1.36.17...v1.36.18) (2025-08-28)
**Note:** Version bump only for package @certd/pipeline

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/pipeline",
"private": false,
"version": "1.36.18",
"version": "1.36.19",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@@ -17,8 +17,8 @@
"pub": "npm publish"
},
"dependencies": {
"@certd/basic": "^1.36.18",
"@certd/plus-core": "^1.36.18",
"@certd/basic": "^1.36.19",
"@certd/plus-core": "^1.36.19",
"dayjs": "^1.11.7",
"lodash-es": "^4.17.21",
"reflect-metadata": "^0.1.13"
@@ -44,5 +44,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "ea18a5ad151b296fda54fb5bcbe64c7d80cdff2f"
"gitHead": "6d8981479517b5de9634e242c1ebf22e70527ec4"
}

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.19](https://github.com/certd/certd/compare/v1.36.18...v1.36.19) (2025-09-05)
**Note:** Version bump only for package @certd/lib-huawei
## [1.36.18](https://github.com/certd/certd/compare/v1.36.17...v1.36.18) (2025-08-28)
**Note:** Version bump only for package @certd/lib-huawei

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/lib-huawei",
"private": false,
"version": "1.36.18",
"version": "1.36.19",
"main": "./dist/bundle.js",
"module": "./dist/bundle.js",
"types": "./dist/d/index.d.ts",
@@ -24,5 +24,5 @@
"prettier": "^2.8.8",
"tslib": "^2.8.1"
},
"gitHead": "ea18a5ad151b296fda54fb5bcbe64c7d80cdff2f"
"gitHead": "6d8981479517b5de9634e242c1ebf22e70527ec4"
}

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.19](https://github.com/certd/certd/compare/v1.36.18...v1.36.19) (2025-09-05)
**Note:** Version bump only for package @certd/lib-iframe
## [1.36.18](https://github.com/certd/certd/compare/v1.36.17...v1.36.18) (2025-08-28)
**Note:** Version bump only for package @certd/lib-iframe

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/lib-iframe",
"private": false,
"version": "1.36.18",
"version": "1.36.19",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@@ -31,5 +31,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "ea18a5ad151b296fda54fb5bcbe64c7d80cdff2f"
"gitHead": "6d8981479517b5de9634e242c1ebf22e70527ec4"
}

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.19](https://github.com/certd/certd/compare/v1.36.18...v1.36.19) (2025-09-05)
**Note:** Version bump only for package @certd/jdcloud
## [1.36.18](https://github.com/certd/certd/compare/v1.36.17...v1.36.18) (2025-08-28)
**Note:** Version bump only for package @certd/jdcloud

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/jdcloud",
"version": "1.36.18",
"version": "1.36.19",
"description": "jdcloud openApi sdk",
"main": "./dist/bundle.js",
"module": "./dist/bundle.js",
@@ -61,5 +61,5 @@
"fetch"
]
},
"gitHead": "ea18a5ad151b296fda54fb5bcbe64c7d80cdff2f"
"gitHead": "6d8981479517b5de9634e242c1ebf22e70527ec4"
}

View File

@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.19](https://github.com/certd/certd/compare/v1.36.18...v1.36.19) (2025-09-05)
### Bug Fixes
* 修复远程数据选择无法过滤的bug ([6cbb073](https://github.com/certd/certd/commit/6cbb0739f8428d51b0712f718fe4d236cc087cf9))
### Performance Improvements
* 创建k8s secret 时设置type为tls ([79ebabf](https://github.com/certd/certd/commit/79ebabfcfb9e5a534049c84f5f1a642b357fc856))
## [1.36.18](https://github.com/certd/certd/compare/v1.36.17...v1.36.18) (2025-08-28)
### Performance Improvements

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/lib-k8s",
"private": false,
"version": "1.36.18",
"version": "1.36.19",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@@ -17,7 +17,7 @@
"pub": "npm publish"
},
"dependencies": {
"@certd/basic": "^1.36.18",
"@certd/basic": "^1.36.19",
"@kubernetes/client-node": "0.21.0"
},
"devDependencies": {
@@ -32,5 +32,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "ea18a5ad151b296fda54fb5bcbe64c7d80cdff2f"
"gitHead": "6d8981479517b5de9634e242c1ebf22e70527ec4"
}

View File

@@ -1,7 +1,7 @@
import { CoreV1Api, KubeConfig, NetworkingV1Api, V1Ingress, V1Secret } from "@kubernetes/client-node";
import dns from "dns";
import { ILogger } from "@certd/basic";
import _ from "lodash-es";
import { merge } from "lodash-es";
export type K8sClientOpts = {
kubeConfigStr: string;
@@ -119,7 +119,13 @@ export class K8sClient {
this.logger.warn(`secret ${secretName} 不存在`);
if (opts.createOnNotFound) {
//没有找到,则创建
const res = await this.createSecret({ namespace, body: opts.body });
const body = merge(
{
type: "type: kubernetes.io/tls",
},
opts.body
);
const res = await this.createSecret({ namespace, body });
this.logger.info(`secret ${secretName} 已创建`);
return res;
}
@@ -127,7 +133,7 @@ export class K8sClient {
throw e;
}
const newSecret = _.merge(oldSecret.body, opts.body);
const newSecret = merge(oldSecret.body, opts.body);
const res = await this.client.replaceNamespacedSecret(secretName, namespace, newSecret);
this.logger.info(`secret ${secretName} 已更新`);
return res.body;
@@ -161,7 +167,7 @@ export class K8sClient {
this.logger.info("patch ingress:", ingressName, namespace);
const client = this.kubeconfig.makeApiClient(NetworkingV1Api);
const oldIngress = await client.readNamespacedIngress(ingressName, namespace);
const newIngress = _.merge(oldIngress.body, opts.body);
const newIngress = merge(oldIngress.body, opts.body);
const res = await client.replaceNamespacedIngress(ingressName, namespace, newIngress);
this.logger.info("ingress patched", opts.body);
return res;

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.19](https://github.com/certd/certd/compare/v1.36.18...v1.36.19) (2025-09-05)
**Note:** Version bump only for package @certd/lib-server
## [1.36.18](https://github.com/certd/certd/compare/v1.36.17...v1.36.18) (2025-08-28)
**Note:** Version bump only for package @certd/lib-server

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/lib-server",
"version": "1.36.18",
"version": "1.36.19",
"description": "midway with flyway, sql upgrade way ",
"private": false,
"type": "module",
@@ -27,10 +27,10 @@
],
"license": "AGPL",
"dependencies": {
"@certd/acme-client": "^1.36.18",
"@certd/basic": "^1.36.18",
"@certd/pipeline": "^1.36.18",
"@certd/plus-core": "^1.36.18",
"@certd/acme-client": "^1.36.19",
"@certd/basic": "^1.36.19",
"@certd/pipeline": "^1.36.19",
"@certd/plus-core": "^1.36.19",
"@midwayjs/cache": "~3.14.0",
"@midwayjs/core": "~3.20.3",
"@midwayjs/i18n": "~3.20.3",
@@ -61,5 +61,5 @@
"typeorm": "^0.3.11",
"typescript": "^5.4.2"
},
"gitHead": "ea18a5ad151b296fda54fb5bcbe64c7d80cdff2f"
"gitHead": "6d8981479517b5de9634e242c1ebf22e70527ec4"
}

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.19](https://github.com/certd/certd/compare/v1.36.18...v1.36.19) (2025-09-05)
**Note:** Version bump only for package @certd/midway-flyway-js
## [1.36.18](https://github.com/certd/certd/compare/v1.36.17...v1.36.18) (2025-08-28)
**Note:** Version bump only for package @certd/midway-flyway-js

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/midway-flyway-js",
"version": "1.36.18",
"version": "1.36.19",
"description": "midway with flyway, sql upgrade way ",
"private": false,
"type": "module",
@@ -46,5 +46,5 @@
"typeorm": "^0.3.11",
"typescript": "^5.4.2"
},
"gitHead": "ea18a5ad151b296fda54fb5bcbe64c7d80cdff2f"
"gitHead": "6d8981479517b5de9634e242c1ebf22e70527ec4"
}

View File

@@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.19](https://github.com/certd/certd/compare/v1.36.18...v1.36.19) (2025-09-05)
### Performance Improvements
* 支持ssl.com证书颁发机构 ([27b6dfa](https://github.com/certd/certd/commit/27b6dfa4d2ab3bddd284c3a34511a72e1a513a4c))
* 子域名托管说明 ([39a0223](https://github.com/certd/certd/commit/39a02235cf4416bb5bd1acd3831241efeaa2f602))
## [1.36.18](https://github.com/certd/certd/compare/v1.36.17...v1.36.18) (2025-08-28)
### Performance Improvements

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/plugin-cert",
"private": false,
"version": "1.36.18",
"version": "1.36.19",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -16,10 +16,10 @@
"pub": "npm publish"
},
"dependencies": {
"@certd/acme-client": "^1.36.18",
"@certd/basic": "^1.36.18",
"@certd/pipeline": "^1.36.18",
"@certd/plugin-lib": "^1.36.18",
"@certd/acme-client": "^1.36.19",
"@certd/basic": "^1.36.19",
"@certd/pipeline": "^1.36.19",
"@certd/plugin-lib": "^1.36.19",
"@google-cloud/publicca": "^1.3.0",
"dayjs": "^1.11.7",
"jszip": "^3.10.1",
@@ -43,5 +43,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "ea18a5ad151b296fda54fb5bcbe64c7d80cdff2f"
"gitHead": "6d8981479517b5de9634e242c1ebf22e70527ec4"
}

View File

@@ -329,8 +329,9 @@ export class AcmeService {
isTest?: boolean;
privateKeyType?: string;
profile?: string;
preferredChain?: string;
}): Promise<CertInfo> {
const { email, isTest, csrInfo, dnsProvider, domainsVerifyPlan, profile } = options;
const { email, isTest, csrInfo, dnsProvider, domainsVerifyPlan, profile, preferredChain } = options;
const client: acme.Client = await this.getAcmeClient(email, isTest);
let domains = options.domains;
@@ -404,6 +405,7 @@ export class AcmeService {
},
signal: this.options.signal,
profile,
preferredChain,
});
const crtString = crt.toString();

View File

@@ -292,6 +292,29 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
})
certProfile!: string;
@TaskInput({
title: "首选链",
value: "ISRG Root X1",
component: {
name: "a-select",
vModel: "value",
options: [
{ value: "ISRG Root X1", label: "ISRG Root X1" },
{ value: "ISRG Root X2", label: "ISRG Root X2" },
],
},
helper: "仅 Let's Encrypt 可选,默认为 ISRG Root X1",
required: false,
mergeScript: `
return {
show: ctx.compute(({form})=>{
return form.sslProvider === 'letsencrypt'
})
}
`,
})
preferredChain!: string;
@TaskInput({
title: "使用代理",
value: false,
@@ -438,6 +461,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
isTest: false,
privateKeyType: this.privateKeyType,
profile: this.certProfile,
preferredChain: this.preferredChain,
});
const certInfo = this.formatCerts(cert);

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.19](https://github.com/certd/certd/compare/v1.36.18...v1.36.19) (2025-09-05)
### Performance Improvements
* ssh 增加超时断开连接默认10分钟超时 ([c24a040](https://github.com/certd/certd/commit/c24a040c19cacafc79228d7a7649af93837d94a1))
## [1.36.18](https://github.com/certd/certd/compare/v1.36.17...v1.36.18) (2025-08-28)
### Performance Improvements

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/plugin-lib",
"private": false,
"version": "1.36.18",
"version": "1.36.19",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -21,8 +21,8 @@
"@alicloud/pop-core": "^1.7.10",
"@alicloud/tea-util": "^1.4.10",
"@aws-sdk/client-s3": "^3.787.0",
"@certd/basic": "^1.36.18",
"@certd/pipeline": "^1.36.18",
"@certd/basic": "^1.36.19",
"@certd/pipeline": "^1.36.19",
"@kubernetes/client-node": "0.21.0",
"ali-oss": "^6.22.0",
"basic-ftp": "^5.0.5",
@@ -53,5 +53,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "ea18a5ad151b296fda54fb5bcbe64c7d80cdff2f"
"gitHead": "6d8981479517b5de9634e242c1ebf22e70527ec4"
}

View File

@@ -86,6 +86,15 @@ export class SshAccess extends BaseAccess {
})
socksProxy!: string;
@AccessInput({
title: "超时时间",
helper: "执行命令的超时时间,单位秒,默认30分钟",
component: {
name: "a-input-number",
},
})
timeout: number;
@AccessInput({
title: "是否Windows",
helper: "如果是Windows主机请勾选此项\n并且需要windows[安装OpenSSH](https://certd.docmirror.cn/guide/use/host/windows.html)",

View File

@@ -588,10 +588,15 @@ export class SshClient {
}
throw e;
}
let timeoutId = null;
try {
timeoutId = setTimeout(() => {
this.logger.info("执行超时,断开连接");
conn.end();
}, 1000 * (connectConf.timeout || 1800));
return await callable(conn);
} finally {
clearTimeout(timeoutId);
conn.end();
}
}

View File

@@ -76,9 +76,26 @@ export class TencentSslClient {
return res;
}
async DescribeCertificates(params: any) {
async DescribeHostUploadUpdateRecordDetail(params: any) {
const client = await this.getSslClient();
const res = await client.DescribeCertificates(params);
const res = await client.request("DescribeHostUploadUpdateRecordDetail", params);
this.checkRet(res);
return res;
}
async UploadUpdateCertificateInstance(params: any) {
const client = await this.getSslClient();
const res = await client.request("UploadUpdateCertificateInstance", params);
this.checkRet(res);
return res;
}
async DescribeCertificates(params: { Limit?: number; Offset?: number; SearchKey?: string }) {
const client = await this.getSslClient();
const res = await client.DescribeCertificates({
ExpirationSort: "ASC",
...params,
});
this.checkRet(res);
return res;
}

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.19](https://github.com/certd/certd/compare/v1.36.18...v1.36.19) (2025-09-05)
### Bug Fixes
* 修复批量流水线执行时日志显示错乱的问题 ([4372adc](https://github.com/certd/certd/commit/4372adc703b9a4c785664054ab2a533626d815a8))
* 修复远程数据选择无法过滤的bug ([6cbb073](https://github.com/certd/certd/commit/6cbb0739f8428d51b0712f718fe4d236cc087cf9))
* 修复mysql下购买套餐加量包无效的bug ([c26ad4c](https://github.com/certd/certd/commit/c26ad4c8075f0606d45b8da13915737968d6191a))
### Performance Improvements
* 创建证书时支持选择通知时机 ([0e96bfd](https://github.com/certd/certd/commit/0e96bfdfa377824d204e72923d1176408ae6b300))
* 商业版隐藏文档相关链接 ([4443a1c](https://github.com/certd/certd/commit/4443a1c0308fa6b95a05efd73d15d24b65d641c9))
* 商业版隐藏文档相关链接 ([db89561](https://github.com/certd/certd/commit/db8956148083bc4f988226ccf719940d08158a27))
* 支持根据id更新证书证书Id不变接口不过该接口为白名单功能普通腾讯云账户无法使用 ([fe9c4f3](https://github.com/certd/certd/commit/fe9c4f3391ff07c01dd9a252225f69a129c39050))
* 子域名托管说明 ([39a0223](https://github.com/certd/certd/commit/39a02235cf4416bb5bd1acd3831241efeaa2f602))
## [1.36.18](https://github.com/certd/certd/compare/v1.36.17...v1.36.18) (2025-08-28)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/ui-client",
"version": "1.36.18",
"version": "1.36.19",
"private": true,
"scripts": {
"dev": "vite --open",
@@ -103,8 +103,8 @@
"zod-defaults": "^0.1.3"
},
"devDependencies": {
"@certd/lib-iframe": "^1.36.18",
"@certd/pipeline": "^1.36.18",
"@certd/lib-iframe": "^1.36.19",
"@certd/pipeline": "^1.36.19",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.12",

View File

@@ -66,7 +66,7 @@ const getOptions = async () => {
const input = (pluginType === "plugin" ? form?.input : form) || {};
for (let key in define.input) {
const inWatches = props.watches.includes(key);
const inWatches = props.watches?.includes(key);
const inputDefine = define.input[key];
if (inWatches && inputDefine.required) {
const value = input[key];

View File

@@ -105,7 +105,7 @@ const getOptions = async () => {
const input = (pluginType === "plugin" ? form?.input : form) || {};
for (let key in define.input) {
const inWatches = props.watches.includes(key);
const inWatches = props.watches?.includes(key);
const inputDefine = define.input[key];
if (inWatches && inputDefine.required) {
const value = input[key];
@@ -169,7 +169,7 @@ const getOptions = async () => {
};
const filterOption = (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 || String(option.value).toLowerCase().indexOf(input.toLowerCase());
return option.label.toLowerCase().includes(input.toLowerCase()) || String(option.value).toLowerCase().includes(input.toLowerCase());
};
async function onClick() {

View File

@@ -0,0 +1,192 @@
<template>
<div class="remote-select">
<div class="flex flex-row">
<a-tree-select class="remote-tree-select-input" :tree-data="optionsRef" :value="value" tree-checkable allow-clear v-bind="attrs" @click="onClick" @update:value="emit('update:value', $event)"> </a-tree-select>
<div class="ml-5">
<fs-button :loading="loading" title="刷新选项" icon="ion:refresh-outline" @click="refreshOptions"></fs-button>
</div>
</div>
<div class="helper" :class="{ error: hasError }">
{{ message }}
</div>
</div>
</template>
<script setup lang="ts">
import { ComponentPropsType, doRequest } from "/@/components/plugins/lib";
import { defineComponent, inject, ref, useAttrs, watch, Ref } from "vue";
import { PluginDefine } from "@certd/pipeline";
defineOptions({
name: "RemoteTreeSelect",
});
const props = defineProps<
{
watches: string[];
search?: boolean;
pager?: boolean;
} & ComponentPropsType
>();
const emit = defineEmits<{
"update:value": any;
}>();
const attrs = useAttrs();
const getCurrentPluginDefine: any = inject("getCurrentPluginDefine", () => {
return {};
});
const getScope: any = inject("get:scope", () => {
return {};
});
const getPluginType: any = inject("get:plugin:type", () => {
return "plugin";
});
const searchKeyRef = ref("");
const optionsRef = ref([]);
const message = ref("");
const hasError = ref(false);
const loading = ref(false);
const pagerRef: Ref = ref({
current: 1,
});
const getOptions = async () => {
debugger;
if (loading.value) {
return;
}
if (!getCurrentPluginDefine) {
return;
}
const define: PluginDefine = getCurrentPluginDefine()?.value;
if (!define) {
return;
}
const pluginType = getPluginType();
const { form } = getScope();
const input = (pluginType === "plugin" ? form?.input : form) || {};
for (let key in define.input) {
const inWatches = props.watches?.includes(key);
const inputDefine = define.input[key];
if (inWatches && inputDefine.required) {
const value = input[key];
if (value == null || value === "") {
console.log("remote-select required", key);
return;
}
}
}
message.value = "";
hasError.value = false;
loading.value = true;
const pageNo = pagerRef.value.pageNo;
const pageSize = pagerRef.value.pageSize;
try {
const res = await doRequest(
{
type: pluginType,
typeName: form.type,
action: props.action,
input,
data: {
searchKey: props.search ? searchKeyRef.value : "",
pageNo,
pageSize,
},
},
{
onError(err: any) {
hasError.value = true;
message.value = `获取选项出错:${err.message}`;
},
showErrorNotify: false,
}
);
const list = res?.list || res || [];
if (list.length > 0) {
message.value = "获取数据成功,请从下拉框中选择";
} else {
message.value = "获取数据成功,没有数据";
}
optionsRef.value = list;
pagerRef.value.total = list.length;
if (props.pager) {
if (res.pageNo != null) {
pagerRef.value.pageNo = res.pageNo ?? 1;
}
if (res.pageSize != null) {
pagerRef.value.pageSize = res.pageSize ?? 100;
}
if (res.total != null) {
pagerRef.value.total = res.total ?? list.length;
}
}
return res;
} finally {
loading.value = false;
}
};
async function onClick() {
if (optionsRef.value?.length === 0) {
await refreshOptions();
}
}
async function refreshOptions() {
await getOptions();
}
async function doSearch() {
pagerRef.value.pageNo = 1;
await refreshOptions();
}
watch(
() => {
const pluginType = getPluginType();
const { form, key } = getScope();
const input = (pluginType === "plugin" ? form?.input : form) || {};
const watches = {};
for (const key of props.watches) {
//@ts-ignore
watches[key] = input[key];
}
return {
form: watches,
key,
};
},
async (value, oldValue) => {
const { form } = value;
const oldForm: any = oldValue?.form;
let changed = oldForm == null || optionsRef.value.length == 0;
for (const key of props.watches) {
//@ts-ignore
if (oldForm && form[key] != oldForm[key]) {
changed = true;
break;
}
}
if (changed) {
await getOptions();
}
},
{
immediate: true,
}
);
async function onPageChange(current: any) {
await refreshOptions();
}
</script>
<style lang="less"></style>

View File

@@ -2,6 +2,7 @@ import SynologyIdDeviceGetter from "./synology/device-id-getter.vue";
import RemoteAutoComplete from "./common/remote-auto-complete.vue";
import RemoteSelect from "./common/remote-select.vue";
import RemoteInput from "./common/remote-input.vue";
import RemoteTreeSelect from "./common/remote-tree-select.vue";
import CertDomainsGetter from "./common/cert-domains-getter.vue";
import OutputSelector from "/@/components/plugins/common/output-selector/index.vue";
import DnsProviderSelector from "/@/components/plugins/cert/dns-provider-selector/index.vue";
@@ -24,6 +25,7 @@ export default {
app.component("SynologyDeviceIdGetter", SynologyIdDeviceGetter);
app.component("RemoteAutoComplete", RemoteAutoComplete);
app.component("RemoteSelect", RemoteSelect);
app.component("RemoteTreeSelect", RemoteTreeSelect);
app.component("RemoteInput", RemoteInput);
app.component("CertDomainsGetter", CertDomainsGetter);
app.component("InputPassword", InputPassword);

View File

@@ -219,6 +219,7 @@ export default {
triggerCronHelper:
"Click the button above to choose a daily execution time.\nIt is recommended to trigger once per day. The task will be skipped if the certificate has not expired and will not be executed repeatedly.",
notificationTitle: "Failure Notification",
notificationWhen: "Notification Timing",
notificationHelper: "Get real-time alerts when the task fails",
groupIdTitle: "Pipeline Group",
},

View File

@@ -224,6 +224,7 @@ export default {
triggerCronTitle: "定时触发",
triggerCronHelper: "点击上面的按钮,选择每天几点定时执行。\n建议设置为每天触发一次证书未到期之前任务会跳过不会重复执行",
notificationTitle: "失败通知",
notificationWhen: "通知时机",
notificationHelper: "任务执行失败实时提醒",
groupIdTitle: "流水线分组",
},

View File

@@ -22,7 +22,7 @@ export function fillPipelineByDefaultForm(pipeline: any, form: any) {
if (form.notification != null) {
notifications.push({
type: "custom",
when: ["error", "turnToSuccess", "success"],
when: form.notificationWhen || ["error", "turnToSuccess"],
notificationId: form.notification,
title: form.notificationTarget?.name || "自定义通知",
});
@@ -223,6 +223,25 @@ export function useCertPipelineCreator() {
helper: t("certd.pipelineForm.notificationHelper"),
},
},
notificationWhen: {
title: t("certd.pipelineForm.notificationWhen"),
type: "text",
form: {
value: ["error", "turnToSuccess"],
component: {
name: "a-select",
vModel: "value",
mode: "multiple",
options: [
{ value: "start", label: t("certd.start_time") },
{ value: "success", label: t("certd.success_time") },
{ value: "turnToSuccess", label: t("certd.fail_to_success_time") },
{ value: "error", label: t("certd.fail_time") },
],
},
order: 102,
},
},
groupId: {
title: t("certd.pipelineForm.groupIdTitle"),
type: "dict-select",
@@ -268,7 +287,7 @@ export function useCertPipelineCreator() {
async function doSubmit({ form }: any) {
// const certDetail = readCertDetail(form.cert.crt);
// 添加certd pipeline
const pluginInput = omit(form, ["triggerCron", "notification", "notificationTarget", "certApplyPlugin", "groupId"]);
const pluginInput = omit(form, ["triggerCron", "notification", "notificationTarget", "notificationWhen", "certApplyPlugin", "groupId"]);
let pipeline: any = {
title: form.domains[0] + "证书自动化",
runnableType: "pipeline",

View File

@@ -3,6 +3,20 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.19](https://github.com/certd/certd/compare/v1.36.18...v1.36.19) (2025-09-05)
### Bug Fixes
* 前置任务输出不存在时输出警告提示 ([b59052c](https://github.com/certd/certd/commit/b59052cc43b7b070fabd8b8e914e4c2a5e0ad61c))
* 修复mysql下购买套餐加量包无效的bug ([c26ad4c](https://github.com/certd/certd/commit/c26ad4c8075f0606d45b8da13915737968d6191a))
### Performance Improvements
* 增加健康检查探针 /health/liveliness 和 /health/readiness ([44019e1](https://github.com/certd/certd/commit/44019e104289fedd32a867db00e9c6cb71b389cc))
* 支持根据id更新证书证书Id不变接口不过该接口为白名单功能普通腾讯云账户无法使用 ([fe9c4f3](https://github.com/certd/certd/commit/fe9c4f3391ff07c01dd9a252225f69a129c39050))
* 支持godaddy ([b7980aa](https://github.com/certd/certd/commit/b7980aad5ab50f58662eaddf5d84aa82876a98eb))
* 支持ssl.com证书颁发机构 ([27b6dfa](https://github.com/certd/certd/commit/27b6dfa4d2ab3bddd284c3a34511a72e1a513a4c))
## [1.36.18](https://github.com/certd/certd/compare/v1.36.17...v1.36.18) (2025-08-28)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/ui-server",
"version": "1.36.18",
"version": "1.36.19",
"description": "fast-server base midway",
"private": true,
"type": "module",
@@ -43,20 +43,20 @@
"@aws-sdk/client-cloudfront": "^3.699.0",
"@aws-sdk/client-iam": "^3.699.0",
"@aws-sdk/client-s3": "^3.705.0",
"@certd/acme-client": "^1.36.18",
"@certd/basic": "^1.36.18",
"@certd/commercial-core": "^1.36.18",
"@certd/acme-client": "^1.36.19",
"@certd/basic": "^1.36.19",
"@certd/commercial-core": "^1.36.19",
"@certd/cv4pve-api-javascript": "^8.4.2",
"@certd/jdcloud": "^1.36.18",
"@certd/lib-huawei": "^1.36.18",
"@certd/lib-k8s": "^1.36.18",
"@certd/lib-server": "^1.36.18",
"@certd/midway-flyway-js": "^1.36.18",
"@certd/pipeline": "^1.36.18",
"@certd/plugin-cert": "^1.36.18",
"@certd/plugin-lib": "^1.36.18",
"@certd/plugin-plus": "^1.36.18",
"@certd/plus-core": "^1.36.18",
"@certd/jdcloud": "^1.36.19",
"@certd/lib-huawei": "^1.36.19",
"@certd/lib-k8s": "^1.36.19",
"@certd/lib-server": "^1.36.19",
"@certd/midway-flyway-js": "^1.36.19",
"@certd/pipeline": "^1.36.19",
"@certd/plugin-cert": "^1.36.19",
"@certd/plugin-lib": "^1.36.19",
"@certd/plugin-plus": "^1.36.19",
"@certd/plus-core": "^1.36.19",
"@huaweicloud/huaweicloud-sdk-cdn": "^3.1.120",
"@huaweicloud/huaweicloud-sdk-core": "^3.1.120",
"@koa/cors": "^5.0.0",
@@ -118,7 +118,7 @@
"socks-proxy-agent": "^8.0.4",
"strip-ansi": "^7.1.0",
"svg-captcha": "^1.4.0",
"tencentcloud-sdk-nodejs": "^4.0.983",
"tencentcloud-sdk-nodejs": "^4.1.112",
"typeorm": "^0.3.20",
"uuid": "^10.0.0"
},

View File

@@ -934,6 +934,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
"sslProvider": "letsencrypt",
"privateKeyType": "rsa_2048",
"certProfile": "classic",
"preferredChain": "ISRG Root X1",
"useProxy": false,
"skipLocalVerify": false,
"maxCheckRetryCount": 20,

View File

@@ -9,3 +9,4 @@ export * from './delete-expiring-cert/index.js';
export * from './deploy-to-tke-ingress/index.js';
export * from './deploy-to-live/index.js';
export * from './start-instances/index.js';
export * from './refresh-cert/index.js';

View File

@@ -1,113 +0,0 @@
// import { AbstractTaskPlugin, IsTaskPlugin, PageSearch, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
// import { CertApplyPluginNames, CertInfo } from "@certd/plugin-cert";
// import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from "@certd/plugin-lib";
// import { TencentAccess, TencentSslClient } from "@certd/plugin-lib";
// @IsTaskPlugin({
// //命名规范,插件类型+功能就是目录plugin-demo中的demo大写字母开头驼峰命名
// name: "TencentRefreshCert",
// title: "腾讯云-更新证书",
// desc: "根据证书id一键更新腾讯云证书并自动部署",
// icon: "svg:icon-tencentcloud",
// //插件分组
// group: pluginGroups.tencent.key,
// needPlus: false,
// default: {
// //默认值配置照抄即可
// strategy: {
// runStrategy: RunStrategy.SkipWhenSucceed
// }
// }
// })
// //类名规范跟上面插件名称name一致
// export class TencentRefreshCert extends AbstractTaskPlugin {
// //证书选择,此项必须要有
// @TaskInput({
// title: "域名证书",
// helper: "请选择前置任务输出的域名证书",
// component: {
// name: "output-selector",
// from: [...CertApplyPluginNames]
// }
// // required: true, // 必填
// })
// cert!: CertInfo;
//
// @TaskInput(createCertDomainGetterInputDefine({ props: { required: false } }))
// certDomains!: string[];
//
// //授权选择框
// @TaskInput({
// title: "腾讯云授权",
// component: {
// name: "access-selector",
// type: "tencent" //固定授权类型
// },
// required: true //必填
// })
// accessId!: string;
// //
//
// @TaskInput(
// createRemoteSelectInputDefine({
// title: "证书Id",
// helper: "要更新的证书id如果这里没有请先给手动绑定一次证书",
// action: TencentRefreshCert.prototype.onGetCertList.name,
// pager: false,
// search: false
// })
// )
// certList!: string[];
//
// //插件实例化时执行的方法
// async onInstance() {
// }
//
// //插件执行方法
// async execute(): Promise<void> {
// const access = await this.getAccess<TencentAccess>(this.accessId);
//
// // await access.createCert({cert:this.cert})
//
// for (const certId of this.certList) {
// this.logger.info(`----------- 开始更新证书:${certId}`);
//
// await access.updateCert({
// id: certId,
// cert: this.cert
// });
// this.logger.info(`----------- 更新证书${certId}成功`);
// }
//
// this.logger.info("部署完成");
// }
//
// async onGetCertList(data: PageSearch = {}) {
// const access = await this.getAccess<TencentAccess>(this.accessId);
//
// const res = await access.getCertList()
// const list = res.list
// if (!list || list.length === 0) {
// throw new Error("没有找到证书你可以直接手动输入id如果id不存在将自动创建");
// }
//
//
// /**
// * certificate-id
// * name
// * dns-names
// */
// const options = list.map((item: any) => {
// return {
// label: `${item.value.snis[0]}<${item.value.id}>`,
// value: item.value.id,
// domain: item.value.snis
// };
// });
// return {
// list: this.ctx.utils.options.buildGroupOptions(options, this.certDomains),
// };
// }
// }
//
// //实例化一下,注册插件
// new TencentRefreshCert();

View File

@@ -0,0 +1,340 @@
import {
AbstractTaskPlugin,
IsTaskPlugin,
Pager,
PageSearch,
pluginGroups,
RunStrategy,
TaskInput
} from "@certd/pipeline";
import { CertApplyPluginNames, CertInfo } from "@certd/plugin-cert";
import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from "@certd/plugin-lib";
import { TencentAccess, TencentSslClient } from "@certd/plugin-lib";
import { omit } from "lodash-es";
@IsTaskPlugin({
//命名规范,插件类型+功能就是目录plugin-demo中的demo大写字母开头驼峰命名
name: "TencentRefreshCert",
title: "腾讯云-更新证书(Id不变)",
desc: "根据证书id一键更新腾讯云证书并自动部署Id不变注意该接口为腾讯云白名单功能非白名单用户无法使用该功能",
icon: "svg:icon-tencentcloud",
//插件分组
group: pluginGroups.tencent.key,
needPlus: false,
default: {
//默认值配置照抄即可
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed
}
}
})
//类名规范跟上面插件名称name一致
export class TencentRefreshCert extends AbstractTaskPlugin {
//证书选择,此项必须要有
@TaskInput({
title: "域名证书",
helper: "请选择前置任务输出的域名证书",
component: {
name: "output-selector",
from: [...CertApplyPluginNames]
}
// required: true, // 必填
})
cert!: CertInfo;
@TaskInput(createCertDomainGetterInputDefine({ props: { required: false } }))
certDomains!: string[];
//授权选择框
@TaskInput({
title: "腾讯云授权",
component: {
name: "access-selector",
type: "tencent" //固定授权类型
},
required: true //必填
})
accessId!: string;
//
@TaskInput(
createRemoteSelectInputDefine({
title: "证书Id",
helper: "要更新的证书id如果这里没有请先给手动绑定一次证书",
action: TencentRefreshCert.prototype.onGetCertList.name,
pager: false,
search: false
})
)
certList!: string[];
// @TaskInput({
// title: '资源类型',
// component: {
// name: 'a-select',
// vModel: 'value',
// allowClear: true,
// mode: "tags",
// options: [
// { value: 'clb',label: '负载均衡'},
// { value: 'cdn',label: 'CDN'},
// { value: 'ddos',label: 'DDoS'},
// { value: 'live',label: '直播'},
// { value: 'vod',label: '点播'},
// { value: 'waf',label: 'Web应用防火墙'},
// { value: 'apigateway',label: 'API网关'},
// { value: 'teo',label: 'TEO'},
// { value: 'tke',label: '容器服务'},
// { value: 'cos',label: '对象存储'},
// { value: 'lighthouse',label: '轻应用服务器'},
// { value: 'tse',label: '云原生微服务'},
// { value: 'tcb',label: '云开发'},
// ]
// },
// helper: '',
// required: true,
// })
// resourceTypes!: string[];
@TaskInput({
title: '资源区域',
helper:"如果云资源类型区分区域,请选择区域,如果区域在选项中不存在,请手动输入",
component: {
name: 'remote-tree-select',
vModel: 'value',
action: TencentRefreshCert.prototype.onGetRegionsTree.name,
pager: false,
search: false,
watches: ['certList'],
},
required: false,
})
resourceTypesRegions!: string[];
//插件实例化时执行的方法
async onInstance() {
}
//插件执行方法
async execute(): Promise<void> {
const access = await this.getAccess<TencentAccess>(this.accessId);
const sslClient = new TencentSslClient({
access:access,
logger: this.logger,
});
// await access.createCert({cert:this.cert})
let resourceTypes = []
const resourceTypesRegions = []
for (const item of this.resourceTypesRegions) {
const [type,region] = item.split("_")
if (!resourceTypes.includes( type)){
resourceTypes.push(type)
}
if (!region){
continue;
}
const resourceType = resourceTypesRegions.find(item => item.ResourceType == type)
if (!resourceType){
resourceTypesRegions.push({
ResourceType: type,
Regions: [region]
})
}else{
resourceType.Regions.push(region)
}
}
// resourceTypes = ["clb"] //固定clb
const maxRetry = 10
for (const certId of this.certList) {
this.logger.info(`----------- 开始更新证书:${certId}`);
let deployRes = null
let retryCount = 0
while(true){
if (retryCount>maxRetry){
this.logger.error(`任务创建失败`);
break;
}
retryCount++
deployRes = await sslClient.UploadUpdateCertificateInstance({
OldCertificateId: certId,
"ResourceTypes": resourceTypes,
"CertificatePublicKey": this.cert.crt,
"CertificatePrivateKey": this.cert.key,
"ResourceTypesRegions":resourceTypesRegions
});
if (deployRes && deployRes.DeployRecordId>0){
this.logger.info(`任务创建成功,开始检查结果:${JSON.stringify(deployRes)}`);
break;
}else{
this.logger.info(`任务创建中,稍后查询:${JSON.stringify(deployRes)}`);
}
await this.ctx.utils.sleep(3000);
}
this.logger.info(`开始查询部署结果`);
retryCount=0
while(true){
if (retryCount>maxRetry){
this.logger.error(`任务结果检查失败`);
break;
}
retryCount++
//查询部署状态
const deployStatus = await sslClient.DescribeHostUploadUpdateRecordDetail({
"DeployRecordId":deployRes.DeployRecordId
})
const details = deployStatus.DeployRecordDetail
let allSuccess = true
for (const item of details) {
this.logger.info(`查询结果:${JSON.stringify(omit(item,"RecordDetailList"))}`);
if (item.Status === 2) {
throw new Error(`任务失败:${JSON.stringify(item.RecordDetailList)}`)
}else if (item.Status !== 1) {
//如果不是成功状态
allSuccess = false
}
}
if (allSuccess) {
break;
}
await this.ctx.utils.sleep(10000);
}
this.logger.info(`----------- 更新证书${certId}成功`);
}
}
async onGetRegionsTree(data: PageSearch = {}){
const commonRegions = [
/**
* 华南地区(广州) waf.ap-guangzhou.tencentcloudapi.com
* 华东地区(上海) waf.ap-shanghai.tencentcloudapi.com
* 华东地区(南京) waf.ap-nanjing.tencentcloudapi.com
* 华北地区(北京) waf.ap-beijing.tencentcloudapi.com
* 西南地区(成都) waf.ap-chengdu.tencentcloudapi.com
* 西南地区(重庆) waf.ap-chongqing.tencentcloudapi.com
* 港澳台地区(中国香港) waf.ap-hongkong.tencentcloudapi.com
* 亚太东南(新加坡) waf.ap-singapore.tencentcloudapi.com
* 亚太东南(雅加达) waf.ap-jakarta.tencentcloudapi.com
* 亚太东南(曼谷) waf.ap-bangkok.tencentcloudapi.com
* 亚太东北(首尔) waf.ap-seoul.tencentcloudapi.com
* 亚太东北(东京) waf.ap-tokyo.tencentcloudapi.com
* 美国东部(弗吉尼亚) waf.na-ashburn.tencentcloudapi.com
* 美国西部(硅谷) waf.na-siliconvalley.tencentcloudapi.com
* 南美地区(圣保罗) waf.sa-saopaulo.tencentcloudapi.com
* 欧洲地区(法兰克福) waf.eu-frankfurt.tencentcloudapi.com
*/
{value:"ap-guangzhou", label:"广州"},
{value:"ap-shanghai", label:"上海"},
{value:"ap-nanjing", label:"南京"},
{value:"ap-beijing", label:"北京"},
{value:"ap-chengdu", label:"成都"},
{value:"ap-chongqing", label:"重庆"},
{value:"ap-hongkong", label:"香港"},
{value:"ap-singapore", label:"新加坡"},
{value:"ap-jakarta", label:"雅加达"},
{value:"ap-bangkok", label:"曼谷"},
{value:"ap-tokyo", label:"东京"},
{value:"ap-seoul", label:"首尔"},
{value:"na-ashburn", label:"弗吉尼亚"},
{value:"na-siliconvalley", label:"硅谷"},
{value:"sa-saopaulo", label:"圣保罗"},
{value:"eu-frankfurt", label:"法兰克福"},
]
function buildTypeRegions(type: string) {
const options :any[]= []
for (const region of commonRegions) {
options.push({
label: type + "_" + region.label,
value: type + "_" + region.value,
});
}
return options
}
return [
{ value: 'cdn',label: 'CDN'},
{ value: 'ddos',label: 'DDoS'},
{ value: 'live',label: '直播'},
{ value: 'vod',label: '点播'},
{ value: 'teo',label: 'TEO'},
{ value: 'lighthouse',label: '轻应用服务器'},
{
label: "负载均衡(clb)",
value: "clb",
children: buildTypeRegions("clb"),
},
{
label: "Web应用防火墙(waf)",
value: "waf",
children: buildTypeRegions("waf"),
},
{
label: "API网关(apigateway)",
value: "apigateway",
children: buildTypeRegions("apigateway"),
},
{
label: "对象存储(COS)",
value: "cos",
children: buildTypeRegions("cos"),
},
{
label: "容器服务(tke)",
value: "tke",
children: buildTypeRegions("tke"),
},
{
label: "云原生微服务(tse)",
value: "tse",
children: buildTypeRegions("tse"),
},
{
label: "云开发(tcb)",
value: "tcb",
children: buildTypeRegions("tcb"),
},
]
}
async onGetCertList(data: PageSearch = {}) {
const access = await this.getAccess<TencentAccess>(this.accessId)
const sslClient = new TencentSslClient({
access:access,
logger: this.logger,
});
const pager = new Pager(data);
const offset = pager.getOffset();
const limit = pager.pageSize
const res = await sslClient.DescribeCertificates({Limit:limit,Offset:offset,SearchKey:data.searchKey})
const list = res.Certificates
if (!list || list.length === 0) {
throw new Error("没有找到证书你可以直接手动输入id");
}
/**
* certificate-id
* name
* dns-names
*/
const options = list.map((item: any) => {
return {
label: `${item.Alias}<${item.Domain}_${item.CertificateId}>`,
value: item.CertificateId,
domain: item.SubjectAltName,
};
});
return {
list: this.ctx.utils.options.buildGroupOptions(options, this.certDomains),
};
}
}
//实例化一下,注册插件
new TencentRefreshCert();

View File

@@ -65,7 +65,7 @@ export class UpyunClient {
Cookie: req.cookie
}
});
if (res.msg.errors.length > 0) {
if (res.msg?.errors?.length > 0) {
throw new Error(JSON.stringify(res.msg));
}
if(res.data?.error_code){

104
pnpm-lock.yaml generated
View File

@@ -49,7 +49,7 @@ importers:
packages/core/acme-client:
dependencies:
'@certd/basic':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../basic
'@peculiar/x509':
specifier: ^1.11.0
@@ -210,10 +210,10 @@ importers:
packages/core/pipeline:
dependencies:
'@certd/basic':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../basic
'@certd/plus-core':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../pro/plus-core
dayjs:
specifier: ^1.11.7
@@ -418,7 +418,7 @@ importers:
packages/libs/lib-k8s:
dependencies:
'@certd/basic':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/basic
'@kubernetes/client-node':
specifier: 0.21.0
@@ -458,16 +458,16 @@ importers:
packages/libs/lib-server:
dependencies:
'@certd/acme-client':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/acme-client
'@certd/basic':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/basic
'@certd/pipeline':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/pipeline
'@certd/plus-core':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../pro/plus-core
'@midwayjs/cache':
specifier: ~3.14.0
@@ -610,16 +610,16 @@ importers:
packages/plugins/plugin-cert:
dependencies:
'@certd/acme-client':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/acme-client
'@certd/basic':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/basic
'@certd/pipeline':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/pipeline
'@certd/plugin-lib':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../plugin-lib
'@google-cloud/publicca':
specifier: ^1.3.0
@@ -701,10 +701,10 @@ importers:
specifier: ^3.787.0
version: 3.810.0(aws-crt@1.26.2)
'@certd/basic':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/basic
'@certd/pipeline':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/pipeline
'@kubernetes/client-node':
specifier: 0.21.0
@@ -792,19 +792,19 @@ importers:
packages/pro/commercial-core:
dependencies:
'@certd/basic':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/basic
'@certd/lib-server':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../libs/lib-server
'@certd/pipeline':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/pipeline
'@certd/plugin-plus':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../plugin-plus
'@certd/plus-core':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../plus-core
'@midwayjs/core':
specifier: ~3.20.3
@@ -889,22 +889,22 @@ importers:
specifier: ^1.0.2
version: 1.0.3
'@certd/basic':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/basic
'@certd/lib-k8s':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../libs/lib-k8s
'@certd/pipeline':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/pipeline
'@certd/plugin-cert':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../plugins/plugin-cert
'@certd/plugin-lib':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../plugins/plugin-lib
'@certd/plus-core':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../plus-core
ali-oss:
specifier: ^6.21.0
@@ -1007,7 +1007,7 @@ importers:
packages/pro/plus-core:
dependencies:
'@certd/basic':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/basic
dayjs:
specifier: ^1.11.7
@@ -1297,10 +1297,10 @@ importers:
version: 0.1.3(zod@3.24.4)
devDependencies:
'@certd/lib-iframe':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../libs/lib-iframe
'@certd/pipeline':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/pipeline
'@rollup/plugin-commonjs':
specifier: ^25.0.7
@@ -1483,46 +1483,46 @@ importers:
specifier: ^3.705.0
version: 3.810.0(aws-crt@1.26.2)
'@certd/acme-client':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/acme-client
'@certd/basic':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/basic
'@certd/commercial-core':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../pro/commercial-core
'@certd/cv4pve-api-javascript':
specifier: ^8.4.2
version: 8.4.2
'@certd/jdcloud':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../libs/lib-jdcloud
'@certd/lib-huawei':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../libs/lib-huawei
'@certd/lib-k8s':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../libs/lib-k8s
'@certd/lib-server':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../libs/lib-server
'@certd/midway-flyway-js':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../libs/midway-flyway-js
'@certd/pipeline':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../core/pipeline
'@certd/plugin-cert':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../plugins/plugin-cert
'@certd/plugin-lib':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../plugins/plugin-lib
'@certd/plugin-plus':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../pro/plugin-plus
'@certd/plus-core':
specifier: ^1.36.17
specifier: ^1.36.18
version: link:../../pro/plus-core
'@huaweicloud/huaweicloud-sdk-cdn':
specifier: ^3.1.120
@@ -1708,8 +1708,8 @@ importers:
specifier: ^1.4.0
version: 1.4.0
tencentcloud-sdk-nodejs:
specifier: ^4.0.983
version: 4.1.37(encoding@0.1.13)
specifier: ^4.1.112
version: 4.1.112(encoding@0.1.13)
typeorm:
specifier: ^0.3.20
version: 0.3.24(better-sqlite3@11.10.0)(mysql2@3.14.1)(pg@8.16.0)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.100)(typescript@5.8.3))
@@ -12242,6 +12242,10 @@ packages:
temp-path@1.0.0:
resolution: {integrity: sha512-TvmyH7kC6ZVTYkqCODjJIbgvu0FKiwQpZ4D1aknE7xpcDf/qEOB8KZEK5ef2pfbVoiBhNWs3yx4y+ESMtNYmlg==}
tencentcloud-sdk-nodejs@4.1.112:
resolution: {integrity: sha512-30Ju53bTd3OjMRwfieDvEYvjHhHVg2Eqc0EM7H8gKEWq0y3xMEdrxgYRrjhIkRo5Doc5YEOl6uUJUCfeT7dmFA==}
engines: {node: '>=10'}
tencentcloud-sdk-nodejs@4.1.37:
resolution: {integrity: sha512-rQV/jaUHGsB71JarqFdDJTl5tC2kIavgSUqlh8JoOUNpfJoAD4qHm1GLdDTUTEPKhv3qF9Is3qo6lj4cG9kKuw==}
engines: {node: '>=10'}
@@ -27035,6 +27039,20 @@ snapshots:
temp-path@1.0.0: {}
tencentcloud-sdk-nodejs@4.1.112(encoding@0.1.13):
dependencies:
form-data: 3.0.3
get-stream: 6.0.1
https-proxy-agent: 5.0.1
is-stream: 2.0.1
json-bigint: 1.0.0
node-fetch: 2.7.0(encoding@0.1.13)
tslib: 1.13.0
uuid: 9.0.1
transitivePeerDependencies:
- encoding
- supports-color
tencentcloud-sdk-nodejs@4.1.37(encoding@0.1.13):
dependencies:
form-data: 3.0.3