Merge branch 'v2-dev' of https://github.com/certd/certd into v2-dev

This commit is contained in:
xiaojunnuo
2025-12-16 10:02:31 +08:00
50 changed files with 386 additions and 168 deletions
+15
View File
@@ -3,6 +3,21 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.16](https://github.com/certd/certd/compare/v1.37.15...v1.37.16) (2025-12-15)
### Bug Fixes
* 修复ipv6作为证书域名申请证书校验失败的bug ([e4e16bc](https://github.com/certd/certd/commit/e4e16bc6a65bb082c18ca0590226f0987a47d477))
* 优化西部数据 500 already exists 的问题 ([2bfad9f](https://github.com/certd/certd/commit/2bfad9fc651da208b610abd921fbfb2fbc04203f))
### Performance Improvements
* 批量设置定时,支持清除定时 ([63d8bcf](https://github.com/certd/certd/commit/63d8bcf8823f713365042d3c7aee3cf31d44b044))
* 新增数据库迁移doc说明文档,优化datetime字段平滑迁移 ([45fbce0](https://github.com/certd/certd/commit/45fbce0c2af5fb3ead6d3dd12a42f8cc1714262f))
* 支持彩虹聚合登录 ([6f18693](https://github.com/certd/certd/commit/6f186932ccad4becfdc0087c0539f7b2d0069844))
* 支持邮件模版设置 ([a6c0d2c](https://github.com/certd/certd/commit/a6c0d2c6f1fd6b60e6d7af290487c94564fd91ea))
* oidc支持使用第三方昵称或账号作为certd用户的用户名 ([b6fea0c](https://github.com/certd/certd/commit/b6fea0c8562abf912daa7d72958ceb2e93575d31))
## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06) ## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06)
### Bug Fixes ### Bug Fixes
+15
View File
@@ -3,6 +3,21 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.16](https://github.com/certd/certd/compare/v1.37.15...v1.37.16) (2025-12-15)
### Bug Fixes
* 修复ipv6作为证书域名申请证书校验失败的bug ([e4e16bc](https://github.com/certd/certd/commit/e4e16bc6a65bb082c18ca0590226f0987a47d477))
* 优化西部数据 500 already exists 的问题 ([2bfad9f](https://github.com/certd/certd/commit/2bfad9fc651da208b610abd921fbfb2fbc04203f))
### Performance Improvements
* 批量设置定时,支持清除定时 ([63d8bcf](https://github.com/certd/certd/commit/63d8bcf8823f713365042d3c7aee3cf31d44b044))
* 新增数据库迁移doc说明文档,优化datetime字段平滑迁移 ([45fbce0](https://github.com/certd/certd/commit/45fbce0c2af5fb3ead6d3dd12a42f8cc1714262f))
* 支持彩虹聚合登录 ([6f18693](https://github.com/certd/certd/commit/6f186932ccad4becfdc0087c0539f7b2d0069844))
* 支持邮件模版设置 ([a6c0d2c](https://github.com/certd/certd/commit/a6c0d2c6f1fd6b60e6d7af290487c94564fd91ea))
* oidc支持使用第三方昵称或账号作为certd用户的用户名 ([b6fea0c](https://github.com/certd/certd/commit/b6fea0c8562abf912daa7d72958ceb2e93575d31))
## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06) ## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06)
### Bug Fixes ### Bug Fixes
+27 -26
View File
@@ -40,32 +40,33 @@
| 36.| **括彩云cdn授权** | 括彩云CDN,每月免费30G[注册即领](https://kuocaicdn.com/register?code=8mn536rrzfbf8) | | 36.| **括彩云cdn授权** | 括彩云CDN,每月免费30G[注册即领](https://kuocaicdn.com/register?code=8mn536rrzfbf8) |
| 37.| **uniCloud** | unicloud授权 | | 37.| **uniCloud** | unicloud授权 |
| 38.| **猫云授权** | | | 38.| **猫云授权** | |
| 39.| **西部数码授权** | | | 39.| **授权插件示例** | |
| 40.| **多吉云** | | | 40.| **西部数码授权** | |
| 41.| **我爱云授权** | 我爱云CDN | | 41.| **多吉云** | |
| 42.| **CacheFly** | CacheFly | | 42.| **我爱云授权** | 我爱云CDN |
| 43.| **Gcore** | Gcore | | 43.| **CacheFly** | CacheFly |
| 44.| **亚马逊云aws授权** | | | 44.| **Gcore** | Gcore |
| 45.| **亚马逊云科技(国区)授权** | | | 45.| **亚马逊云aws授权** | |
| 46.| **dns.la授权** | | | 46.| **亚马逊云科技(国区)授权** | |
| 47.| **又拍云** | | | 47.| **dns.la授权** | |
| 48.| **51dns授权** | | | 48.| **又拍云** | |
| 49.| **FlexCDN授权** | | | 49.| **51dns授权** | |
| 50.| **farcdn授权** | | | 50.| **FlexCDN授权** | |
| 51.| **cloudflare授权** | | | 51.| **farcdn授权** | |
| 52.| **Github授权** | | | 52.| **cloudflare授权** | |
| 53.| **namesilo授权** | | | 53.| **Github授权** | |
| 54.| **proxmox** | | | 54.| **namesilo授权** | |
| 55.| **网宿授权** | | | 55.| **proxmox** | |
| 56.| **金山云授权** | | | 56.| **网宿授权** | |
| 57.| **APISIX授权** | | | 57.| **金山云授权** | |
| 58.| **Dokploy授权** | | | 58.| **APISIX授权** | |
| 59.| **godaddy授权** | | | 59.| **Dokploy授权** | |
| 60.| **新网授权** | | | 60.| **godaddy授权** | |
| 61.| **新网授权(代理方式)** | | | 61.| **新网授权** | |
| 62.| **新网互联授权** | 仅支持代理账号,ip需要加入白名单 | | 62.| **新网授权(代理方式)** | |
| 63.| **中国移动CND授权** | | | 63.| **新网互联授权** | 仅支持代理账号,ip需要加入白名单 |
| 64.| **雨云授权** | https://app.rainyun.com/ | | 64.| **中国移动CND授权** | |
| 65.| **雨云授权** | https://app.rainyun.com/ |
<style module> <style module>
table th:first-of-type { table th:first-of-type {
+3 -2
View File
@@ -17,8 +17,9 @@
| 13.| **cloudflare** | cloudflare dns provider | | 13.| **cloudflare** | cloudflare dns provider |
| 14.| **namesilo** | namesilo dns provider | | 14.| **namesilo** | namesilo dns provider |
| 15.| **godaddy** | GoDaddy | | 15.| **godaddy** | GoDaddy |
| 16.| **51dns** | 51DNS | | 16.| **Dns提供商Demo** | dns provider示例 |
| 17.| **新网互联** | 新网互联 | | 17.| **51dns** | 51DNS |
| 18.| **新网互联** | 新网互联 |
<style module> <style module>
table th:first-of-type { table th:first-of-type {
+1 -1
View File
@@ -9,5 +9,5 @@
} }
}, },
"npmClient": "pnpm", "npmClient": "pnpm",
"version": "1.37.15" "version": "1.37.16"
} }
+6
View File
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.16](https://github.com/publishlab/node-acme-client/compare/v1.37.15...v1.37.16) (2025-12-15)
### Bug Fixes
* 修复ipv6作为证书域名申请证书校验失败的bug ([e4e16bc](https://github.com/publishlab/node-acme-client/commit/e4e16bc6a65bb082c18ca0590226f0987a47d477))
## [1.37.15](https://github.com/publishlab/node-acme-client/compare/v1.37.14...v1.37.15) (2025-12-06) ## [1.37.15](https://github.com/publishlab/node-acme-client/compare/v1.37.14...v1.37.15) (2025-12-06)
**Note:** Version bump only for package @certd/acme-client **Note:** Version bump only for package @certd/acme-client
+3 -3
View File
@@ -3,7 +3,7 @@
"description": "Simple and unopinionated ACME client", "description": "Simple and unopinionated ACME client",
"private": false, "private": false,
"author": "nmorsman", "author": "nmorsman",
"version": "1.37.15", "version": "1.37.16",
"type": "module", "type": "module",
"module": "scr/index.js", "module": "scr/index.js",
"main": "src/index.js", "main": "src/index.js",
@@ -18,7 +18,7 @@
"types" "types"
], ],
"dependencies": { "dependencies": {
"@certd/basic": "^1.37.15", "@certd/basic": "^1.37.16",
"@peculiar/x509": "^1.11.0", "@peculiar/x509": "^1.11.0",
"asn1js": "^3.0.5", "asn1js": "^3.0.5",
"axios": "^1.7.2", "axios": "^1.7.2",
@@ -70,5 +70,5 @@
"bugs": { "bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues" "url": "https://github.com/publishlab/node-acme-client/issues"
}, },
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b" "gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
} }
+7 -3
View File
@@ -8,7 +8,7 @@ import {log as defaultLog} from './logger.js'
import axios from './axios.js' import axios from './axios.js'
import * as util from './util.js' import * as util from './util.js'
import {isAlpnCertificateAuthorizationValid} from './crypto/index.js' import {isAlpnCertificateAuthorizationValid} from './crypto/index.js'
import {utils} from '@certd/basic'
const dns = dnsSdk.promises const dns = dnsSdk.promises
@@ -60,11 +60,15 @@ async function verifyHttpChallenge(authz, challenge, keyAuthorization, suffix =
} }
const httpPort = axios.defaults.acmeSettings.httpChallengePort || 80; const httpPort = axios.defaults.acmeSettings.httpChallengePort || 80;
const challengeUrl = `http://${authz.identifier.value}:${httpPort}${suffix}`; let host = authz.identifier.value;
if(utils.domain.isIpv6(host)){
host = `[${host}]`;
}
const challengeUrl = `http://${host}:${httpPort}${suffix}`;
if (!await doQuery(challengeUrl)) { if (!await doQuery(challengeUrl)) {
const httpsPort = axios.defaults.acmeSettings.httpsChallengePort || 443; const httpsPort = axios.defaults.acmeSettings.httpsChallengePort || 443;
const httpsChallengeUrl = `https://${authz.identifier.value}:${httpsPort}${suffix}`; const httpsChallengeUrl = `https://${host}:${httpsPort}${suffix}`;
const res = await doQuery(httpsChallengeUrl) const res = await doQuery(httpsChallengeUrl)
if (!res) { if (!res) {
throw new Error(`[error] 验证失败,请检查以上测试url是否可以正常访问`); throw new Error(`[error] 验证失败,请检查以上测试url是否可以正常访问`);
+1
View File
@@ -26,3 +26,4 @@ dist-ssr
test/user.secret.* test/user.secret.*
test/**/*.js test/**/*.js
src/**/*.spec.ts src/**/*.spec.ts
test.mjs
+6
View File
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.16](https://github.com/certd/certd/compare/v1.37.15...v1.37.16) (2025-12-15)
### Bug Fixes
* 修复ipv6作为证书域名申请证书校验失败的bug ([e4e16bc](https://github.com/certd/certd/commit/e4e16bc6a65bb082c18ca0590226f0987a47d477))
## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06) ## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06)
**Note:** Version bump only for package @certd/basic **Note:** Version bump only for package @certd/basic
+1 -1
View File
@@ -1 +1 @@
00:56 01:44
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/basic", "name": "@certd/basic",
"private": false, "private": false,
"version": "1.37.15", "version": "1.37.16",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js", "module": "./dist/index.js",
@@ -47,5 +47,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b" "gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
} }
+1 -1
View File
@@ -58,7 +58,7 @@ function isIpv6(d: string) {
if (!d) { if (!d) {
return false; return false;
} }
const isIPv6Regex = /^([\da-f]{1,4}:){2,7}[\da-f]{1,4}$/i; const isIPv6Regex = /^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})$/gm;
return isIPv6Regex.test(d); return isIPv6Regex.test(d);
} }
+16 -12
View File
@@ -1,14 +1,18 @@
import { random } from "lodash-es"; // import { random } from "lodash-es";
import { locker } from "./dist/utils/util.lock.js"; // import { locker } from "./dist/utils/util.lock.js";
async function testLocker() { // async function testLocker() {
for (let i = 0; i < 10; i++) { // for (let i = 0; i < 10; i++) {
await locker.execute("test", async () => { // await locker.execute("test", async () => {
console.log("test", i); // console.log("test", i);
await new Promise(resolve => setTimeout(resolve, Math.random() * 1000)); // await new Promise(resolve => setTimeout(resolve, Math.random() * 1000));
throw new Error("test error"); // throw new Error("test error");
}); // });
} // }
} // }
await testLocker(); // await testLocker();
import { domainUtils } from "./dist/utils/util.domain.js";
console.log(domainUtils.isIpv6("::0:0:0:FFFF:129.144.52.38"));
+6
View File
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.16](https://github.com/certd/certd/compare/v1.37.15...v1.37.16) (2025-12-15)
### Performance Improvements
* 支持邮件模版设置 ([a6c0d2c](https://github.com/certd/certd/commit/a6c0d2c6f1fd6b60e6d7af290487c94564fd91ea))
## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06) ## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06)
**Note:** Version bump only for package @certd/pipeline **Note:** Version bump only for package @certd/pipeline
+4 -4
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/pipeline", "name": "@certd/pipeline",
"private": false, "private": false,
"version": "1.37.15", "version": "1.37.16",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js", "module": "./dist/index.js",
@@ -18,8 +18,8 @@
"compile": "tsc --skipLibCheck --watch" "compile": "tsc --skipLibCheck --watch"
}, },
"dependencies": { "dependencies": {
"@certd/basic": "^1.37.15", "@certd/basic": "^1.37.16",
"@certd/plus-core": "^1.37.15", "@certd/plus-core": "^1.37.16",
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"reflect-metadata": "^0.1.13" "reflect-metadata": "^0.1.13"
@@ -45,5 +45,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b" "gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.16](https://github.com/certd/certd/compare/v1.37.15...v1.37.16) (2025-12-15)
**Note:** Version bump only for package @certd/lib-huawei
## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06) ## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06)
**Note:** Version bump only for package @certd/lib-huawei **Note:** Version bump only for package @certd/lib-huawei
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/lib-huawei", "name": "@certd/lib-huawei",
"private": false, "private": false,
"version": "1.37.15", "version": "1.37.16",
"main": "./dist/bundle.js", "main": "./dist/bundle.js",
"module": "./dist/bundle.js", "module": "./dist/bundle.js",
"types": "./dist/d/index.d.ts", "types": "./dist/d/index.d.ts",
@@ -24,5 +24,5 @@
"prettier": "^2.8.8", "prettier": "^2.8.8",
"tslib": "^2.8.1" "tslib": "^2.8.1"
}, },
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b" "gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.16](https://github.com/certd/certd/compare/v1.37.15...v1.37.16) (2025-12-15)
**Note:** Version bump only for package @certd/lib-iframe
## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06) ## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06)
**Note:** Version bump only for package @certd/lib-iframe **Note:** Version bump only for package @certd/lib-iframe
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/lib-iframe", "name": "@certd/lib-iframe",
"private": false, "private": false,
"version": "1.37.15", "version": "1.37.16",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js", "module": "./dist/index.js",
@@ -31,5 +31,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b" "gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.16](https://github.com/certd/certd/compare/v1.37.15...v1.37.16) (2025-12-15)
**Note:** Version bump only for package @certd/jdcloud
## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06) ## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06)
**Note:** Version bump only for package @certd/jdcloud **Note:** Version bump only for package @certd/jdcloud
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@certd/jdcloud", "name": "@certd/jdcloud",
"version": "1.37.15", "version": "1.37.16",
"description": "jdcloud openApi sdk", "description": "jdcloud openApi sdk",
"main": "./dist/bundle.js", "main": "./dist/bundle.js",
"module": "./dist/bundle.js", "module": "./dist/bundle.js",
@@ -56,5 +56,5 @@
"fetch" "fetch"
] ]
}, },
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b" "gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.16](https://github.com/certd/certd/compare/v1.37.15...v1.37.16) (2025-12-15)
**Note:** Version bump only for package @certd/lib-k8s
## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06) ## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06)
### Performance Improvements ### Performance Improvements
+3 -3
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/lib-k8s", "name": "@certd/lib-k8s",
"private": false, "private": false,
"version": "1.37.15", "version": "1.37.16",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js", "module": "./dist/index.js",
@@ -17,7 +17,7 @@
"pub": "npm publish" "pub": "npm publish"
}, },
"dependencies": { "dependencies": {
"@certd/basic": "^1.37.15", "@certd/basic": "^1.37.16",
"@kubernetes/client-node": "0.21.0" "@kubernetes/client-node": "0.21.0"
}, },
"devDependencies": { "devDependencies": {
@@ -32,5 +32,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b" "gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
} }
+10
View File
@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.16](https://github.com/certd/certd/compare/v1.37.15...v1.37.16) (2025-12-15)
### Bug Fixes
* 修复ipv6作为证书域名申请证书校验失败的bug ([e4e16bc](https://github.com/certd/certd/commit/e4e16bc6a65bb082c18ca0590226f0987a47d477))
### Performance Improvements
* 支持邮件模版设置 ([a6c0d2c](https://github.com/certd/certd/commit/a6c0d2c6f1fd6b60e6d7af290487c94564fd91ea))
## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06) ## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06)
**Note:** Version bump only for package @certd/lib-server **Note:** Version bump only for package @certd/lib-server
+7 -7
View File
@@ -1,6 +1,6 @@
{ {
"name": "@certd/lib-server", "name": "@certd/lib-server",
"version": "1.37.15", "version": "1.37.16",
"description": "midway with flyway, sql upgrade way ", "description": "midway with flyway, sql upgrade way ",
"private": false, "private": false,
"type": "module", "type": "module",
@@ -28,11 +28,11 @@
], ],
"license": "AGPL", "license": "AGPL",
"dependencies": { "dependencies": {
"@certd/acme-client": "^1.37.15", "@certd/acme-client": "^1.37.16",
"@certd/basic": "^1.37.15", "@certd/basic": "^1.37.16",
"@certd/pipeline": "^1.37.15", "@certd/pipeline": "^1.37.16",
"@certd/plugin-lib": "^1.37.15", "@certd/plugin-lib": "^1.37.16",
"@certd/plus-core": "^1.37.15", "@certd/plus-core": "^1.37.16",
"@midwayjs/cache": "3.14.0", "@midwayjs/cache": "3.14.0",
"@midwayjs/core": "3.20.11", "@midwayjs/core": "3.20.11",
"@midwayjs/i18n": "3.20.13", "@midwayjs/i18n": "3.20.13",
@@ -64,5 +64,5 @@
"typeorm": "^0.3.11", "typeorm": "^0.3.11",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b" "gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
} }
@@ -134,12 +134,9 @@ export class SysEmailConf extends BaseSettings {
templates:{ templates:{
registerCode?: EmailTemplate, registerCode?: EmailTemplate,
forgotPasswordCode?: EmailTemplate, forgotPassword?: EmailTemplate,
certSuccessNotify?: EmailTemplate, pipelineResult?: EmailTemplate,
certSend?: EmailTemplate, common?: EmailTemplate,
pipelineNotify?: EmailTemplate,
test?: EmailTemplate,
siteMonitorNotify?: EmailTemplate,
} }
} }
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.16](https://github.com/certd/certd/compare/v1.37.15...v1.37.16) (2025-12-15)
**Note:** Version bump only for package @certd/midway-flyway-js
## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06) ## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06)
**Note:** Version bump only for package @certd/midway-flyway-js **Note:** Version bump only for package @certd/midway-flyway-js
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@certd/midway-flyway-js", "name": "@certd/midway-flyway-js",
"version": "1.37.15", "version": "1.37.16",
"description": "midway with flyway, sql upgrade way ", "description": "midway with flyway, sql upgrade way ",
"private": false, "private": false,
"type": "module", "type": "module",
@@ -46,5 +46,5 @@
"typeorm": "^0.3.11", "typeorm": "^0.3.11",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b" "gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
} }
+10
View File
@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.16](https://github.com/certd/certd/compare/v1.37.15...v1.37.16) (2025-12-15)
### Bug Fixes
* 修复ipv6作为证书域名申请证书校验失败的bug ([e4e16bc](https://github.com/certd/certd/commit/e4e16bc6a65bb082c18ca0590226f0987a47d477))
### Performance Improvements
* 支持邮件模版设置 ([a6c0d2c](https://github.com/certd/certd/commit/a6c0d2c6f1fd6b60e6d7af290487c94564fd91ea))
## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06) ## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06)
**Note:** Version bump only for package @certd/plugin-cert **Note:** Version bump only for package @certd/plugin-cert
+6 -6
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/plugin-cert", "name": "@certd/plugin-cert",
"private": false, "private": false,
"version": "1.37.15", "version": "1.37.16",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
@@ -17,10 +17,10 @@
"compile": "tsc --skipLibCheck --watch" "compile": "tsc --skipLibCheck --watch"
}, },
"dependencies": { "dependencies": {
"@certd/acme-client": "^1.37.15", "@certd/acme-client": "^1.37.16",
"@certd/basic": "^1.37.15", "@certd/basic": "^1.37.16",
"@certd/pipeline": "^1.37.15", "@certd/pipeline": "^1.37.16",
"@certd/plugin-lib": "^1.37.15", "@certd/plugin-lib": "^1.37.16",
"@google-cloud/publicca": "^1.3.0", "@google-cloud/publicca": "^1.3.0",
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"jszip": "^3.10.1", "jszip": "^3.10.1",
@@ -43,5 +43,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b" "gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
} }
@@ -21,6 +21,11 @@ export class DomainParser implements IDomainParser {
} }
async parse(fullDomain: string) { async parse(fullDomain: string) {
//如果是ip
if (utils.domain.isIp(fullDomain)) {
return fullDomain;
}
this.logger.info(`查找主域名:${fullDomain}`); this.logger.info(`查找主域名:${fullDomain}`);
const cacheKey = `domain_parse:${fullDomain}`; const cacheKey = `domain_parse:${fullDomain}`;
const value = utils.cache.get(cacheKey); const value = utils.cache.get(cacheKey);
@@ -220,7 +220,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
if(form.challengeType === 'cname' ){ if(form.challengeType === 'cname' ){
return '请按照上面的提示,给要申请证书的域名添加CNAME记录,添加后,点击验证,验证成功后不要删除记录,申请和续期证书会一直用它' return '请按照上面的提示,给要申请证书的域名添加CNAME记录,添加后,点击验证,验证成功后不要删除记录,申请和续期证书会一直用它'
}else if (form.challengeType === 'http'){ }else if (form.challengeType === 'http'){
return '请按照上面的提示,给每个域名设置文件上传配置,证书申请过程中会上传校验文件到网站根目录下' return '请按照上面的提示,给每个域名设置文件上传配置,证书申请过程中会上传校验文件到网站根目录的.well-known/acme-challenge/目录下'
}else if (form.challengeType === 'http'){ }else if (form.challengeType === 'http'){
return '给每个域名单独配置dns提供商' return '给每个域名单独配置dns提供商'
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.16](https://github.com/certd/certd/compare/v1.37.15...v1.37.16) (2025-12-15)
**Note:** Version bump only for package @certd/plugin-lib
## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06) ## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06)
**Note:** Version bump only for package @certd/plugin-lib **Note:** Version bump only for package @certd/plugin-lib
+4 -4
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/plugin-lib", "name": "@certd/plugin-lib",
"private": false, "private": false,
"version": "1.37.15", "version": "1.37.16",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
@@ -22,8 +22,8 @@
"@alicloud/pop-core": "^1.7.10", "@alicloud/pop-core": "^1.7.10",
"@alicloud/tea-util": "^1.4.10", "@alicloud/tea-util": "^1.4.10",
"@aws-sdk/client-s3": "^3.787.0", "@aws-sdk/client-s3": "^3.787.0",
"@certd/basic": "^1.37.15", "@certd/basic": "^1.37.16",
"@certd/pipeline": "^1.37.15", "@certd/pipeline": "^1.37.16",
"@kubernetes/client-node": "0.21.0", "@kubernetes/client-node": "0.21.0",
"ali-oss": "^6.22.0", "ali-oss": "^6.22.0",
"basic-ftp": "^5.0.5", "basic-ftp": "^5.0.5",
@@ -53,5 +53,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "f2e4e59f8d1b54b835d5da43aef8b527d6a4ba0b" "gitHead": "fa14f6219810ddbfcf1dde7b69963ee8a36c80c4"
} }
+12
View File
@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.16](https://github.com/certd/certd/compare/v1.37.15...v1.37.16) (2025-12-15)
### Bug Fixes
* 修复ipv6作为证书域名申请证书校验失败的bug ([e4e16bc](https://github.com/certd/certd/commit/e4e16bc6a65bb082c18ca0590226f0987a47d477))
### Performance Improvements
* 批量设置定时,支持清除定时 ([63d8bcf](https://github.com/certd/certd/commit/63d8bcf8823f713365042d3c7aee3cf31d44b044))
* 支持彩虹聚合登录 ([6f18693](https://github.com/certd/certd/commit/6f186932ccad4becfdc0087c0539f7b2d0069844))
* 支持邮件模版设置 ([a6c0d2c](https://github.com/certd/certd/commit/a6c0d2c6f1fd6b60e6d7af290487c94564fd91ea))
## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06) ## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06)
### Performance Improvements ### Performance Improvements
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@certd/ui-client", "name": "@certd/ui-client",
"version": "1.37.15", "version": "1.37.16",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite --open", "dev": "vite --open",
@@ -106,8 +106,8 @@
"zod-defaults": "^0.1.3" "zod-defaults": "^0.1.3"
}, },
"devDependencies": { "devDependencies": {
"@certd/lib-iframe": "^1.37.15", "@certd/lib-iframe": "^1.37.16",
"@certd/pipeline": "^1.37.15", "@certd/pipeline": "^1.37.16",
"@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.12", "@types/chai": "^4.3.12",
@@ -1,4 +1,26 @@
import Validator from "async-validator"; import Validator from "async-validator";
function isIpv6(d: string) {
if (!d) {
return false;
}
const isIPv6Regex = /^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})$/gm;
return isIPv6Regex.test(d);
}
function isIpv4(d: string) {
if (!d) {
return false;
}
const isIPv4Regex = /^(\d{1,3}\.){3}\d{1,3}$/;
return isIPv4Regex.test(d);
}
function isIp(d: string) {
if (!d) {
return false;
}
return isIpv4(d) || isIpv6(d);
}
// 自定义验证器函数 // 自定义验证器函数
export function isDomain(rule: any, value: any) { export function isDomain(rule: any, value: any) {
if (value == null || value == "") { if (value == null || value == "") {
@@ -14,7 +36,9 @@ export function isDomain(rule: any, value: any) {
const compiled = new RegExp(exp); const compiled = new RegExp(exp);
for (const domain of domains) { for (const domain of domains) {
//域名可以是泛域名,中文域名,数字域名,英文域名,域名中可以包含-和. ,可以_开头 //域名可以是泛域名,中文域名,数字域名,英文域名,域名中可以包含-和. ,可以_开头
if (isIp(domain)) {
continue;
}
if (!compiled.test(domain)) { if (!compiled.test(domain)) {
throw new Error(`域名有误:${domain},请输入正确的域名`); throw new Error(`域名有误:${domain},请输入正确的域名`);
} }
@@ -3,10 +3,11 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useFormWrapper } from "@fast-crud/fast-crud"; import { compute, dict, useFormWrapper } from "@fast-crud/fast-crud";
import * as api from "../api"; import * as api from "../api";
import { useSettingStore } from "/@/store/settings"; import { useSettingStore } from "/@/store/settings";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { computed } from "vue";
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps<{ const props = defineProps<{
@@ -20,7 +21,7 @@ async function batchUpdateRequest(form: any) {
await api.BatchUpdateTrigger(props.selectedRowKeys, { await api.BatchUpdateTrigger(props.selectedRowKeys, {
title: "定时触发", title: "定时触发",
type: "timer", type: "timer",
props: form.props, props: form.clear ? false : form.props,
}); });
emit("change"); emit("change");
} }
@@ -33,6 +34,28 @@ async function openFormDialog() {
settingStore.checkPlus(); settingStore.checkPlus();
const crudOptions: any = { const crudOptions: any = {
columns: { columns: {
clear: {
title: "设置/清空",
form: {
value: false,
component: {
name: "fs-dict-switch",
vModel: "checked",
dict: dict({
data: [
{
label: "设置定时",
value: false,
},
{
label: "清空定时",
value: true,
},
],
}),
},
},
},
"props.cron": { "props.cron": {
title: t("certd.schedule"), title: t("certd.schedule"),
form: { form: {
@@ -40,12 +63,18 @@ async function openFormDialog() {
name: "cron-editor", name: "cron-editor",
vModel: "modelValue", vModel: "modelValue",
}, },
show: compute(({ form }) => {
return form.clear !== true;
}),
rules: [{ required: true, message: t("certd.selectCron") }], rules: [{ required: true, message: t("certd.selectCron") }],
}, },
}, },
}, },
form: { form: {
mode: "edit", mode: "edit",
initialForm: {
clear: false,
},
//@ts-ignore //@ts-ignore
async doSubmit({ form }) { async doSubmit({ form }) {
await batchUpdateRequest(form); await batchUpdateRequest(form);
@@ -59,7 +59,11 @@
<a-button type="primary" html-type="submit">{{ t("certd.save") }}</a-button> <a-button type="primary" html-type="submit">{{ t("certd.save") }}</a-button>
</a-form-item> </a-form-item>
<div class="flex items-center">
<h2>{{ t("certd.sys.setting.email.templateSetting") }}</h2> <h2>{{ t("certd.sys.setting.email.templateSetting") }}</h2>
<vip-button class="ml-10" mode="button"></vip-button>
</div>
<a-form-item :label="t('certd.sys.setting.email.templates')" :name="['templates']"> <a-form-item :label="t('certd.sys.setting.email.templates')" :name="['templates']">
<div class="flex flex-wrap"> <div class="flex flex-wrap">
<table class="w-full table-auto border-collapse border border-gray-400"> <table class="w-full table-auto border-collapse border border-gray-400">
@@ -78,7 +82,14 @@
</div> </div>
</td> </td>
<td class="border border-gray-300 px-4 py-2"> <td class="border border-gray-300 px-4 py-2">
<AddonSelector v-model:model-value="item.addonId" addon-type="emailTemplate" from="sys" :type="item.name" :placeholder="t('certd.sys.setting.email.templateProviderSelectorPlaceholder')" /> <AddonSelector
v-model:model-value="item.addonId"
:disabled="!settingStore.isPlus"
addon-type="emailTemplate"
from="sys"
:type="item.name"
:placeholder="t('certd.sys.setting.email.templateProviderSelectorPlaceholder')"
/>
</td> </td>
</tr> </tr>
</tbody> </tbody>
+14
View File
@@ -3,6 +3,20 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.16](https://github.com/certd/certd/compare/v1.37.15...v1.37.16) (2025-12-15)
### Bug Fixes
* 优化西部数据 500 already exists 的问题 ([2bfad9f](https://github.com/certd/certd/commit/2bfad9fc651da208b610abd921fbfb2fbc04203f))
### Performance Improvements
* 批量设置定时,支持清除定时 ([63d8bcf](https://github.com/certd/certd/commit/63d8bcf8823f713365042d3c7aee3cf31d44b044))
* 新增数据库迁移doc说明文档,优化datetime字段平滑迁移 ([45fbce0](https://github.com/certd/certd/commit/45fbce0c2af5fb3ead6d3dd12a42f8cc1714262f))
* 支持彩虹聚合登录 ([6f18693](https://github.com/certd/certd/commit/6f186932ccad4becfdc0087c0539f7b2d0069844))
* 支持邮件模版设置 ([a6c0d2c](https://github.com/certd/certd/commit/a6c0d2c6f1fd6b60e6d7af290487c94564fd91ea))
* oidc支持使用第三方昵称或账号作为certd用户的用户名 ([b6fea0c](https://github.com/certd/certd/commit/b6fea0c8562abf912daa7d72958ceb2e93575d31))
## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06) ## [1.37.15](https://github.com/certd/certd/compare/v1.37.14...v1.37.15) (2025-12-06)
### Bug Fixes ### Bug Fixes
+14 -14
View File
@@ -1,6 +1,6 @@
{ {
"name": "@certd/ui-server", "name": "@certd/ui-server",
"version": "1.37.15", "version": "1.37.16",
"description": "fast-server base midway", "description": "fast-server base midway",
"private": true, "private": true,
"type": "module", "type": "module",
@@ -45,20 +45,20 @@
"@aws-sdk/client-cloudfront": "^3.699.0", "@aws-sdk/client-cloudfront": "^3.699.0",
"@aws-sdk/client-iam": "^3.699.0", "@aws-sdk/client-iam": "^3.699.0",
"@aws-sdk/client-s3": "^3.705.0", "@aws-sdk/client-s3": "^3.705.0",
"@certd/acme-client": "^1.37.15", "@certd/acme-client": "^1.37.16",
"@certd/basic": "^1.37.15", "@certd/basic": "^1.37.16",
"@certd/commercial-core": "^1.37.15", "@certd/commercial-core": "^1.37.16",
"@certd/cv4pve-api-javascript": "^8.4.2", "@certd/cv4pve-api-javascript": "^8.4.2",
"@certd/jdcloud": "^1.37.15", "@certd/jdcloud": "^1.37.16",
"@certd/lib-huawei": "^1.37.15", "@certd/lib-huawei": "^1.37.16",
"@certd/lib-k8s": "^1.37.15", "@certd/lib-k8s": "^1.37.16",
"@certd/lib-server": "^1.37.15", "@certd/lib-server": "^1.37.16",
"@certd/midway-flyway-js": "^1.37.15", "@certd/midway-flyway-js": "^1.37.16",
"@certd/pipeline": "^1.37.15", "@certd/pipeline": "^1.37.16",
"@certd/plugin-cert": "^1.37.15", "@certd/plugin-cert": "^1.37.16",
"@certd/plugin-lib": "^1.37.15", "@certd/plugin-lib": "^1.37.16",
"@certd/plugin-plus": "^1.37.15", "@certd/plugin-plus": "^1.37.16",
"@certd/plus-core": "^1.37.15", "@certd/plus-core": "^1.37.16",
"@huaweicloud/huaweicloud-sdk-cdn": "^3.1.120", "@huaweicloud/huaweicloud-sdk-cdn": "^3.1.120",
"@huaweicloud/huaweicloud-sdk-core": "^3.1.120", "@huaweicloud/huaweicloud-sdk-core": "^3.1.120",
"@koa/cors": "^5.0.0", "@koa/cors": "^5.0.0",
@@ -117,10 +117,11 @@ export class EmailService implements IEmailService {
async test(userId: number, receiver: string) { async test(userId: number, receiver: string) {
await this.sendByTemplate({ await this.sendByTemplate({
type:"common", type: "common",
data:{ data: {
title: '测试邮件,from certd', title: '测试邮件,from certd',
content: '测试邮件,from certd', content: '测试邮件,from certd',
url:"https://certd.handfree.work",
}, },
email: { email: {
receivers: [receiver], receivers: [receiver],
@@ -150,10 +151,10 @@ export class EmailService implements IEmailService {
async sendByTemplate(req: EmailSendByTemplateReq) { async sendByTemplate(req: EmailSendByTemplateReq) {
const emailConf = await this.sysSettingsService.getSetting<SysEmailConf>(SysEmailConf);
const template = emailConf?.templates?.[req.type]
let content = null let content = null
if (isPlus()) {
const emailConf = await this.sysSettingsService.getSetting<SysEmailConf>(SysEmailConf);
const template = emailConf?.templates?.[req.type]
if (template && template.addonId) { if (template && template.addonId) {
const addon: ITemplateProvider<EmailContent> = await this.addonGetterService.getAddonById(template.addonId, true, 0) const addon: ITemplateProvider<EmailContent> = await this.addonGetterService.getAddonById(template.addonId, true, 0)
if (addon) { if (addon) {
@@ -176,10 +177,13 @@ export class EmailService implements IEmailService {
content = await addon.buildDefaultContent({ data: req.data }) content = await addon.buildDefaultContent({ data: req.data })
} catch (e) { } catch (e) {
// 对应的通知类型模版可能没有注册或者开发 // 对应的通知类型模版可能没有注册或者开发
}
}
}
if (!content) {
const addon: ITemplateProvider<EmailContent> = await this.addonGetterService.getBlank("emailTemplate", "common") const addon: ITemplateProvider<EmailContent> = await this.addonGetterService.getBlank("emailTemplate", "common")
content = await addon.buildDefaultContent({ data: req.data }) content = await addon.buildDefaultContent({ data: req.data })
//common类型的一定有,已经开发了
}
} }
return await this.send({ return await this.send({
...req.email, ...req.email,
@@ -1,5 +1,5 @@
import parser from 'cron-parser'; import parser from 'cron-parser';
import { ILogger } from '@certd/basic'; import { ILogger, logger } from '@certd/basic';
export type CronTaskReq = { export type CronTaskReq = {
/** /**
@@ -52,7 +52,7 @@ export class Cron {
queue: CronTask[] = []; queue: CronTask[] = [];
constructor(opts: any) { constructor(opts: any) {
this.logger = opts.logger; this.logger = opts.logger || logger;
this.immediateTriggerOnce = opts.immediateTriggerOnce; this.immediateTriggerOnce = opts.immediateTriggerOnce;
} }
@@ -128,7 +128,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
} }
const pipeline = JSON.parse(item.content); const pipeline = JSON.parse(item.content);
let stepCount = 0; let stepCount = 0;
if(pipeline.stages){ if (pipeline.stages) {
RunnableCollection.each(pipeline.stages, (runnable: any) => { RunnableCollection.each(pipeline.stages, (runnable: any) => {
stepCount++; stepCount++;
}); });
@@ -237,7 +237,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
let fromType = "pipeline"; let fromType = "pipeline";
if (bean.type === "cert_upload") { if (bean.type === "cert_upload") {
fromType = "upload"; fromType = "upload";
}else if (bean.type === "cert_auto") { } else if (bean.type === "cert_auto") {
fromType = "auto"; fromType = "auto";
} }
await this.certInfoService.updateDomains(pipeline.id, pipeline.userId || bean.userId, domains, fromType); await this.certInfoService.updateDomains(pipeline.id, pipeline.userId || bean.userId, domains, fromType);
@@ -376,17 +376,17 @@ export class PipelineService extends BaseService<PipelineEntity> {
} }
if (immediateTriggerOnce) { if (immediateTriggerOnce) {
try{ try {
await this.trigger(pipeline.id); await this.trigger(pipeline.id);
await sleep(200); await sleep(200);
}catch(e){ } catch (e) {
logger.error(e); logger.error(e);
} }
} }
} }
async trigger(id: any, stepId?: string , doCheck = false) { async trigger(id: any, stepId?: string, doCheck = false) {
const entity: PipelineEntity = await this.info(id); const entity: PipelineEntity = await this.info(id);
if (doCheck) { if (doCheck) {
await this.beforeCheck(entity); await this.beforeCheck(entity);
@@ -441,6 +441,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
pipeline = await this.info(id); pipeline = await this.info(id);
} else { } else {
pipeline = id; pipeline = id;
id = pipeline.id;
} }
if (!pipeline) { if (!pipeline) {
return; return;
@@ -456,6 +457,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
removeCron(pipelineId, trigger) { removeCron(pipelineId, trigger) {
const name = this.buildCronKey(pipelineId, trigger.id); const name = this.buildCronKey(pipelineId, trigger.id);
this.cron.remove(name); this.cron.remove(name);
logger.info("当前定时器数量:", this.cron.getTaskSize());
} }
registerCron(pipelineId, trigger) { registerCron(pipelineId, trigger) {
@@ -500,8 +502,8 @@ export class PipelineService extends BaseService<PipelineEntity> {
async isPipelineValidTimeEnabled(entity: PipelineEntity) { async isPipelineValidTimeEnabled(entity: PipelineEntity) {
const settings = await this.sysSettingsService.getPublicSettings(); const settings = await this.sysSettingsService.getPublicSettings();
if (isPlus() && settings.pipelineValidTimeEnabled){ if (isPlus() && settings.pipelineValidTimeEnabled) {
if (entity.validTime > 0 && entity.validTime < Date.now()){ if (entity.validTime > 0 && entity.validTime < Date.now()) {
return false return false
} }
} }
@@ -538,8 +540,8 @@ export class PipelineService extends BaseService<PipelineEntity> {
async doRun(entity: PipelineEntity, triggerId: string, stepId?: string) { async doRun(entity: PipelineEntity, triggerId: string, stepId?: string) {
let suite:any = null let suite: any = null
try{ try {
const res = await this.beforeCheck(entity); const res = await this.beforeCheck(entity);
suite = res.suite suite = res.suite
} catch (e) { } catch (e) {
@@ -803,11 +805,17 @@ export class PipelineService extends BaseService<PipelineEntity> {
for (const item of list) { for (const item of list) {
const pipeline = JSON.parse(item.content); const pipeline = JSON.parse(item.content);
if (trigger.props === false) {
//清除trigger
pipeline.triggers = []
} else {
pipeline.triggers = [{ pipeline.triggers = [{
id: nanoid(), id: nanoid(),
title: "定时触发", title: "定时触发",
...trigger ...trigger
}]; }];
}
await this.doUpdatePipelineJson(item, pipeline); await this.doUpdatePipelineJson(item, pipeline);
} }
@@ -919,20 +927,20 @@ export class PipelineService extends BaseService<PipelineEntity> {
} }
} }
async createAutoPipeline(req: { domains: string[]; email: string; userId: number ,from:string}) { async createAutoPipeline(req: { domains: string[]; email: string; userId: number, from: string }) {
const randomHour = Math.floor(Math.random() * 6); const randomHour = Math.floor(Math.random() * 6);
const randomMin = Math.floor(Math.random() * 60); const randomMin = Math.floor(Math.random() * 60);
const randomCron = `0 ${randomMin} ${randomHour} * * *`; const randomCron = `0 ${randomMin} ${randomHour} * * *`;
let pipeline: any = { let pipeline: any = {
title: req.domains[0] + `证书自动申请【${req.from??"OpenAPI"}`, title: req.domains[0] + `证书自动申请【${req.from ?? "OpenAPI"}`,
runnableType: "pipeline", runnableType: "pipeline",
triggers: [ triggers: [
{ {
id: nanoid(), id: nanoid(),
title: "定时触发", title: "定时触发",
props:{ props: {
cron: randomCron, cron: randomCron,
}, },
type: "timer" type: "timer"
@@ -25,13 +25,16 @@ export class EmailNotification extends BaseNotification {
const templateData = { const templateData = {
...body, ...body,
} }
const emailSend:any = {
receivers: this.receivers,
}
if (body.attachments && body.attachments.length > 0) {
emailSend.attachments = body.attachments;
}
await this.ctx.emailService.sendByTemplate({ await this.ctx.emailService.sendByTemplate({
type: body.notificationType, type: body.notificationType,
data: templateData, data: templateData,
email: { email: emailSend
receivers: this.receivers,
attachments: body.attachments,
}
}) })
// await this.ctx.emailService.send({ // await this.ctx.emailService.send({
@@ -60,7 +60,9 @@ export class TelegramNotification extends BaseNotification {
replaceText(text: string) { replaceText(text: string) {
// .*()<> 等都需要用\\进行替换 // .*()<> 等都需要用\\进行替换
return text.replace(/[\\.*()<>-]/g, '\\$&'); return text.replace(/[_*[\]()~`>#\+\-=|{}.!]/g, '\\$&');
// .replace(/([\\_*`|!.[\](){}>+#=~-])/gm, '\\$1')
// return text.replace(/[\\.*()<>]/g, '\\$&');
} }
async send(body: NotificationBody) { async send(body: NotificationBody) {
if (!this.botToken || !this.chatId) { if (!this.botToken || !this.chatId) {
@@ -61,8 +61,14 @@ export class BaseEmailTemplateProvider extends BaseAddon implements ITemplatePro
async buildContent(params: BuildContentReq): Promise<EmailContent> { async buildContent(params: BuildContentReq): Promise<EmailContent> {
const title = this.compile(this.titleTemplate)(params.data) const data = {
const content = this.compile(this.contentTemplate)(params.data) title:"",
content:"",
url:"",
...params.data,
}
const title = this.compile(this.titleTemplate)(data)
const content = this.compile(this.contentTemplate)(data)
const body: any = { const body: any = {
subject: title, subject: title,
+1 -1
View File
@@ -1 +1 @@
00:59 01:47
+1 -1
View File
@@ -1 +1 @@
01:17 07:43