chore: 优化阿里云cdn

This commit is contained in:
xiaojunnuo
2026-03-29 02:40:26 +08:00
parent a68301e4dc
commit 8debac2edf
4 changed files with 14 additions and 12 deletions

View File

@@ -588,7 +588,8 @@ class AcmeClient {
if (invalidStates.includes(resp.data.status)) { if (invalidStates.includes(resp.data.status)) {
abort(); abort();
throw new Error(util.formatResponseError(resp)); this.log(`[${d}] : 检查状态 = ${resp.data.status} ${JSON.stringify(resp.data)}`);
throw new Error("校验失败:" + util.formatResponseError(resp));
} }
else if (pendingStates.includes(resp.data.status)) { else if (pendingStates.includes(resp.data.status)) {
throw new Error(`[${d}] Operation is pending or processing当前仍然在等待状态`); throw new Error(`[${d}] Operation is pending or processing当前仍然在等待状态`);

View File

@@ -379,9 +379,9 @@ export abstract class AbstractTaskPlugin implements ITaskPlugin {
targetName: string; targetName: string;
getCertDomains: () => Promise<string[]>; getCertDomains: () => Promise<string[]>;
uploadCert: () => Promise<any>; uploadCert: () => Promise<any>;
deployOne: (req: { target: any; cert: any }) => Promise<void>; deployOne: (req: { target: CertTargetItem; cert: any }) => Promise<void>;
getDeployTargetList: (req: PageSearch) => Promise<{ list: CertTargetItem[]; total: number }>; getDeployTargetList: (req: PageSearch) => Promise<{ list: CertTargetItem[]; total: number }>;
}): Promise<{ result: any; deployedList: any[] }> { }): Promise<{ result: string; deployedList: string[] }> {
this.logger.info("证书匹配模式部署"); this.logger.info("证书匹配模式部署");
const certDomains = await req.getCertDomains(); const certDomains = await req.getCertDomains();
const certTargetList = await this.getAutoMatchedTargets({ const certTargetList = await this.getAutoMatchedTargets({

View File

@@ -1,5 +1,5 @@
import { optionsUtils } from '@certd/basic'; import { optionsUtils } from '@certd/basic';
import { AbstractTaskPlugin, IsTaskPlugin, Pager, PageSearch, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline'; import { AbstractTaskPlugin, CertTargetItem, IsTaskPlugin, Pager, PageSearch, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline';
import { CertApplyPluginNames, CertReader } from "@certd/plugin-cert"; import { CertApplyPluginNames, CertReader } from "@certd/plugin-cert";
import { CertInfo, createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from '@certd/plugin-lib'; import { CertInfo, createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from '@certd/plugin-lib';
import { AliyunAccess } from "../../../plugin-lib/aliyun/access/index.js"; import { AliyunAccess } from "../../../plugin-lib/aliyun/access/index.js";
@@ -10,11 +10,12 @@ import { AliyunClient, AliyunSslClient, CasCertId } from "../../../plugin-lib/al
icon: 'svg:icon-aliyun', icon: 'svg:icon-aliyun',
group: pluginGroups.aliyun.key, group: pluginGroups.aliyun.key,
desc: '自动部署域名证书至阿里云CDN', desc: '自动部署域名证书至阿里云CDN',
default: { runStrategy: RunStrategy.AlwaysRun,
strategy: { // default: {
runStrategy: RunStrategy.SkipWhenSucceed, // strategy: {
}, // runStrategy: RunStrategy.SkipWhenSucceed,
}, // },
// },
}) })
export class DeployCertToAliyunCDN extends AbstractTaskPlugin { export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
@TaskInput({ @TaskInput({
@@ -143,8 +144,8 @@ export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
uploadCert: async () => { uploadCert: async () => {
return await sslClient.uploadCertOrGet(this.cert); return await sslClient.uploadCertOrGet(this.cert);
}, },
deployOne: async (req: { target: any, cert: any }) => { deployOne: async (req: { target: CertTargetItem, cert: any }) => {
return await this.deployOne(client, req.target, req.cert); return await this.deployOne(client, req.target.value, req.cert);
}, },
getCertDomains:async ()=>{ getCertDomains:async ()=>{
return sslClient.getCertDomains(this.cert); return sslClient.getCertDomains(this.cert);

View File

@@ -108,7 +108,7 @@ export class DeployCertToAliyunDCDN extends AbstractTaskPlugin {
uploadCert: async () => { uploadCert: async () => {
return await sslClient.uploadCertOrGet(this.cert); return await sslClient.uploadCertOrGet(this.cert);
}, },
deployOne: async (req: { target: any, cert: any }) => { deployOne: async (req: { target: CertTargetItem, cert: any }) => {
return await this.deployOne(client, req.target.value, req.cert); return await this.deployOne(client, req.target.value, req.cert);
}, },
getCertDomains: async ()=>{ getCertDomains: async ()=>{