mirror of
https://github.com/certd/certd.git
synced 2026-04-03 22:20:51 +08:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d876ea6711 | ||
|
|
b40b4c3cfd | ||
|
|
44980d6c46 | ||
|
|
442f9647a2 | ||
|
|
a06ef07178 | ||
|
|
0c2ea5da4c | ||
|
|
45814ceb49 | ||
|
|
41f4617e66 | ||
|
|
a463711b03 | ||
|
|
3a147141b1 | ||
|
|
aea1c13bd3 | ||
|
|
9cc4c017ae | ||
|
|
88022747be | ||
|
|
ebb292a2f7 | ||
|
|
818998259d | ||
|
|
36b02c2cec | ||
|
|
e6195ade3e | ||
|
|
231a875bb4 | ||
|
|
378c777a38 | ||
|
|
8ef63916ef | ||
|
|
f32ecdf5f1 | ||
|
|
94739b9b8e |
19
CHANGELOG.md
19
CHANGELOG.md
@@ -3,6 +3,25 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.34.8](https://github.com/certd/certd/compare/v1.34.7...v1.34.8) (2025-05-28)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 更新 1panel API 版本支持v1/v2设置 ([e6195ad](https://github.com/certd/certd/commit/e6195ade3ec54b138825b8d6738f86eb8afdd720))
|
||||
* 同步更新namesilo接口,修复无法创建和删除dns记录的问题 ([36b02c2](https://github.com/certd/certd/commit/36b02c2cec145c13d4ef29d49aba5b6b4f697df2))
|
||||
* 修复阿里云 esa 证书获取站点列表错误的问题 ([0c2ea5d](https://github.com/certd/certd/commit/0c2ea5da4c836f8a0df132a3f22d399bd9ee1de9))
|
||||
* 修复部署到华为cdn,子账号ak查询不到域名的bug ([ebb292a](https://github.com/certd/certd/commit/ebb292a2f7a425c1bc810f59468beb3f1d5bc3f0))
|
||||
* 修复证书申请任务无法修改dns提供商类型的bug ([8802274](https://github.com/certd/certd/commit/88022747bebe2054223e0241d68d410771405e68))
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* 关闭腾讯云证书通知提醒 ([231a875](https://github.com/certd/certd/commit/231a875bb481420c39bf76ec9ff4e50954ab9fe4))
|
||||
* 优化站点选择组件,切换选择时不刷新列表 ([3a14714](https://github.com/certd/certd/commit/3a147141b1a5d67c92a5ce88a5313eaa62859e03))
|
||||
* 优化站点ip检查 ([a463711](https://github.com/certd/certd/commit/a463711b03a20120f2a298be15d71ca152d27f21))
|
||||
* 站点监控支持监控IP ([9cc4c01](https://github.com/certd/certd/commit/9cc4c017ae646a18284e732769b82636feda01d3))
|
||||
* 支持批量重新运行 ([8189982](https://github.com/certd/certd/commit/818998259ddc75e722196ac5c365038818539b9b))
|
||||
* farcdn优化 ([a06ef07](https://github.com/certd/certd/commit/a06ef07178ed73c537e21c7d57e5e5144d2c056d))
|
||||
|
||||
## [1.34.7](https://github.com/certd/certd/compare/v1.34.6...v1.34.7) (2025-05-26)
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
@@ -1 +1 @@
|
||||
23:45
|
||||
23:34
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.34.7](https://github.com/certd/certd/compare/v1.34.6...v1.34.7) (2025-05-26)
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* 优化阿里云DCDN插件,支持多选 ([b091657](https://github.com/certd/certd/commit/b091657b5c537acf2442a2bfc345d0a77f5e2c50))
|
||||
* 支持部署到farcdn ([e08cf57](https://github.com/certd/certd/commit/e08cf57b72128998f487ab6469868052fbce0dba))
|
||||
|
||||
## [1.34.6](https://github.com/certd/certd/compare/v1.34.5...v1.34.6) (2025-05-25)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
}
|
||||
},
|
||||
"npmClient": "pnpm",
|
||||
"version": "1.34.7"
|
||||
"version": "1.34.8"
|
||||
}
|
||||
|
||||
@@ -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.34.8](https://github.com/publishlab/node-acme-client/compare/v1.34.7...v1.34.8) (2025-05-28)
|
||||
|
||||
**Note:** Version bump only for package @certd/acme-client
|
||||
|
||||
## [1.34.7](https://github.com/publishlab/node-acme-client/compare/v1.34.6...v1.34.7) (2025-05-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/acme-client
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"description": "Simple and unopinionated ACME client",
|
||||
"private": false,
|
||||
"author": "nmorsman",
|
||||
"version": "1.34.7",
|
||||
"version": "1.34.8",
|
||||
"type": "module",
|
||||
"module": "scr/index.js",
|
||||
"main": "src/index.js",
|
||||
@@ -18,7 +18,7 @@
|
||||
"types"
|
||||
],
|
||||
"dependencies": {
|
||||
"@certd/basic": "^1.34.7",
|
||||
"@certd/basic": "^1.34.8",
|
||||
"@peculiar/x509": "^1.11.0",
|
||||
"asn1js": "^3.0.5",
|
||||
"axios": "^1.7.2",
|
||||
@@ -69,5 +69,5 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/publishlab/node-acme-client/issues"
|
||||
},
|
||||
"gitHead": "8478ce25f11f8e13b9be508cf44d7090f5c8a663"
|
||||
"gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
|
||||
}
|
||||
|
||||
@@ -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.34.8](https://github.com/certd/certd/compare/v1.34.7...v1.34.8) (2025-05-28)
|
||||
|
||||
**Note:** Version bump only for package @certd/basic
|
||||
|
||||
## [1.34.7](https://github.com/certd/certd/compare/v1.34.6...v1.34.7) (2025-05-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/basic
|
||||
|
||||
@@ -1 +1 @@
|
||||
23:20
|
||||
23:11
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@certd/basic",
|
||||
"private": false,
|
||||
"version": "1.34.7",
|
||||
"version": "1.34.8",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
@@ -45,5 +45,5 @@
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "8478ce25f11f8e13b9be508cf44d7090f5c8a663"
|
||||
"gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
|
||||
}
|
||||
|
||||
@@ -97,11 +97,17 @@ export function createAxiosService({ logger }: { logger: Logger }) {
|
||||
if (config.logRes == null) {
|
||||
config.logRes = false;
|
||||
}
|
||||
if (config.logData == null) {
|
||||
config.logData = false;
|
||||
}
|
||||
|
||||
logger.info(`http request:${config.url},method:${config.method}`);
|
||||
if (config.logParams !== false && config.params) {
|
||||
logger.info(`params:${JSON.stringify(config.params)}`);
|
||||
}
|
||||
if (config.logData !== false && config.data) {
|
||||
logger.info(`data:${JSON.stringify(config.data)}`);
|
||||
}
|
||||
if (config.timeout == null) {
|
||||
config.timeout = 15000;
|
||||
}
|
||||
@@ -226,6 +232,7 @@ export type HttpRequestConfig<D = any> = {
|
||||
skipCheckRes?: boolean;
|
||||
logParams?: boolean;
|
||||
logRes?: boolean;
|
||||
logData?: boolean;
|
||||
httpProxy?: string;
|
||||
returnOriginRes?: boolean;
|
||||
} & AxiosRequestConfig<D>;
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.34.8](https://github.com/certd/certd/compare/v1.34.7...v1.34.8) (2025-05-28)
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* 优化站点选择组件,切换选择时不刷新列表 ([3a14714](https://github.com/certd/certd/commit/3a147141b1a5d67c92a5ce88a5313eaa62859e03))
|
||||
* 站点监控支持监控IP ([9cc4c01](https://github.com/certd/certd/commit/9cc4c017ae646a18284e732769b82636feda01d3))
|
||||
* 支持批量重新运行 ([8189982](https://github.com/certd/certd/commit/818998259ddc75e722196ac5c365038818539b9b))
|
||||
|
||||
## [1.34.7](https://github.com/certd/certd/compare/v1.34.6...v1.34.7) (2025-05-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/pipeline
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@certd/pipeline",
|
||||
"private": false,
|
||||
"version": "1.34.7",
|
||||
"version": "1.34.8",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
@@ -17,8 +17,8 @@
|
||||
"pub": "npm publish"
|
||||
},
|
||||
"dependencies": {
|
||||
"@certd/basic": "^1.34.7",
|
||||
"@certd/plus-core": "^1.34.7",
|
||||
"@certd/basic": "^1.34.8",
|
||||
"@certd/plus-core": "^1.34.8",
|
||||
"dayjs": "^1.11.7",
|
||||
"lodash-es": "^4.17.21",
|
||||
"reflect-metadata": "^0.1.13"
|
||||
@@ -44,5 +44,5 @@
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "8478ce25f11f8e13b9be508cf44d7090f5c8a663"
|
||||
"gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
|
||||
}
|
||||
|
||||
@@ -2,3 +2,18 @@ import { IContext } from "../core/index.js";
|
||||
|
||||
export type UserContext = IContext;
|
||||
export type PipelineContext = IContext;
|
||||
|
||||
export type PageReq = {
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
searchKey?: string;
|
||||
// sortBy?: string;
|
||||
// sortOrder?: "asc" | "desc";
|
||||
};
|
||||
|
||||
export type PageRes = {
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
total?: string;
|
||||
list: any[];
|
||||
};
|
||||
|
||||
@@ -489,7 +489,15 @@ export class Executor {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param stepId 如果==ALL 清除所有
|
||||
*/
|
||||
clearLastStatus(stepId: string) {
|
||||
if (stepId === "ALL") {
|
||||
this.lastStatusMap.clear();
|
||||
return;
|
||||
}
|
||||
this.lastStatusMap.clearById(stepId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.34.8](https://github.com/certd/certd/compare/v1.34.7...v1.34.8) (2025-05-28)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-huawei
|
||||
|
||||
## [1.34.7](https://github.com/certd/certd/compare/v1.34.6...v1.34.7) (2025-05-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-huawei
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@certd/lib-huawei",
|
||||
"private": false,
|
||||
"version": "1.34.7",
|
||||
"version": "1.34.8",
|
||||
"main": "./dist/bundle.js",
|
||||
"module": "./dist/bundle.js",
|
||||
"types": "./dist/d/index.d.ts",
|
||||
@@ -24,5 +24,5 @@
|
||||
"prettier": "^2.8.8",
|
||||
"tslib": "^2.8.1"
|
||||
},
|
||||
"gitHead": "8478ce25f11f8e13b9be508cf44d7090f5c8a663"
|
||||
"gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
|
||||
}
|
||||
|
||||
@@ -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.34.8](https://github.com/certd/certd/compare/v1.34.7...v1.34.8) (2025-05-28)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-iframe
|
||||
|
||||
## [1.34.7](https://github.com/certd/certd/compare/v1.34.6...v1.34.7) (2025-05-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-iframe
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@certd/lib-iframe",
|
||||
"private": false,
|
||||
"version": "1.34.7",
|
||||
"version": "1.34.8",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
@@ -31,5 +31,5 @@
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "8478ce25f11f8e13b9be508cf44d7090f5c8a663"
|
||||
"gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
|
||||
}
|
||||
|
||||
@@ -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.34.8](https://github.com/certd/certd/compare/v1.34.7...v1.34.8) (2025-05-28)
|
||||
|
||||
**Note:** Version bump only for package @certd/jdcloud
|
||||
|
||||
## [1.34.7](https://github.com/certd/certd/compare/v1.34.6...v1.34.7) (2025-05-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/jdcloud
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@certd/jdcloud",
|
||||
"version": "1.34.7",
|
||||
"version": "1.34.8",
|
||||
"description": "jdcloud openApi sdk",
|
||||
"main": "./dist/bundle.js",
|
||||
"module": "./dist/bundle.js",
|
||||
@@ -61,5 +61,5 @@
|
||||
"fetch"
|
||||
]
|
||||
},
|
||||
"gitHead": "8478ce25f11f8e13b9be508cf44d7090f5c8a663"
|
||||
"gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
|
||||
}
|
||||
|
||||
@@ -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.34.8](https://github.com/certd/certd/compare/v1.34.7...v1.34.8) (2025-05-28)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-k8s
|
||||
|
||||
## [1.34.7](https://github.com/certd/certd/compare/v1.34.6...v1.34.7) (2025-05-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-k8s
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@certd/lib-k8s",
|
||||
"private": false,
|
||||
"version": "1.34.7",
|
||||
"version": "1.34.8",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
@@ -17,7 +17,7 @@
|
||||
"pub": "npm publish"
|
||||
},
|
||||
"dependencies": {
|
||||
"@certd/basic": "^1.34.7",
|
||||
"@certd/basic": "^1.34.8",
|
||||
"@kubernetes/client-node": "0.21.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -32,5 +32,5 @@
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "8478ce25f11f8e13b9be508cf44d7090f5c8a663"
|
||||
"gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
|
||||
}
|
||||
|
||||
@@ -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.34.8](https://github.com/certd/certd/compare/v1.34.7...v1.34.8) (2025-05-28)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-server
|
||||
|
||||
## [1.34.7](https://github.com/certd/certd/compare/v1.34.6...v1.34.7) (2025-05-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-server
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@certd/lib-server",
|
||||
"version": "1.34.7",
|
||||
"version": "1.34.8",
|
||||
"description": "midway with flyway, sql upgrade way ",
|
||||
"private": false,
|
||||
"type": "module",
|
||||
@@ -27,10 +27,10 @@
|
||||
],
|
||||
"license": "AGPL",
|
||||
"dependencies": {
|
||||
"@certd/acme-client": "^1.34.7",
|
||||
"@certd/basic": "^1.34.7",
|
||||
"@certd/pipeline": "^1.34.7",
|
||||
"@certd/plus-core": "^1.34.7",
|
||||
"@certd/acme-client": "^1.34.8",
|
||||
"@certd/basic": "^1.34.8",
|
||||
"@certd/pipeline": "^1.34.8",
|
||||
"@certd/plus-core": "^1.34.8",
|
||||
"@midwayjs/cache": "~3.14.0",
|
||||
"@midwayjs/core": "~3.20.3",
|
||||
"@midwayjs/i18n": "~3.20.3",
|
||||
@@ -61,5 +61,5 @@
|
||||
"typeorm": "^0.3.11",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "8478ce25f11f8e13b9be508cf44d7090f5c8a663"
|
||||
"gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
|
||||
}
|
||||
|
||||
@@ -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.34.8](https://github.com/certd/certd/compare/v1.34.7...v1.34.8) (2025-05-28)
|
||||
|
||||
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||
|
||||
## [1.34.7](https://github.com/certd/certd/compare/v1.34.6...v1.34.7) (2025-05-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@certd/midway-flyway-js",
|
||||
"version": "1.34.7",
|
||||
"version": "1.34.8",
|
||||
"description": "midway with flyway, sql upgrade way ",
|
||||
"private": false,
|
||||
"type": "module",
|
||||
@@ -46,5 +46,5 @@
|
||||
"typeorm": "^0.3.11",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "8478ce25f11f8e13b9be508cf44d7090f5c8a663"
|
||||
"gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
|
||||
}
|
||||
|
||||
@@ -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.34.8](https://github.com/certd/certd/compare/v1.34.7...v1.34.8) (2025-05-28)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 修复证书申请任务无法修改dns提供商类型的bug ([8802274](https://github.com/certd/certd/commit/88022747bebe2054223e0241d68d410771405e68))
|
||||
|
||||
## [1.34.7](https://github.com/certd/certd/compare/v1.34.6...v1.34.7) (2025-05-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/plugin-cert
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@certd/plugin-cert",
|
||||
"private": false,
|
||||
"version": "1.34.7",
|
||||
"version": "1.34.8",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -16,10 +16,10 @@
|
||||
"pub": "npm publish"
|
||||
},
|
||||
"dependencies": {
|
||||
"@certd/acme-client": "^1.34.7",
|
||||
"@certd/basic": "^1.34.7",
|
||||
"@certd/pipeline": "^1.34.7",
|
||||
"@certd/plugin-lib": "^1.34.7",
|
||||
"@certd/acme-client": "^1.34.8",
|
||||
"@certd/basic": "^1.34.8",
|
||||
"@certd/pipeline": "^1.34.8",
|
||||
"@certd/plugin-lib": "^1.34.8",
|
||||
"@google-cloud/publicca": "^1.3.0",
|
||||
"dayjs": "^1.11.7",
|
||||
"jszip": "^3.10.1",
|
||||
@@ -43,5 +43,5 @@
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "8478ce25f11f8e13b9be508cf44d7090f5c8a663"
|
||||
"gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
|
||||
}
|
||||
|
||||
@@ -102,11 +102,11 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
|
||||
return form.challengeType === 'dns'
|
||||
}),
|
||||
component:{
|
||||
on:{
|
||||
selectedChange({form,$event}){
|
||||
form.dnsProviderAccessType = $event.accessType
|
||||
onSelectedChange: ctx.compute(({form})=>{
|
||||
return ($event)=>{
|
||||
form.dnsProviderAccessType = $event.accessType
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
`,
|
||||
|
||||
@@ -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.34.8](https://github.com/certd/certd/compare/v1.34.7...v1.34.8) (2025-05-28)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 修复阿里云 esa 证书获取站点列表错误的问题 ([0c2ea5d](https://github.com/certd/certd/commit/0c2ea5da4c836f8a0df132a3f22d399bd9ee1de9))
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* 关闭腾讯云证书通知提醒 ([231a875](https://github.com/certd/certd/commit/231a875bb481420c39bf76ec9ff4e50954ab9fe4))
|
||||
* 优化站点选择组件,切换选择时不刷新列表 ([3a14714](https://github.com/certd/certd/commit/3a147141b1a5d67c92a5ce88a5313eaa62859e03))
|
||||
|
||||
## [1.34.7](https://github.com/certd/certd/compare/v1.34.6...v1.34.7) (2025-05-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/plugin-lib
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@certd/plugin-lib",
|
||||
"private": false,
|
||||
"version": "1.34.7",
|
||||
"version": "1.34.8",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -20,8 +20,8 @@
|
||||
"@alicloud/pop-core": "^1.7.10",
|
||||
"@alicloud/tea-util": "^1.4.10",
|
||||
"@aws-sdk/client-s3": "^3.787.0",
|
||||
"@certd/basic": "^1.34.7",
|
||||
"@certd/pipeline": "^1.34.7",
|
||||
"@certd/basic": "^1.34.8",
|
||||
"@certd/pipeline": "^1.34.8",
|
||||
"@kubernetes/client-node": "0.21.0",
|
||||
"ali-oss": "^6.22.0",
|
||||
"basic-ftp": "^5.0.5",
|
||||
@@ -52,5 +52,5 @@
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "8478ce25f11f8e13b9be508cf44d7090f5c8a663"
|
||||
"gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ export type AliyunClientV2Req = {
|
||||
pathname?: `/`;
|
||||
|
||||
data?: any;
|
||||
query?: any;
|
||||
};
|
||||
export class AliyunClientV2 {
|
||||
access: AliyunAccess;
|
||||
@@ -32,6 +31,12 @@ export class AliyunClientV2 {
|
||||
return this.client;
|
||||
}
|
||||
const $OpenApi = await import("@alicloud/openapi-client");
|
||||
// const Credential = await import("@alicloud/credentials");
|
||||
// //@ts-ignore
|
||||
// const credential = new Credential.default.default({
|
||||
//
|
||||
// type: "access_key",
|
||||
// });
|
||||
const config = new $OpenApi.Config({
|
||||
accessKeyId: this.access.accessKeyId,
|
||||
accessKeySecret: this.access.accessKeySecret,
|
||||
@@ -70,10 +75,7 @@ export class AliyunClientV2 {
|
||||
});
|
||||
|
||||
const runtime = new $Util.RuntimeOptions({});
|
||||
const request = new $OpenApi.OpenApiRequest({
|
||||
body: req.data,
|
||||
query: req.query,
|
||||
});
|
||||
const request = new $OpenApi.OpenApiRequest(req.data);
|
||||
// 复制代码运行请自行打印 API 的返回值
|
||||
// 返回值实际为 Map 类型,可从 Map 中获得三类数据:响应体 body、响应头 headers、HTTP 返回的状态码 statusCode。
|
||||
const res = await client.callApi(params, request, runtime);
|
||||
|
||||
@@ -39,6 +39,8 @@ export function createRemoteSelectInputDefine(opts?: {
|
||||
rules?: any;
|
||||
mergeScript?: string;
|
||||
search?: boolean;
|
||||
pager?: boolean;
|
||||
component?: any;
|
||||
}) {
|
||||
const title = opts?.title || "请选择";
|
||||
const certDomainsInputKey = opts?.certDomainsInputKey || "certDomains";
|
||||
@@ -49,6 +51,7 @@ export function createRemoteSelectInputDefine(opts?: {
|
||||
const watches = opts?.watches || [];
|
||||
const helper = opts?.helper || "请选择";
|
||||
const search = opts?.search ?? false;
|
||||
const pager = opts?.pager ?? false;
|
||||
let mode = "tags";
|
||||
if (opts.multi === false) {
|
||||
mode = undefined;
|
||||
@@ -66,7 +69,9 @@ export function createRemoteSelectInputDefine(opts?: {
|
||||
typeName,
|
||||
action,
|
||||
search,
|
||||
pager,
|
||||
watches: [certDomainsInputKey, accessIdInputKey, ...watches],
|
||||
...opts.component,
|
||||
},
|
||||
rules: opts?.rules,
|
||||
required: opts.required ?? true,
|
||||
|
||||
@@ -49,7 +49,7 @@ export class TencentSslClient {
|
||||
};
|
||||
const ret = await client.UploadCertificate(params);
|
||||
this.checkRet(ret);
|
||||
this.logger.info("证书上传成功:tencentCertId=", ret.CertificateId);
|
||||
this.logger.info(`证书[${opts.certName}]上传成功:tencentCertId=`, ret.CertificateId);
|
||||
await this.switchCertNotify([ret.CertificateId], true);
|
||||
return ret.CertificateId;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,19 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.34.8](https://github.com/certd/certd/compare/v1.34.7...v1.34.8) (2025-05-28)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 修复证书申请任务无法修改dns提供商类型的bug ([8802274](https://github.com/certd/certd/commit/88022747bebe2054223e0241d68d410771405e68))
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* 优化站点选择组件,切换选择时不刷新列表 ([3a14714](https://github.com/certd/certd/commit/3a147141b1a5d67c92a5ce88a5313eaa62859e03))
|
||||
* 优化站点ip检查 ([a463711](https://github.com/certd/certd/commit/a463711b03a20120f2a298be15d71ca152d27f21))
|
||||
* 站点监控支持监控IP ([9cc4c01](https://github.com/certd/certd/commit/9cc4c017ae646a18284e732769b82636feda01d3))
|
||||
* 支持批量重新运行 ([8189982](https://github.com/certd/certd/commit/818998259ddc75e722196ac5c365038818539b9b))
|
||||
|
||||
## [1.34.7](https://github.com/certd/certd/compare/v1.34.6...v1.34.7) (2025-05-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/ui-client
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@certd/ui-client",
|
||||
"version": "1.34.7",
|
||||
"version": "1.34.8",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite --open",
|
||||
@@ -102,8 +102,8 @@
|
||||
"zod-defaults": "^0.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@certd/lib-iframe": "^1.34.7",
|
||||
"@certd/pipeline": "^1.34.7",
|
||||
"@certd/lib-iframe": "^1.34.8",
|
||||
"@certd/pipeline": "^1.34.8",
|
||||
"@rollup/plugin-commonjs": "^25.0.7",
|
||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||
"@types/chai": "^4.3.12",
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
<a-divider style="margin: 4px 0" />
|
||||
</template>
|
||||
<v-nodes :vnodes="menu" />
|
||||
|
||||
<div v-if="pager === true" class="pager text-center p-5">
|
||||
<a-pagination v-model:current="pagerRef.current" simple :total="pagerRef.total" :page-size="pagerRef.limit" />
|
||||
</div>
|
||||
</template>
|
||||
</a-select>
|
||||
<div class="ml-5">
|
||||
@@ -32,7 +36,7 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ComponentPropsType, doRequest } from "/@/components/plugins/lib";
|
||||
import { defineComponent, inject, ref, useAttrs, watch } from "vue";
|
||||
import { defineComponent, inject, ref, useAttrs, watch, Ref } from "vue";
|
||||
import { PluginDefine } from "@certd/pipeline";
|
||||
|
||||
defineOptions({
|
||||
@@ -54,7 +58,8 @@ const VNodes = defineComponent({
|
||||
const props = defineProps<
|
||||
{
|
||||
watches: string[];
|
||||
search: boolean;
|
||||
search?: boolean;
|
||||
pager?: boolean;
|
||||
} & ComponentPropsType
|
||||
>();
|
||||
|
||||
@@ -73,6 +78,9 @@ const optionsRef = ref([]);
|
||||
const message = ref("");
|
||||
const hasError = ref(false);
|
||||
const loading = ref(false);
|
||||
const pagerRef: Ref = ref({
|
||||
current: 1,
|
||||
});
|
||||
const getOptions = async () => {
|
||||
if (loading.value) {
|
||||
return;
|
||||
@@ -107,6 +115,7 @@ const getOptions = async () => {
|
||||
loading.value = true;
|
||||
optionsRef.value = [];
|
||||
|
||||
const offset = (pagerRef.value.current - 1) * (pagerRef.value.limit ?? 100);
|
||||
try {
|
||||
const res = await doRequest(
|
||||
{
|
||||
@@ -116,6 +125,8 @@ const getOptions = async () => {
|
||||
input,
|
||||
data: {
|
||||
searchKey: props.search ? searchKeyRef.value : "",
|
||||
offset: offset,
|
||||
limit: pagerRef.value.limit,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -126,10 +137,26 @@ const getOptions = async () => {
|
||||
showErrorNotify: false,
|
||||
}
|
||||
);
|
||||
if (res && res.length > 0) {
|
||||
const list = res?.list || res || [];
|
||||
if (list.length > 0) {
|
||||
message.value = "获取数据成功,请从下拉框中选择";
|
||||
}
|
||||
optionsRef.value = res;
|
||||
optionsRef.value = list;
|
||||
pagerRef.value.total = list.length;
|
||||
if (props.pager) {
|
||||
if (res.offset != null) {
|
||||
pagerRef.value.offset = res.offset ?? 0;
|
||||
}
|
||||
if (res.limit != null) {
|
||||
pagerRef.value.limit = res.limit ?? 100;
|
||||
}
|
||||
if (res.total != null) {
|
||||
pagerRef.value.total = res.total ?? list.length;
|
||||
}
|
||||
const { offset, limit } = pagerRef.value;
|
||||
pagerRef.value.current = offset % limit === 0 ? offset / limit + 1 : offset / limit;
|
||||
}
|
||||
|
||||
return res;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
@@ -151,27 +178,37 @@ async function refreshOptions() {
|
||||
}
|
||||
|
||||
async function doSearch() {
|
||||
pagerRef.value.current = 1;
|
||||
await refreshOptions();
|
||||
}
|
||||
|
||||
watch(
|
||||
() => {
|
||||
const values = [];
|
||||
|
||||
const pluginType = getPluginType();
|
||||
const { form } = getScope();
|
||||
const { form, key } = getScope();
|
||||
const input = pluginType === "plugin" ? form.input : form;
|
||||
|
||||
for (const item of props.watches) {
|
||||
values.push(input[item]);
|
||||
const watches = {};
|
||||
for (const key of props.watches) {
|
||||
watches[key] = input[key];
|
||||
}
|
||||
return {
|
||||
form: input,
|
||||
watched: values,
|
||||
form: watches,
|
||||
key,
|
||||
};
|
||||
},
|
||||
async () => {
|
||||
await getOptions();
|
||||
async (value, oldValue) => {
|
||||
const { form } = value;
|
||||
const oldForm = oldValue.form;
|
||||
let changed = oldForm == null || optionsRef.value.length == 0;
|
||||
for (const key of props.watches) {
|
||||
if (form[key] != oldForm[key]) {
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
await getOptions();
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
|
||||
@@ -55,4 +55,25 @@ export const siteInfoApi = {
|
||||
method: "post",
|
||||
});
|
||||
},
|
||||
|
||||
async DisabledChange(id: number, disabled: boolean) {
|
||||
return await request({
|
||||
url: apiPrefix + "/disabledChange",
|
||||
method: "post",
|
||||
data: {
|
||||
id,
|
||||
disabled,
|
||||
},
|
||||
});
|
||||
},
|
||||
async IpCheckChange(id: number, ipCheck: boolean) {
|
||||
return await request({
|
||||
url: apiPrefix + "/ipCheckChange",
|
||||
method: "post",
|
||||
data: {
|
||||
id,
|
||||
ipCheck,
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// @ts-ignore
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { AddReq, ColumnCompositionProps, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { siteInfoApi } from "./api";
|
||||
import dayjs from "dayjs";
|
||||
import { notification } from "ant-design-vue";
|
||||
import { Modal, notification } from "ant-design-vue";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { mySuiteApi } from "/@/views/certd/suite/mine/api";
|
||||
import { mitter } from "/@/utils/util.mitt";
|
||||
import { useSiteIpMonitor } from "./ip/use";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
@@ -41,6 +42,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
{ label: "异常", value: "error", color: "red" },
|
||||
],
|
||||
});
|
||||
|
||||
const { openSiteIpMonitorDialog } = useSiteIpMonitor();
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
@@ -116,8 +119,27 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
});
|
||||
},
|
||||
},
|
||||
ipCheck: {
|
||||
order: 10,
|
||||
type: "link",
|
||||
text: null,
|
||||
show: compute(({ row }) => {
|
||||
return row.ipCheck === true;
|
||||
}),
|
||||
tooltip: {
|
||||
title: "IP管理",
|
||||
},
|
||||
icon: "entypo:address",
|
||||
click: async ({ row }) => {
|
||||
openSiteIpMonitorDialog({ siteId: row.id });
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
tabs: {
|
||||
name: "disabled",
|
||||
show: true,
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "ID",
|
||||
@@ -192,6 +214,34 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
certInfo: {
|
||||
title: "证书信息",
|
||||
type: "text",
|
||||
form: { show: false },
|
||||
column: {
|
||||
width: 200,
|
||||
sorter: false,
|
||||
show: true,
|
||||
conditionalRender: false,
|
||||
cellRender({ value, row }) {
|
||||
const slots = {
|
||||
content() {
|
||||
return (
|
||||
<div>
|
||||
<div>证书颁发机构:{row.certProvider}</div>
|
||||
<div>证书域名:{row.certDomains}</div>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
};
|
||||
return (
|
||||
<a-popover placement="left" v-slots={slots} overlayStyle={{ maxWidth: "30%" }}>
|
||||
{row.certDomains}
|
||||
</a-popover>
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
certDomains: {
|
||||
title: "证书域名",
|
||||
search: {
|
||||
@@ -204,7 +254,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
column: {
|
||||
width: 200,
|
||||
sorter: true,
|
||||
show: true,
|
||||
show: false,
|
||||
cellRender({ value }) {
|
||||
return (
|
||||
<a-tooltip title={value} placement="left">
|
||||
@@ -226,6 +276,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
column: {
|
||||
width: 200,
|
||||
sorter: true,
|
||||
show: false,
|
||||
cellRender({ value }) {
|
||||
return <a-tooltip title={value}>{value}</a-tooltip>;
|
||||
},
|
||||
@@ -305,6 +356,72 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
form: {
|
||||
value: false,
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
sorter: true,
|
||||
align: "center",
|
||||
component: {
|
||||
name: "fs-dict-switch",
|
||||
vModel: "checked",
|
||||
on: {
|
||||
async change({ row, $event }) {
|
||||
await api.DisabledChange(row.id, $event);
|
||||
await crudExpose.doRefresh();
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ipCheck: {
|
||||
title: "开启IP检查",
|
||||
type: "dict-switch",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: "启用", value: true, color: "green" },
|
||||
{ label: "禁用", value: false, color: "gray" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
value: false,
|
||||
rules: [{ required: true, message: "请选择" }],
|
||||
},
|
||||
column: {
|
||||
align: "center",
|
||||
width: 100,
|
||||
conditionalRender: false,
|
||||
component: {
|
||||
name: "fs-dict-switch",
|
||||
vModel: "checked",
|
||||
on: {
|
||||
change({ row, $event }) {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: `确定${$event ? "开启" : "关闭"}IP检查?`,
|
||||
onOk: async () => {
|
||||
await api.IpCheckChange(row.id, $event);
|
||||
await crudExpose.doRefresh();
|
||||
if ($event) {
|
||||
openSiteIpMonitorDialog({ siteId: row.id });
|
||||
}
|
||||
},
|
||||
onCancel: async () => {
|
||||
await crudExpose.doRefresh();
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} as ColumnCompositionProps,
|
||||
ipCount: {
|
||||
title: "IP数量",
|
||||
search: {
|
||||
show: false,
|
||||
},
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
sorter: true,
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
import { request } from "/src/api/service";
|
||||
|
||||
const apiPrefix = "/monitor/site/ip";
|
||||
|
||||
export const siteIpApi = {
|
||||
async GetList(query: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "post",
|
||||
data: query,
|
||||
});
|
||||
},
|
||||
|
||||
async AddObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj,
|
||||
});
|
||||
},
|
||||
|
||||
async UpdateObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj,
|
||||
});
|
||||
},
|
||||
|
||||
async DelObj(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id },
|
||||
});
|
||||
},
|
||||
|
||||
async GetObj(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "post",
|
||||
params: { id },
|
||||
});
|
||||
},
|
||||
async DoCheck(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/check",
|
||||
method: "post",
|
||||
data: { id },
|
||||
});
|
||||
},
|
||||
async CheckAll(siteId: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/checkAll",
|
||||
method: "post",
|
||||
data: {
|
||||
siteId,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
async DoSync(siteId: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/sync",
|
||||
method: "post",
|
||||
data: {
|
||||
siteId,
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,347 @@
|
||||
// @ts-ignore
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { siteIpApi } from "./api";
|
||||
import dayjs from "dayjs";
|
||||
import { Modal, notification } from "ant-design-vue";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
const api = siteIpApi;
|
||||
|
||||
const { crudBinding } = crudExpose;
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
if (!query.query) {
|
||||
query.query = {};
|
||||
}
|
||||
query.query.siteId = context.props.siteId;
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async (req: EditReq) => {
|
||||
const { form, row } = req;
|
||||
form.id = row.id;
|
||||
const res = await api.UpdateObj(form);
|
||||
return res;
|
||||
};
|
||||
const delRequest = async (req: DelReq) => {
|
||||
const { row } = req;
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async (req: AddReq) => {
|
||||
const { form } = req;
|
||||
form.siteId = context.props.siteId;
|
||||
const res = await api.AddObj(form);
|
||||
return res;
|
||||
};
|
||||
|
||||
const settingsStore = useSettingStore();
|
||||
|
||||
const checkStatusDict = dict({
|
||||
data: [
|
||||
{ label: "成功", value: "ok", color: "green" },
|
||||
{ label: "检查中", value: "checking", color: "blue" },
|
||||
{ label: "异常", value: "error", color: "red" },
|
||||
],
|
||||
});
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest,
|
||||
},
|
||||
form: {
|
||||
labelCol: {
|
||||
//固定label宽度
|
||||
span: null,
|
||||
style: {
|
||||
width: "100px",
|
||||
},
|
||||
},
|
||||
col: {
|
||||
span: 22,
|
||||
},
|
||||
wrapper: {
|
||||
width: 600,
|
||||
},
|
||||
},
|
||||
actionbar: {
|
||||
buttons: {
|
||||
add: {
|
||||
async click() {
|
||||
await crudExpose.openAdd({});
|
||||
},
|
||||
},
|
||||
load: {
|
||||
text: "同步IP",
|
||||
type: "primary",
|
||||
async click() {
|
||||
Modal.confirm({
|
||||
title: "同步IP",
|
||||
content: "确定要同步IP吗?",
|
||||
onOk: async () => {
|
||||
await api.DoSync(context.props.siteId);
|
||||
await crudExpose.doRefresh();
|
||||
notification.success({
|
||||
message: "同步完成",
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
checkAll: {
|
||||
text: "检查全部",
|
||||
type: "primary",
|
||||
click: () => {
|
||||
Modal.confirm({
|
||||
title: "确认",
|
||||
content: "确认触发检查全部IP站点的证书吗?",
|
||||
onOk: async () => {
|
||||
await siteIpApi.CheckAll(context.props.siteId);
|
||||
notification.success({
|
||||
message: "检查任务已提交",
|
||||
description: "请稍后刷新页面查看结果",
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
rowHandle: {
|
||||
fixed: "right",
|
||||
width: 240,
|
||||
buttons: {
|
||||
check: {
|
||||
order: 0,
|
||||
type: "link",
|
||||
text: null,
|
||||
tooltip: {
|
||||
title: "立即检查",
|
||||
},
|
||||
icon: "ion:play-sharp",
|
||||
click: async ({ row }) => {
|
||||
await api.DoCheck(row.id);
|
||||
await crudExpose.doRefresh();
|
||||
notification.success({
|
||||
message: "检查任务已提交",
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "ID",
|
||||
key: "id",
|
||||
type: "number",
|
||||
search: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 80,
|
||||
align: "center",
|
||||
},
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
ipAddress: {
|
||||
title: "IP",
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
type: "text",
|
||||
form: {
|
||||
rules: [{ required: true, message: "请输入IP" }],
|
||||
},
|
||||
column: {
|
||||
width: 160,
|
||||
},
|
||||
},
|
||||
certDomains: {
|
||||
title: "证书域名",
|
||||
search: {
|
||||
show: false,
|
||||
},
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 200,
|
||||
sorter: true,
|
||||
show: false,
|
||||
cellRender({ value }) {
|
||||
return (
|
||||
<a-tooltip title={value} placement="left">
|
||||
{value}
|
||||
</a-tooltip>
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
certProvider: {
|
||||
title: "颁发机构",
|
||||
search: {
|
||||
show: false,
|
||||
},
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 200,
|
||||
show: false,
|
||||
sorter: true,
|
||||
cellRender({ value }) {
|
||||
return <a-tooltip title={value}>{value}</a-tooltip>;
|
||||
},
|
||||
},
|
||||
},
|
||||
certStatus: {
|
||||
title: "证书状态",
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
type: "dict-select",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: "正常", value: "ok", color: "green" },
|
||||
{ label: "过期", value: "expired", color: "red" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
sorter: true,
|
||||
show: true,
|
||||
align: "center",
|
||||
},
|
||||
},
|
||||
certExpiresTime: {
|
||||
title: "证书到期时间",
|
||||
search: {
|
||||
show: false,
|
||||
},
|
||||
type: "date",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
cellRender({ value }) {
|
||||
if (!value) {
|
||||
return "-";
|
||||
}
|
||||
const expireDate = dayjs(value).format("YYYY-MM-DD");
|
||||
const leftDays = dayjs(value).diff(dayjs(), "day");
|
||||
const color = leftDays < 20 ? "red" : "#389e0d";
|
||||
const percent = (leftDays / 90) * 100;
|
||||
return <a-progress title={expireDate + "过期"} percent={percent} strokeColor={color} format={(percent: number) => `${leftDays}天`} />;
|
||||
},
|
||||
},
|
||||
},
|
||||
checkStatus: {
|
||||
title: "检查状态",
|
||||
search: {
|
||||
show: false,
|
||||
},
|
||||
type: "dict-select",
|
||||
dict: checkStatusDict,
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
align: "center",
|
||||
sorter: true,
|
||||
cellRender({ value, row, key }) {
|
||||
return (
|
||||
<a-tooltip title={row.error}>
|
||||
<fs-values-format v-model={value} dict={checkStatusDict}></fs-values-format>
|
||||
</a-tooltip>
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
lastCheckTime: {
|
||||
title: "上次检查时间",
|
||||
search: {
|
||||
show: false,
|
||||
},
|
||||
type: "datetime",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 155,
|
||||
},
|
||||
},
|
||||
from: {
|
||||
title: "来源",
|
||||
search: {
|
||||
show: false,
|
||||
},
|
||||
type: "dict-switch",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: "同步", value: "sync", color: "green" },
|
||||
{ label: "手动", value: "manual", color: "blue" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
value: false,
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
sorter: true,
|
||||
align: "center",
|
||||
},
|
||||
},
|
||||
disabled: {
|
||||
title: "禁用启用",
|
||||
search: {
|
||||
show: false,
|
||||
},
|
||||
type: "dict-switch",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: "启用", value: false, color: "green" },
|
||||
{ label: "禁用", value: true, color: "red" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
value: false,
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
sorter: true,
|
||||
align: "center",
|
||||
},
|
||||
},
|
||||
remark: {
|
||||
title: "备注",
|
||||
search: {
|
||||
show: false,
|
||||
},
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 200,
|
||||
sorter: true,
|
||||
tooltip: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<div class="site-ip-dialog" style="height: 60vh">
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding"> </fs-crud>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onActivated, onMounted, ref, Ref } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud";
|
||||
import { siteIpApi } from "./api";
|
||||
|
||||
defineOptions({
|
||||
name: "SiteIpCertMonitor",
|
||||
});
|
||||
const props = defineProps<{
|
||||
siteId: number;
|
||||
}>();
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({
|
||||
createCrudOptions,
|
||||
context: {
|
||||
props,
|
||||
},
|
||||
});
|
||||
|
||||
const siteInfoRef: Ref<any> = ref({});
|
||||
onMounted(async () => {
|
||||
siteInfoRef.value = await siteIpApi.GetObj(props.siteId);
|
||||
});
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
onActivated(() => {
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,40 @@
|
||||
import { useFormWrapper } from "@fast-crud/fast-crud";
|
||||
import { useRouter } from "vue-router";
|
||||
|
||||
import SiteIpCertMonitor from "./index.vue";
|
||||
|
||||
export function useSiteIpMonitor() {
|
||||
const { openDialog } = useFormWrapper();
|
||||
const router = useRouter();
|
||||
|
||||
async function openSiteIpMonitorDialog(opts: { siteId: number }) {
|
||||
await openDialog({
|
||||
wrapper: {
|
||||
title: "站点IP监控",
|
||||
width: "80%",
|
||||
is: "a-modal",
|
||||
footer: false,
|
||||
buttons: {
|
||||
cancel: {
|
||||
show: false,
|
||||
},
|
||||
reset: {
|
||||
show: false,
|
||||
},
|
||||
ok: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
slots: {
|
||||
"form-body-top": () => {
|
||||
return <SiteIpCertMonitor siteId={opts.siteId} />;
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
openSiteIpMonitorDialog,
|
||||
};
|
||||
}
|
||||
@@ -15,13 +15,13 @@ export function notificationProvide(api: any) {
|
||||
|
||||
export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
||||
const notificationTypeDictRef = dict({
|
||||
url: "/pi/notification/getTypeDict"
|
||||
url: "/pi/notification/getTypeDict",
|
||||
});
|
||||
const defaultPluginConfig = {
|
||||
component: {
|
||||
name: "a-input",
|
||||
vModel: "value"
|
||||
}
|
||||
vModel: "value",
|
||||
},
|
||||
};
|
||||
|
||||
function buildDefineFields(define: any, form: any, mode: string) {
|
||||
@@ -38,7 +38,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
||||
const key = "body." + mapKey;
|
||||
const field = {
|
||||
...value,
|
||||
key
|
||||
key,
|
||||
};
|
||||
const column = merge({ title: key }, defaultPluginConfig, field);
|
||||
//eval
|
||||
@@ -69,29 +69,29 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
||||
key: "id",
|
||||
type: "number",
|
||||
column: {
|
||||
width: 100
|
||||
width: 100,
|
||||
},
|
||||
form: {
|
||||
show: false
|
||||
}
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
type: {
|
||||
title: "通知类型",
|
||||
type: "dict-select",
|
||||
dict: notificationTypeDictRef,
|
||||
search: {
|
||||
show: false
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 200,
|
||||
component: {
|
||||
color: "auto"
|
||||
}
|
||||
color: "auto",
|
||||
},
|
||||
},
|
||||
editForm: {
|
||||
component: {
|
||||
disabled: false
|
||||
}
|
||||
disabled: false,
|
||||
},
|
||||
},
|
||||
form: {
|
||||
component: {
|
||||
@@ -108,7 +108,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
||||
{item.needPlus && <fs-icon icon={"mingcute:vip-1-line"} className={"color-plus"}></fs-icon>}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
rules: [{ required: true, message: "请选择通知类型" }],
|
||||
valueChange: {
|
||||
@@ -133,7 +133,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
||||
form.name = define.title;
|
||||
}
|
||||
buildDefineFields(define, form, mode);
|
||||
}
|
||||
},
|
||||
},
|
||||
helper: computed(() => {
|
||||
const define = currentDefine.value;
|
||||
@@ -141,22 +141,22 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
||||
return "";
|
||||
}
|
||||
return define.desc;
|
||||
})
|
||||
}
|
||||
}),
|
||||
},
|
||||
} as ColumnCompositionProps,
|
||||
name: {
|
||||
title: "通知名称",
|
||||
search: {
|
||||
show: true
|
||||
show: true,
|
||||
},
|
||||
type: ["text"],
|
||||
form: {
|
||||
rules: [{ required: true, message: "请填写名称" }],
|
||||
helper: "随便填,当多个相同类型的通知时,便于区分"
|
||||
helper: "随便填,当多个相同类型的通知时,便于区分",
|
||||
},
|
||||
column: {
|
||||
width: 200
|
||||
}
|
||||
width: 200,
|
||||
},
|
||||
},
|
||||
isDefault: {
|
||||
title: "是否默认",
|
||||
@@ -164,13 +164,13 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: "是", value: true, color: "success" },
|
||||
{ label: "否", value: false, color: "default" }
|
||||
]
|
||||
{ label: "否", value: false, color: "default" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
value: false,
|
||||
rules: [{ required: true, message: "请选择是否默认" }],
|
||||
order: 999
|
||||
order: 999,
|
||||
},
|
||||
column: {
|
||||
align: "center",
|
||||
@@ -192,12 +192,12 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
||||
},
|
||||
onCancel: async () => {
|
||||
await crudExpose.doRefresh();
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} as ColumnCompositionProps,
|
||||
test: {
|
||||
title: "测试",
|
||||
@@ -207,16 +207,16 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
||||
}),
|
||||
component: {
|
||||
name: "api-test",
|
||||
action: "TestRequest"
|
||||
action: "TestRequest",
|
||||
},
|
||||
order: 990,
|
||||
col: {
|
||||
span: 24
|
||||
}
|
||||
span: 24,
|
||||
},
|
||||
},
|
||||
column: {
|
||||
show: false
|
||||
}
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
setting: {
|
||||
column: { show: false },
|
||||
@@ -235,8 +235,8 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
||||
valueResolve({ form }) {
|
||||
const setting = form.body;
|
||||
form.setting = JSON.stringify(setting);
|
||||
}
|
||||
}
|
||||
} as ColumnCompositionProps
|
||||
},
|
||||
},
|
||||
} as ColumnCompositionProps,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -32,23 +32,23 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest
|
||||
delRequest,
|
||||
},
|
||||
form: {
|
||||
labelCol: {
|
||||
//固定label宽度
|
||||
span: null,
|
||||
style: {
|
||||
width: "145px"
|
||||
}
|
||||
}
|
||||
width: "145px",
|
||||
},
|
||||
},
|
||||
},
|
||||
rowHandle: {
|
||||
width: 200
|
||||
width: 200,
|
||||
},
|
||||
columns: {
|
||||
...commonColumnsDefine
|
||||
}
|
||||
}
|
||||
...commonColumnsDefine,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ export async function Cancel(historyId: any) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function BatchUpdateGroup(pipelineIds: number[], groupId: number): Promise<CertInfo> {
|
||||
export async function BatchUpdateGroup(pipelineIds: number[], groupId: number): Promise<void> {
|
||||
return await request({
|
||||
url: apiPrefix + "/batchUpdateGroup",
|
||||
method: "post",
|
||||
@@ -84,13 +84,20 @@ export async function BatchUpdateGroup(pipelineIds: number[], groupId: number):
|
||||
});
|
||||
}
|
||||
|
||||
export async function BatchDelete(pipelineIds: number[]): Promise<CertInfo> {
|
||||
export async function BatchDelete(pipelineIds: number[]): Promise<void> {
|
||||
return await request({
|
||||
url: apiPrefix + "/batchDelete",
|
||||
method: "post",
|
||||
data: { ids: pipelineIds },
|
||||
});
|
||||
}
|
||||
export async function BatchRerun(pipelineIds: number[]): Promise<void> {
|
||||
return await request({
|
||||
url: apiPrefix + "/batchRerun",
|
||||
method: "post",
|
||||
data: { ids: pipelineIds },
|
||||
});
|
||||
}
|
||||
|
||||
export async function GetFiles(pipelineId: number) {
|
||||
return await request({
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<span> 已选择 {{ selectedRowKeys.length }} 项 </span>
|
||||
<fs-button icon="ion:trash-outline" class="color-green" type="link" text="批量删除" @click="batchDelete"></fs-button>
|
||||
<change-group class="color-green" :selected-row-keys="selectedRowKeys" @change="groupChanged"></change-group>
|
||||
<fs-button icon="icon-park-outline:replay-music" class="need-plus" type="link" text="强制重新运行" @click="batchRerun"></fs-button>
|
||||
</div>
|
||||
</div>
|
||||
<template #actionbar-right> </template>
|
||||
@@ -70,6 +71,19 @@ function batchDelete() {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function batchRerun() {
|
||||
Modal.confirm({
|
||||
title: "确认强制重新运行吗",
|
||||
content: "确定要强制重新运行选中流水线吗?(20条一批执行)",
|
||||
async onOk() {
|
||||
await api.BatchRerun(selectedRowKeys.value);
|
||||
notification.success({ message: "任务已提交" });
|
||||
await crudExpose.doRefresh();
|
||||
selectedRowKeys.value = [];
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style lang="less">
|
||||
.batch-actions {
|
||||
|
||||
@@ -208,7 +208,6 @@ function useStepForm() {
|
||||
const stepOpen = (step: any, emit: any) => {
|
||||
callback.value = emit;
|
||||
currentStep.value = merge({ input: {}, strategy: {} }, step);
|
||||
|
||||
if (step.type) {
|
||||
changeCurrentPlugin(currentStep.value);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,12 @@
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
<template #footer>
|
||||
<fs-button v-if="settingsStore.sysPublic.aiChatEnabled !== false" key="aiChat" type="primary" icon="ion:color-wand-outline" @click="taskModal.onAiChat">AI分析</fs-button>
|
||||
<a-tooltip title="AI分析异常">
|
||||
<fs-button v-if="settingsStore.sysPublic.aiChatEnabled !== false" key="aiChat" type="primary" icon="ion:color-wand-outline" @click="taskModal.onAiChat">AI分析</fs-button>
|
||||
</a-tooltip>
|
||||
<a-tooltip title="强制重新执行此步骤">
|
||||
<fs-button key="rerun" type="primary" text="重新运行" icon="icon-park-outline:replay-music" @click="triggerRun(activeKey)"></fs-button>
|
||||
</a-tooltip>
|
||||
<fs-button key="cancel" icon="ion:close-circle-outline" @click="taskModal.onOk">关闭</fs-button>
|
||||
<fs-button key="submit" icon="ion:checkmark-circle-outline" type="primary" @click="taskModal.onOk">确定</fs-button>
|
||||
</template>
|
||||
|
||||
@@ -3,6 +3,24 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.34.8](https://github.com/certd/certd/compare/v1.34.7...v1.34.8) (2025-05-28)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 更新 1panel API 版本支持v1/v2设置 ([e6195ad](https://github.com/certd/certd/commit/e6195ade3ec54b138825b8d6738f86eb8afdd720))
|
||||
* 同步更新namesilo接口,修复无法创建和删除dns记录的问题 ([36b02c2](https://github.com/certd/certd/commit/36b02c2cec145c13d4ef29d49aba5b6b4f697df2))
|
||||
* 修复阿里云 esa 证书获取站点列表错误的问题 ([0c2ea5d](https://github.com/certd/certd/commit/0c2ea5da4c836f8a0df132a3f22d399bd9ee1de9))
|
||||
* 修复部署到华为cdn,子账号ak查询不到域名的bug ([ebb292a](https://github.com/certd/certd/commit/ebb292a2f7a425c1bc810f59468beb3f1d5bc3f0))
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* 关闭腾讯云证书通知提醒 ([231a875](https://github.com/certd/certd/commit/231a875bb481420c39bf76ec9ff4e50954ab9fe4))
|
||||
* 优化站点选择组件,切换选择时不刷新列表 ([3a14714](https://github.com/certd/certd/commit/3a147141b1a5d67c92a5ce88a5313eaa62859e03))
|
||||
* 优化站点ip检查 ([a463711](https://github.com/certd/certd/commit/a463711b03a20120f2a298be15d71ca152d27f21))
|
||||
* 站点监控支持监控IP ([9cc4c01](https://github.com/certd/certd/commit/9cc4c017ae646a18284e732769b82636feda01d3))
|
||||
* 支持批量重新运行 ([8189982](https://github.com/certd/certd/commit/818998259ddc75e722196ac5c365038818539b9b))
|
||||
* farcdn优化 ([a06ef07](https://github.com/certd/certd/commit/a06ef07178ed73c537e21c7d57e5e5144d2c056d))
|
||||
|
||||
## [1.34.7](https://github.com/certd/certd/compare/v1.34.6...v1.34.7) (2025-05-26)
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
```
|
||||
|
||||
|
||||
```shell
|
||||
npm run heap
|
||||
```
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
ALTER TABLE cd_site_info ADD COLUMN `ip_check` boolean;
|
||||
ALTER TABLE cd_site_info ADD COLUMN `ip_count` bigint;
|
||||
ALTER TABLE cd_site_info ADD COLUMN `ip_error_count` bigint;
|
||||
ALTER TABLE cd_site_info MODIFY COLUMN `error` longtext NULL;
|
||||
|
||||
|
||||
CREATE TABLE `cd_site_ip`
|
||||
(
|
||||
`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL,
|
||||
`user_id` bigint,
|
||||
`site_id` bigint,
|
||||
`ip_address` varchar(100),
|
||||
`cert_domains` varchar(10240),
|
||||
`cert_provider` varchar(100),
|
||||
`cert_status` varchar(100),
|
||||
`cert_expires_time` bigint,
|
||||
`last_check_time` bigint,
|
||||
`check_status` varchar(100),
|
||||
`error` longtext,
|
||||
`remark` varchar(4096),
|
||||
`from` varchar(100),
|
||||
`disabled` boolean NOT NULL DEFAULT false,
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX `index_site_ip_user_id` ON `cd_site_ip` (`user_id`);
|
||||
CREATE INDEX `index_site_ip_site_id` ON `cd_site_ip` (`site_id`);
|
||||
28
packages/ui/certd-server/db/migration-pg/v10023__site_ip.sql
Normal file
28
packages/ui/certd-server/db/migration-pg/v10023__site_ip.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
ALTER TABLE cd_site_info ADD COLUMN "ip_check" boolean;
|
||||
ALTER TABLE cd_site_info ADD COLUMN "ip_count" bigint;
|
||||
ALTER TABLE cd_site_info ADD COLUMN "ip_error_count" bigint;
|
||||
alter table cd_site_info alter column error type text using error::text;
|
||||
|
||||
CREATE TABLE "cd_site_ip"
|
||||
(
|
||||
"id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY NOT NULL,
|
||||
"user_id" bigint,
|
||||
"site_id" bigint,
|
||||
"ip_address" varchar(100),
|
||||
"cert_domains" varchar(10240),
|
||||
"cert_provider" varchar(100),
|
||||
"cert_status" varchar(100),
|
||||
"cert_expires_time" bigint,
|
||||
"last_check_time" bigint,
|
||||
"check_status" varchar(100),
|
||||
"error" text,
|
||||
"remark" varchar(4096),
|
||||
"from" varchar(100),
|
||||
"disabled" boolean NOT NULL DEFAULT (false),
|
||||
"create_time" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP),
|
||||
"update_time" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP)
|
||||
);
|
||||
|
||||
CREATE INDEX "index_site_ip_user_id" ON "cd_site_ip" ("user_id");
|
||||
CREATE INDEX "index_site_ip_site_id" ON "cd_site_ip" ("site_id");
|
||||
28
packages/ui/certd-server/db/migration/v10023__site_ip.sql
Normal file
28
packages/ui/certd-server/db/migration/v10023__site_ip.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
ALTER TABLE cd_site_info ADD COLUMN "ip_check" boolean;
|
||||
ALTER TABLE cd_site_info ADD COLUMN "ip_count" integer;
|
||||
ALTER TABLE cd_site_info ADD COLUMN "ip_error_count" integer;
|
||||
|
||||
|
||||
CREATE TABLE "cd_site_ip"
|
||||
(
|
||||
"id" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
"user_id" integer,
|
||||
"site_id" integer,
|
||||
"ip_address" varchar(100),
|
||||
"cert_domains" varchar(10240),
|
||||
"cert_provider" varchar(100),
|
||||
"cert_status" varchar(100),
|
||||
"cert_expires_time" integer,
|
||||
"last_check_time" integer,
|
||||
"check_status" varchar(100),
|
||||
"error" varchar(4096),
|
||||
"remark" varchar(4096),
|
||||
"from" varchar(100),
|
||||
"disabled" boolean NOT NULL DEFAULT (false),
|
||||
"create_time" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP),
|
||||
"update_time" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP)
|
||||
);
|
||||
|
||||
CREATE INDEX "index_site_ip_user_id" ON "cd_site_ip" ("user_id");
|
||||
CREATE INDEX "index_site_ip_site_id" ON "cd_site_ip" ("site_id");
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@certd/ui-server",
|
||||
"version": "1.34.7",
|
||||
"version": "1.34.8",
|
||||
"description": "fast-server base midway",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
@@ -41,19 +41,19 @@
|
||||
"@aws-sdk/client-acm": "^3.699.0",
|
||||
"@aws-sdk/client-cloudfront": "^3.699.0",
|
||||
"@aws-sdk/client-s3": "^3.705.0",
|
||||
"@certd/acme-client": "^1.34.7",
|
||||
"@certd/basic": "^1.34.7",
|
||||
"@certd/commercial-core": "^1.34.7",
|
||||
"@certd/jdcloud": "^1.34.7",
|
||||
"@certd/lib-huawei": "^1.34.7",
|
||||
"@certd/lib-k8s": "^1.34.7",
|
||||
"@certd/lib-server": "^1.34.7",
|
||||
"@certd/midway-flyway-js": "^1.34.7",
|
||||
"@certd/pipeline": "^1.34.7",
|
||||
"@certd/plugin-cert": "^1.34.7",
|
||||
"@certd/plugin-lib": "^1.34.7",
|
||||
"@certd/plugin-plus": "^1.34.7",
|
||||
"@certd/plus-core": "^1.34.7",
|
||||
"@certd/acme-client": "^1.34.8",
|
||||
"@certd/basic": "^1.34.8",
|
||||
"@certd/commercial-core": "^1.34.8",
|
||||
"@certd/jdcloud": "^1.34.8",
|
||||
"@certd/lib-huawei": "^1.34.8",
|
||||
"@certd/lib-k8s": "^1.34.8",
|
||||
"@certd/lib-server": "^1.34.8",
|
||||
"@certd/midway-flyway-js": "^1.34.8",
|
||||
"@certd/pipeline": "^1.34.8",
|
||||
"@certd/plugin-cert": "^1.34.8",
|
||||
"@certd/plugin-lib": "^1.34.8",
|
||||
"@certd/plugin-plus": "^1.34.8",
|
||||
"@certd/plus-core": "^1.34.8",
|
||||
"@corsinvest/cv4pve-api-javascript": "^8.3.0",
|
||||
"@huaweicloud/huaweicloud-sdk-cdn": "^3.1.120",
|
||||
"@huaweicloud/huaweicloud-sdk-core": "^3.1.120",
|
||||
|
||||
@@ -4,6 +4,7 @@ import { AuthService } from "../../../modules/sys/authority/service/auth-service
|
||||
import { SiteInfoService } from "../../../modules/monitor/service/site-info-service.js";
|
||||
import { UserSiteMonitorSetting } from "../../../modules/mine/service/models.js";
|
||||
import { merge } from "lodash-es";
|
||||
import {SiteIpService} from "../../../modules/monitor/service/site-ip-service.js";
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -14,6 +15,8 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
|
||||
service: SiteInfoService;
|
||||
@Inject()
|
||||
authService: AuthService;
|
||||
@Inject()
|
||||
siteIpService: SiteIpService;
|
||||
|
||||
getService(): SiteInfoService {
|
||||
return this.service;
|
||||
@@ -59,7 +62,10 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
|
||||
async add(@Body(ALL) bean: any) {
|
||||
bean.userId = this.getUserId();
|
||||
const res = await this.service.add(bean);
|
||||
this.service.check(res.id, true, 0);
|
||||
const entity = await this.service.info(res.id);
|
||||
if (entity.disabled) {
|
||||
this.service.check(entity.id, true, 0);
|
||||
}
|
||||
return this.ok(res);
|
||||
}
|
||||
|
||||
@@ -68,7 +74,10 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
|
||||
await this.service.checkUserId(bean.id, this.getUserId());
|
||||
delete bean.userId;
|
||||
await this.service.update(bean);
|
||||
this.service.check(bean.id, true, 0);
|
||||
const entity = await this.service.info(bean.id);
|
||||
if (entity.disabled) {
|
||||
this.service.check(entity.id, true, 0);
|
||||
}
|
||||
return this.ok();
|
||||
}
|
||||
@Post('/info', { summary: Constants.per.authOnly })
|
||||
@@ -96,8 +105,27 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
|
||||
await this.service.checkAllByUsers(userId);
|
||||
return this.ok();
|
||||
}
|
||||
@Post('/ipCheckChange', { summary: Constants.per.authOnly })
|
||||
async ipCheckChange(@Body(ALL) bean: any) {
|
||||
const userId = this.getUserId();
|
||||
await this.service.checkUserId(bean.id, userId)
|
||||
await this.service.ipCheckChange({
|
||||
id: bean.id,
|
||||
ipCheck: bean.ipCheck
|
||||
});
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
|
||||
@Post('/disabledChange', { summary: Constants.per.authOnly })
|
||||
async disabledChange(@Body(ALL) bean: any) {
|
||||
const userId = this.getUserId();
|
||||
await this.service.checkUserId(bean.id, userId)
|
||||
await this.service.disabledChange({
|
||||
id: bean.id,
|
||||
disabled: bean.disabled
|
||||
});
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@Post("/setting/get", { summary: Constants.per.authOnly })
|
||||
async get() {
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
import { ALL, Body, Controller, Inject, Post, Provide, Query } from "@midwayjs/core";
|
||||
import { Constants, CrudController } from "@certd/lib-server";
|
||||
import { AuthService } from "../../../modules/sys/authority/service/auth-service.js";
|
||||
import { SiteIpService } from "../../../modules/monitor/service/site-ip-service.js";
|
||||
import { SiteInfoService } from "../../../modules/monitor/index.js";
|
||||
|
||||
/**
|
||||
*/
|
||||
@Provide()
|
||||
@Controller('/api/monitor/site/ip')
|
||||
export class SiteInfoController extends CrudController<SiteIpService> {
|
||||
@Inject()
|
||||
service: SiteIpService;
|
||||
@Inject()
|
||||
authService: AuthService;
|
||||
@Inject()
|
||||
siteInfoService: SiteInfoService;
|
||||
|
||||
getService(): SiteIpService {
|
||||
return this.service;
|
||||
}
|
||||
|
||||
@Post('/page', { summary: Constants.per.authOnly })
|
||||
async page(@Body(ALL) body: any) {
|
||||
body.query = body.query ?? {};
|
||||
body.query.userId = this.getUserId();
|
||||
const res = await this.service.page({
|
||||
query: body.query,
|
||||
page: body.page,
|
||||
sort: body.sort,
|
||||
});
|
||||
return this.ok(res);
|
||||
}
|
||||
|
||||
@Post('/list', { summary: Constants.per.authOnly })
|
||||
async list(@Body(ALL) body: any) {
|
||||
body.query = body.query ?? {};
|
||||
body.query.userId = this.getUserId();
|
||||
return await super.list(body);
|
||||
}
|
||||
|
||||
@Post('/add', { summary: Constants.per.authOnly })
|
||||
async add(@Body(ALL) bean: any) {
|
||||
bean.userId = this.getUserId();
|
||||
bean.from = "manual"
|
||||
const res = await this.service.add(bean);
|
||||
const siteEntity = await this.siteInfoService.info(bean.siteId);
|
||||
if(!siteEntity.disabled){
|
||||
const {domain, httpsPort} = siteEntity;
|
||||
this.service.check(res.id,domain, httpsPort);
|
||||
}
|
||||
return this.ok(res);
|
||||
}
|
||||
|
||||
@Post('/update', { summary: Constants.per.authOnly })
|
||||
async update(@Body(ALL) bean) {
|
||||
await this.service.checkUserId(bean.id, this.getUserId());
|
||||
delete bean.userId;
|
||||
await this.service.update(bean);
|
||||
const siteEntity = await this.siteInfoService.info(bean.siteId);
|
||||
if(!siteEntity.disabled){
|
||||
const {domain, httpsPort} = siteEntity;
|
||||
this.service.check(siteEntity.id,domain, httpsPort);
|
||||
}
|
||||
return this.ok();
|
||||
}
|
||||
@Post('/info', { summary: Constants.per.authOnly })
|
||||
async info(@Query('id') id: number) {
|
||||
await this.service.checkUserId(id, this.getUserId());
|
||||
return await super.info(id);
|
||||
}
|
||||
|
||||
@Post('/delete', { summary: Constants.per.authOnly })
|
||||
async delete(@Query('id') id: number) {
|
||||
const entity = await this.service.info(id);
|
||||
await this.service.checkUserId(id, this.getUserId());
|
||||
|
||||
const res = await super.delete(id);
|
||||
await this.service.updateIpCount(entity.siteId)
|
||||
return res
|
||||
}
|
||||
|
||||
@Post('/check', { summary: Constants.per.authOnly })
|
||||
async check(@Body('id') id: number) {
|
||||
await this.service.checkUserId(id, this.getUserId());
|
||||
const entity = await this.service.info(id);
|
||||
const siteEntity = await this.siteInfoService.info(entity.siteId);
|
||||
const domain = siteEntity.domain;
|
||||
const port = siteEntity.httpsPort;
|
||||
this.service.check(id,domain,port);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@Post('/checkAll', { summary: Constants.per.authOnly })
|
||||
async checkAll(@Body('siteId') siteId: number) {
|
||||
const userId = this.getUserId();
|
||||
await this.siteInfoService.checkUserId(siteId, userId);
|
||||
const siteEntity = await this.siteInfoService.info(siteId);
|
||||
await this.service.checkAll(siteEntity);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@Post('/sync', { summary: Constants.per.authOnly })
|
||||
async sync(@Body('siteId') siteId: number) {
|
||||
const userId = this.getUserId();
|
||||
const entity = await this.siteInfoService.info(siteId)
|
||||
if(entity.userId != userId){
|
||||
throw new Error('无权限')
|
||||
}
|
||||
await this.service.sync(entity);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -122,4 +122,10 @@ export class PipelineController extends CrudController<PipelineService> {
|
||||
await this.service.batchUpdateGroup(ids, groupId, this.getUserId());
|
||||
return this.ok({});
|
||||
}
|
||||
|
||||
@Post('/batchRerun', { summary: Constants.per.authOnly })
|
||||
async batchRerun(@Body('ids') ids: number[]) {
|
||||
await this.service.batchRerun(ids, this.getUserId());
|
||||
return this.ok({});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,17 @@ export class SiteInfoEntity {
|
||||
@Column({ name: 'cert_info_id', comment: '证书id' })
|
||||
certInfoId: number;
|
||||
|
||||
|
||||
@Column({ name: 'ip_check', comment: '是否检查IP' })
|
||||
ipCheck: boolean;
|
||||
|
||||
@Column({ name: 'ip_count', comment: 'ip数量' })
|
||||
ipCount: number
|
||||
|
||||
@Column({ name: 'ip_error_count', comment: 'ip异常数量' })
|
||||
ipErrorCount: number
|
||||
|
||||
|
||||
@Column({ name: 'disabled', comment: '禁用启用' })
|
||||
disabled: boolean;
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
*/
|
||||
@Entity('cd_site_ip')
|
||||
export class SiteIpEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
@Column({ name: 'user_id', comment: '用户id' })
|
||||
userId: number;
|
||||
@Column({ name: 'site_id', comment: '站点id' })
|
||||
siteId: number;
|
||||
@Column({ name: 'ip_address', comment: 'IP', length: 100 })
|
||||
ipAddress: string;
|
||||
|
||||
@Column({ name: 'cert_domains', comment: '证书域名', length: 4096 })
|
||||
certDomains: string;
|
||||
@Column({ name: 'cert_status', comment: '证书状态', length: 100 })
|
||||
certStatus: string;
|
||||
@Column({ name: 'cert_provider', comment: '证书颁发机构', length: 100 })
|
||||
certProvider: string;
|
||||
@Column({ name: 'cert_expires_time', comment: '证书到期时间' })
|
||||
certExpiresTime: number;
|
||||
@Column({ name: 'last_check_time', comment: '上次检查时间' })
|
||||
lastCheckTime: number;
|
||||
@Column({ name: 'check_status', comment: '检查状态' })
|
||||
checkStatus: string;
|
||||
@Column({ name: 'error', comment: '错误信息' })
|
||||
error: string;
|
||||
@Column({ name: 'from', comment: '来源' })
|
||||
from: string
|
||||
@Column({ name: 'remark', comment: '备注' })
|
||||
remark: string;
|
||||
@Column({ name: "disabled", comment: "禁用启用" })
|
||||
disabled: boolean;
|
||||
|
||||
@Column({ name: 'create_time', comment: '创建时间', default: () => 'CURRENT_TIMESTAMP' })
|
||||
createTime: Date;
|
||||
@Column({ name: 'update_time', comment: '修改时间', default: () => 'CURRENT_TIMESTAMP' })
|
||||
updateTime: Date;
|
||||
}
|
||||
@@ -12,6 +12,8 @@ import { isComm, isPlus } from '@certd/plus-core';
|
||||
import { UserSuiteService } from '@certd/commercial-core';
|
||||
import { UserSettingsService } from "../../mine/service/user-settings-service.js";
|
||||
import { UserSiteMonitorSetting } from "../../mine/service/models.js";
|
||||
import {SiteIpService} from "./site-ip-service.js";
|
||||
import {SiteIpEntity} from "../entity/site-ip.js";
|
||||
|
||||
@Provide()
|
||||
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
||||
@@ -31,6 +33,8 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
|
||||
@Inject()
|
||||
userSettingsService: UserSettingsService;
|
||||
|
||||
@Inject()
|
||||
siteIpService: SiteIpService;
|
||||
|
||||
//@ts-ignore
|
||||
getRepository() {
|
||||
@@ -94,7 +98,7 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
|
||||
await this.update({
|
||||
id: site.id,
|
||||
checkStatus: 'checking',
|
||||
lastCheckTime: dayjs,
|
||||
lastCheckTime: dayjs().valueOf(),
|
||||
});
|
||||
const res = await siteTester.test({
|
||||
host: site.domain,
|
||||
@@ -128,6 +132,11 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
|
||||
};
|
||||
|
||||
await this.update(updateData);
|
||||
|
||||
|
||||
//检查ip
|
||||
await this.checkAllIp(site)
|
||||
|
||||
if (!notify) {
|
||||
return;
|
||||
}
|
||||
@@ -155,8 +164,48 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
|
||||
}
|
||||
}
|
||||
|
||||
async checkAllIp(site:SiteInfoEntity){
|
||||
if( !site.ipCheck){
|
||||
return;
|
||||
}
|
||||
const certExpiresTime = site.certExpiresTime;
|
||||
const onFinished = async (list:SiteIpEntity[])=>{
|
||||
let errorCount = 0
|
||||
let errorMessage = ""
|
||||
for (const item of list) {
|
||||
if (!item) {
|
||||
continue;
|
||||
}
|
||||
errorCount++
|
||||
if(item.error){
|
||||
errorMessage += `${item.ipAddress}:${item.error}; \n`
|
||||
}else if(item.certExpiresTime!==certExpiresTime){
|
||||
errorMessage += `${item.ipAddress}:与主站证书过期时间不一致; \n`
|
||||
}else{
|
||||
errorCount--
|
||||
}
|
||||
}
|
||||
if (errorCount<=0){
|
||||
return
|
||||
}
|
||||
await this.update({
|
||||
id: site.id,
|
||||
checkStatus: 'error',
|
||||
error: errorMessage,
|
||||
ipErrorCount: errorCount,
|
||||
})
|
||||
try {
|
||||
site = await this.info(site.id)
|
||||
await this.sendCheckErrorNotify(site,true);
|
||||
} catch (e) {
|
||||
logger.error('send notify error', e);
|
||||
}
|
||||
}
|
||||
await this.siteIpService.checkAll(site,onFinished)
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查,但不发邮件
|
||||
* 检查
|
||||
* @param id
|
||||
* @param notify
|
||||
* @param retryTimes
|
||||
@@ -169,7 +218,7 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
|
||||
return await this.doCheck(site, notify, retryTimes);
|
||||
}
|
||||
|
||||
async sendCheckErrorNotify(site: SiteInfoEntity) {
|
||||
async sendCheckErrorNotify(site: SiteInfoEntity,fromIpCheck=false) {
|
||||
const url = await this.notificationService.getBindUrl('#/certd/monitor/site');
|
||||
// 发邮件
|
||||
await this.notificationService.send(
|
||||
@@ -178,8 +227,9 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
|
||||
logger: logger,
|
||||
body: {
|
||||
url,
|
||||
title: `站点证书检查出错<${site.name}>`,
|
||||
title: `站点证书${fromIpCheck?"(IP)":""}检查出错<${site.name}>`,
|
||||
content: `站点名称: ${site.name} \n站点域名: ${site.domain} \n错误信息:${site.error}`,
|
||||
errorMessage: site.error,
|
||||
},
|
||||
},
|
||||
site.userId
|
||||
@@ -217,6 +267,7 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
|
||||
title: `站点证书已过期${-validDays}天<${site.name}>`,
|
||||
content,
|
||||
url,
|
||||
errorMessage: "站点证书已过期"
|
||||
},
|
||||
},
|
||||
site.userId
|
||||
@@ -250,4 +301,27 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
|
||||
async saveSetting(userId: number, bean: UserSiteMonitorSetting) {
|
||||
await this.userSettingsService.saveSetting(userId, bean);
|
||||
}
|
||||
|
||||
async ipCheckChange(req: {id: any; ipCheck: any}) {
|
||||
|
||||
await this.update({
|
||||
id: req.id,
|
||||
ipCheck: req.ipCheck,
|
||||
});
|
||||
if(req.ipCheck){
|
||||
const site = await this.info(req.id);
|
||||
await this.siteIpService.sync(site)
|
||||
}
|
||||
}
|
||||
|
||||
async disabledChange(req: { disabled: any; id: any }) {
|
||||
await this.update({
|
||||
id: req.id,
|
||||
disabled: req.disabled,
|
||||
});
|
||||
if(!req.disabled){
|
||||
const site = await this.info(req.id);
|
||||
await this.doCheck(site)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
import {Inject, Provide, Scope, ScopeEnum} from "@midwayjs/core";
|
||||
import {BaseService, SysSettingsService} from "@certd/lib-server";
|
||||
import {InjectEntityModel} from "@midwayjs/typeorm";
|
||||
import {Repository} from "typeorm";
|
||||
import {SiteInfoEntity} from "../entity/site-info.js";
|
||||
import {NotificationService} from "../../pipeline/service/notification-service.js";
|
||||
import {UserSuiteService} from "@certd/commercial-core";
|
||||
import {UserSettingsService} from "../../mine/service/user-settings-service.js";
|
||||
import {SiteIpEntity} from "../entity/site-ip.js";
|
||||
import dns from "dns";
|
||||
import {logger, safePromise} from "@certd/basic";
|
||||
import dayjs from "dayjs";
|
||||
import {siteTester} from "./site-tester.js";
|
||||
import {PeerCertificate} from "tls";
|
||||
|
||||
@Provide()
|
||||
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
||||
export class SiteIpService extends BaseService<SiteIpEntity> {
|
||||
@InjectEntityModel(SiteIpEntity)
|
||||
repository: Repository<SiteIpEntity>;
|
||||
@InjectEntityModel(SiteInfoEntity)
|
||||
siteInfoRepository: Repository<SiteInfoEntity>;
|
||||
|
||||
@Inject()
|
||||
notificationService: NotificationService;
|
||||
|
||||
@Inject()
|
||||
sysSettingsService: SysSettingsService;
|
||||
|
||||
@Inject()
|
||||
userSuiteService: UserSuiteService;
|
||||
|
||||
@Inject()
|
||||
userSettingsService: UserSettingsService;
|
||||
|
||||
//@ts-ignore
|
||||
getRepository() {
|
||||
return this.repository;
|
||||
}
|
||||
|
||||
async add(data: SiteIpEntity) {
|
||||
if (!data.userId) {
|
||||
throw new Error("userId is required");
|
||||
}
|
||||
data.disabled = false;
|
||||
const res= await super.add(data);
|
||||
await this.updateIpCount(data.siteId)
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
async update(data: any) {
|
||||
if (!data.id) {
|
||||
throw new Error("id is required");
|
||||
}
|
||||
delete data.userId;
|
||||
await super.update(data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
async sync(entity: SiteInfoEntity) {
|
||||
|
||||
const domain = entity.domain;
|
||||
//从域名解析中获取所有ip
|
||||
const ips = await this.getAllIpsFromDomain(domain);
|
||||
if (ips.length === 0 ) {
|
||||
throw new Error(`没有发现${domain}的IP`)
|
||||
}
|
||||
//删除所有的ip
|
||||
await this.repository.delete({
|
||||
siteId: entity.id,
|
||||
from: "sync"
|
||||
});
|
||||
|
||||
//添加新的ip
|
||||
for (const ip of ips) {
|
||||
await this.repository.save({
|
||||
ipAddress: ip,
|
||||
userId: entity.userId,
|
||||
siteId: entity.id,
|
||||
from: "sync",
|
||||
disabled:false,
|
||||
});
|
||||
}
|
||||
|
||||
await this.checkAll(entity);
|
||||
await this.updateIpCount(entity.id)
|
||||
}
|
||||
|
||||
async check(ipId: number, domain: string, port: number) {
|
||||
if(!ipId){
|
||||
return
|
||||
}
|
||||
const entity = await this.info(ipId);
|
||||
if (!entity) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await this.update({
|
||||
id: entity.id,
|
||||
checkStatus: "checking",
|
||||
lastCheckTime: dayjs().valueOf()
|
||||
});
|
||||
const res = await siteTester.test({
|
||||
host: domain,
|
||||
port: port,
|
||||
retryTimes: 3,
|
||||
ipAddress: entity.ipAddress
|
||||
});
|
||||
|
||||
const certi: PeerCertificate = res.certificate;
|
||||
if (!certi) {
|
||||
throw new Error("没有发现证书");
|
||||
}
|
||||
const expires = certi.valid_to;
|
||||
const allDomains = certi.subjectaltname?.replaceAll("DNS:", "").split(",") || [];
|
||||
const mainDomain = certi.subject?.CN;
|
||||
let domains = allDomains;
|
||||
if (!allDomains.includes(mainDomain)) {
|
||||
domains = [mainDomain, ...allDomains];
|
||||
}
|
||||
const issuer = `${certi.issuer.O}<${certi.issuer.CN}>`;
|
||||
const isExpired = dayjs().valueOf() > dayjs(expires).valueOf();
|
||||
const status = isExpired ? "expired" : "ok";
|
||||
const updateData = {
|
||||
id: entity.id,
|
||||
certDomains: domains.join(","),
|
||||
certStatus: status,
|
||||
certProvider: issuer,
|
||||
certExpiresTime: dayjs(expires).valueOf(),
|
||||
lastCheckTime: dayjs().valueOf(),
|
||||
error: null,
|
||||
checkStatus: "ok"
|
||||
};
|
||||
|
||||
await this.update(updateData);
|
||||
|
||||
return updateData
|
||||
|
||||
} catch (e) {
|
||||
logger.error("check site ip error", e);
|
||||
await this.update({
|
||||
id: entity.id,
|
||||
checkStatus: "error",
|
||||
lastCheckTime: dayjs().valueOf(),
|
||||
error: e.message
|
||||
});
|
||||
return {
|
||||
id: entity.id,
|
||||
ipAddress: entity.ipAddress,
|
||||
error: e.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async checkAll(siteInfo: SiteInfoEntity,onFinish?: (e: any) => void) {
|
||||
const siteId = siteInfo.id;
|
||||
const ips = await this.repository.find({
|
||||
where: {
|
||||
siteId: siteId
|
||||
}
|
||||
});
|
||||
const domain = siteInfo.domain;
|
||||
const port = siteInfo.httpsPort;
|
||||
const promiseList = [];
|
||||
for (const item of ips) {
|
||||
const func = async () => {
|
||||
try {
|
||||
return await this.check(item.id, domain, port);
|
||||
} catch (e) {
|
||||
logger.error("check site item error", e);
|
||||
return {
|
||||
...item,
|
||||
error:e.message
|
||||
}
|
||||
}
|
||||
}
|
||||
promiseList.push(func());
|
||||
}
|
||||
Promise.all(promiseList).then((res)=>{
|
||||
const finished = res.filter(item=>{
|
||||
return item!=null
|
||||
})
|
||||
if (finished.length > 0) {
|
||||
onFinish && onFinish(finished)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async getAllIpsFromDomain(domain: string) {
|
||||
const getFromV4 = safePromise<string[]>((resolve, reject) => {
|
||||
dns.resolve4(domain, (err, addresses) => {
|
||||
if (err) {
|
||||
logger.error(`[${domain}] resolve4 error`, err)
|
||||
resolve([])
|
||||
return;
|
||||
}
|
||||
resolve(addresses);
|
||||
});
|
||||
});
|
||||
|
||||
const getFromV6 = safePromise<string[]>((resolve, reject) => {
|
||||
dns.resolve6(domain, (err, addresses) => {
|
||||
if (err) {
|
||||
logger.error("[${domain}] resolve6 error", err)
|
||||
resolve([])
|
||||
return;
|
||||
}
|
||||
resolve(addresses);
|
||||
});
|
||||
});
|
||||
|
||||
return Promise.all([getFromV4, getFromV6]).then(res => {
|
||||
return [...res[0], ...res[1]];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async updateIpCount(siteId:number){
|
||||
const count = await this.repository.count({
|
||||
where:{
|
||||
siteId
|
||||
}
|
||||
})
|
||||
await this.siteInfoRepository.update({
|
||||
//where
|
||||
id:siteId,
|
||||
},
|
||||
{
|
||||
//update
|
||||
ipCount:count
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,23 @@
|
||||
import {logger, safePromise, utils} from '@certd/basic';
|
||||
import { merge } from 'lodash-es';
|
||||
import https from 'https';
|
||||
import { PeerCertificate } from 'tls';
|
||||
import { logger, safePromise, utils } from "@certd/basic";
|
||||
import { merge } from "lodash-es";
|
||||
import https from "https";
|
||||
import { PeerCertificate } from "tls";
|
||||
|
||||
export type SiteTestReq = {
|
||||
host: string; // 只用域名部分
|
||||
port?: number;
|
||||
method?: string;
|
||||
retryTimes?: number;
|
||||
ipAddress?: string;
|
||||
};
|
||||
|
||||
export type SiteTestRes = {
|
||||
certificate?: PeerCertificate;
|
||||
};
|
||||
|
||||
export class SiteTester {
|
||||
async test(req: SiteTestReq): Promise<SiteTestRes> {
|
||||
logger.info('测试站点:', JSON.stringify(req));
|
||||
logger.info("测试站点:", JSON.stringify(req));
|
||||
const maxRetryTimes = req.retryTimes ?? 3;
|
||||
let tryCount = 0;
|
||||
let result: SiteTestRes = {};
|
||||
@@ -37,17 +40,28 @@ export class SiteTester {
|
||||
}
|
||||
|
||||
async doTestOnce(req: SiteTestReq): Promise<SiteTestRes> {
|
||||
const agent = new https.Agent({ keepAlive: false });
|
||||
|
||||
const options: any = merge(
|
||||
{
|
||||
port: 443,
|
||||
method: 'GET',
|
||||
rejectUnauthorized: false,
|
||||
method: "GET",
|
||||
rejectUnauthorized: false
|
||||
},
|
||||
req
|
||||
);
|
||||
options.agent = agent;
|
||||
|
||||
if (req.ipAddress) {
|
||||
//使用固定的ip
|
||||
const ipAddress = req.ipAddress;
|
||||
options.headers={
|
||||
host: options.host,
|
||||
//sni
|
||||
servername: options.host
|
||||
}
|
||||
options.host = ipAddress;
|
||||
}
|
||||
|
||||
options.agent = new https.Agent({ keepAlive: false });
|
||||
|
||||
// 创建 HTTPS 请求
|
||||
const requestPromise = safePromise((resolve, reject) => {
|
||||
const req = https.request(options, res => {
|
||||
@@ -56,20 +70,20 @@ export class SiteTester {
|
||||
const certificate = res.socket.getPeerCertificate();
|
||||
// logger.info('证书信息', certificate);
|
||||
if (certificate.subject == null) {
|
||||
logger.warn('证书信息为空');
|
||||
logger.warn("证书信息为空");
|
||||
resolve({
|
||||
certificate: null,
|
||||
certificate: null
|
||||
});
|
||||
}
|
||||
resolve({
|
||||
certificate,
|
||||
certificate
|
||||
});
|
||||
res.socket.end();
|
||||
// 关闭响应
|
||||
res.destroy();
|
||||
});
|
||||
|
||||
req.on('error', e => {
|
||||
req.on("error", e => {
|
||||
reject(e);
|
||||
});
|
||||
req.end();
|
||||
|
||||
@@ -38,7 +38,7 @@ import {CnameRecordService} from "../../cname/service/cname-record-service.js";
|
||||
import {PluginConfigGetter} from "../../plugin/service/plugin-config-getter.js";
|
||||
import dayjs from "dayjs";
|
||||
import {DbAdapter} from "../../db/index.js";
|
||||
import {isComm} from "@certd/plus-core";
|
||||
import {isComm, isPlus} from "@certd/plus-core";
|
||||
import {logger} from "@certd/basic";
|
||||
import {UrlService} from "./url-service.js";
|
||||
import {NotificationService} from "./notification-service.js";
|
||||
@@ -429,6 +429,12 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
||||
logger.info('当前定时器数量:', this.cron.getTaskSize());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @param triggerId =null手动启动
|
||||
* @param stepId 如果传入ALL,清空所有状态
|
||||
*/
|
||||
async run(id: number, triggerId: string, stepId?: string) {
|
||||
const entity: PipelineEntity = await this.info(id);
|
||||
await this.doRun(entity, triggerId, stepId);
|
||||
@@ -684,6 +690,42 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
||||
{ groupId }
|
||||
);
|
||||
}
|
||||
async batchRerun(ids: number[], userId: any) {
|
||||
if (!isPlus()){
|
||||
throw new NeedVIPException("此功能需要升级专业版")
|
||||
}
|
||||
|
||||
if (!userId || ids.length === 0) {
|
||||
return;
|
||||
}
|
||||
const list = await this.repository.find({
|
||||
select:{
|
||||
id:true
|
||||
},
|
||||
where:{
|
||||
id: In(ids),
|
||||
userId
|
||||
}
|
||||
})
|
||||
|
||||
ids = list.map(item=>item.id)
|
||||
|
||||
//异步执行
|
||||
this.startBatchRerun(ids)
|
||||
}
|
||||
|
||||
async startBatchRerun(ids: number[]){
|
||||
//20条一批
|
||||
const batchSize = 20;
|
||||
for (let i = 0; i < ids.length; i += batchSize) {
|
||||
const batchIds = ids.slice(i, i + batchSize);
|
||||
const batchPromises = batchIds.map(async (id)=>{
|
||||
await this.run(id,null,"ALL")
|
||||
});
|
||||
await Promise.all(batchPromises)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async getUserPipelineCount(userId) {
|
||||
return await this.repository.count({ where: { userId } });
|
||||
|
||||
@@ -132,10 +132,12 @@ export class AliyunDeployCertToESA extends AbstractTaskPlugin {
|
||||
// 接口版本
|
||||
version: "2024-09-10",
|
||||
data: {
|
||||
SiteId: siteId,
|
||||
CasId: certId,
|
||||
Type: "cas",
|
||||
Name: certName
|
||||
body:{
|
||||
SiteId: siteId,
|
||||
CasId: certId,
|
||||
Type: "cas",
|
||||
Name: certName
|
||||
}
|
||||
}
|
||||
});
|
||||
this.logger.info(`部署站点[${siteId}]证书成功:${JSON.stringify(res)}`);
|
||||
@@ -197,8 +199,10 @@ export class AliyunDeployCertToESA extends AbstractTaskPlugin {
|
||||
action: "ListCertificates",
|
||||
version: "2024-09-10",
|
||||
method: "GET",
|
||||
query: {
|
||||
SiteId: siteId
|
||||
data:{
|
||||
query: {
|
||||
SiteId: siteId
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -212,10 +216,12 @@ export class AliyunDeployCertToESA extends AbstractTaskPlugin {
|
||||
version: "2024-09-10",
|
||||
// 接口 HTTP 方法
|
||||
method: "GET",
|
||||
query: {
|
||||
SiteId: siteId,
|
||||
Id: item.id
|
||||
}
|
||||
data:{
|
||||
query: {
|
||||
SiteId: siteId,
|
||||
Id: item.id
|
||||
}
|
||||
}
|
||||
});
|
||||
this.logger.info(`证书${item.Name}已删除`);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import { CertInfo, CertReader } from "@certd/plugin-cert";
|
||||
export class FarcdnAccess extends BaseAccess {
|
||||
@AccessInput({
|
||||
title: "接口地址",
|
||||
value:"https://open.farcdn.net/api/source",
|
||||
component: {
|
||||
placeholder: "https://open.farcdn.net/api/source",
|
||||
name: "a-input",
|
||||
@@ -63,7 +64,7 @@ export class FarcdnAccess extends BaseAccess {
|
||||
}
|
||||
},
|
||||
encrypt: false,
|
||||
required: true
|
||||
required: false
|
||||
})
|
||||
httpProxy!: string;
|
||||
|
||||
@@ -79,21 +80,16 @@ export class FarcdnAccess extends BaseAccess {
|
||||
testRequest = true;
|
||||
|
||||
async onTestRequest() {
|
||||
try{
|
||||
const data = await this.findSSLCertConfig(1);
|
||||
if (data) {
|
||||
return "ok";
|
||||
}
|
||||
}catch (e) {
|
||||
if(e.message.indexOf("11111111")>-1){
|
||||
return "ok";
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
throw "测试失败,未知错误";
|
||||
await this.getSSLCertList({size:1});
|
||||
return "ok"
|
||||
}
|
||||
|
||||
async getSSLCertList(req:{offset?:number,size?:number}){
|
||||
return await this.doRequest({
|
||||
url: "/getSSLCertList",
|
||||
data: req
|
||||
});
|
||||
}
|
||||
|
||||
async findSSLCertConfig(sslCertId: number) {
|
||||
/**
|
||||
@@ -154,7 +150,7 @@ export class FarcdnAccess extends BaseAccess {
|
||||
keyData: req.cert.key,
|
||||
isOn: true,
|
||||
isCA: false,
|
||||
serverName: oldCert.serverName,
|
||||
serverName: oldCert.serverName || certReader.getMainDomain(),
|
||||
commonNames: [certReader.getMainDomain()],
|
||||
dnsNames: certReader.getAltNames(),
|
||||
timeBeginAt: detail.notBefore,
|
||||
@@ -183,7 +179,7 @@ export class FarcdnAccess extends BaseAccess {
|
||||
httpProxy: this.httpProxy||undefined,
|
||||
});
|
||||
|
||||
if (res.code === "200") {
|
||||
if (res.code === 200) {
|
||||
return res.data;
|
||||
}
|
||||
throw new Error(res.message || res);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
|
||||
import { IsTaskPlugin, PageReq, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
|
||||
import { CertApplyPluginNames, CertInfo } from "@certd/plugin-cert";
|
||||
import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from "@certd/plugin-lib";
|
||||
import { FarcdnAccess } from "../access.js";
|
||||
@@ -8,6 +8,7 @@ import { AbstractPlusTaskPlugin } from "@certd/plugin-plus";
|
||||
//命名规范,插件类型+功能(就是目录plugin-demo中的demo),大写字母开头,驼峰命名
|
||||
name: "FarcdnRefreshCert",
|
||||
title: "farcdn-更新证书",
|
||||
desc:"www.farcdn.net",
|
||||
icon: "svg:icon-lucky",
|
||||
//插件分组
|
||||
group: pluginGroups.cdn.key,
|
||||
@@ -52,6 +53,7 @@ export class FarcdnRefreshCert extends AbstractPlusTaskPlugin {
|
||||
createRemoteSelectInputDefine({
|
||||
title: "证书Id",
|
||||
helper: "要更新的Farcdn证书id",
|
||||
|
||||
action: FarcdnRefreshCert.prototype.onGetCertList.name
|
||||
})
|
||||
)
|
||||
@@ -77,28 +79,31 @@ export class FarcdnRefreshCert extends AbstractPlusTaskPlugin {
|
||||
this.logger.info("部署完成");
|
||||
}
|
||||
|
||||
async onGetCertList() {
|
||||
throw new Error("暂无查询证书列表接口,您需要手动输入证书id");
|
||||
// const access = await this.getAccess<FarcdnAccess>(this.accessId);
|
||||
async onGetCertList(data:PageReq = {}) {
|
||||
const access = await this.getAccess<FarcdnAccess>(this.accessId);
|
||||
|
||||
// const res = await access.doRequest({
|
||||
// url: "/SSLCertService/listSSLCerts",
|
||||
// data: { size: 1000 },
|
||||
// method: "POST"
|
||||
// });
|
||||
// const list = JSON.parse(this.ctx.utils.hash.base64Decode(res.sslCertsJSON));
|
||||
// if (!list || list.length === 0) {
|
||||
// throw new Error("没有找到证书,请先在控制台上传一次证书且关联网站");
|
||||
// }
|
||||
//
|
||||
// const options = list.map((item: any) => {
|
||||
// return {
|
||||
// label: `${item.name}<${item.id}-${item.dnsNames[0]}>`,
|
||||
// value: item.id,
|
||||
// domain: item.dnsNames
|
||||
// };
|
||||
// });
|
||||
// return this.ctx.utils.options.buildGroupOptions(options, this.certDomains);
|
||||
const res = await access.getSSLCertList({
|
||||
offset: data.offset?? 0,
|
||||
size: data.limit?? 100,
|
||||
});
|
||||
const list = res.list
|
||||
if (!list || list.length === 0) {
|
||||
throw new Error("没有找到证书,请先在控制台上传一次证书且关联网站");
|
||||
}
|
||||
|
||||
const options = list.map((item: any) => {
|
||||
return {
|
||||
label: `${item.name}<${item.id}>`,
|
||||
value: item.id,
|
||||
domain: item.dnsNames
|
||||
};
|
||||
});
|
||||
return {
|
||||
list:this.ctx.utils.options.buildGroupOptions(options, this.certDomains),
|
||||
total:res.total,
|
||||
offset: res.offset,
|
||||
limit:res.size
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,14 @@ export class HauweiDeployCertToCDN extends AbstractTaskPlugin {
|
||||
@TaskInput(createCertDomainGetterInputDefine({ props: { required: false } }))
|
||||
certDomains!: string[];
|
||||
|
||||
@TaskInput({
|
||||
title: '企业项目ID',
|
||||
helper: '华为云子账号必填,"all"表示查询所有项目',
|
||||
required: false,
|
||||
value:"all"
|
||||
})
|
||||
enterpriseProjectId!: string;
|
||||
|
||||
@TaskInput({
|
||||
title: 'Access授权',
|
||||
helper: '华为云授权AccessKeyId、AccessKeySecret',
|
||||
@@ -52,6 +60,8 @@ export class HauweiDeployCertToCDN extends AbstractTaskPlugin {
|
||||
)
|
||||
domains!: string[];
|
||||
|
||||
|
||||
|
||||
async execute(): Promise<void> {
|
||||
if (!this.cert) {
|
||||
throw new Error('域名证书不能为空');
|
||||
@@ -84,6 +94,9 @@ export class HauweiDeployCertToCDN extends AbstractTaskPlugin {
|
||||
this.logger.info('部署到域名:', domain);
|
||||
|
||||
const queryReq = new cdn.ShowDomainDetailByNameRequest(domain);
|
||||
if(this.enterpriseProjectId){
|
||||
queryReq.withEnterpriseProjectId(this.enterpriseProjectId)
|
||||
}
|
||||
const domainDetail = await client.showDomainDetailByName(queryReq);
|
||||
//@ts-ignore
|
||||
const status = domainDetail.domain.domainStatus || domainDetail.domain.domain_status
|
||||
@@ -94,6 +107,9 @@ export class HauweiDeployCertToCDN extends AbstractTaskPlugin {
|
||||
}
|
||||
try{
|
||||
const req = new cdn.UpdateDomainFullConfigRequest().withDomainName(domain).withBody(body);
|
||||
if(this.enterpriseProjectId){
|
||||
req.withEnterpriseProjectId(this.enterpriseProjectId)
|
||||
}
|
||||
await client.updateDomainFullConfig(req);
|
||||
this.logger.info(`部署到域名${domain}完成:`);
|
||||
}catch (e) {
|
||||
@@ -129,6 +145,7 @@ export class HauweiDeployCertToCDN extends AbstractTaskPlugin {
|
||||
const request = new cdn.ListDomainsRequest();
|
||||
request.pageNumber = 1;
|
||||
request.pageSize = 1000;
|
||||
request.enterpriseProjectId = this.enterpriseProjectId || undefined;
|
||||
const result: any = await client.listDomains(request);
|
||||
if (!result || !result.domains || result.domains.length === 0) {
|
||||
throw new Error('未找到CDN域名,您可以手动输入');
|
||||
|
||||
@@ -44,7 +44,7 @@ export class NamesiloDnsProvider extends AbstractDnsProvider<NamesiloRecord> {
|
||||
},
|
||||
});
|
||||
|
||||
if (res.reply?.code !== '300') {
|
||||
if (res.reply?.code !== '300' && res.reply?.code !== 300 && res.reply?.detail!=="success") {
|
||||
throw new Error(`${JSON.stringify(res.reply.detail)}`);
|
||||
}
|
||||
return res.reply;
|
||||
@@ -93,7 +93,7 @@ export class NamesiloDnsProvider extends AbstractDnsProvider<NamesiloRecord> {
|
||||
const recordId = record.record_id;
|
||||
await this.doRequest('/api/dnsDeleteRecord', {
|
||||
domain: options.recordReq.domain,
|
||||
record_id: recordId,
|
||||
rrid: recordId,
|
||||
});
|
||||
this.logger.info(`删除域名解析成功:fullRecord=${fullRecord},value=${value}`);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline';
|
||||
import dayjs from 'dayjs';
|
||||
import { CertApplyPluginNames} from '@certd/plugin-cert';
|
||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from "@certd/pipeline";
|
||||
import { CertApplyPluginNames, CertReader } from "@certd/plugin-cert";
|
||||
import { TencentAccess, TencentSslClient } from "@certd/plugin-lib";
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'UploadCertToTencent',
|
||||
title: '腾讯云-上传证书到腾讯云',
|
||||
@@ -14,8 +15,8 @@ import { CertApplyPluginNames} from '@certd/plugin-cert';
|
||||
},
|
||||
})
|
||||
export class UploadCertToTencent extends AbstractTaskPlugin {
|
||||
@TaskInput({ title: '证书名称' })
|
||||
name!: string;
|
||||
// @TaskInput({ title: '证书名称' })
|
||||
// name!: string;
|
||||
|
||||
@TaskInput({
|
||||
title: 'Access授权',
|
||||
@@ -51,63 +52,23 @@ export class UploadCertToTencent extends AbstractTaskPlugin {
|
||||
}
|
||||
|
||||
async execute(): Promise<void> {
|
||||
const { accessId, name, cert } = this;
|
||||
const accessProvider = await this.getAccess(accessId);
|
||||
const certName = this.appendTimeSuffix(name || cert.domain);
|
||||
const client = this.getClient(accessProvider);
|
||||
const access = await this.getAccess<TencentAccess>(this.accessId);
|
||||
const sslClient = new TencentSslClient({
|
||||
access,
|
||||
logger: this.logger,
|
||||
});
|
||||
|
||||
const params = {
|
||||
CertificatePublicKey: cert.crt,
|
||||
CertificatePrivateKey: cert.key,
|
||||
Alias: certName,
|
||||
};
|
||||
const ret = await client.UploadCertificate(params);
|
||||
this.checkRet(ret);
|
||||
this.logger.info('证书上传成功:tencentCertId=', ret.CertificateId);
|
||||
const certReader = new CertReader(this.cert);
|
||||
const tencentCertId = await sslClient.uploadToTencent({
|
||||
certName: certReader.buildCertName(),
|
||||
cert: this.cert,
|
||||
});
|
||||
|
||||
this.tencentCertId = ret.CertificateId;
|
||||
this.tencentCertId = tencentCertId;
|
||||
}
|
||||
|
||||
appendTimeSuffix(name: string) {
|
||||
if (name == null) {
|
||||
name = 'certd';
|
||||
}
|
||||
return name + '-' + dayjs().format('YYYYMMDD-HHmmss');
|
||||
}
|
||||
|
||||
getClient(accessProvider: any) {
|
||||
const SslClient = this.Client;
|
||||
|
||||
const clientConfig = {
|
||||
credential: {
|
||||
secretId: accessProvider.secretId,
|
||||
secretKey: accessProvider.secretKey,
|
||||
},
|
||||
region: '',
|
||||
profile: {
|
||||
httpProfile: {
|
||||
endpoint: 'ssl.tencentcloudapi.com',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
return new SslClient(clientConfig);
|
||||
}
|
||||
|
||||
// async rollback({ input }) {
|
||||
// const { accessId } = input;
|
||||
// const accessProvider = await this.getAccess(accessId);
|
||||
// const client = this.getClient(accessProvider);
|
||||
//
|
||||
// const { tencentCertId } = context;
|
||||
// const params = {
|
||||
// CertificateId: tencentCertId,
|
||||
// };
|
||||
// const ret = await client.DeleteCertificate(params);
|
||||
// this.checkRet(ret);
|
||||
// this.logger.info("证书删除成功:DeleteResult=", ret.DeleteResult);
|
||||
// delete context.tencentCertId;
|
||||
// }
|
||||
checkRet(ret: any) {
|
||||
if (!ret || ret.Error) {
|
||||
throw new Error('执行失败:' + ret.Error.Code + ',' + ret.Error.Message);
|
||||
|
||||
85
pnpm-lock.yaml
generated
85
pnpm-lock.yaml
generated
@@ -46,7 +46,7 @@ importers:
|
||||
packages/core/acme-client:
|
||||
dependencies:
|
||||
'@certd/basic':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../basic
|
||||
'@peculiar/x509':
|
||||
specifier: ^1.11.0
|
||||
@@ -207,10 +207,10 @@ importers:
|
||||
packages/core/pipeline:
|
||||
dependencies:
|
||||
'@certd/basic':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../basic
|
||||
'@certd/plus-core':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../pro/plus-core
|
||||
dayjs:
|
||||
specifier: ^1.11.7
|
||||
@@ -415,7 +415,7 @@ importers:
|
||||
packages/libs/lib-k8s:
|
||||
dependencies:
|
||||
'@certd/basic':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/basic
|
||||
'@kubernetes/client-node':
|
||||
specifier: 0.21.0
|
||||
@@ -455,16 +455,16 @@ importers:
|
||||
packages/libs/lib-server:
|
||||
dependencies:
|
||||
'@certd/acme-client':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/acme-client
|
||||
'@certd/basic':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/basic
|
||||
'@certd/pipeline':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/pipeline
|
||||
'@certd/plus-core':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../pro/plus-core
|
||||
'@midwayjs/cache':
|
||||
specifier: ~3.14.0
|
||||
@@ -607,16 +607,16 @@ importers:
|
||||
packages/plugins/plugin-cert:
|
||||
dependencies:
|
||||
'@certd/acme-client':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/acme-client
|
||||
'@certd/basic':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/basic
|
||||
'@certd/pipeline':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/pipeline
|
||||
'@certd/plugin-lib':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../plugin-lib
|
||||
'@google-cloud/publicca':
|
||||
specifier: ^1.3.0
|
||||
@@ -682,6 +682,9 @@ importers:
|
||||
|
||||
packages/plugins/plugin-lib:
|
||||
dependencies:
|
||||
'@alicloud/credentials':
|
||||
specifier: ^2.4.3
|
||||
version: 2.4.3
|
||||
'@alicloud/openapi-client':
|
||||
specifier: ^0.4.14
|
||||
version: 0.4.14
|
||||
@@ -695,10 +698,10 @@ importers:
|
||||
specifier: ^3.787.0
|
||||
version: 3.810.0(aws-crt@1.26.2)
|
||||
'@certd/basic':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/basic
|
||||
'@certd/pipeline':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/pipeline
|
||||
'@kubernetes/client-node':
|
||||
specifier: 0.21.0
|
||||
@@ -786,19 +789,19 @@ importers:
|
||||
packages/pro/commercial-core:
|
||||
dependencies:
|
||||
'@certd/basic':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/basic
|
||||
'@certd/lib-server':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../libs/lib-server
|
||||
'@certd/pipeline':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/pipeline
|
||||
'@certd/plugin-plus':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../plugin-plus
|
||||
'@certd/plus-core':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../plus-core
|
||||
'@midwayjs/core':
|
||||
specifier: ~3.20.3
|
||||
@@ -883,22 +886,22 @@ importers:
|
||||
specifier: ^1.0.2
|
||||
version: 1.0.3
|
||||
'@certd/basic':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/basic
|
||||
'@certd/lib-k8s':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../libs/lib-k8s
|
||||
'@certd/pipeline':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/pipeline
|
||||
'@certd/plugin-cert':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../plugins/plugin-cert
|
||||
'@certd/plugin-lib':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../plugins/plugin-lib
|
||||
'@certd/plus-core':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../plus-core
|
||||
ali-oss:
|
||||
specifier: ^6.21.0
|
||||
@@ -1001,7 +1004,7 @@ importers:
|
||||
packages/pro/plus-core:
|
||||
dependencies:
|
||||
'@certd/basic':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/basic
|
||||
dayjs:
|
||||
specifier: ^1.11.7
|
||||
@@ -1291,10 +1294,10 @@ importers:
|
||||
version: 0.1.3(zod@3.24.4)
|
||||
devDependencies:
|
||||
'@certd/lib-iframe':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../libs/lib-iframe
|
||||
'@certd/pipeline':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/pipeline
|
||||
'@rollup/plugin-commonjs':
|
||||
specifier: ^25.0.7
|
||||
@@ -1474,43 +1477,43 @@ importers:
|
||||
specifier: ^3.705.0
|
||||
version: 3.810.0(aws-crt@1.26.2)
|
||||
'@certd/acme-client':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/acme-client
|
||||
'@certd/basic':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/basic
|
||||
'@certd/commercial-core':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../pro/commercial-core
|
||||
'@certd/jdcloud':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../libs/lib-jdcloud
|
||||
'@certd/lib-huawei':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../libs/lib-huawei
|
||||
'@certd/lib-k8s':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../libs/lib-k8s
|
||||
'@certd/lib-server':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../libs/lib-server
|
||||
'@certd/midway-flyway-js':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../libs/midway-flyway-js
|
||||
'@certd/pipeline':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../core/pipeline
|
||||
'@certd/plugin-cert':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../plugins/plugin-cert
|
||||
'@certd/plugin-lib':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../plugins/plugin-lib
|
||||
'@certd/plugin-plus':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../pro/plugin-plus
|
||||
'@certd/plus-core':
|
||||
specifier: ^1.34.5
|
||||
specifier: ^1.34.7
|
||||
version: link:../../pro/plus-core
|
||||
'@corsinvest/cv4pve-api-javascript':
|
||||
specifier: ^8.3.0
|
||||
|
||||
Reference in New Issue
Block a user