diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b8a630b4..0c205142d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.25.7](https://github.com/certd/certd/compare/v1.25.6...v1.25.7) (2024-09-29) + +### Bug Fixes + +* 修复某些地区被屏蔽无法激活专业版的bug ([7532a96](https://github.com/certd/certd/commit/7532a960851b84d4f2cc3dba02353c5235e1a364)) + +### Performance Improvements + +* 上传到主机,支持socks代理 ([d91026d](https://github.com/certd/certd/commit/d91026dc4fbfe5fedc4ee8e43dc0d08f1cf88356)) +* 支持上传到七牛云oss ([bf024bd](https://github.com/certd/certd/commit/bf024bdda8bc2a463475be5761acf0da7317a08a)) + ## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29) ### Bug Fixes diff --git a/build.trigger b/build.trigger index 8a5b8e718..7b66193a9 100644 --- a/build.trigger +++ b/build.trigger @@ -1 +1 @@ -10:11 +02:35 diff --git a/lerna.json b/lerna.json index 2a34a112c..84c1a94a8 100644 --- a/lerna.json +++ b/lerna.json @@ -9,5 +9,5 @@ } }, "npmClient": "pnpm", - "version": "1.25.6" + "version": "1.25.7" } diff --git a/package.json b/package.json index a89239bc9..3caaa7d87 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "scripts": { "start": "lerna bootstrap --hoist", "i-all": "lerna link && lerna exec npm install ", - "publish": "npm run prepublishOnly2 && lerna publish --conventional-commits --create-release github && npm run afterpublishOnly", + "publish": "npm run prepublishOnly2 && lerna publish --force-publish=pro/plus-core --conventional-commits --create-release github && npm run afterpublishOnly", "afterpublishOnly": "time /t >build.trigger && git add ./build.trigger && git commit -m \"build: trigger build image\" && TIMEOUT /T 10 && git push", "prepublishOnly1": "npm run check && lerna run build ", "prepublishOnly2": "npm run check && npm run before-build && lerna run build ", diff --git a/packages/core/acme-client/CHANGELOG.md b/packages/core/acme-client/CHANGELOG.md index 8fab96f0c..80d70d7e0 100644 --- a/packages/core/acme-client/CHANGELOG.md +++ b/packages/core/acme-client/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.25.7](https://github.com/publishlab/node-acme-client/compare/v1.25.6...v1.25.7) (2024-09-29) + +**Note:** Version bump only for package @certd/acme-client + ## [1.25.6](https://github.com/publishlab/node-acme-client/compare/v1.25.5...v1.25.6) (2024-09-29) ### Performance Improvements diff --git a/packages/core/acme-client/package.json b/packages/core/acme-client/package.json index 261e1fc6f..b1a0dbd5b 100644 --- a/packages/core/acme-client/package.json +++ b/packages/core/acme-client/package.json @@ -3,7 +3,7 @@ "description": "Simple and unopinionated ACME client", "private": false, "author": "nmorsman", - "version": "1.25.6", + "version": "1.25.7", "main": "src/index.js", "types": "types/index.d.ts", "license": "MIT", diff --git a/packages/core/pipeline/CHANGELOG.md b/packages/core/pipeline/CHANGELOG.md index 1c0788e88..03e88a617 100644 --- a/packages/core/pipeline/CHANGELOG.md +++ b/packages/core/pipeline/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.25.7](https://github.com/certd/certd/compare/v1.25.6...v1.25.7) (2024-09-29) + +### Bug Fixes + +* 修复某些地区被屏蔽无法激活专业版的bug ([7532a96](https://github.com/certd/certd/commit/7532a960851b84d4f2cc3dba02353c5235e1a364)) + ## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29) ### Performance Improvements diff --git a/packages/core/pipeline/package.json b/packages/core/pipeline/package.json index d8ebeb511..b690fe5f5 100644 --- a/packages/core/pipeline/package.json +++ b/packages/core/pipeline/package.json @@ -1,7 +1,7 @@ { "name": "@certd/pipeline", "private": false, - "version": "1.25.6", + "version": "1.25.7", "type": "module", "main": "./dist/index.js", "types": "./dist/index.d.ts", @@ -15,7 +15,7 @@ "test": "mocha --loader=ts-node/esm" }, "dependencies": { - "@certd/plus-core": "^1.25.4", + "@certd/plus-core": "^1.25.6", "axios": "^1.7.2", "fix-path": "^4.0.0", "http-proxy-agent": "^7.0.2", diff --git a/packages/core/pipeline/src/utils/util.request.ts b/packages/core/pipeline/src/utils/util.request.ts index c76c6b79b..735eadb21 100644 --- a/packages/core/pipeline/src/utils/util.request.ts +++ b/packages/core/pipeline/src/utils/util.request.ts @@ -8,7 +8,7 @@ export class HttpError extends Error { status?: number; statusText?: string; code?: string; - request?: { url: string; method: string; params?: any; data?: any }; + request?: { baseURL: string; url: string; method: string; params?: any; data?: any }; response?: { data: any }; cause?: any; constructor(error: any) { @@ -23,6 +23,7 @@ export class HttpError extends Error { this.status = error.response?.status; this.statusText = error.response?.statusText; this.request = { + baseURL: error.config?.baseURL, url: error.config?.url, method: error.config?.method, params: error.config?.params, diff --git a/packages/libs/lib-huawei/CHANGELOG.md b/packages/libs/lib-huawei/CHANGELOG.md index e94687fe3..94fab6ec8 100644 --- a/packages/libs/lib-huawei/CHANGELOG.md +++ b/packages/libs/lib-huawei/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.25.7](https://github.com/certd/certd/compare/v1.25.6...v1.25.7) (2024-09-29) + +**Note:** Version bump only for package @certd/lib-huawei + ## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29) **Note:** Version bump only for package @certd/lib-huawei diff --git a/packages/libs/lib-huawei/package.json b/packages/libs/lib-huawei/package.json index 41bce6a18..f205a1098 100644 --- a/packages/libs/lib-huawei/package.json +++ b/packages/libs/lib-huawei/package.json @@ -1,7 +1,7 @@ { "name": "@certd/lib-huawei", "private": false, - "version": "1.25.6", + "version": "1.25.7", "main": "./dist/bundle.js", "module": "./dist/bundle.js", "types": "./dist/d/index.d.ts", diff --git a/packages/libs/lib-iframe/CHANGELOG.md b/packages/libs/lib-iframe/CHANGELOG.md index 34b584526..08daf6c4d 100644 --- a/packages/libs/lib-iframe/CHANGELOG.md +++ b/packages/libs/lib-iframe/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.25.7](https://github.com/certd/certd/compare/v1.25.6...v1.25.7) (2024-09-29) + +**Note:** Version bump only for package @certd/lib-iframe + ## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29) ### Performance Improvements diff --git a/packages/libs/lib-iframe/package.json b/packages/libs/lib-iframe/package.json index 760811508..5114b0720 100644 --- a/packages/libs/lib-iframe/package.json +++ b/packages/libs/lib-iframe/package.json @@ -1,7 +1,7 @@ { "name": "@certd/lib-iframe", "private": false, - "version": "1.25.6", + "version": "1.25.7", "type": "module", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/packages/libs/lib-jdcloud/CHANGELOG.md b/packages/libs/lib-jdcloud/CHANGELOG.md index 155e80de8..751ea0c16 100644 --- a/packages/libs/lib-jdcloud/CHANGELOG.md +++ b/packages/libs/lib-jdcloud/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.25.7](https://github.com/certd/certd/compare/v1.25.6...v1.25.7) (2024-09-29) + +**Note:** Version bump only for package @certd/lib-jdcloud + ## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29) **Note:** Version bump only for package @certd/lib-jdcloud diff --git a/packages/libs/lib-jdcloud/package.json b/packages/libs/lib-jdcloud/package.json index 8ac0a4f83..7f1757b60 100644 --- a/packages/libs/lib-jdcloud/package.json +++ b/packages/libs/lib-jdcloud/package.json @@ -1,7 +1,7 @@ { "name": "@certd/lib-jdcloud", "private": false, - "version": "1.25.6", + "version": "1.25.7", "main": "./dist/bundle.mjs", "module": "./dist/bundle.mjs", "types": "./dist/d/index.d.ts", diff --git a/packages/libs/lib-k8s/CHANGELOG.md b/packages/libs/lib-k8s/CHANGELOG.md index fa4dde9a5..9d8c6618f 100644 --- a/packages/libs/lib-k8s/CHANGELOG.md +++ b/packages/libs/lib-k8s/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.25.7](https://github.com/certd/certd/compare/v1.25.6...v1.25.7) (2024-09-29) + +**Note:** Version bump only for package @certd/lib-k8s + ## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29) ### Performance Improvements diff --git a/packages/libs/lib-k8s/package.json b/packages/libs/lib-k8s/package.json index 8e541f6c4..6848357b8 100644 --- a/packages/libs/lib-k8s/package.json +++ b/packages/libs/lib-k8s/package.json @@ -1,7 +1,7 @@ { "name": "@certd/lib-k8s", "private": false, - "version": "1.25.6", + "version": "1.25.7", "type": "module", "main": "./dist/index.js", "types": "./dist/index.d.ts", @@ -17,7 +17,7 @@ "@kubernetes/client-node": "0.21.0" }, "devDependencies": { - "@certd/pipeline": "^1.25.6", + "@certd/pipeline": "^1.25.7", "@rollup/plugin-commonjs": "^23.0.4", "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-node-resolve": "^15.0.1", diff --git a/packages/libs/midway-flyway-js/CHANGELOG.md b/packages/libs/midway-flyway-js/CHANGELOG.md index 30bec31a9..b62e9821a 100644 --- a/packages/libs/midway-flyway-js/CHANGELOG.md +++ b/packages/libs/midway-flyway-js/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.25.7](https://github.com/certd/certd/compare/v1.25.6...v1.25.7) (2024-09-29) + +**Note:** Version bump only for package @certd/midway-flyway-js + ## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29) ### Performance Improvements diff --git a/packages/libs/midway-flyway-js/package.json b/packages/libs/midway-flyway-js/package.json index f1decf63d..8b6ef71b6 100644 --- a/packages/libs/midway-flyway-js/package.json +++ b/packages/libs/midway-flyway-js/package.json @@ -1,6 +1,6 @@ { "name": "@certd/midway-flyway-js", - "version": "1.25.6", + "version": "1.25.7", "description": "midway with flyway, sql upgrade way ", "private": false, "type": "module", diff --git a/packages/plugins/plugin-cert/CHANGELOG.md b/packages/plugins/plugin-cert/CHANGELOG.md index e7b715a2a..6cd0c12f8 100644 --- a/packages/plugins/plugin-cert/CHANGELOG.md +++ b/packages/plugins/plugin-cert/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.25.7](https://github.com/certd/certd/compare/v1.25.6...v1.25.7) (2024-09-29) + +**Note:** Version bump only for package @certd/plugin-cert + ## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29) ### Performance Improvements diff --git a/packages/plugins/plugin-cert/package.json b/packages/plugins/plugin-cert/package.json index c56a6dc80..007e15d80 100644 --- a/packages/plugins/plugin-cert/package.json +++ b/packages/plugins/plugin-cert/package.json @@ -1,7 +1,7 @@ { "name": "@certd/plugin-cert", "private": false, - "version": "1.25.6", + "version": "1.25.7", "type": "module", "main": "./dist/index.js", "types": "./dist/index.d.ts", @@ -14,8 +14,9 @@ "preview": "vite preview" }, "dependencies": { - "@certd/acme-client": "^1.25.6", - "@certd/pipeline": "^1.25.6", + "@certd/acme-client": "^1.25.7", + "@certd/pipeline": "^1.25.7", + "dayjs": "^1.11.7", "jszip": "^3.10.1", "node-forge": "^0.10.0", "psl": "^1.9.0", @@ -37,7 +38,6 @@ "@typescript-eslint/eslint-plugin": "^5.38.1", "@typescript-eslint/parser": "^5.38.1", "chai": "^4.3.6", - "dayjs": "^1.11.6", "eslint": "^8.24.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-import": "^2.26.0", diff --git a/packages/ui/certd-client/CHANGELOG.md b/packages/ui/certd-client/CHANGELOG.md index 25f200d8b..f5d877705 100644 --- a/packages/ui/certd-client/CHANGELOG.md +++ b/packages/ui/certd-client/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.25.7](https://github.com/certd/certd/compare/v1.25.6...v1.25.7) (2024-09-29) + +**Note:** Version bump only for package @certd/ui-client + ## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29) ### Performance Improvements diff --git a/packages/ui/certd-client/package.json b/packages/ui/certd-client/package.json index 633661823..0378a7989 100644 --- a/packages/ui/certd-client/package.json +++ b/packages/ui/certd-client/package.json @@ -1,6 +1,6 @@ { "name": "@certd/ui-client", - "version": "1.25.6", + "version": "1.25.7", "private": true, "scripts": { "dev": "vite --open", @@ -58,8 +58,8 @@ "vuedraggable": "^4.1.0" }, "devDependencies": { - "@certd/lib-iframe": "^1.25.6", - "@certd/pipeline": "^1.25.6", + "@certd/lib-iframe": "^1.25.7", + "@certd/pipeline": "^1.25.7", "@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-node-resolve": "^15.2.3", "@types/chai": "^4.3.12", diff --git a/packages/ui/certd-server/.env.development.yaml b/packages/ui/certd-server/.env.development.yaml index aeeac74f4..992ae4432 100644 --- a/packages/ui/certd-server/.env.development.yaml +++ b/packages/ui/certd-server/.env.development.yaml @@ -3,9 +3,10 @@ #plus: # server: # baseUrl: 'http://127.0.0.1:11007' + plus: server: - baseUrl: 'https://api.ai.handsfree.work' + baseUrls: ['https://api.ai.handsfree.work', 'https://api.ai.docmirror.cn'] #typeorm: # dataSource: # default: diff --git a/packages/ui/certd-server/.env.production.yaml b/packages/ui/certd-server/.env.production.yaml index db3436c49..98c5d9691 100644 --- a/packages/ui/certd-server/.env.production.yaml +++ b/packages/ui/certd-server/.env.production.yaml @@ -9,8 +9,7 @@ typeorm: plus: server: - baseUrl: 'https://api.ai.handsfree.work' - + baseUrls: ['https://api.ai.handsfree.work', 'https://api.ai.docmirror.cn'] account: server: baseUrl: 'https://ai.handsfree.work/subject' diff --git a/packages/ui/certd-server/CHANGELOG.md b/packages/ui/certd-server/CHANGELOG.md index e6fbccee0..304509a36 100644 --- a/packages/ui/certd-server/CHANGELOG.md +++ b/packages/ui/certd-server/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.25.7](https://github.com/certd/certd/compare/v1.25.6...v1.25.7) (2024-09-29) + +### Bug Fixes + +* 修复某些地区被屏蔽无法激活专业版的bug ([7532a96](https://github.com/certd/certd/commit/7532a960851b84d4f2cc3dba02353c5235e1a364)) + +### Performance Improvements + +* 上传到主机,支持socks代理 ([d91026d](https://github.com/certd/certd/commit/d91026dc4fbfe5fedc4ee8e43dc0d08f1cf88356)) +* 支持上传到七牛云oss ([bf024bd](https://github.com/certd/certd/commit/bf024bdda8bc2a463475be5761acf0da7317a08a)) + ## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29) ### Bug Fixes diff --git a/packages/ui/certd-server/package.json b/packages/ui/certd-server/package.json index 0293a12c6..1e05d7d9e 100644 --- a/packages/ui/certd-server/package.json +++ b/packages/ui/certd-server/package.json @@ -1,6 +1,6 @@ { "name": "@certd/ui-server", - "version": "1.25.6", + "version": "1.25.7", "description": "fast-server base midway", "private": true, "type": "module", @@ -22,15 +22,15 @@ "dependencies": { "@alicloud/cs20151215": "^3.0.3", "@alicloud/pop-core": "^1.7.10", - "@certd/acme-client": "^1.25.6", - "@certd/lib-huawei": "^1.25.6", - "@certd/lib-jdcloud": "^1.25.6", - "@certd/lib-k8s": "^1.25.6", - "@certd/midway-flyway-js": "^1.25.6", - "@certd/pipeline": "^1.25.6", - "@certd/plugin-cert": "^1.25.6", - "@certd/plugin-plus": "^1.25.6", - "@certd/plus-core": "^1.25.4", + "@certd/acme-client": "^1.25.7", + "@certd/lib-huawei": "^1.25.7", + "@certd/lib-jdcloud": "^1.25.7", + "@certd/lib-k8s": "^1.25.7", + "@certd/midway-flyway-js": "^1.25.7", + "@certd/pipeline": "^1.25.7", + "@certd/plugin-cert": "^1.25.7", + "@certd/plugin-plus": "^1.25.7", + "@certd/plus-core": "^1.25.6", "@koa/cors": "^5.0.0", "@midwayjs/bootstrap": "^3.16.2", "@midwayjs/cache": "^3.14.0", diff --git a/packages/ui/certd-server/src/config/config.default.ts b/packages/ui/certd-server/src/config/config.default.ts index d5a1ffc05..7d6be59df 100644 --- a/packages/ui/certd-server/src/config/config.default.ts +++ b/packages/ui/certd-server/src/config/config.default.ts @@ -86,7 +86,7 @@ const development = { resetAdminPasswd: false, }, plus: { - serverBaseUrl: 'http://127.0.0.1:11007', + serverBaseUrls: ['http://127.0.0.1:11007'], }, } as MidwayConfig; mergeConfig(development, 'development'); diff --git a/packages/ui/certd-server/src/modules/basic/service/plus-service.ts b/packages/ui/certd-server/src/modules/basic/service/plus-service.ts index 6021d60f3..141641247 100644 --- a/packages/ui/certd-server/src/modules/basic/service/plus-service.ts +++ b/packages/ui/certd-server/src/modules/basic/service/plus-service.ts @@ -9,8 +9,8 @@ import { logger } from '../../../utils/logger.js'; export class PlusService { @Inject() sysSettingsService: SysSettingsService; - @Config('plus.server.baseUrl') - plusServerBaseUrl; + @Config('plus.server.baseUrls') + plusServerBaseUrls: string[]; plusRequestService: PlusRequestService; @@ -18,7 +18,7 @@ export class PlusService { async init() { const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo); this.plusRequestService = new PlusRequestService({ - plusServerBaseUrl: this.plusServerBaseUrl, + plusServerBaseUrls: this.plusServerBaseUrls, http: http, logger, subjectId: installInfo.siteId, diff --git a/packages/ui/certd-server/src/plugins/plugin-qiniu/access/access.ts b/packages/ui/certd-server/src/plugins/plugin-qiniu/access/access.ts deleted file mode 100644 index 3aa3e4a2f..000000000 --- a/packages/ui/certd-server/src/plugins/plugin-qiniu/access/access.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { AccessInput, IAccess, IsAccess } from '@certd/pipeline'; - -@IsAccess({ - name: 'qiniu', - title: '七牛云授权', - desc: '', - input: {}, -}) -export class QiniuAccess implements IAccess { - @AccessInput({ - title: 'AccessKey', - rules: [{ required: true, message: '此项必填' }], - helper: 'AK,前往[密钥管理](https://portal.qiniu.com/developer/user/key)获取', - }) - accessKey!: string; - @AccessInput({ - title: 'SecretKey', - encrypt: true, - helper: 'SK', - }) - secretKey!: string; -} - -new QiniuAccess(); diff --git a/packages/ui/certd-server/src/plugins/plugin-qiniu/access/index.ts b/packages/ui/certd-server/src/plugins/plugin-qiniu/access/index.ts deleted file mode 100644 index 5bc1631b9..000000000 --- a/packages/ui/certd-server/src/plugins/plugin-qiniu/access/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './access.js'; diff --git a/packages/ui/certd-server/src/plugins/plugin-qiniu/index.ts b/packages/ui/certd-server/src/plugins/plugin-qiniu/index.ts index 739b1ea4c..640fdbe36 100644 --- a/packages/ui/certd-server/src/plugins/plugin-qiniu/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-qiniu/index.ts @@ -1,2 +1 @@ export * from './plugin/index.js'; -export * from './access/index.js'; 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 ad89f453e..d523a50ad 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 @@ -1,7 +1,6 @@ import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline'; -import { QiniuAccess } from '../../access/index.js'; +import { QiniuAccess, QiniuClient } from '@certd/plugin-plus'; import { CertInfo } from '@certd/plugin-cert'; -import { doRequest, uploadCert } from '../lib/sdk.js'; @IsTaskPlugin({ name: 'QiniuDeployCertToCDN', @@ -49,24 +48,27 @@ export class QiniuDeployCertToCDN extends AbstractTaskPlugin { async execute(): Promise { this.logger.info('开始部署证书到七牛云cdn'); const access = await this.accessService.getById(this.accessId); - + const qiniuClient = new QiniuClient({ + http: this.ctx.http, + access, + }); const url = `https://api.qiniu.com/domain/${this.domainName}/httpsconf`; let certId = null; if (typeof this.cert !== 'string') { // 是证书id,直接上传即可 this.logger.info('先上传证书'); - certId = await uploadCert(this.ctx.http, access, this.cert, this.appendTimeSuffix('certd')); + certId = await qiniuClient.uploadCert(this.cert, this.appendTimeSuffix('certd')); } else { certId = this.cert; } //开始修改证书 - this.logger.info('开始修改证书'); + this.logger.info(`开始修改证书,certId:${certId},domain:${this.domainName}`); const body = { certID: certId, }; - await doRequest(this.ctx.http, access, url, 'put', body); + await qiniuClient.doRequest(url, 'put', body); this.logger.info('部署完成'); } diff --git a/packages/ui/certd-server/src/plugins/plugin-qiniu/plugin/lib/sdk.ts b/packages/ui/certd-server/src/plugins/plugin-qiniu/plugin/lib/sdk.ts deleted file mode 100644 index 5047a6ca0..000000000 --- a/packages/ui/certd-server/src/plugins/plugin-qiniu/plugin/lib/sdk.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { HttpClient } from '@certd/pipeline'; -import { QiniuAccess } from '../../access/index.js'; -import { CertInfo } from '@certd/plugin-cert'; - -export async function doRequest(http: HttpClient, access: QiniuAccess, url: string, method: string, body: any) { - const { generateAccessToken } = await import('qiniu/qiniu/util.js'); - const token = generateAccessToken(access, url); - const res = await http.request({ - url, - method: method, - headers: { - Authorization: token, - }, - data: body, - }); - - if (res.code !== 200 || res.error) { - throw new Error('请求失败:' + res.error); - } - return res; -} - -export async function uploadCert(http: HttpClient, access: QiniuAccess, cert: CertInfo, certName?: string) { - const url = 'https://api.qiniu.com/sslcert'; - - const body = { - name: certName, - common_name: 'certd', - pri: cert.key, - ca: cert.crt, - }; - - const res = await doRequest(http, access, url, 'post', body); - - return res.certID; -} 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 382ff94b5..c4f2cde9e 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 @@ -1,7 +1,6 @@ import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline'; -import { QiniuAccess } from '../../access/index.js'; +import { QiniuAccess, QiniuClient } from '@certd/plugin-plus'; import { CertInfo } from '@certd/plugin-cert'; -import { uploadCert } from '../lib/sdk.js'; @IsTaskPlugin({ name: 'QiniuCertUpload', @@ -53,7 +52,11 @@ export class QiniuCertUpload extends AbstractTaskPlugin { async execute(): Promise { this.logger.info('开始上传证书到七牛云'); const access = (await this.accessService.getById(this.accessId)) as QiniuAccess; - this.qiniuCertId = await uploadCert(this.ctx.http, access, this.cert, this.appendTimeSuffix(this.certName)); + const qiniuClient = new QiniuClient({ + http: this.ctx.http, + access, + }); + this.qiniuCertId = await qiniuClient.uploadCert(this.cert, this.appendTimeSuffix(this.certName)); this.logger.info('上传完成,id:', this.qiniuCertId); } }