v2
xiaojunnuo 2025-09-05 00:16:34 +08:00
parent 27b6dfa4d2
commit cdd2816642
2 changed files with 114 additions and 1 deletions

View File

@ -89,7 +89,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
{ value: "letsencrypt", label: "Let's Encrypt", icon: "simple-icons:letsencrypt" },
{ value: "google", label: "Google", icon: "flat-color-icons:google" },
{ value: "zerossl", label: "ZeroSSL", icon: "emojione:digit-zero" },
{ value: "sslcom", label: "SSL.com", icon: "la:expeditedssl" },
{ value: "sslcom", label: "SSL.com仅主域名和www免费", icon: "la:expeditedssl" },
],
},
helper: "Let's Encrypt申请最简单\nGoogle大厂光环兼容性好仅首次需要翻墙获取EAB授权\nZeroSSL需要EAB授权无需翻墙",

View File

@ -0,0 +1,113 @@
// 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();