From 759cfdaabd67813ad6e65c4ec199cdd2100e06c2 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Sat, 12 Apr 2025 00:14:55 +0800 Subject: [PATCH] =?UTF-8?q?pref:=20=E6=97=A5=E5=BF=97=E4=B8=AD=E5=8A=A0?= =?UTF-8?q?=E5=AF=86=E6=8E=88=E6=9D=83=E4=BF=A1=E6=81=AF=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E6=88=90=E6=98=9F=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/basic/src/utils/util.log.ts | 26 +++++++++++++----- .../core/pipeline/src/access/decorator.ts | 1 + .../core/pipeline/src/core/run-history.ts | 12 ++++----- packages/core/pipeline/src/plugin/api.ts | 27 ++++++++++++++++--- .../src/plugin/cert-plugin/index.ts | 16 +++++------ .../modules/plugin/service/default-plugin.ts | 2 +- .../plugin/deploy-to-alb/index.ts | 8 +++--- .../plugin/deploy-to-cdn/index.ts | 4 +-- .../plugin/deploy-to-dcdn/index.ts | 2 +- .../plugin/deploy-to-fc/index.ts | 4 +-- .../plugin/deploy-to-nlb/index.ts | 8 +++--- .../plugin/deploy-to-oss/index.ts | 2 +- .../plugin/deploy-to-slb/index.ts | 8 +++--- .../plugin/deploy-to-waf/index.ts | 4 +-- .../plugin/upload-to-aliyun/index.ts | 2 +- .../plugins/plugin-upload-to-acm.ts | 2 +- .../plugins/plugin-deploy-to-cdn.ts | 2 +- .../plugin-demo/plugins/plugin-test.ts | 4 +-- .../plugins/deploy-to-cdn/index.ts | 2 +- .../plugin-gcore/plugins/plugin-flush.ts | 2 +- .../plugin-gcore/plugins/plugin-upload.ts | 2 +- .../plugin/host-shell-execute/index.ts | 2 +- .../plugin/upload-to-host/index.ts | 4 +-- .../plugins/deploy-to-cdn/index.ts | 2 +- .../plugins/plugin-deploy-to-cdn.ts | 4 +-- .../plugins/plugin-update-cert.ts | 4 +-- .../plugins/plugin-upload-cert.ts | 2 +- .../plugin-other/plugins/plugin-db-backup.ts | 2 +- .../plugin-proxmox/plugins/plugin-upload.ts | 2 +- .../plugin/deploy-to-cdn/index.ts | 4 +-- .../plugin-qiniu/plugin/upload-cert/index.ts | 2 +- .../plugin-qnap/plugins/plugin-qnap.ts | 2 +- .../plugin/delete-expiring-cert/index.ts | 2 +- .../plugin/deploy-to-all/index.ts | 2 +- .../plugin/deploy-to-cdn-v2/index.ts | 4 +-- .../plugin/deploy-to-cdn/index.ts | 2 +- .../plugin/deploy-to-clb/index.ts | 2 +- .../plugin/deploy-to-cos/index.ts | 4 +-- .../plugin/deploy-to-eo/index.ts | 2 +- .../plugin/deploy-to-live/index.ts | 4 +-- .../plugin/deploy-to-tke-ingress/index.ts | 2 +- .../plugin/start-instances/index.ts | 2 +- .../plugin/upload-to-tencent/index.ts | 4 +-- .../plugins/plugin-depoy-to-cdn.ts | 4 +-- .../plugins/plugin-deploy-to-cdn.ts | 4 +-- .../plugins/plugin-deploy-to-cdn.ts | 2 +- 46 files changed, 122 insertions(+), 88 deletions(-) diff --git a/packages/core/basic/src/utils/util.log.ts b/packages/core/basic/src/utils/util.log.ts index f65a0797..88c209ed 100644 --- a/packages/core/basic/src/utils/util.log.ts +++ b/packages/core/basic/src/utils/util.log.ts @@ -1,4 +1,4 @@ -import log4js, { LoggingEvent, Logger } from 'log4js'; +import log4js, { LoggingEvent, Logger } from "log4js"; const OutputAppender = { configure: (config: any, layouts: any, findAppender: any, levels: any) => { @@ -21,17 +21,29 @@ const OutputAppender = { export function resetLogConfigure() { // @ts-ignore log4js.configure({ - appenders: { std: { type: 'stdout' }, output: { type: OutputAppender } }, - categories: { default: { appenders: ['std'], level: 'info' }, pipeline: { appenders: ['std', 'output'], level: 'info' } }, + appenders: { std: { type: "stdout" }, output: { type: OutputAppender } }, + categories: { default: { appenders: ["std"], level: "info" }, pipeline: { appenders: ["std", "output"], level: "info" } }, }); } resetLogConfigure(); -export const logger = log4js.getLogger('default'); +export const logger = log4js.getLogger("default"); export function buildLogger(write: (text: string) => void) { - const logger = log4js.getLogger('pipeline'); - logger.addContext('outputHandler', { - write, + const logger = log4js.getLogger("pipeline"); + const _secrets: string[] = []; + //@ts-ignore + logger.addSecret = (secret: string) => { + _secrets.push(secret); + }; + logger.addContext("outputHandler", { + write: (text: string) => { + for (const item of _secrets) { + //换成同长度的*号, item可能有多行 + const reg = new RegExp(item, "g"); + text = text.replaceAll(reg, "*".repeat(item.length)); + write(text); + } + }, }); return logger; } diff --git a/packages/core/pipeline/src/access/decorator.ts b/packages/core/pipeline/src/access/decorator.ts index a0c19eee..b131ecd1 100644 --- a/packages/core/pipeline/src/access/decorator.ts +++ b/packages/core/pipeline/src/access/decorator.ts @@ -57,5 +57,6 @@ export function newAccess(type: string, input: any, ctx?: AccessContext) { }; } access.setCtx(ctx); + access._type = type; return access; } diff --git a/packages/core/pipeline/src/core/run-history.ts b/packages/core/pipeline/src/core/run-history.ts index 9c472ee6..fdb26a0c 100644 --- a/packages/core/pipeline/src/core/run-history.ts +++ b/packages/core/pipeline/src/core/run-history.ts @@ -150,11 +150,11 @@ export class RunnableCollection { pipeline.stages = []; return; } - pipeline.stages.forEach((stage) => { + pipeline.stages.forEach(stage => { stage.runnableType = "stage"; - stage.tasks.forEach((task) => { + stage.tasks.forEach(task => { task.runnableType = "task"; - task.steps.forEach((step) => { + task.steps.forEach(step => { step.runnableType = "step"; }); }); @@ -162,7 +162,7 @@ export class RunnableCollection { } static each(list: T[], exec: (item: Runnable) => void) { - list.forEach((item) => { + list.forEach(item => { exec(item); if (item.runnableType === "pipeline") { // @ts-ignore @@ -179,7 +179,7 @@ export class RunnableCollection { public toMap(pipeline: Pipeline) { const map: RunnableMap = {}; - RunnableCollection.each(pipeline.stages, (item) => { + RunnableCollection.each(pipeline.stages, item => { map[item.id] = item; }); return map; @@ -193,7 +193,7 @@ export class RunnableCollection { if (!this.pipeline) { return; } - RunnableCollection.each(this.pipeline.stages, (item) => { + RunnableCollection.each(this.pipeline.stages, item => { item.status = undefined; }); } diff --git a/packages/core/pipeline/src/plugin/api.ts b/packages/core/pipeline/src/plugin/api.ts index 20f5ff54..21c28792 100644 --- a/packages/core/pipeline/src/plugin/api.ts +++ b/packages/core/pipeline/src/plugin/api.ts @@ -1,7 +1,7 @@ import { Registrable } from "../registry/index.js"; import { FileItem, FormItemProps, Pipeline, Runnable, Step } from "../dt/index.js"; import { FileStore } from "../core/file-store.js"; -import { IAccessService } from "../access/index.js"; +import { accessRegistry, IAccessService } from "../access/index.js"; import { ICnameProxyService, IEmailService, IServiceGetter, IUrlService } from "../service/index.js"; import { CancelError, IContext, RunHistory, RunnableCollection } from "../core/index.js"; import { HttpRequestConfig, ILogger, logger, utils } from "@certd/basic"; @@ -158,14 +158,35 @@ export abstract class AbstractTaskPlugin implements ITaskPlugin { this.http = ctx.http; } - async getAccess(accessId: string) { + async getAccess(accessId: string | number, isCommon = false) { if (accessId == null) { throw new Error("您还没有配置授权"); } - const res = await this.ctx.accessService.getById(accessId); + let res: any = null; + if (isCommon) { + res = await this.ctx.accessService.getCommonById(accessId); + } else { + res = await this.ctx.accessService.getById(accessId); + } if (res == null) { throw new Error("授权不存在,可能已被删除,请前往任务配置里面重新选择授权"); } + // @ts-ignore + if (this.logger?.addSecret) { + // 隐藏加密信息,不在日志中输出 + const type = res._type; + const plugin = accessRegistry.get(type); + const define = plugin.define; + // @ts-ignore + const input = define.input; + for (const key in input) { + if (input[key].encrypt) { + // @ts-ignore + this.logger.addSecret(res[key]); + } + } + } + return res as T; } diff --git a/packages/plugins/plugin-cert/src/plugin/cert-plugin/index.ts b/packages/plugins/plugin-cert/src/plugin/cert-plugin/index.ts index c2a83bf6..5923c343 100644 --- a/packages/plugins/plugin-cert/src/plugin/cert-plugin/index.ts +++ b/packages/plugins/plugin-cert/src/plugin/cert-plugin/index.ts @@ -288,7 +288,7 @@ HTTP文件验证:不支持泛域名,需要配置网站文件上传`, if (this.sslProvider === "google") { if (this.googleAccessId) { this.logger.info("当前正在使用 google服务账号授权获取EAB"); - const googleAccess = await this.ctx.accessService.getById(this.googleAccessId); + const googleAccess = await this.getAccess(this.googleAccessId); const googleClient = new GoogleClient({ access: googleAccess, logger: this.logger, @@ -296,20 +296,20 @@ HTTP文件验证:不支持泛域名,需要配置网站文件上传`, eab = await googleClient.getEab(); } else if (this.eabAccessId) { this.logger.info("当前正在使用 google EAB授权"); - eab = await this.ctx.accessService.getById(this.eabAccessId); + eab = await this.getAccess(this.eabAccessId); } else if (this.googleCommonEabAccessId) { this.logger.info("当前正在使用 google公共EAB授权"); - eab = await this.ctx.accessService.getCommonById(this.googleCommonEabAccessId); + eab = await this.getAccess(this.googleCommonEabAccessId, true); } else { throw new Error("google需要配置EAB授权或服务账号授权"); } } else if (this.sslProvider === "zerossl") { if (this.eabAccessId) { this.logger.info("当前正在使用 zerossl EAB授权"); - eab = await this.ctx.accessService.getById(this.eabAccessId); + eab = await this.getAccess(this.eabAccessId); } else if (this.zerosslCommonEabAccessId) { this.logger.info("当前正在使用 zerossl 公共EAB授权"); - eab = await this.ctx.accessService.getCommonById(this.zerosslCommonEabAccessId); + eab = await this.getAccess(this.zerosslCommonEabAccessId, true); } else { throw new Error("zerossl需要配置EAB授权"); } @@ -359,7 +359,7 @@ HTTP文件验证:不支持泛域名,需要配置网站文件上传`, domainsVerifyPlan = await this.createDomainsVerifyPlan(); } else { const dnsProviderType = this.dnsProviderType; - const access = await this.ctx.accessService.getById(this.dnsProviderAccess); + const access = await this.getAccess(this.dnsProviderAccess); dnsProvider = await this.createDnsProvider(dnsProviderType, access); } @@ -406,7 +406,7 @@ HTTP文件验证:不支持泛域名,需要配置网站文件上传`, const cnameVerifyPlan: Record = {}; const httpVerifyPlan: Record = {}; if (domainVerifyPlan.type === "dns") { - const access = await this.ctx.accessService.getById(domainVerifyPlan.dnsProviderAccessId); + const access = await this.getAccess(domainVerifyPlan.dnsProviderAccessId); dnsProvider = await this.createDnsProvider(domainVerifyPlan.dnsProviderType, access); } else if (domainVerifyPlan.type === "cname") { for (const key in domainVerifyPlan.cnameVerifyPlan) { @@ -430,7 +430,7 @@ HTTP文件验证:不支持泛域名,需要配置网站文件上传`, }; for (const key in domainVerifyPlan.httpVerifyPlan) { const httpRecord = domainVerifyPlan.httpVerifyPlan[key]; - const access = await this.ctx.accessService.getById(httpRecord.httpUploaderAccess); + const access = await this.getAccess(httpRecord.httpUploaderAccess); let rootDir = httpRecord.httpUploadRootDir; if (!rootDir.endsWith("/") && !rootDir.endsWith("\\")) { rootDir = rootDir + "/"; diff --git a/packages/ui/certd-server/src/modules/plugin/service/default-plugin.ts b/packages/ui/certd-server/src/modules/plugin/service/default-plugin.ts index e876aaf0..74e65a84 100644 --- a/packages/ui/certd-server/src/modules/plugin/service/default-plugin.ts +++ b/packages/ui/certd-server/src/modules/plugin/service/default-plugin.ts @@ -110,7 +110,7 @@ return class DemoTask extends AbstractTaskPlugin { // 编写执行方法 async execute(){ # 根据accessId获取授权配置 - const access = await this.accessService.getById(this.accessId) + const access = await this.getAccess(this.accessId) //必须使用this.logger打印日志 // this.logger.info("cert:",this.cert); diff --git a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-alb/index.ts b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-alb/index.ts index d64a9acd..40d5cc50 100644 --- a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-alb/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-alb/index.ts @@ -108,7 +108,7 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin { async execute(): Promise { this.logger.info(`开始部署证书到阿里云(alb)`); - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const certId = await this.getAliyunCertId(access); const client = await this.getLBClient(access, this.regionId); @@ -155,7 +155,7 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin { if (!this.accessId) { throw new Error('请选择Access授权'); } - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = await this.getLBClient(access, 'cn-shanghai'); const res = await client.request('DescribeRegions', {}); @@ -180,7 +180,7 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin { if (!this.regionId) { throw new Error('请先选择地区'); } - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = await this.getLBClient(access, this.regionId); const params = { @@ -208,7 +208,7 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin { if (!this.regionId) { throw new Error('请先选择地区'); } - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = await this.getLBClient(access, this.regionId); const params: any = { diff --git a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-cdn/index.ts b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-cdn/index.ts index af182414..fa5d94fb 100644 --- a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-cdn/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-cdn/index.ts @@ -77,7 +77,7 @@ export class DeployCertToAliyunCDN extends AbstractTaskPlugin { async onInstance() {} async execute(): Promise { this.logger.info('开始部署证书到阿里云cdn'); - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const sslClient = new AliyunSslClient({ access, logger: this.logger, @@ -151,7 +151,7 @@ export class DeployCertToAliyunCDN extends AbstractTaskPlugin { if (!this.accessId) { throw new Error('请选择Access授权'); } - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = await this.getClient(access); diff --git a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-dcdn/index.ts b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-dcdn/index.ts index edabe09f..cd864c3c 100644 --- a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-dcdn/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-dcdn/index.ts @@ -57,7 +57,7 @@ export class DeployCertToAliyunDCDN extends AbstractTaskPlugin { async onInstance() {} async execute(): Promise { this.logger.info('开始部署证书到阿里云DCDN'); - const access = (await this.accessService.getById(this.accessId)) as AliyunAccess; + const access = (await this.getAccess(this.accessId)) as AliyunAccess; const client = await this.getClient(access); const params = await this.buildParams(); await this.doRequest(client, params); diff --git a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-fc/index.ts b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-fc/index.ts index b67decf6..12d3857e 100644 --- a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-fc/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-fc/index.ts @@ -116,7 +116,7 @@ export class AliyunDeployCertToFC extends AbstractPlusTaskPlugin { async execute(): Promise { this.logger.info('开始部署证书到阿里云'); - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = await this.getClient(access); @@ -177,7 +177,7 @@ export class AliyunDeployCertToFC extends AbstractPlusTaskPlugin { if (!this.accessId) { throw new Error('请选择Access授权'); } - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = await this.getClient(access); const $OpenApi = await import('@alicloud/openapi-client'); diff --git a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-nlb/index.ts b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-nlb/index.ts index 65577d76..b8c46471 100644 --- a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-nlb/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-nlb/index.ts @@ -108,7 +108,7 @@ export class AliyunDeployCertToNLB extends AbstractTaskPlugin { async execute(): Promise { this.logger.info(`开始部署证书到阿里云(nlb)`); - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const certId = await this.getAliyunCertId(access); const client = await this.getLBClient(access, this.regionId); @@ -151,7 +151,7 @@ export class AliyunDeployCertToNLB extends AbstractTaskPlugin { if (!this.accessId) { throw new Error('请选择Access授权'); } - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = await this.getLBClient(access, 'cn-shanghai'); const res = await client.request('DescribeRegions', {}); @@ -176,7 +176,7 @@ export class AliyunDeployCertToNLB extends AbstractTaskPlugin { if (!this.regionId) { throw new Error('请先选择地区'); } - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = await this.getLBClient(access, this.regionId); const params = { @@ -204,7 +204,7 @@ export class AliyunDeployCertToNLB extends AbstractTaskPlugin { if (!this.regionId) { throw new Error('请先选择地区'); } - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = await this.getLBClient(access, this.regionId); const params: any = { diff --git a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-oss/index.ts b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-oss/index.ts index d75a685b..6b087488 100644 --- a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-oss/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-oss/index.ts @@ -102,7 +102,7 @@ export class DeployCertToAliyunOSS extends AbstractTaskPlugin { async onInstance() {} async execute(): Promise { this.logger.info('开始部署证书到阿里云OSS'); - const access = (await this.accessService.getById(this.accessId)) as AliyunAccess; + const access = (await this.getAccess(this.accessId)) as AliyunAccess; this.logger.info(`bucket: ${this.bucket}, region: ${this.region}, domainName: ${this.domainName}`); const client = await this.getClient(access); await this.doRequest(client, {}); diff --git a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-slb/index.ts b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-slb/index.ts index f5667fa3..4c9bce66 100644 --- a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-slb/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-slb/index.ts @@ -107,7 +107,7 @@ export class AliyunDeployCertToSLB extends AbstractTaskPlugin { async execute(): Promise { this.logger.info(`开始部署证书到阿里云(slb)`); - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = await this.getLBClient(access, this.regionId); const aliyunCert = await this.getAliyunCertId(access); @@ -167,7 +167,7 @@ export class AliyunDeployCertToSLB extends AbstractTaskPlugin { if (!this.accessId) { throw new Error('请选择Access授权'); } - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = await this.getLBClient(access, 'cn-shanghai'); const res = await client.request('DescribeRegions', {}); @@ -192,7 +192,7 @@ export class AliyunDeployCertToSLB extends AbstractTaskPlugin { if (!this.regionId) { throw new Error('请先选择地区'); } - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = await this.getLBClient(access, this.regionId); const params = { @@ -221,7 +221,7 @@ export class AliyunDeployCertToSLB extends AbstractTaskPlugin { if (!this.regionId) { throw new Error('请先选择地区'); } - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = await this.getLBClient(access, this.regionId); const params: any = { diff --git a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-waf/index.ts b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-waf/index.ts index 8fe04519..d8588ce6 100644 --- a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-waf/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/deploy-to-waf/index.ts @@ -109,7 +109,7 @@ export class AliyunDeployCertToWaf extends AbstractPlusTaskPlugin { async execute(): Promise { this.logger.info('开始部署证书到阿里云'); - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); let certId: any = this.cert; if (typeof this.cert === 'object') { const sslClient = new AliyunSslClient({ @@ -163,7 +163,7 @@ export class AliyunDeployCertToWaf extends AbstractPlusTaskPlugin { if (!this.accessId) { throw new Error('请选择Access授权'); } - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = await this.getWafClient(access); const instanceId = await this.getInstanceId(client); diff --git a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/upload-to-aliyun/index.ts b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/upload-to-aliyun/index.ts index 47331a67..89305e5e 100644 --- a/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/upload-to-aliyun/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-aliyun/plugin/upload-to-aliyun/index.ts @@ -83,7 +83,7 @@ export class UploadCertToAliyun extends AbstractTaskPlugin { async execute(): Promise { this.logger.info('开始部署证书到阿里云cdn'); - const access: AliyunAccess = await this.accessService.getById(this.accessId); + const access: AliyunAccess = await this.getAccess(this.accessId); let endpoint = ''; for (const region of regionDict) { diff --git a/packages/ui/certd-server/src/plugins/plugin-aws/plugins/plugin-upload-to-acm.ts b/packages/ui/certd-server/src/plugins/plugin-aws/plugins/plugin-upload-to-acm.ts index 97677d04..2b9116a2 100644 --- a/packages/ui/certd-server/src/plugins/plugin-aws/plugins/plugin-upload-to-acm.ts +++ b/packages/ui/certd-server/src/plugins/plugin-aws/plugins/plugin-upload-to-acm.ts @@ -58,7 +58,7 @@ export class AwsUploadToACM extends AbstractTaskPlugin { async execute(): Promise { const { cert, accessId, region } = this; - const access = await this.accessService.getById(accessId); + const access = await this.getAccess(accessId); const acmClient = new AwsAcmClient({ access, region, diff --git a/packages/ui/certd-server/src/plugins/plugin-cachefly/plugins/plugin-deploy-to-cdn.ts b/packages/ui/certd-server/src/plugins/plugin-cachefly/plugins/plugin-deploy-to-cdn.ts index d6f2c697..0df70084 100644 --- a/packages/ui/certd-server/src/plugins/plugin-cachefly/plugins/plugin-deploy-to-cdn.ts +++ b/packages/ui/certd-server/src/plugins/plugin-cachefly/plugins/plugin-deploy-to-cdn.ts @@ -56,7 +56,7 @@ export class CacheFlyPlugin extends AbstractTaskPlugin { async execute(): Promise { const { cert, accessId } = this; - const access = (await this.accessService.getById(accessId)) as CacheflyAccess; + const access = (await this.getAccess(accessId)) as CacheflyAccess; let otp = null; if (access.otpkey) { const response = await this.http.request({ diff --git a/packages/ui/certd-server/src/plugins/plugin-demo/plugins/plugin-test.ts b/packages/ui/certd-server/src/plugins/plugin-demo/plugins/plugin-test.ts index 76bae8b6..11b13964 100644 --- a/packages/ui/certd-server/src/plugins/plugin-demo/plugins/plugin-test.ts +++ b/packages/ui/certd-server/src/plugins/plugin-demo/plugins/plugin-test.ts @@ -140,7 +140,7 @@ export class DemoTest extends AbstractTaskPlugin { const { select, text, cert, accessId } = this; try { - const access = await this.accessService.getById(accessId); + const access = await this.getAccess(accessId); this.logger.debug('access', access); } catch (e) { this.logger.error('获取授权失败', e); @@ -177,7 +177,7 @@ export class DemoTest extends AbstractTaskPlugin { } // @ts-ignore - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); // const siteRes = await this.ctx.http.request({ // url: '你的服务端获取选项的请求地址', diff --git a/packages/ui/certd-server/src/plugins/plugin-doge/plugins/deploy-to-cdn/index.ts b/packages/ui/certd-server/src/plugins/plugin-doge/plugins/deploy-to-cdn/index.ts index a8bd3ccd..7c75669e 100644 --- a/packages/ui/certd-server/src/plugins/plugin-doge/plugins/deploy-to-cdn/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-doge/plugins/deploy-to-cdn/index.ts @@ -59,7 +59,7 @@ export class DogeCloudDeployToCDNPlugin extends AbstractTaskPlugin { dogeClient!: DogeClient; async onInstance() { - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); this.dogeClient = new DogeClient(access, this.ctx.http); } async execute(): Promise { diff --git a/packages/ui/certd-server/src/plugins/plugin-gcore/plugins/plugin-flush.ts b/packages/ui/certd-server/src/plugins/plugin-gcore/plugins/plugin-flush.ts index 975ee6d1..9b345864 100644 --- a/packages/ui/certd-server/src/plugins/plugin-gcore/plugins/plugin-flush.ts +++ b/packages/ui/certd-server/src/plugins/plugin-gcore/plugins/plugin-flush.ts @@ -66,7 +66,7 @@ export class GcoreflushPlugin extends AbstractTaskPlugin { async execute(): Promise { const { cert, accessId } = this; - const access = (await this.accessService.getById(accessId)) as GcoreAccess; + const access = (await this.getAccess(accessId)) as GcoreAccess; let otp = null; if (access.otpkey) { const response = await this.http.request({ diff --git a/packages/ui/certd-server/src/plugins/plugin-gcore/plugins/plugin-upload.ts b/packages/ui/certd-server/src/plugins/plugin-gcore/plugins/plugin-upload.ts index 0085686e..c61a1a47 100644 --- a/packages/ui/certd-server/src/plugins/plugin-gcore/plugins/plugin-upload.ts +++ b/packages/ui/certd-server/src/plugins/plugin-gcore/plugins/plugin-upload.ts @@ -62,7 +62,7 @@ export class GcoreuploadPlugin extends AbstractTaskPlugin { async execute(): Promise { const { cert, accessId } = this; - const access = (await this.accessService.getById(accessId)) as GcoreAccess; + const access = (await this.getAccess(accessId)) as GcoreAccess; let otp = null; if (access.otpkey) { const response = await this.http.request({ diff --git a/packages/ui/certd-server/src/plugins/plugin-host/plugin/host-shell-execute/index.ts b/packages/ui/certd-server/src/plugins/plugin-host/plugin/host-shell-execute/index.ts index 17d06899..7dffc408 100644 --- a/packages/ui/certd-server/src/plugins/plugin-host/plugin/host-shell-execute/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-host/plugin/host-shell-execute/index.ts @@ -41,7 +41,7 @@ export class HostShellExecutePlugin extends AbstractTaskPlugin { async onInstance() {} async execute(): Promise { const { script, accessId } = this; - const connectConf = await this.accessService.getById(accessId); + const connectConf = await this.getAccess(accessId); const sshClient = new SshClient(this.logger); const scripts = script.split('\n'); diff --git a/packages/ui/certd-server/src/plugins/plugin-host/plugin/upload-to-host/index.ts b/packages/ui/certd-server/src/plugins/plugin-host/plugin/upload-to-host/index.ts index 2e3d801e..4def0157 100644 --- a/packages/ui/certd-server/src/plugins/plugin-host/plugin/upload-to-host/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-host/plugin/upload-to-host/index.ts @@ -278,7 +278,7 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin { this.logger.error('复制到当前主机功能已迁移到 “复制到本机”插件,请换成复制到本机插件'); return; } - const connectConf: SshAccess = await this.accessService.getById(accessId); + const connectConf: SshAccess = await this.getAccess(accessId); const sshClient = new SshClient(this.logger); if (!accessId) { @@ -370,7 +370,7 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin { }); if (this.script && this.script?.trim()) { - const connectConf: SshAccess = await this.accessService.getById(accessId); + const connectConf: SshAccess = await this.getAccess(accessId); const sshClient = new SshClient(this.logger); this.logger.info('执行脚本命令'); diff --git a/packages/ui/certd-server/src/plugins/plugin-huawei/plugins/deploy-to-cdn/index.ts b/packages/ui/certd-server/src/plugins/plugin-huawei/plugins/deploy-to-cdn/index.ts index 85079928..5827b37b 100644 --- a/packages/ui/certd-server/src/plugins/plugin-huawei/plugins/deploy-to-cdn/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-huawei/plugins/deploy-to-cdn/index.ts @@ -79,7 +79,7 @@ export class HauweiDeployCertToCDN extends AbstractTaskPlugin { } async getCdnClient() { - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const { BasicCredentials } = await import('@huaweicloud/huaweicloud-sdk-core'); const cdn = await import('@huaweicloud/huaweicloud-sdk-cdn/v2/public-api.js'); //恢复华为云把log4j的config改了的问题 diff --git a/packages/ui/certd-server/src/plugins/plugin-jdcloud/plugins/plugin-deploy-to-cdn.ts b/packages/ui/certd-server/src/plugins/plugin-jdcloud/plugins/plugin-deploy-to-cdn.ts index c9347abd..a5f7069e 100644 --- a/packages/ui/certd-server/src/plugins/plugin-jdcloud/plugins/plugin-deploy-to-cdn.ts +++ b/packages/ui/certd-server/src/plugins/plugin-jdcloud/plugins/plugin-deploy-to-cdn.ts @@ -61,7 +61,7 @@ export class JDCloudDeployToCDN extends AbstractTaskPlugin { async execute(): Promise { this.logger.info("开始部署证书到京东云CDN"); - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const service = await this.getClient(access); let certId = this.cert; @@ -145,7 +145,7 @@ export class JDCloudDeployToCDN extends AbstractTaskPlugin { if (!this.accessId) { throw new Error("请选择Access授权"); } - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const service = await this.getClient(access); /** diff --git a/packages/ui/certd-server/src/plugins/plugin-jdcloud/plugins/plugin-update-cert.ts b/packages/ui/certd-server/src/plugins/plugin-jdcloud/plugins/plugin-update-cert.ts index a17f6a92..e8a81057 100644 --- a/packages/ui/certd-server/src/plugins/plugin-jdcloud/plugins/plugin-update-cert.ts +++ b/packages/ui/certd-server/src/plugins/plugin-jdcloud/plugins/plugin-update-cert.ts @@ -60,7 +60,7 @@ export class JDCloudUpdateCert extends AbstractTaskPlugin { async onInstance() {} async execute(): Promise { this.logger.info('开始部署证书到京东云CDN'); - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const service = await this.getClient(access) // let certId = this.cert @@ -119,7 +119,7 @@ export class JDCloudUpdateCert extends AbstractTaskPlugin { if (!this.accessId) { throw new Error('请选择Access授权'); } - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const service = await this.getClient(access); /** diff --git a/packages/ui/certd-server/src/plugins/plugin-jdcloud/plugins/plugin-upload-cert.ts b/packages/ui/certd-server/src/plugins/plugin-jdcloud/plugins/plugin-upload-cert.ts index 6041aa02..79cd95de 100644 --- a/packages/ui/certd-server/src/plugins/plugin-jdcloud/plugins/plugin-upload-cert.ts +++ b/packages/ui/certd-server/src/plugins/plugin-jdcloud/plugins/plugin-upload-cert.ts @@ -56,7 +56,7 @@ export class JDCloudUploadCert extends AbstractTaskPlugin { async execute(): Promise { this.logger.info("开始上传证书到京东云数字证书中心"); - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const service = await this.getClient(access); diff --git a/packages/ui/certd-server/src/plugins/plugin-other/plugins/plugin-db-backup.ts b/packages/ui/certd-server/src/plugins/plugin-other/plugins/plugin-db-backup.ts index cd02d340..8ccf4515 100644 --- a/packages/ui/certd-server/src/plugins/plugin-other/plugins/plugin-db-backup.ts +++ b/packages/ui/certd-server/src/plugins/plugin-other/plugins/plugin-db-backup.ts @@ -190,7 +190,7 @@ export class DBBackupPlugin extends AbstractPlusTaskPlugin { } private async sshBackup(dbPath: string, backupDir: string, backupPath: string) { - const access: SshAccess = await this.ctx.accessService.getById(this.sshAccessId); + const access: SshAccess = await this.getAccess(this.sshAccessId); const sshClient = new SshClient(this.logger); this.logger.info('备份目录:', backupPath); await sshClient.uploadFiles({ diff --git a/packages/ui/certd-server/src/plugins/plugin-proxmox/plugins/plugin-upload.ts b/packages/ui/certd-server/src/plugins/plugin-proxmox/plugins/plugin-upload.ts index 2c102b6a..f70c1a6d 100644 --- a/packages/ui/certd-server/src/plugins/plugin-proxmox/plugins/plugin-upload.ts +++ b/packages/ui/certd-server/src/plugins/plugin-proxmox/plugins/plugin-upload.ts @@ -92,7 +92,7 @@ export class ProxmoxUploadCert extends AbstractPlusTaskPlugin { } async getClient() { - const access: ProxmoxAccess = await this.accessService.getById(this.accessId); + const access: ProxmoxAccess = await this.getAccess(this.accessId); const pve = await import('@corsinvest/cv4pve-api-javascript'); const client = new pve.PveClient(access.host, access.port); const login = await client.login(access.username, access.password, 'pam'); 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 68741098..af328c4d 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 @@ -55,7 +55,7 @@ export class QiniuDeployCertToCDN extends AbstractTaskPlugin { async onInstance() {} async execute(): Promise { this.logger.info('开始部署证书到七牛云cdn'); - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const qiniuClient = new QiniuClient({ http: this.ctx.http, access, @@ -104,7 +104,7 @@ export class QiniuDeployCertToCDN extends AbstractTaskPlugin { } async onGetDomainList() { - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const qiniuClient = new QiniuClient({ http: this.ctx.http, access, diff --git a/packages/ui/certd-server/src/plugins/plugin-qiniu/plugin/upload-cert/index.ts b/packages/ui/certd-server/src/plugins/plugin-qiniu/plugin/upload-cert/index.ts index db34bab9..349461a9 100644 --- a/packages/ui/certd-server/src/plugins/plugin-qiniu/plugin/upload-cert/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-qiniu/plugin/upload-cert/index.ts @@ -51,7 +51,7 @@ export class QiniuCertUpload extends AbstractTaskPlugin { async onInstance() {} async execute(): Promise { this.logger.info('开始上传证书到七牛云'); - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const qiniuClient = new QiniuClient({ http: this.ctx.http, access, diff --git a/packages/ui/certd-server/src/plugins/plugin-qnap/plugins/plugin-qnap.ts b/packages/ui/certd-server/src/plugins/plugin-qnap/plugins/plugin-qnap.ts index 4aa5b3c3..42d6e87e 100644 --- a/packages/ui/certd-server/src/plugins/plugin-qnap/plugins/plugin-qnap.ts +++ b/packages/ui/certd-server/src/plugins/plugin-qnap/plugins/plugin-qnap.ts @@ -51,7 +51,7 @@ export class QnapDeploy extends AbstractPlusTaskPlugin { throw new Error('主机登录授权配置不能为空'); } - const connectConf = await this.ctx.accessService.getById(accessId); + const connectConf = await this.getAccess(accessId); const sshClient = new SshClient(this.logger); //合并证书 const newCert = cert.key + '\n' + cert.crt; diff --git a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/delete-expiring-cert/index.ts b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/delete-expiring-cert/index.ts index 16621791..5dd12b59 100644 --- a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/delete-expiring-cert/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/delete-expiring-cert/index.ts @@ -79,7 +79,7 @@ export class TencentDeleteExpiringCert extends AbstractPlusTaskPlugin { async onInstance() {} async execute(): Promise { - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const sslClient = new TencentSslClient({ access, logger: this.logger, diff --git a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-all/index.ts b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-all/index.ts index 8d1a3860..63072581 100644 --- a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-all/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-all/index.ts @@ -53,7 +53,7 @@ export class DeployCertToTencentAll extends AbstractTaskPlugin { async onInstance() {} async execute(): Promise { - const accessProvider = await this.accessService.getById(this.accessId); + const accessProvider = await this.getAccess(this.accessId); const sdk = await import('tencentcloud-sdk-nodejs/tencentcloud/services/ssl/v20191205/index.js'); const Client = sdk.v20191205.Client; diff --git a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-cdn-v2/index.ts b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-cdn-v2/index.ts index 9abab173..72980cba 100644 --- a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-cdn-v2/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-cdn-v2/index.ts @@ -51,7 +51,7 @@ export class TencentDeployCertToCDNv2 extends AbstractTaskPlugin { async onInstance() {} async execute(): Promise { - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const sslClient = new TencentSslClient({ access, logger: this.logger, @@ -82,7 +82,7 @@ export class TencentDeployCertToCDNv2 extends AbstractTaskPlugin { } async getCdnClient() { - const accessProvider = await this.accessService.getById(this.accessId); + const accessProvider = await this.getAccess(this.accessId); const sdk = await import('tencentcloud-sdk-nodejs/tencentcloud/services/cdn/v20180606/index.js'); const CdnClient = sdk.v20180606.Client; diff --git a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-cdn/index.ts b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-cdn/index.ts index 41749e19..eb68b3c6 100644 --- a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-cdn/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-cdn/index.ts @@ -68,7 +68,7 @@ export class DeployToCdnPlugin extends AbstractTaskPlugin { } async getClient() { - const accessProvider: TencentAccess = (await this.accessService.getById(this.accessId)) as TencentAccess; + const accessProvider: TencentAccess = (await this.getAccess(this.accessId)) as TencentAccess; const CdnClient = this.Client; diff --git a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-clb/index.ts b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-clb/index.ts index 6f06876a..1abb57d3 100644 --- a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-clb/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-clb/index.ts @@ -108,7 +108,7 @@ export class DeployCertToTencentCLB extends AbstractTaskPlugin { const sdk = await import('tencentcloud-sdk-nodejs/tencentcloud/services/clb/v20180317/index.js'); const ClbClient = sdk.v20180317.Client; - const accessProvider = (await this.accessService.getById(this.accessId)) as TencentAccess; + const accessProvider = (await this.getAccess(this.accessId)) as TencentAccess; const region = this.region; const clientConfig = { diff --git a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-cos/index.ts b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-cos/index.ts index 1d7130b1..0515ade6 100644 --- a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-cos/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-cos/index.ts @@ -99,7 +99,7 @@ export class DeployCertToTencentCosPlugin extends AbstractTaskPlugin { async onInstance() {} async execute(): Promise { - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = new TencentSslClient({ access, @@ -130,7 +130,7 @@ export class DeployCertToTencentCosPlugin extends AbstractTaskPlugin { } async onGetDomainList(data: any) { - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const cosv5 = await import('cos-nodejs-sdk-v5'); const cos = new cosv5.default({ diff --git a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-eo/index.ts b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-eo/index.ts index ecf13537..9b37b33d 100644 --- a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-eo/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-eo/index.ts @@ -80,7 +80,7 @@ export class DeployCertToTencentEO extends AbstractTaskPlugin { } async execute(): Promise { - const accessProvider: TencentAccess = (await this.accessService.getById(this.accessId)) as TencentAccess; + const accessProvider: TencentAccess = (await this.getAccess(this.accessId)) as TencentAccess; const client = this.getClient(accessProvider); const params = this.buildParams(); await this.doRequest(client, params); diff --git a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-live/index.ts b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-live/index.ts index b42a7a99..c086fbc2 100644 --- a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-live/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-live/index.ts @@ -52,7 +52,7 @@ export class TencentDeployCertToLive extends AbstractPlusTaskPlugin { async onInstance() {} async execute(): Promise { - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); let tencentCertId = this.cert as string; if (typeof this.cert !== 'string') { @@ -90,7 +90,7 @@ export class TencentDeployCertToLive extends AbstractPlusTaskPlugin { } async getLiveClient() { - const accessProvider = await this.accessService.getById(this.accessId); + const accessProvider = await this.getAccess(this.accessId); const sdk = await import('tencentcloud-sdk-nodejs/tencentcloud/services/live/v20180801/index.js'); const CssClient = sdk.v20180801.Client; diff --git a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-tke-ingress/index.ts b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-tke-ingress/index.ts index 8bb99902..a5244e1a 100644 --- a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-tke-ingress/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/deploy-to-tke-ingress/index.ts @@ -116,7 +116,7 @@ export class DeployCertToTencentTKEIngressPlugin extends AbstractPlusTaskPlugin this.K8sClient = k8sSdk.K8sClient; } async execute(): Promise { - const accessProvider = await this.accessService.getById(this.accessId); + const accessProvider = await this.getAccess(this.accessId); const tkeClient = await this.getTkeClient(accessProvider, this.region); const kubeConfigStr = await this.getTkeKubeConfig(tkeClient, this.clusterId); diff --git a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/start-instances/index.ts b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/start-instances/index.ts index 965d0728..e4de138e 100644 --- a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/start-instances/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/start-instances/index.ts @@ -135,7 +135,7 @@ export class TencentActionInstancesPlugin extends AbstractTaskPlugin { } async getCvmClient() { - const accessProvider = await this.accessService.getById(this.accessId); + const accessProvider = await this.getAccess(this.accessId); const sdk = await import('tencentcloud-sdk-nodejs/tencentcloud/services/cvm/v20170312/index.js'); const CvmClient = sdk.v20170312.Client; diff --git a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/upload-to-tencent/index.ts b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/upload-to-tencent/index.ts index 8dfe32e4..22cb2ec2 100644 --- a/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/upload-to-tencent/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-tencent/plugin/upload-to-tencent/index.ts @@ -52,7 +52,7 @@ export class UploadCertToTencent extends AbstractTaskPlugin { async execute(): Promise { const { accessId, name, cert } = this; - const accessProvider = await this.accessService.getById(accessId); + const accessProvider = await this.getAccess(accessId); const certName = this.appendTimeSuffix(name || cert.domain); const client = this.getClient(accessProvider); @@ -96,7 +96,7 @@ export class UploadCertToTencent extends AbstractTaskPlugin { // async rollback({ input }) { // const { accessId } = input; - // const accessProvider = await this.accessService.getById(accessId); + // const accessProvider = await this.getAccess(accessId); // const client = this.getClient(accessProvider); // // const { tencentCertId } = context; diff --git a/packages/ui/certd-server/src/plugins/plugin-upyun/plugins/plugin-depoy-to-cdn.ts b/packages/ui/certd-server/src/plugins/plugin-upyun/plugins/plugin-depoy-to-cdn.ts index 8818e266..35b265ba 100644 --- a/packages/ui/certd-server/src/plugins/plugin-upyun/plugins/plugin-depoy-to-cdn.ts +++ b/packages/ui/certd-server/src/plugins/plugin-upyun/plugins/plugin-depoy-to-cdn.ts @@ -68,7 +68,7 @@ export class UpyunDeployToCdn extends AbstractPlusTaskPlugin { //插件执行方法 async execute(): Promise { - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const upyunClient = new UpyunClient({ access, @@ -101,7 +101,7 @@ export class UpyunDeployToCdn extends AbstractPlusTaskPlugin { if (!this.accessId) { throw new Error("accessId不能为空"); } - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const upyunClient = new UpyunClient({ access, diff --git a/packages/ui/certd-server/src/plugins/plugin-volcengine/plugins/plugin-deploy-to-cdn.ts b/packages/ui/certd-server/src/plugins/plugin-volcengine/plugins/plugin-deploy-to-cdn.ts index ab2e3c55..b16b34ff 100644 --- a/packages/ui/certd-server/src/plugins/plugin-volcengine/plugins/plugin-deploy-to-cdn.ts +++ b/packages/ui/certd-server/src/plugins/plugin-volcengine/plugins/plugin-deploy-to-cdn.ts @@ -78,7 +78,7 @@ export class VolcengineDeployToCDN extends AbstractTaskPlugin { async onInstance() {} async execute(): Promise { this.logger.info('开始部署证书到火山引擎CDN'); - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = await this.getClient(access) const service = await client.getCdnClient() @@ -117,7 +117,7 @@ export class VolcengineDeployToCDN extends AbstractTaskPlugin { if (!this.accessId) { throw new Error('请选择Access授权'); } - const access = await this.accessService.getById(this.accessId); + const access = await this.getAccess(this.accessId); const client = await this.getClient(access); const service = await client.getCdnClient() diff --git a/packages/ui/certd-server/src/plugins/plugin-woai/plugins/plugin-deploy-to-cdn.ts b/packages/ui/certd-server/src/plugins/plugin-woai/plugins/plugin-deploy-to-cdn.ts index 8b35a6e3..e0db45a9 100644 --- a/packages/ui/certd-server/src/plugins/plugin-woai/plugins/plugin-deploy-to-cdn.ts +++ b/packages/ui/certd-server/src/plugins/plugin-woai/plugins/plugin-deploy-to-cdn.ts @@ -71,7 +71,7 @@ export class WoaiCdnPlugin extends AbstractTaskPlugin { async execute(): Promise { const { baseApi, certId, cert, accessId } = this; - const access = (await this.accessService.getById(accessId)) as WoaiAccess; + const access = (await this.getAccess(accessId)) as WoaiAccess; // 使用默认值或用户输入的值 const apiBase = baseApi || 'https://console.edeg.sxhjgy.cn'; // 登录获取token