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