From 88d745e29063a089864fb9c6705be7b8d4c2669a Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Thu, 10 Oct 2024 14:38:40 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=B8=83=E7=89=9B=E4=BA=91cdn=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E9=85=8D=E7=BD=AE=E5=A4=9A=E4=B8=AA=E5=9F=9F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/deploy-to-cdn/index.ts | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/packages/ui/certd-server/src/plugins/plugin-qiniu/plugin/deploy-to-cdn/index.ts b/packages/ui/certd-server/src/plugins/plugin-qiniu/plugin/deploy-to-cdn/index.ts index 9ad04d1eb..338486cf5 100644 --- a/packages/ui/certd-server/src/plugins/plugin-qiniu/plugin/deploy-to-cdn/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-qiniu/plugin/deploy-to-cdn/index.ts @@ -18,9 +18,17 @@ export class QiniuDeployCertToCDN extends AbstractTaskPlugin { @TaskInput({ title: 'CDN加速域名', helper: '你在七牛云上配置的CDN加速域名,比如:certd.handsfree.work', + component: { + name: 'a-select', + vModel: 'value', + mode: 'tags', + open: false, + tokenSeparators: [',', ' ', ',', '、', '|'], + }, + rules: [{ type: 'domains' }], required: true, }) - domainName!: string; + domainName!: string | string[]; @TaskInput({ title: '域名证书', @@ -52,7 +60,7 @@ export class QiniuDeployCertToCDN extends AbstractTaskPlugin { http: this.ctx.http, access, }); - const url = `https://api.qiniu.com/domain/${this.domainName}/httpsconf`; + let certId = null; if (typeof this.cert !== 'string') { // 是证书id,直接上传即可 @@ -62,13 +70,17 @@ export class QiniuDeployCertToCDN extends AbstractTaskPlugin { certId = this.cert; } - //开始修改证书 - this.logger.info(`开始修改证书,certId:${certId},domain:${this.domainName}`); - const body = { - certID: certId, - }; - - await qiniuClient.doRequest(url, 'put', body); + const domains: string[] = typeof this.domainName === 'string' ? [this.domainName] : this.domainName; + for (const domain of domains) { + //开始修改证书 + this.logger.info(`开始修改证书,certId:${certId},domain:${domain}`); + const body = { + certID: certId, + }; + const url = `https://api.qiniu.com/domain/${domain}/httpsconf`; + await qiniuClient.doRequest(url, 'put', body); + this.logger.info(`修改证书成功,certId:${certId},domain:${domain}`); + } this.logger.info('部署完成'); }