mirror of https://github.com/certd/certd
chore:
parent
27b6dfa4d2
commit
cdd2816642
|
@ -89,7 +89,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
|
||||||
{ value: "letsencrypt", label: "Let's Encrypt", icon: "simple-icons:letsencrypt" },
|
{ value: "letsencrypt", label: "Let's Encrypt", icon: "simple-icons:letsencrypt" },
|
||||||
{ value: "google", label: "Google", icon: "flat-color-icons:google" },
|
{ value: "google", label: "Google", icon: "flat-color-icons:google" },
|
||||||
{ value: "zerossl", label: "ZeroSSL", icon: "emojione:digit-zero" },
|
{ 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授权,无需翻墙",
|
helper: "Let's Encrypt:申请最简单\nGoogle:大厂光环,兼容性好,仅首次需要翻墙获取EAB授权\nZeroSSL:需要EAB授权,无需翻墙",
|
||||||
|
|
|
@ -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();
|
Loading…
Reference in New Issue