Compare commits

...

68 Commits

Author SHA1 Message Date
xiaojunnuo
d876ea6711 v1.34.8 2025-05-28 23:13:12 +08:00
xiaojunnuo
b40b4c3cfd build: prepare to build 2025-05-28 23:11:23 +08:00
xiaojunnuo
44980d6c46 build: prepare to build 2025-05-28 23:02:13 +08:00
xiaojunnuo
442f9647a2 chore: 2025-05-28 23:01:55 +08:00
xiaojunnuo
a06ef07178 perf: farcdn优化 2025-05-28 16:11:18 +08:00
xiaojunnuo
0c2ea5da4c fix: 修复阿里云 esa 证书获取站点列表错误的问题 2025-05-28 16:06:38 +08:00
xiaojunnuo
45814ceb49 chore: 优化站点ip检查 2025-05-28 15:49:48 +08:00
xiaojunnuo
41f4617e66 chore: 优化站点ip检查 2025-05-28 15:12:54 +08:00
xiaojunnuo
a463711b03 perf: 优化站点ip检查 2025-05-28 13:57:31 +08:00
xiaojunnuo
3a147141b1 perf: 优化站点选择组件,切换选择时不刷新列表 2025-05-28 11:22:39 +08:00
xiaojunnuo
aea1c13bd3 chore: 2025-05-28 01:22:23 +08:00
xiaojunnuo
9cc4c017ae perf: 站点监控支持监控IP 2025-05-28 00:57:52 +08:00
xiaojunnuo
88022747be fix: 修复证书申请任务无法修改dns提供商类型的bug 2025-05-27 15:32:31 +08:00
xiaojunnuo
ebb292a2f7 fix: 修复部署到华为cdn,子账号ak查询不到域名的bug 2025-05-27 12:02:54 +08:00
xiaojunnuo
818998259d perf: 支持批量重新运行 2025-05-27 11:08:08 +08:00
xiaojunnuo
36b02c2cec fix: 同步更新namesilo接口,修复无法创建和删除dns记录的问题 2025-05-27 10:31:48 +08:00
xiaojunnuo
e6195ade3e fix: 更新 1panel API 版本支持v1/v2设置 2025-05-27 00:22:39 +08:00
xiaojunnuo
231a875bb4 perf: 关闭腾讯云证书通知提醒 2025-05-27 00:10:50 +08:00
xiaojunnuo
378c777a38 chore: 2025-05-27 00:03:15 +08:00
xiaojunnuo
8ef63916ef chore: 2025-05-26 23:36:19 +08:00
xiaojunnuo
f32ecdf5f1 build: trigger build image 2025-05-26 23:34:59 +08:00
xiaojunnuo
94739b9b8e chore: 2025-05-26 23:25:43 +08:00
xiaojunnuo
023db4e04e v1.34.7 2025-05-26 23:24:35 +08:00
xiaojunnuo
5a4b95f5fe build: prepare to build 2025-05-26 23:20:59 +08:00
xiaojunnuo
b091657b5c perf: 优化阿里云DCDN插件,支持多选 2025-05-26 23:10:31 +08:00
xiaojunnuo
f7bf5c9328 chore: 2025-05-26 22:50:58 +08:00
xiaojunnuo
86e521b9aa chore: 2025-05-26 22:44:56 +08:00
xiaojunnuo
e08cf57b72 perf: 支持部署到farcdn 2025-05-26 22:22:39 +08:00
xiaojunnuo
9e06cb9a83 docs: 2025-05-26 00:03:22 +08:00
xiaojunnuo
c65e8622b8 Merge branch 'v2-dev' into v2 2025-05-26 00:00:32 +08:00
xiaojunnuo
7795efeb7a build: publish 2025-05-25 23:46:02 +08:00
xiaojunnuo
e725e0020e build: trigger build image 2025-05-25 23:45:46 +08:00
xiaojunnuo
8478ce25f1 v1.34.6 2025-05-25 23:44:23 +08:00
xiaojunnuo
22cdac6210 build: prepare to build 2025-05-25 23:42:01 +08:00
xiaojunnuo
3422a1a59f perf: 站点证书监控增加通知设置 2025-05-25 23:38:25 +08:00
xiaojunnuo
f807b8cb46 fix: 修复lego模式下每次都重新申请证书的bug 2025-05-25 22:58:30 +08:00
xiaojunnuo
e1e510ce1e fix: 修复公共插件配置修改不生效的bug,优化系统设置参数注入时机
- 将系统设置参数注入移至 outputContext读取输入参数之后
-修复了某些情况下系统设置参数可能被覆盖的问题
- 优化了代码结构,提高了可读性和维护性
2025-05-25 21:08:23 +08:00
xiaojunnuo
36bc3ff22d fix: 优化 RunnableError错误信息展示
- 确保在不同错误场景下都能正确显示错误详情
2025-05-25 20:50:15 +08:00
xiaojunnuo
1db1ffde99 perf: 添加阿里云 ESA证书部署插件
- 新增 AliyunDeployCertToESA 插件类,实现证书上传和部署到阿里云 ESA 功能
- 优化证书名称生成逻辑,支持通配符域名
- 重构部分代码,提高可复用性和可维护性
- 更新相关依赖版本,确保兼容性
2025-05-22 23:21:50 +08:00
xiaojunnuo
7984b625ba fix: 修复又拍云 CDN 设置证书参数和强制 HTTPS 配置报错的bug 2025-05-20 23:37:24 +08:00
xiaojunnuo
bb22f062ed perf: 二次认证页面中,添加动态验证码输入框的焦点控制,提升用户体验 2025-05-20 23:28:09 +08:00
xiaojunnuo
a3086e6a5b fix(cert): 修正证书过期时间计算逻辑 2025-05-20 23:19:50 +08:00
xiaojunnuo
1eb9bd34fd docs: 2025-05-20 09:36:13 +08:00
xiaojunnuo
cff7baaaad Merge branch 'v2-dev' into v2 2025-05-20 01:42:12 +08:00
xiaojunnuo
47af700375 build: publish 2025-05-20 01:40:26 +08:00
xiaojunnuo
eb7f53a1e3 build: trigger build image 2025-05-20 01:40:08 +08:00
xiaojunnuo
d23792fda2 v1.34.5 2025-05-20 01:38:18 +08:00
xiaojunnuo
b5cbb8e450 build: prepare to build 2025-05-20 01:35:39 +08:00
xiaojunnuo
fc037b4518 Merge remote-tracking branch 'origin/v2-dev' into v2-dev 2025-05-20 01:13:50 +08:00
xiaojunnuo
c04921f42b docs: 2025-05-20 01:13:01 +08:00
xiaojunnuo
8af3463668 perf: aaWaf、cdnfly站点选择支持查询 2025-05-20 01:11:26 +08:00
xiaojunnuo
094565ccd6 perf: 支持部署到宝塔aaWAF 2025-05-20 00:27:18 +08:00
xiaojunnuo
07b9769504 docs: 2025-05-19 11:34:59 +08:00
xiaojunnuo
566b12f5d1 perf: 1panel增加授权测试按钮 2025-05-19 10:58:28 +08:00
xiaojunnuo
a560999d13 perf: 优化钉钉通知标题颜色 2025-05-17 01:13:36 +08:00
xiaojunnuo
a818a3d293 perf: 优化飞书通知为卡片模式 2025-05-17 00:47:28 +08:00
xiaojunnuo
4d68a174cb Merge branch 'v2-dev' into v2 2025-05-17 00:14:16 +08:00
xiaojunnuo
905219e523 build: publish 2025-05-17 00:05:31 +08:00
xiaojunnuo
c675b87040 build: trigger build image 2025-05-17 00:05:13 +08:00
xiaojunnuo
ed1a9fc7aa Merge branch 'v2-dev' into v2 2025-05-16 00:21:55 +08:00
xiaojunnuo
47ebab237b Merge branch 'v2-dev' into v2 2025-05-11 20:29:59 +08:00
xiaojunnuo
f9553e7d44 Merge branch 'v2-dev' into v2 2025-05-06 00:33:19 +08:00
xiaojunnuo
ae51676471 Merge branch 'v2-dev' into v2 2025-04-28 17:31:04 +08:00
xiaojunnuo
f933fb705c Merge branch 'v2-dev' into v2 2025-04-27 02:01:28 +08:00
xiaojunnuo
918ea59b9a Merge branch 'v2-dev' into v2 2025-04-22 22:49:53 +08:00
xiaojunnuo
b9dab77c8b Merge branch 'v2-dev' into v2 2025-04-21 00:18:53 +08:00
xiaojunnuo
4159534a64 Merge branch 'v2-dev' into v2 2025-04-17 23:38:29 +08:00
xiaojunnuo
d00177a9b6 chore: 2025-04-16 00:04:40 +08:00
108 changed files with 3233 additions and 392 deletions

View File

@@ -3,6 +3,58 @@
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.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
* 优化阿里云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
* 修复公共插件配置修改不生效的bug优化系统设置参数注入时机 ([e1e510c](https://github.com/certd/certd/commit/e1e510ce1e37a5ae82478226b6987a83f22d1ecb))
* 修复又拍云 CDN 设置证书参数和强制 HTTPS 配置报错的bug ([7984b62](https://github.com/certd/certd/commit/7984b625ba6727132f205db8e25f790bce27b2f7))
* 修复lego模式下每次都重新申请证书的bug ([f807b8c](https://github.com/certd/certd/commit/f807b8cb465cc329fa034ecbef94e18ef394f870))
* 优化 RunnableError错误信息展示 ([36bc3ff](https://github.com/certd/certd/commit/36bc3ff22da93ba342c3c1103d7ee2bbcecf44f2))
* **cert:** 修正证书过期时间计算逻辑 ([a3086e6](https://github.com/certd/certd/commit/a3086e6a5bec8b07f5e1d21a2ca8bd969c75bd5c))
### Performance Improvements
* 二次认证页面中,添加动态验证码输入框的焦点控制,提升用户体验 ([bb22f06](https://github.com/certd/certd/commit/bb22f062ed4ab4b5b71938270fe4cc666af6b8e7))
* 添加阿里云 ESA证书部署插件 ([1db1ffd](https://github.com/certd/certd/commit/1db1ffde99ac7e4684fa606ebc4c327f829b3a26))
* 站点证书监控增加通知设置 ([3422a1a](https://github.com/certd/certd/commit/3422a1a59fd0d2c0f17fa9c7e8988ac527ecfdd9))
## [1.34.5](https://github.com/certd/certd/compare/v1.34.4...v1.34.5) (2025-05-19)
### Performance Improvements
* 1panel增加授权测试按钮 ([566b12f](https://github.com/certd/certd/commit/566b12f5d14ce10e8f5cf1807c58f7bf27f0d199))
* 优化钉钉通知标题颜色 ([a560999](https://github.com/certd/certd/commit/a560999d13eed18d08dd32ee530166569e3f8746))
* 优化飞书通知为卡片模式 ([a818a3d](https://github.com/certd/certd/commit/a818a3d293e22fb46979bc77055c05621a6fed81))
* 支持部署到宝塔aaWAF ([094565c](https://github.com/certd/certd/commit/094565ccd619ef671c6c11ce5fb7fd54a7a21d1c))
* aaWaf、cdnfly站点选择支持查询 ([8af3463](https://github.com/certd/certd/commit/8af3463668a40b9b99febb02e3b4e0d9d8d719b4))
## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16) ## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16)
### Bug Fixes ### Bug Fixes

View File

@@ -110,8 +110,7 @@ https://certd.handfree.work/
> * 请务必使用web应用防火墙防护本应用防止XSS、SQL注入等攻击 > * 请务必使用web应用防火墙防护本应用防止XSS、SQL注入等攻击
> * 请务必做好服务器本身的安全防护,防止数据库泄露 > * 请务必做好服务器本身的安全防护,防止数据库泄露
> * 请务必做好数据备份,避免数据丢失 > * 请务必做好数据备份,避免数据丢失
> * [更多安全生产建议点我](https://certd.docmirror.cn/guide/feature/safe/)
## 五、更多帮助 ## 五、更多帮助

View File

@@ -1 +1 @@
00:14 23:34

View File

@@ -16,7 +16,7 @@ services:
- "7001:7001" - "7001:7001"
# ↓↓↓↓ ---------------------------------------------------------- https端口可以根据实际情况是否暴露该端口 # ↓↓↓↓ ---------------------------------------------------------- https端口可以根据实际情况是否暴露该端口
- "7002:7002" - "7002:7002"
#↓↓↓↓ -------------------------------------------------------------- 如果出现getaddrinfo ENOTFOUND错误可以尝试设置dns #↓↓↓↓ -------------------------------------------------------------- 如果出现getaddrinfo EAI_AGAIN 或 getaddrinfo ENOTFOUND 错误可以尝试设置dns
# dns: # dns:
# - 223.5.5.5 # 阿里云公共dns # - 223.5.5.5 # 阿里云公共dns
# - 223.6.6.6 # - 223.6.6.6

View File

@@ -91,14 +91,14 @@ export default defineConfig({
{text: "多数据库支持", link: "/guide/install/database.md"}, {text: "多数据库支持", link: "/guide/install/database.md"},
{text: "开放接口", link: "/guide/open/index.md"}, {text: "开放接口", link: "/guide/open/index.md"},
{ {
text: "站点安全", link: "/guide/feature/safe" text: "站点安全", link: "/guide/feature/safe/"
}, },
{ {
text: "插件列表", items: [ text: "插件列表", items: [
{text: "授权提供商", link: "/guide/plugins/access"}, {text: "授权提供商", link: "/guide/plugins/access.md"},
{text: "DNS提供商", link: "/guide/plugins/dns-provider"}, {text: "DNS提供商", link: "/guide/plugins/dns-provider.md"},
{text: "任务插件", link: "/guide/plugins/deploy"}, {text: "任务插件", link: "/guide/plugins/deploy.md"},
{text: "通知插件", link: "/guide/plugins/notification"}, {text: "通知插件", link: "/guide/plugins/notification.md"},
] ]
}, },
] ]
@@ -106,7 +106,7 @@ export default defineConfig({
{ {
text: "常见问题", text: "常见问题",
items: [ items: [
{text: "QA", link: "/guide/qa/use"}, {text: "QA", link: "/guide/qa/use.md"},
{text: "常见报错处理", link: "/guide/qa/"}, {text: "常见报错处理", link: "/guide/qa/"},
{text: "群晖证书部署", link: "/guide/use/synology/"}, {text: "群晖证书部署", link: "/guide/use/synology/"},
{text: "腾讯云密钥获取", link: "/guide/use/tencent/"}, {text: "腾讯云密钥获取", link: "/guide/use/tencent/"},
@@ -139,7 +139,6 @@ export default defineConfig({
{text: "捐赠", link: "/guide/donate/"}, {text: "捐赠", link: "/guide/donate/"},
{text: "开源协议", link: "/guide/license/"}, {text: "开源协议", link: "/guide/license/"},
{text: "我的其他开源项目", link: "/guide/link/"}, {text: "我的其他开源项目", link: "/guide/link/"},
] ]
} }
], ],

View File

@@ -3,6 +3,52 @@
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.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
* 修复公共插件配置修改不生效的bug优化系统设置参数注入时机 ([e1e510c](https://github.com/certd/certd/commit/e1e510ce1e37a5ae82478226b6987a83f22d1ecb))
* 修复又拍云 CDN 设置证书参数和强制 HTTPS 配置报错的bug ([7984b62](https://github.com/certd/certd/commit/7984b625ba6727132f205db8e25f790bce27b2f7))
* 修复lego模式下每次都重新申请证书的bug ([f807b8c](https://github.com/certd/certd/commit/f807b8cb465cc329fa034ecbef94e18ef394f870))
* 优化 RunnableError错误信息展示 ([36bc3ff](https://github.com/certd/certd/commit/36bc3ff22da93ba342c3c1103d7ee2bbcecf44f2))
* **cert:** 修正证书过期时间计算逻辑 ([a3086e6](https://github.com/certd/certd/commit/a3086e6a5bec8b07f5e1d21a2ca8bd969c75bd5c))
### Performance Improvements
* 二次认证页面中,添加动态验证码输入框的焦点控制,提升用户体验 ([bb22f06](https://github.com/certd/certd/commit/bb22f062ed4ab4b5b71938270fe4cc666af6b8e7))
* 添加阿里云 ESA证书部署插件 ([1db1ffd](https://github.com/certd/certd/commit/1db1ffde99ac7e4684fa606ebc4c327f829b3a26))
* 站点证书监控增加通知设置 ([3422a1a](https://github.com/certd/certd/commit/3422a1a59fd0d2c0f17fa9c7e8988ac527ecfdd9))
## [1.34.5](https://github.com/certd/certd/compare/v1.34.4...v1.34.5) (2025-05-19)
### Performance Improvements
* 1panel增加授权测试按钮 ([566b12f](https://github.com/certd/certd/commit/566b12f5d14ce10e8f5cf1807c58f7bf27f0d199))
* 优化钉钉通知标题颜色 ([a560999](https://github.com/certd/certd/commit/a560999d13eed18d08dd32ee530166569e3f8746))
* 优化飞书通知为卡片模式 ([a818a3d](https://github.com/certd/certd/commit/a818a3d293e22fb46979bc77055c05621a6fed81))
* 支持部署到宝塔aaWAF ([094565c](https://github.com/certd/certd/commit/094565ccd619ef671c6c11ce5fb7fd54a7a21d1c))
* aaWaf、cdnfly站点选择支持查询 ([8af3463](https://github.com/certd/certd/commit/8af3463668a40b9b99febb02e3b4e0d9d8d719b4))
## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16)
### Bug Fixes
* 修复部署flexcdn问题 ([76b19a4](https://github.com/certd/certd/commit/76b19a4980f8edba5238543b82a7811e1003746c))
* 修复插件导入的bug ([677fec0](https://github.com/certd/certd/commit/677fec0a0b6fceb4966705e471bbfeeda91610c7))
* 修复导入在线插件不生效的bug ([fcf8309](https://github.com/certd/certd/commit/fcf8309c238208281ecb4575b2c3cfe50c11d783))
* 修复自建插件保存丢失部署策略的bug ([863e74d](https://github.com/certd/certd/commit/863e74dd2e3912f950ff5025b5ed0070aeb37035))
### Performance Improvements
* 调整小助手,仅在登录之后显示 ([aebb07c](https://github.com/certd/certd/commit/aebb07c5cc8b1f233b9d203ff017ac60e6971a85))
## [1.34.3](https://github.com/certd/certd/compare/v1.34.2...v1.34.3) (2025-05-15) ## [1.34.3](https://github.com/certd/certd/compare/v1.34.2...v1.34.3) (2025-05-15)
### Performance Improvements ### Performance Improvements

View File

@@ -1,12 +1,12 @@
# 常见报错解决 # 常见报错解决
## 1. getaddrinfo ENOTFOUND错误 ## 1. getaddrinfo ENOTFOUND错误
如果出现`getaddrinfo ENOTFOUND`错误,可以尝试在`docker-compose.yaml`中设置dns 如果出现`getaddrinfo ENOTFOUND`/`getaddrinfo EAI_AGAIN`错误,可以尝试在`docker-compose.yaml`中设置dns
```yaml ```yaml
version: '3.3' # 兼容旧版docker-compose version: '3.3' # 兼容旧版docker-compose
services: services:
certd: certd:
#↓↓↓↓ ------------ # 如果出现getaddrinfo ENOTFOUND错误可以尝试设置dns #↓↓↓↓ ------------ # 如果出现getaddrinfo ENOTFOUND 或 EAI_AGAIN错误可以尝试设置dns
dns: dns:
- 223.5.5.5 # 阿里云公共dns - 223.5.5.5 # 阿里云公共dns
- 223.6.6.6 - 223.6.6.6

View File

@@ -9,5 +9,5 @@
} }
}, },
"npmClient": "pnpm", "npmClient": "pnpm",
"version": "1.34.4" "version": "1.34.8"
} }

View File

@@ -3,6 +3,22 @@
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.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
## [1.34.6](https://github.com/publishlab/node-acme-client/compare/v1.34.5...v1.34.6) (2025-05-25)
**Note:** Version bump only for package @certd/acme-client
## [1.34.5](https://github.com/publishlab/node-acme-client/compare/v1.34.4...v1.34.5) (2025-05-19)
**Note:** Version bump only for package @certd/acme-client
## [1.34.4](https://github.com/publishlab/node-acme-client/compare/v1.34.3...v1.34.4) (2025-05-16) ## [1.34.4](https://github.com/publishlab/node-acme-client/compare/v1.34.3...v1.34.4) (2025-05-16)
**Note:** Version bump only for package @certd/acme-client **Note:** Version bump only for package @certd/acme-client

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.34.4", "version": "1.34.8",
"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.34.4", "@certd/basic": "^1.34.8",
"@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",
@@ -69,5 +69,5 @@
"bugs": { "bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues" "url": "https://github.com/publishlab/node-acme-client/issues"
}, },
"gitHead": "0b152a3cb8ef13113f9612c1bf555755e6f5b209" "gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
} }

View File

@@ -3,6 +3,24 @@
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.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.34.6](https://github.com/certd/certd/compare/v1.34.5...v1.34.6) (2025-05-25)
**Note:** Version bump only for package @certd/basic
## [1.34.5](https://github.com/certd/certd/compare/v1.34.4...v1.34.5) (2025-05-19)
### Performance Improvements
* 支持部署到宝塔aaWAF ([094565c](https://github.com/certd/certd/commit/094565ccd619ef671c6c11ce5fb7fd54a7a21d1c))
## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16) ## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16)
### Bug Fixes ### Bug Fixes

View File

@@ -1 +1 @@
23:58 23:11

View File

@@ -1,7 +1,7 @@
{ {
"name": "@certd/basic", "name": "@certd/basic",
"private": false, "private": false,
"version": "1.34.4", "version": "1.34.8",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js", "module": "./dist/index.js",
@@ -45,5 +45,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "0b152a3cb8ef13113f9612c1bf555755e6f5b209" "gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
} }

View File

@@ -97,11 +97,17 @@ export function createAxiosService({ logger }: { logger: Logger }) {
if (config.logRes == null) { if (config.logRes == null) {
config.logRes = false; config.logRes = false;
} }
if (config.logData == null) {
config.logData = false;
}
logger.info(`http request:${config.url}method:${config.method}`); logger.info(`http request:${config.url}method:${config.method}`);
if (config.logParams !== false && config.params) { if (config.logParams !== false && config.params) {
logger.info(`params:${JSON.stringify(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) { if (config.timeout == null) {
config.timeout = 15000; config.timeout = 15000;
} }
@@ -209,6 +215,10 @@ export function createAxiosService({ logger }: { logger: Logger }) {
logger.error("AggregateError", error); logger.error("AggregateError", error);
} }
const err = new HttpError(error); const err = new HttpError(error);
if (error.response?.config?.logParams === false) {
delete err.request?.params;
delete err.request?.data;
}
return Promise.reject(err); return Promise.reject(err);
} }
); );
@@ -222,6 +232,7 @@ export type HttpRequestConfig<D = any> = {
skipCheckRes?: boolean; skipCheckRes?: boolean;
logParams?: boolean; logParams?: boolean;
logRes?: boolean; logRes?: boolean;
logData?: boolean;
httpProxy?: string; httpProxy?: string;
returnOriginRes?: boolean; returnOriginRes?: boolean;
} & AxiosRequestConfig<D>; } & AxiosRequestConfig<D>;

View File

@@ -3,6 +3,36 @@
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.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.34.6](https://github.com/certd/certd/compare/v1.34.5...v1.34.6) (2025-05-25)
### Bug Fixes
* 修复公共插件配置修改不生效的bug优化系统设置参数注入时机 ([e1e510c](https://github.com/certd/certd/commit/e1e510ce1e37a5ae82478226b6987a83f22d1ecb))
* 优化 RunnableError错误信息展示 ([36bc3ff](https://github.com/certd/certd/commit/36bc3ff22da93ba342c3c1103d7ee2bbcecf44f2))
### Performance Improvements
* 添加阿里云 ESA证书部署插件 ([1db1ffd](https://github.com/certd/certd/commit/1db1ffde99ac7e4684fa606ebc4c327f829b3a26))
## [1.34.5](https://github.com/certd/certd/compare/v1.34.4...v1.34.5) (2025-05-19)
### Performance Improvements
* 优化钉钉通知标题颜色 ([a560999](https://github.com/certd/certd/commit/a560999d13eed18d08dd32ee530166569e3f8746))
* 优化飞书通知为卡片模式 ([a818a3d](https://github.com/certd/certd/commit/a818a3d293e22fb46979bc77055c05621a6fed81))
## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16) ## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16)
### Bug Fixes ### Bug Fixes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@certd/pipeline", "name": "@certd/pipeline",
"private": false, "private": false,
"version": "1.34.4", "version": "1.34.8",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js", "module": "./dist/index.js",
@@ -17,8 +17,8 @@
"pub": "npm publish" "pub": "npm publish"
}, },
"dependencies": { "dependencies": {
"@certd/basic": "^1.34.4", "@certd/basic": "^1.34.8",
"@certd/plus-core": "^1.34.4", "@certd/plus-core": "^1.34.8",
"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"
@@ -44,5 +44,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "0b152a3cb8ef13113f9612c1bf555755e6f5b209" "gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
} }

View File

@@ -2,3 +2,18 @@ import { IContext } from "../core/index.js";
export type UserContext = IContext; export type UserContext = IContext;
export type PipelineContext = 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[];
};

View File

@@ -218,7 +218,7 @@ export class Executor {
returnType: ResultType.error, returnType: ResultType.error,
runnable: t, runnable: t,
}); });
errorMessage += `任务${t.title}执行失败,错误详情:${e.message}`; errorMessage += `任务${t.title}执行失败,错误详情${e.message}`;
} }
} }
if (errorList.length > 0) { if (errorList.length > 0) {
@@ -295,6 +295,12 @@ export class Executor {
const pluginConfig = await this.options.pluginConfigService.getPluginConfig(pluginName); const pluginConfig = await this.options.pluginConfigService.getPluginConfig(pluginName);
//从outputContext读取输入参数 //从outputContext读取输入参数
const input = cloneDeep(step.input); const input = cloneDeep(step.input);
const sysInput = pluginConfig.sysSetting?.input || {};
//注入系统设置参数
for (const sysInputKey in sysInput) {
input[sysInputKey] = sysInput[sysInputKey];
}
Decorator.inject(define.input, instance, input, (item, key) => { Decorator.inject(define.input, instance, input, (item, key) => {
if (item.component?.name === "output-selector") { if (item.component?.name === "output-selector") {
const contextKey = input[key]; const contextKey = input[key];
@@ -314,12 +320,6 @@ export class Executor {
} }
}); });
const sysInput = pluginConfig.sysSetting?.input || {};
//注入系统设置参数
for (const sysInputKey in sysInput) {
input[sysInputKey] = sysInput[sysInputKey];
}
const newInputHash = hashUtils.md5(JSON.stringify(input)); const newInputHash = hashUtils.md5(JSON.stringify(input));
step.status!.inputHash = newInputHash; step.status!.inputHash = newInputHash;
//判断是否需要跳过 //判断是否需要跳过
@@ -438,7 +438,7 @@ export class Executor {
const runnableError = error as RunnableError; const runnableError = error as RunnableError;
content = `流水线ID:${this.pipeline.id}运行ID:${this.runtime.id}\n\n`; content = `流水线ID:${this.pipeline.id}运行ID:${this.runtime.id}\n\n`;
for (const re of runnableError.errors) { for (const re of runnableError.errors) {
content += ` - ${re.runnable.title} 执行失败\n 错误详情:${re.e.message}\n\n`; content += ` - ${re.runnable.title} 执行失败错误详情${re.e?.message || re.e?.error?.message}\n\n`;
} }
} else { } else {
content = `流水线ID:${this.pipeline.id}运行ID:${this.runtime.id}\n\n${this.currentStatusMap?.currentStep?.title} 执行失败\n\n错误详情:${error.message}`; content = `流水线ID:${this.pipeline.id}运行ID:${this.runtime.id}\n\n${this.currentStatusMap?.currentStep?.title} 执行失败\n\n错误详情:${error.message}`;
@@ -489,7 +489,15 @@ export class Executor {
} }
} }
/**
*
* @param stepId 如果==ALL 清除所有
*/
clearLastStatus(stepId: string) { clearLastStatus(stepId: string) {
if (stepId === "ALL") {
this.lastStatusMap.clear();
return;
}
this.lastStatusMap.clearById(stepId); this.lastStatusMap.clearById(stepId);
} }
} }

View File

@@ -227,6 +227,11 @@ export abstract class AbstractTaskPlugin implements ITaskPlugin {
return name + "_" + dayjs().format("YYYYMMDDHHmmssSSS"); return name + "_" + dayjs().format("YYYYMMDDHHmmssSSS");
} }
buildCertName(domain: string) {
domain = domain.replaceAll("*", "_").replaceAll(".", "_");
return `${domain}_${dayjs().format("YYYYMMDDHHmmssSSS")}`;
}
async onRequest(req: PluginRequestHandleReq<any>) { async onRequest(req: PluginRequestHandleReq<any>) {
if (!req.action) { if (!req.action) {
throw new Error("action is required"); throw new Error("action is required");

View File

@@ -3,6 +3,22 @@
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.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.34.6](https://github.com/certd/certd/compare/v1.34.5...v1.34.6) (2025-05-25)
**Note:** Version bump only for package @certd/lib-huawei
## [1.34.5](https://github.com/certd/certd/compare/v1.34.4...v1.34.5) (2025-05-19)
**Note:** Version bump only for package @certd/lib-huawei
## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16) ## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16)
**Note:** Version bump only for package @certd/lib-huawei **Note:** Version bump only for package @certd/lib-huawei

View File

@@ -1,7 +1,7 @@
{ {
"name": "@certd/lib-huawei", "name": "@certd/lib-huawei",
"private": false, "private": false,
"version": "1.34.4", "version": "1.34.8",
"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": "0b152a3cb8ef13113f9612c1bf555755e6f5b209" "gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
} }

View File

@@ -3,6 +3,22 @@
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.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.34.6](https://github.com/certd/certd/compare/v1.34.5...v1.34.6) (2025-05-25)
**Note:** Version bump only for package @certd/lib-iframe
## [1.34.5](https://github.com/certd/certd/compare/v1.34.4...v1.34.5) (2025-05-19)
**Note:** Version bump only for package @certd/lib-iframe
## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16) ## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16)
**Note:** Version bump only for package @certd/lib-iframe **Note:** Version bump only for package @certd/lib-iframe

View File

@@ -1,7 +1,7 @@
{ {
"name": "@certd/lib-iframe", "name": "@certd/lib-iframe",
"private": false, "private": false,
"version": "1.34.4", "version": "1.34.8",
"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": "0b152a3cb8ef13113f9612c1bf555755e6f5b209" "gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
} }

View File

@@ -3,6 +3,22 @@
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.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.34.6](https://github.com/certd/certd/compare/v1.34.5...v1.34.6) (2025-05-25)
**Note:** Version bump only for package @certd/jdcloud
## [1.34.5](https://github.com/certd/certd/compare/v1.34.4...v1.34.5) (2025-05-19)
**Note:** Version bump only for package @certd/jdcloud
## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16) ## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16)
**Note:** Version bump only for package @certd/jdcloud **Note:** Version bump only for package @certd/jdcloud

View File

@@ -1,6 +1,6 @@
{ {
"name": "@certd/jdcloud", "name": "@certd/jdcloud",
"version": "1.34.4", "version": "1.34.8",
"description": "jdcloud openApi sdk", "description": "jdcloud openApi sdk",
"main": "./dist/bundle.js", "main": "./dist/bundle.js",
"module": "./dist/bundle.js", "module": "./dist/bundle.js",
@@ -61,5 +61,5 @@
"fetch" "fetch"
] ]
}, },
"gitHead": "0b152a3cb8ef13113f9612c1bf555755e6f5b209" "gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
} }

View File

@@ -3,6 +3,22 @@
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.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.34.6](https://github.com/certd/certd/compare/v1.34.5...v1.34.6) (2025-05-25)
**Note:** Version bump only for package @certd/lib-k8s
## [1.34.5](https://github.com/certd/certd/compare/v1.34.4...v1.34.5) (2025-05-19)
**Note:** Version bump only for package @certd/lib-k8s
## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16) ## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16)
**Note:** Version bump only for package @certd/lib-k8s **Note:** Version bump only for package @certd/lib-k8s

View File

@@ -1,7 +1,7 @@
{ {
"name": "@certd/lib-k8s", "name": "@certd/lib-k8s",
"private": false, "private": false,
"version": "1.34.4", "version": "1.34.8",
"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.34.4", "@certd/basic": "^1.34.8",
"@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": "0b152a3cb8ef13113f9612c1bf555755e6f5b209" "gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
} }

View File

@@ -3,6 +3,24 @@
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.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.34.6](https://github.com/certd/certd/compare/v1.34.5...v1.34.6) (2025-05-25)
### Performance Improvements
* 站点证书监控增加通知设置 ([3422a1a](https://github.com/certd/certd/commit/3422a1a59fd0d2c0f17fa9c7e8988ac527ecfdd9))
## [1.34.5](https://github.com/certd/certd/compare/v1.34.4...v1.34.5) (2025-05-19)
**Note:** Version bump only for package @certd/lib-server
## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16) ## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16)
**Note:** Version bump only for package @certd/lib-server **Note:** Version bump only for package @certd/lib-server

View File

@@ -1,6 +1,6 @@
{ {
"name": "@certd/lib-server", "name": "@certd/lib-server",
"version": "1.34.4", "version": "1.34.8",
"description": "midway with flyway, sql upgrade way ", "description": "midway with flyway, sql upgrade way ",
"private": false, "private": false,
"type": "module", "type": "module",
@@ -27,10 +27,10 @@
], ],
"license": "AGPL", "license": "AGPL",
"dependencies": { "dependencies": {
"@certd/acme-client": "^1.34.4", "@certd/acme-client": "^1.34.8",
"@certd/basic": "^1.34.4", "@certd/basic": "^1.34.8",
"@certd/pipeline": "^1.34.4", "@certd/pipeline": "^1.34.8",
"@certd/plus-core": "^1.34.4", "@certd/plus-core": "^1.34.8",
"@midwayjs/cache": "~3.14.0", "@midwayjs/cache": "~3.14.0",
"@midwayjs/core": "~3.20.3", "@midwayjs/core": "~3.20.3",
"@midwayjs/i18n": "~3.20.3", "@midwayjs/i18n": "~3.20.3",
@@ -61,5 +61,5 @@
"typeorm": "^0.3.11", "typeorm": "^0.3.11",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "0b152a3cb8ef13113f9612c1bf555755e6f5b209" "gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
} }

View File

@@ -204,3 +204,5 @@ export class SysSafeSetting extends BaseSettings {
autoHiddenTimes: 5, autoHiddenTimes: 5,
}; };
} }

View File

@@ -3,6 +3,22 @@
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.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.34.6](https://github.com/certd/certd/compare/v1.34.5...v1.34.6) (2025-05-25)
**Note:** Version bump only for package @certd/midway-flyway-js
## [1.34.5](https://github.com/certd/certd/compare/v1.34.4...v1.34.5) (2025-05-19)
**Note:** Version bump only for package @certd/midway-flyway-js
## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16) ## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16)
**Note:** Version bump only for package @certd/midway-flyway-js **Note:** Version bump only for package @certd/midway-flyway-js

View File

@@ -1,6 +1,6 @@
{ {
"name": "@certd/midway-flyway-js", "name": "@certd/midway-flyway-js",
"version": "1.34.4", "version": "1.34.8",
"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": "0b152a3cb8ef13113f9612c1bf555755e6f5b209" "gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
} }

View File

@@ -3,6 +3,32 @@
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.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.34.6](https://github.com/certd/certd/compare/v1.34.5...v1.34.6) (2025-05-25)
### Bug Fixes
* 修复公共插件配置修改不生效的bug优化系统设置参数注入时机 ([e1e510c](https://github.com/certd/certd/commit/e1e510ce1e37a5ae82478226b6987a83f22d1ecb))
* 修复lego模式下每次都重新申请证书的bug ([f807b8c](https://github.com/certd/certd/commit/f807b8cb465cc329fa034ecbef94e18ef394f870))
* **cert:** 修正证书过期时间计算逻辑 ([a3086e6](https://github.com/certd/certd/commit/a3086e6a5bec8b07f5e1d21a2ca8bd969c75bd5c))
### Performance Improvements
* 添加阿里云 ESA证书部署插件 ([1db1ffd](https://github.com/certd/certd/commit/1db1ffde99ac7e4684fa606ebc4c327f829b3a26))
## [1.34.5](https://github.com/certd/certd/compare/v1.34.4...v1.34.5) (2025-05-19)
**Note:** Version bump only for package @certd/plugin-cert
## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16) ## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16)
**Note:** Version bump only for package @certd/plugin-cert **Note:** Version bump only for package @certd/plugin-cert

View File

@@ -1,7 +1,7 @@
{ {
"name": "@certd/plugin-cert", "name": "@certd/plugin-cert",
"private": false, "private": false,
"version": "1.34.4", "version": "1.34.8",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
@@ -16,10 +16,10 @@
"pub": "npm publish" "pub": "npm publish"
}, },
"dependencies": { "dependencies": {
"@certd/acme-client": "^1.34.4", "@certd/acme-client": "^1.34.8",
"@certd/basic": "^1.34.4", "@certd/basic": "^1.34.8",
"@certd/pipeline": "^1.34.4", "@certd/pipeline": "^1.34.8",
"@certd/plugin-lib": "^1.34.4", "@certd/plugin-lib": "^1.34.8",
"@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": "0b152a3cb8ef13113f9612c1bf555755e6f5b209" "gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
} }

View File

@@ -81,6 +81,10 @@ export abstract class CertApplyBasePlugin extends CertApplyBaseConvertPlugin {
} }
} }
getCheckChangeInputKeys() {
//插件哪些字段参与校验是否需要更新
return ["domains", "sslProvider", "privateKeyType", "dnsProviderType", "pfxPassword"];
}
/** /**
* 是否更新证书 * 是否更新证书
*/ */
@@ -91,7 +95,7 @@ export abstract class CertApplyBasePlugin extends CertApplyBaseConvertPlugin {
// return null; // return null;
// } // }
const checkInputChanges = ["domains", "sslProvider", "privateKeyType", "dnsProviderType", "pfxPassword"]; const checkInputChanges = this.getCheckChangeInputKeys();
const oldInput = JSON.stringify(pick(this.lastStatus?.input, checkInputChanges)); const oldInput = JSON.stringify(pick(this.lastStatus?.input, checkInputChanges));
const thisInput = JSON.stringify(pick(this, checkInputChanges)); const thisInput = JSON.stringify(pick(this, checkInputChanges));
const inputChanged = oldInput !== thisInput; const inputChanged = oldInput !== thisInput;
@@ -145,7 +149,8 @@ export abstract class CertApplyBasePlugin extends CertApplyBaseConvertPlugin {
throw new Error("过期时间不能为空"); throw new Error("过期时间不能为空");
} }
// 检查有效期 // 检查有效期
const leftDays = dayjs(expires).diff(dayjs(), "day"); const leftDays = Math.floor((expires - dayjs().valueOf()) / (1000 * 60 * 60 * 24));
this.logger.info(`证书剩余天数:${leftDays}`);
return { return {
isWillExpire: leftDays <= maxDays, isWillExpire: leftDays <= maxDays,
leftDays, leftDays,

View File

@@ -93,6 +93,21 @@ export class CertReader {
return domains; return domains;
} }
getAltNames() {
const { detail } = this.getCrtDetail();
return detail.domains.altNames;
}
static getMainDomain(crt: string) {
const { detail } = CertReader.readCertDetail(crt);
return detail.domains.commonName;
}
getMainDomain() {
const { detail } = this.getCrtDetail();
return detail.domains.commonName;
}
saveToFile(type: "crt" | "key" | "pfx" | "der" | "oc" | "one" | "ic" | "jks", filepath?: string) { saveToFile(type: "crt" | "key" | "pfx" | "der" | "oc" | "one" | "ic" | "jks", filepath?: string) {
if (!this.cert[type]) { if (!this.cert[type]) {
return; return;
@@ -164,8 +179,14 @@ export class CertReader {
buildCertFileName(suffix: string, applyTime: any, prefix = "cert") { buildCertFileName(suffix: string, applyTime: any, prefix = "cert") {
const detail = this.getCrtDetail(); const detail = this.getCrtDetail();
let domain = detail.detail.domains.commonName; let domain = detail.detail.domains.commonName;
domain = domain.replace(".", "_").replace("*", "_"); domain = domain.replaceAll(".", "_").replaceAll("*", "_");
const timeStr = dayjs(applyTime).format("YYYYMMDDHHmmss"); const timeStr = dayjs(applyTime).format("YYYYMMDDHHmmss");
return `${prefix}_${domain}_${timeStr}.${suffix}`; return `${prefix}_${domain}_${timeStr}.${suffix}`;
} }
buildCertName() {
let domain = this.getMainDomain();
domain = domain.replaceAll("*", "_").replaceAll("*", "_");
return `${domain}_${dayjs().format("YYYYMMDDHHmmssSSS")}`;
}
} }

View File

@@ -102,11 +102,11 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
return form.challengeType === 'dns' return form.challengeType === 'dns'
}), }),
component:{ component:{
on:{ onSelectedChange: ctx.compute(({form})=>{
selectedChange({form,$event}){ return ($event)=>{
form.dnsProviderAccessType = $event.accessType form.dnsProviderAccessType = $event.accessType
} }
} })
} }
} }
`, `,
@@ -320,7 +320,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
this.logger.info("当前正在使用 google EAB授权"); this.logger.info("当前正在使用 google EAB授权");
eab = await this.getAccess(this.eabAccessId); eab = await this.getAccess(this.eabAccessId);
} else if (this.googleCommonEabAccessId) { } else if (this.googleCommonEabAccessId) {
this.logger.info("当前正在使用 google公共EAB授权"); this.logger.info("当前正在使用 google 公共EAB授权");
eab = await this.getAccess(this.googleCommonEabAccessId, true); eab = await this.getAccess(this.googleCommonEabAccessId, true);
} else { } else {
throw new Error("google需要配置EAB授权或服务账号授权"); throw new Error("google需要配置EAB授权或服务账号授权");

View File

@@ -112,9 +112,12 @@ export class CertApplyLegoPlugin extends CertApplyBasePlugin {
}) })
privateKeyType!: PrivateKeyType; privateKeyType!: PrivateKeyType;
eab?: EabAccess; eab?: EabAccess;
getCheckChangeInputKeys() {
return ["domains", "privateKeyType", "dnsType"];
}
async onInstance() { async onInstance() {
this.accessService = this.ctx.accessService; this.accessService = this.ctx.accessService;
this.logger = this.ctx.logger; this.logger = this.ctx.logger;

View File

@@ -0,0 +1,27 @@
import { expect } from "chai";
import { CertApplyPlugin } from "../dist/index.js";
import dayjs from "dayjs";
import { logger } from "@certd/basic";
describe("test/cert-plugin.ts", () => {
const certApplyPlugin = new CertApplyPlugin();
certApplyPlugin.logger = logger;
it("should throw error when expires is null or undefined", () => {
expect(() => {
// @ts-ignore
certApplyPlugin.isWillExpire(undefined);
}).throw("过期时间不能为空");
expect(() => {
// @ts-ignore
certApplyPlugin.isWillExpire(null);
}).throw("过期时间不能为空");
});
it("isWillExpire", () => {
const now = dayjs().add(36, "day") - 10000;
const res = certApplyPlugin.isWillExpire(now.valueOf(), 35);
console.log(res);
expect(res.isWillExpire).eq(true);
});
});

View File

@@ -3,6 +3,33 @@
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.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.34.6](https://github.com/certd/certd/compare/v1.34.5...v1.34.6) (2025-05-25)
### Performance Improvements
* 添加阿里云 ESA证书部署插件 ([1db1ffd](https://github.com/certd/certd/commit/1db1ffde99ac7e4684fa606ebc4c327f829b3a26))
## [1.34.5](https://github.com/certd/certd/compare/v1.34.4...v1.34.5) (2025-05-19)
### Performance Improvements
* aaWaf、cdnfly站点选择支持查询 ([8af3463](https://github.com/certd/certd/commit/8af3463668a40b9b99febb02e3b4e0d9d8d719b4))
## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16) ## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16)
**Note:** Version bump only for package @certd/plugin-lib **Note:** Version bump only for package @certd/plugin-lib

View File

@@ -1,7 +1,7 @@
{ {
"name": "@certd/plugin-lib", "name": "@certd/plugin-lib",
"private": false, "private": false,
"version": "1.34.4", "version": "1.34.8",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
@@ -16,10 +16,12 @@
"pub": "npm publish" "pub": "npm publish"
}, },
"dependencies": { "dependencies": {
"@alicloud/openapi-client": "^0.4.14",
"@alicloud/pop-core": "^1.7.10", "@alicloud/pop-core": "^1.7.10",
"@alicloud/tea-util": "^1.4.10",
"@aws-sdk/client-s3": "^3.787.0", "@aws-sdk/client-s3": "^3.787.0",
"@certd/basic": "^1.34.4", "@certd/basic": "^1.34.8",
"@certd/pipeline": "^1.34.4", "@certd/pipeline": "^1.34.8",
"@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",
@@ -50,5 +52,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "0b152a3cb8ef13113f9612c1bf555755e6f5b209" "gitHead": "023db4e04ee3142d3857ff98224c16bbcfba8834"
} }

View File

@@ -1,4 +1,90 @@
import { IsAccess, AccessInput, BaseAccess } from "@certd/pipeline"; import { IsAccess, AccessInput, BaseAccess } from "@certd/pipeline";
import { ILogger } from "@certd/basic";
export type AliyunClientV2Req = {
action: string;
version: string;
protocol?: "HTTPS";
// 接口 HTTP 方法
method?: "GET" | "POST";
authType?: "AK";
style?: "RPC";
// 接口 PATH
pathname?: `/`;
data?: any;
};
export class AliyunClientV2 {
access: AliyunAccess;
logger: ILogger;
endpoint: string;
client: any;
constructor(opts: { access: AliyunAccess; logger: ILogger; endpoint: string }) {
this.access = opts.access;
this.logger = opts.logger;
this.endpoint = opts.endpoint;
}
async getClient() {
if (this.client) {
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,
});
// Endpoint 请参考 https://api.aliyun.com/product/FC
// config.endpoint = `esa.${this.regionId}.aliyuncs.com`;
config.endpoint = this.endpoint;
//@ts-ignore
this.client = new $OpenApi.default.default(config);
return this.client;
}
async doRequest(req: AliyunClientV2Req) {
const client = await this.getClient();
const $OpenApi = await import("@alicloud/openapi-client");
const $Util = await import("@alicloud/tea-util");
const params = new $OpenApi.Params({
// 接口名称
action: req.action,
// 接口版本
version: req.version,
// 接口协议
protocol: "HTTPS",
// 接口 HTTP 方法
method: req.method ?? "POST",
authType: "AK",
style: "RPC",
// 接口 PATH
pathname: `/`,
// 接口请求体内容格式
reqBodyType: "json",
// 接口响应体内容格式
bodyType: "json",
});
const runtime = new $Util.RuntimeOptions({});
const request = new $OpenApi.OpenApiRequest(req.data);
// 复制代码运行请自行打印 API 的返回值
// 返回值实际为 Map 类型,可从 Map 中获得三类数据:响应体 body、响应头 headers、HTTP 返回的状态码 statusCode。
const res = await client.callApi(params, request, runtime);
/**
* res?.body?.
*/
return res?.body;
}
}
@IsAccess({ @IsAccess({
name: "aliyun", name: "aliyun",
@@ -27,6 +113,14 @@ export class AliyunAccess extends BaseAccess {
helper: "注意证书申请需要dns解析权限其他阿里云插件需要对应的权限比如证书上传需要证书管理权限嫌麻烦就用主账号的全量权限的accessKey", helper: "注意证书申请需要dns解析权限其他阿里云插件需要对应的权限比如证书上传需要证书管理权限嫌麻烦就用主账号的全量权限的accessKey",
}) })
accessKeySecret = ""; accessKeySecret = "";
getClient(endpoint: string) {
return new AliyunClientV2({
access: this,
logger: this.ctx.logger,
endpoint: endpoint,
});
}
} }
new AliyunAccess(); new AliyunAccess();

View File

@@ -83,7 +83,7 @@ export class AliyunSslClient {
method: "POST", method: "POST",
}; };
this.opts.logger.info("开始上传证书"); this.opts.logger.info(`开始上传证书${req.name}`);
const ret: any = await client.request("UploadUserCertificate", params, requestOption); const ret: any = await client.request("UploadUserCertificate", params, requestOption);
this.checkRet(ret); this.checkRet(ret);
this.opts.logger.info("证书上传成功aliyunCertId=", ret.CertId); this.opts.logger.info("证书上传成功aliyunCertId=", ret.CertId);

View File

@@ -38,6 +38,9 @@ export function createRemoteSelectInputDefine(opts?: {
required?: boolean; required?: boolean;
rules?: any; rules?: any;
mergeScript?: string; mergeScript?: string;
search?: boolean;
pager?: boolean;
component?: any;
}) { }) {
const title = opts?.title || "请选择"; const title = opts?.title || "请选择";
const certDomainsInputKey = opts?.certDomainsInputKey || "certDomains"; const certDomainsInputKey = opts?.certDomainsInputKey || "certDomains";
@@ -47,6 +50,8 @@ export function createRemoteSelectInputDefine(opts?: {
const type = opts?.type || "plugin"; const type = opts?.type || "plugin";
const watches = opts?.watches || []; const watches = opts?.watches || [];
const helper = opts?.helper || "请选择"; const helper = opts?.helper || "请选择";
const search = opts?.search ?? false;
const pager = opts?.pager ?? false;
let mode = "tags"; let mode = "tags";
if (opts.multi === false) { if (opts.multi === false) {
mode = undefined; mode = undefined;
@@ -63,7 +68,10 @@ export function createRemoteSelectInputDefine(opts?: {
type, type,
typeName, typeName,
action, action,
search,
pager,
watches: [certDomainsInputKey, accessIdInputKey, ...watches], watches: [certDomainsInputKey, accessIdInputKey, ...watches],
...opts.component,
}, },
rules: opts?.rules, rules: opts?.rules,
required: opts.required ?? true, required: opts.required ?? true,

View File

@@ -49,10 +49,23 @@ export class TencentSslClient {
}; };
const ret = await client.UploadCertificate(params); const ret = await client.UploadCertificate(params);
this.checkRet(ret); 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; return ret.CertificateId;
} }
async switchCertNotify(certIds: string[], disabled: boolean) {
const client = await this.getSslClient();
const params = {
CertificateIds: certIds,
SwitchStatus: disabled ? 1 : 0, //1是忽略通知0是不忽略
};
const ret = await client.ModifyCertificatesExpiringNotificationSwitch(params);
this.checkRet(ret);
this.logger.info(`关闭证书${certIds}过期通知成功`);
return ret.RequestId;
}
async deployCertificateInstance(params: any) { async deployCertificateInstance(params: any) {
const client = await this.getSslClient(); const client = await this.getSslClient();
const res = await client.DeployCertificateInstance(params); const res = await client.DeployCertificateInstance(params);

View File

@@ -3,6 +3,41 @@
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.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.34.6](https://github.com/certd/certd/compare/v1.34.5...v1.34.6) (2025-05-25)
### Bug Fixes
* 修复又拍云 CDN 设置证书参数和强制 HTTPS 配置报错的bug ([7984b62](https://github.com/certd/certd/commit/7984b625ba6727132f205db8e25f790bce27b2f7))
* **cert:** 修正证书过期时间计算逻辑 ([a3086e6](https://github.com/certd/certd/commit/a3086e6a5bec8b07f5e1d21a2ca8bd969c75bd5c))
### Performance Improvements
* 二次认证页面中,添加动态验证码输入框的焦点控制,提升用户体验 ([bb22f06](https://github.com/certd/certd/commit/bb22f062ed4ab4b5b71938270fe4cc666af6b8e7))
* 站点证书监控增加通知设置 ([3422a1a](https://github.com/certd/certd/commit/3422a1a59fd0d2c0f17fa9c7e8988ac527ecfdd9))
## [1.34.5](https://github.com/certd/certd/compare/v1.34.4...v1.34.5) (2025-05-19)
### Performance Improvements
* aaWaf、cdnfly站点选择支持查询 ([8af3463](https://github.com/certd/certd/commit/8af3463668a40b9b99febb02e3b4e0d9d8d719b4))
## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16) ## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16)
### Bug Fixes ### Bug Fixes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@certd/ui-client", "name": "@certd/ui-client",
"version": "1.34.4", "version": "1.34.8",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite --open", "dev": "vite --open",
@@ -102,8 +102,8 @@
"zod-defaults": "^0.1.3" "zod-defaults": "^0.1.3"
}, },
"devDependencies": { "devDependencies": {
"@certd/lib-iframe": "^1.34.4", "@certd/lib-iframe": "^1.34.8",
"@certd/pipeline": "^1.34.4", "@certd/pipeline": "^1.34.8",
"@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",

View File

@@ -140,7 +140,7 @@ function createRequestFunction(service: any) {
headers: { headers: {
"Content-Type": get(config, "headers.Content-Type", "application/json"), "Content-Type": get(config, "headers.Content-Type", "application/json"),
}, },
timeout: 20000, timeout: 30000,
baseURL: env.API, baseURL: env.API,
data: {}, data: {},
}; };

View File

@@ -1,7 +1,30 @@
<template> <template>
<div class="remote-select"> <div class="remote-select">
<div class="flex flex-row"> <div class="flex flex-row">
<a-select class="remote-select-input" show-search :filter-option="filterOption" :options="optionsRef" :value="value" v-bind="attrs" @click="onClick" @update:value="emit('update:value', $event)" /> <a-select class="remote-select-input" show-search :filter-option="filterOption" :options="optionsRef" :value="value" v-bind="attrs" @click="onClick" @update:value="emit('update:value', $event)">
<template #dropdownRender="{ menuNode: menu }">
<template v-if="search">
<div class="flex w-full" style="padding: 4px 8px">
<a-input ref="inputRef" v-model:value="searchKeyRef" class="flex-1" allow-clear placeholder="查询关键字" @keydown.enter="doSearch" />
<a-button class="ml-2" :loading="loading" type="text" @click="doSearch">
<template #icon>
<search-outlined />
</template>
查询
</a-button>
</div>
<div v-if="hasError" class="helper p-2" :class="{ error: hasError }">
{{ message }}
</div>
<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"> <div class="ml-5">
<fs-button :loading="loading" title="刷新选项" icon="ion:refresh-outline" @click="refreshOptions"></fs-button> <fs-button :loading="loading" title="刷新选项" icon="ion:refresh-outline" @click="refreshOptions"></fs-button>
</div> </div>
@@ -13,16 +36,30 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ComponentPropsType, doRequest } from "/@/components/plugins/lib"; import { ComponentPropsType, doRequest } from "/@/components/plugins/lib";
import { inject, ref, useAttrs, watch } from "vue"; import { defineComponent, inject, ref, useAttrs, watch, Ref } from "vue";
import { PluginDefine } from "@certd/pipeline"; import { PluginDefine } from "@certd/pipeline";
defineOptions({ defineOptions({
name: "RemoteSelect", name: "RemoteSelect",
}); });
const VNodes = defineComponent({
props: {
vnodes: {
type: Object,
required: true,
},
},
render() {
return this.vnodes;
},
});
const props = defineProps< const props = defineProps<
{ {
watches: string[]; watches: string[];
search?: boolean;
pager?: boolean;
} & ComponentPropsType } & ComponentPropsType
>(); >();
@@ -36,10 +73,14 @@ const getCurrentPluginDefine: any = inject("getCurrentPluginDefine");
const getScope: any = inject("get:scope"); const getScope: any = inject("get:scope");
const getPluginType: any = inject("get:plugin:type"); const getPluginType: any = inject("get:plugin:type");
const searchKeyRef = ref("");
const optionsRef = ref([]); const optionsRef = ref([]);
const message = ref(""); const message = ref("");
const hasError = ref(false); const hasError = ref(false);
const loading = ref(false); const loading = ref(false);
const pagerRef: Ref = ref({
current: 1,
});
const getOptions = async () => { const getOptions = async () => {
if (loading.value) { if (loading.value) {
return; return;
@@ -74,6 +115,7 @@ const getOptions = async () => {
loading.value = true; loading.value = true;
optionsRef.value = []; optionsRef.value = [];
const offset = (pagerRef.value.current - 1) * (pagerRef.value.limit ?? 100);
try { try {
const res = await doRequest( const res = await doRequest(
{ {
@@ -81,6 +123,11 @@ const getOptions = async () => {
typeName: form.type, typeName: form.type,
action: props.action, action: props.action,
input, input,
data: {
searchKey: props.search ? searchKeyRef.value : "",
offset: offset,
limit: pagerRef.value.limit,
},
}, },
{ {
onError(err: any) { onError(err: any) {
@@ -90,10 +137,26 @@ const getOptions = async () => {
showErrorNotify: false, showErrorNotify: false,
} }
); );
if (res && res.length > 0) { const list = res?.list || res || [];
if (list.length > 0) {
message.value = "获取数据成功,请从下拉框中选择"; 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; return res;
} finally { } finally {
loading.value = false; loading.value = false;
@@ -114,24 +177,38 @@ async function refreshOptions() {
await getOptions(); await getOptions();
} }
async function doSearch() {
pagerRef.value.current = 1;
await refreshOptions();
}
watch( watch(
() => { () => {
const values = [];
const pluginType = getPluginType(); const pluginType = getPluginType();
const { form } = getScope(); const { form, key } = getScope();
const input = pluginType === "plugin" ? form.input : form; const input = pluginType === "plugin" ? form.input : form;
const watches = {};
for (const item of props.watches) { for (const key of props.watches) {
values.push(input[item]); watches[key] = input[key];
} }
return { return {
form: input, form: watches,
watched: values, key,
}; };
}, },
async () => { async (value, oldValue) => {
await getOptions(); 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, immediate: true,

View File

@@ -21,6 +21,13 @@ const menus = computed(() => [
icon: "fa-solid:book", icon: "fa-solid:book",
text: "账号信息", text: "账号信息",
}, },
{
handler: () => {
router.push("/certd/mine/security");
},
icon: "fluent:shield-keyhole-16-regular",
text: "认证安全设置",
},
]); ]);
const avatar = computed(() => { const avatar = computed(() => {

View File

@@ -143,6 +143,17 @@ export const certdResources = [
keepAlive: true, keepAlive: true,
}, },
}, },
{
title: "站点监控设置",
name: "SiteMonitorSetting",
path: "/certd/monitor/setting",
component: "/certd/monitor/site/setting/index.vue",
meta: {
icon: "ion:videocam-outline",
auth: true,
isMenu: true,
},
},
{ {
title: "认证安全设置", title: "认证安全设置",
name: "UserSecurity", name: "UserSecurity",

View File

@@ -66,3 +66,9 @@ footer{
display: flex; display: flex;
align-items: center; align-items: center;
} }
.ant-progress.ant-progress-show-info .ant-progress-outer {
margin-inline-end: calc(-3em - 8px);
padding-inline-end: calc(3em + 8px);
}

View File

@@ -35,10 +35,15 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
pageRequest, pageRequest,
addRequest, addRequest,
editRequest, editRequest,
delRequest delRequest,
},
table: {
remove: {
confirmMessage: "授权如果已经被使用,可能会导致流水线无法正常运行,请谨慎操作",
},
}, },
rowHandle: { rowHandle: {
width: 200 width: 200,
}, },
columns: { columns: {
id: { id: {
@@ -46,24 +51,24 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
key: "id", key: "id",
type: "number", type: "number",
column: { column: {
width: 100 width: 100,
}, },
form: { form: {
show: false show: false,
} },
}, },
name: { name: {
title: "名称", title: "名称",
type: "text", type: "text",
search: { search: {
show: true show: true,
}, },
form: { form: {
rules: [{ required: true, message: "必填项" }] rules: [{ required: true, message: "必填项" }],
}, },
column: { column: {
width: 300 width: 300,
} },
}, },
from: { from: {
title: "级别", title: "级别",
@@ -71,29 +76,29 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
dict: dict({ dict: dict({
data: [ data: [
{ label: "系统", value: "sys" }, { label: "系统", value: "sys" },
{ label: "用户", value: "user" } { label: "用户", value: "user" },
] ],
}), }),
search: { search: {
show: false show: false,
}, },
form: { form: {
show: false show: false,
}, },
column: { column: {
width: 100, width: 100,
align: "center", align: "center",
component: { component: {
color: "auto" color: "auto",
}, },
order: 10 order: 10,
}, },
valueBuilder: ({ row, key, value }) => { valueBuilder: ({ row, key, value }) => {
row[key] = row.userId > 0 ? "user" : "sys"; row[key] = row.userId > 0 ? "user" : "sys";
} },
}, },
...commonColumnsDefine ...commonColumnsDefine,
} },
} },
}; };
} }

View File

@@ -7,7 +7,7 @@ export const siteInfoApi = {
return await request({ return await request({
url: apiPrefix + "/page", url: apiPrefix + "/page",
method: "post", method: "post",
data: query data: query,
}); });
}, },
@@ -15,7 +15,7 @@ export const siteInfoApi = {
return await request({ return await request({
url: apiPrefix + "/add", url: apiPrefix + "/add",
method: "post", method: "post",
data: obj data: obj,
}); });
}, },
@@ -23,7 +23,7 @@ export const siteInfoApi = {
return await request({ return await request({
url: apiPrefix + "/update", url: apiPrefix + "/update",
method: "post", method: "post",
data: obj data: obj,
}); });
}, },
@@ -31,7 +31,7 @@ export const siteInfoApi = {
return await request({ return await request({
url: apiPrefix + "/delete", url: apiPrefix + "/delete",
method: "post", method: "post",
params: { id } params: { id },
}); });
}, },
@@ -39,20 +39,41 @@ export const siteInfoApi = {
return await request({ return await request({
url: apiPrefix + "/info", url: apiPrefix + "/info",
method: "post", method: "post",
params: { id } params: { id },
}); });
}, },
async DoCheck(id: number) { async DoCheck(id: number) {
return await request({ return await request({
url: apiPrefix + "/check", url: apiPrefix + "/check",
method: "post", method: "post",
data: { id } data: { id },
}); });
}, },
async CheckAll() { async CheckAll() {
return await request({ return await request({
url: apiPrefix + "/checkAll", url: apiPrefix + "/checkAll",
method: "post" 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,
},
});
},
}; };

View File

@@ -1,12 +1,13 @@
// @ts-ignore // @ts-ignore
import { useI18n } from "vue-i18n"; 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 { siteInfoApi } from "./api";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { notification } from "ant-design-vue"; import { Modal, notification } from "ant-design-vue";
import { useSettingStore } from "/@/store/settings"; import { useSettingStore } from "/@/store/settings";
import { mySuiteApi } from "/@/views/certd/suite/mine/api"; import { mySuiteApi } from "/@/views/certd/suite/mine/api";
import { mitter } from "/@/utils/util.mitt"; import { mitter } from "/@/utils/util.mitt";
import { useSiteIpMonitor } from "./ip/use";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const { t } = useI18n(); const { t } = useI18n();
@@ -41,6 +42,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
{ label: "异常", value: "error", color: "red" }, { label: "异常", value: "error", color: "red" },
], ],
}); });
const { openSiteIpMonitorDialog } = useSiteIpMonitor();
return { return {
crudOptions: { crudOptions: {
request: { 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: { columns: {
id: { id: {
title: "ID", title: "ID",
@@ -192,6 +214,34 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
show: false, 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: { certDomains: {
title: "证书域名", title: "证书域名",
search: { search: {
@@ -204,7 +254,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
column: { column: {
width: 200, width: 200,
sorter: true, sorter: true,
show: true, show: false,
cellRender({ value }) { cellRender({ value }) {
return ( return (
<a-tooltip title={value} placement="left"> <a-tooltip title={value} placement="left">
@@ -226,6 +276,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
column: { column: {
width: 200, width: 200,
sorter: true, sorter: true,
show: false,
cellRender({ value }) { cellRender({ value }) {
return <a-tooltip title={value}>{value}</a-tooltip>; return <a-tooltip title={value}>{value}</a-tooltip>;
}, },
@@ -305,6 +356,72 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
form: { form: {
value: false, 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: { column: {
width: 100, width: 100,
sorter: true, sorter: true,

View File

@@ -4,7 +4,10 @@
<div class="title flex items-center"> <div class="title flex items-center">
站点证书监控 站点证书监控
<div class="sub flex-1"> <div class="sub flex-1">
<div>每天0点检查网站证书的过期时间到期前10天时将发出提醒使用默认通知渠道;</div> <div>
每天0点检查网站证书的过期时间到期前10天时将发出提醒使用默认通知渠道;
<router-link to="/certd/monitor/setting">站点监控设置</router-link>
</div>
<div class="flex items-center">基础版限制1条专业版以上无限制当前<vip-button class="ml-5" mode="nav"></vip-button></div> <div class="flex items-center">基础版限制1条专业版以上无限制当前<vip-button class="ml-5" mode="nav"></vip-button></div>
</div> </div>
</div> </div>

View File

@@ -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,
},
});
},
};

View File

@@ -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,
},
},
},
},
};
}

View File

@@ -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>

View File

@@ -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,
};
}

View File

@@ -0,0 +1,24 @@
// @ts-ignore
import { request } from "/src/api/service";
const apiPrefix = "/monitor/site/setting";
export type UserSiteMonitorSetting = {
notificationId?: number;
};
export async function SiteMonitorSettingsGet() {
const res = await request({
url: apiPrefix + "/get",
method: "post",
});
if (!res) {
return {};
}
return res as UserSiteMonitorSetting;
}
export async function SiteMonitorSettingsSave(data: UserSiteMonitorSetting) {
await request({
url: apiPrefix + "/save",
method: "post",
data: data,
});
}

View File

@@ -0,0 +1,63 @@
<template>
<fs-page class="page-user-settings page-site-monitor-setting">
<template #header>
<div class="title">站点监控设置</div>
</template>
<div class="user-settings-form settings-form">
<a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off">
<a-form-item label="通知渠道" :name="['notificationId']">
<div class="flex">
<NotificationSelector v-model="formState.notificationId" />
</div>
<div class="helper">设置通知渠道</div>
</a-form-item>
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 16 }">
<loading-button type="primary" html-type="button" :click="doSave">保存</loading-button>
</a-form-item>
</a-form>
</div>
</fs-page>
</template>
<script setup lang="tsx">
import { reactive } from "vue";
import * as api from "./api";
import { UserSiteMonitorSetting } from "./api";
import { notification } from "ant-design-vue";
import { merge } from "lodash-es";
import { useSettingStore } from "/src/store/settings";
import NotificationSelector from "/@/views/certd/notification/notification-selector/index.vue";
const settingsStore = useSettingStore();
defineOptions({
name: "UserSecurity",
});
const formState = reactive<Partial<UserSiteMonitorSetting>>({
notificationId: 0,
});
async function loadUserSettings() {
const data: any = await api.SiteMonitorSettingsGet();
merge(formState, data);
}
loadUserSettings();
const doSave = async (form: any) => {
await api.SiteMonitorSettingsSave({
...formState,
});
notification.success({
message: "保存成功",
});
};
</script>
<style lang="less">
.page-user-settings {
.user-settings-form {
width: 600px;
margin: 20px;
}
}
</style>

View File

@@ -15,13 +15,13 @@ export function notificationProvide(api: any) {
export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) { export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
const notificationTypeDictRef = dict({ const notificationTypeDictRef = dict({
url: "/pi/notification/getTypeDict" url: "/pi/notification/getTypeDict",
}); });
const defaultPluginConfig = { const defaultPluginConfig = {
component: { component: {
name: "a-input", name: "a-input",
vModel: "value" vModel: "value",
} },
}; };
function buildDefineFields(define: any, form: any, mode: string) { 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 key = "body." + mapKey;
const field = { const field = {
...value, ...value,
key key,
}; };
const column = merge({ title: key }, defaultPluginConfig, field); const column = merge({ title: key }, defaultPluginConfig, field);
//eval //eval
@@ -69,29 +69,29 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
key: "id", key: "id",
type: "number", type: "number",
column: { column: {
width: 100 width: 100,
}, },
form: { form: {
show: false show: false,
} },
}, },
type: { type: {
title: "通知类型", title: "通知类型",
type: "dict-select", type: "dict-select",
dict: notificationTypeDictRef, dict: notificationTypeDictRef,
search: { search: {
show: false show: false,
}, },
column: { column: {
width: 200, width: 200,
component: { component: {
color: "auto" color: "auto",
} },
}, },
editForm: { editForm: {
component: { component: {
disabled: false disabled: false,
} },
}, },
form: { form: {
component: { 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>} {item.needPlus && <fs-icon icon={"mingcute:vip-1-line"} className={"color-plus"}></fs-icon>}
</span> </span>
); );
} },
}, },
rules: [{ required: true, message: "请选择通知类型" }], rules: [{ required: true, message: "请选择通知类型" }],
valueChange: { valueChange: {
@@ -133,7 +133,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
form.name = define.title; form.name = define.title;
} }
buildDefineFields(define, form, mode); buildDefineFields(define, form, mode);
} },
}, },
helper: computed(() => { helper: computed(() => {
const define = currentDefine.value; const define = currentDefine.value;
@@ -141,22 +141,22 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
return ""; return "";
} }
return define.desc; return define.desc;
}) }),
} },
} as ColumnCompositionProps, } as ColumnCompositionProps,
name: { name: {
title: "通知名称", title: "通知名称",
search: { search: {
show: true show: true,
}, },
type: ["text"], type: ["text"],
form: { form: {
rules: [{ required: true, message: "请填写名称" }], rules: [{ required: true, message: "请填写名称" }],
helper: "随便填,当多个相同类型的通知时,便于区分" helper: "随便填,当多个相同类型的通知时,便于区分",
}, },
column: { column: {
width: 200 width: 200,
} },
}, },
isDefault: { isDefault: {
title: "是否默认", title: "是否默认",
@@ -164,13 +164,13 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
dict: dict({ dict: dict({
data: [ data: [
{ label: "是", value: true, color: "success" }, { label: "是", value: true, color: "success" },
{ label: "否", value: false, color: "default" } { label: "否", value: false, color: "default" },
] ],
}), }),
form: { form: {
value: false, value: false,
rules: [{ required: true, message: "请选择是否默认" }], rules: [{ required: true, message: "请选择是否默认" }],
order: 999 order: 999,
}, },
column: { column: {
align: "center", align: "center",
@@ -192,12 +192,12 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
}, },
onCancel: async () => { onCancel: async () => {
await crudExpose.doRefresh(); await crudExpose.doRefresh();
} },
}); });
} },
} },
} },
} },
} as ColumnCompositionProps, } as ColumnCompositionProps,
test: { test: {
title: "测试", title: "测试",
@@ -207,16 +207,16 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
}), }),
component: { component: {
name: "api-test", name: "api-test",
action: "TestRequest" action: "TestRequest",
}, },
order: 990, order: 990,
col: { col: {
span: 24 span: 24,
} },
}, },
column: { column: {
show: false show: false,
} },
}, },
setting: { setting: {
column: { show: false }, column: { show: false },
@@ -235,8 +235,8 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
valueResolve({ form }) { valueResolve({ form }) {
const setting = form.body; const setting = form.body;
form.setting = JSON.stringify(setting); form.setting = JSON.stringify(setting);
} },
} },
} as ColumnCompositionProps } as ColumnCompositionProps,
}; };
} }

View File

@@ -32,23 +32,23 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
pageRequest, pageRequest,
addRequest, addRequest,
editRequest, editRequest,
delRequest delRequest,
}, },
form: { form: {
labelCol: { labelCol: {
//固定label宽度 //固定label宽度
span: null, span: null,
style: { style: {
width: "145px" width: "145px",
} },
} },
}, },
rowHandle: { rowHandle: {
width: 200 width: 200,
}, },
columns: { columns: {
...commonColumnsDefine ...commonColumnsDefine,
} },
} },
}; };
} }

View File

@@ -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({ return await request({
url: apiPrefix + "/batchUpdateGroup", url: apiPrefix + "/batchUpdateGroup",
method: "post", 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({ return await request({
url: apiPrefix + "/batchDelete", url: apiPrefix + "/batchDelete",
method: "post", method: "post",
data: { ids: pipelineIds }, 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) { export async function GetFiles(pipelineId: number) {
return await request({ return await request({

View File

@@ -9,6 +9,7 @@
<span> 已选择 {{ selectedRowKeys.length }} </span> <span> 已选择 {{ selectedRowKeys.length }} </span>
<fs-button icon="ion:trash-outline" class="color-green" type="link" text="批量删除" @click="batchDelete"></fs-button> <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> <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>
</div> </div>
<template #actionbar-right> </template> <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> </script>
<style lang="less"> <style lang="less">
.batch-actions { .batch-actions {

View File

@@ -208,7 +208,6 @@ function useStepForm() {
const stepOpen = (step: any, emit: any) => { const stepOpen = (step: any, emit: any) => {
callback.value = emit; callback.value = emit;
currentStep.value = merge({ input: {}, strategy: {} }, step); currentStep.value = merge({ input: {}, strategy: {} }, step);
if (step.type) { if (step.type) {
changeCurrentPlugin(currentStep.value); changeCurrentPlugin(currentStep.value);
} }

View File

@@ -23,7 +23,12 @@
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
<template #footer> <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="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> <fs-button key="submit" icon="ion:checkmark-circle-outline" type="primary" @click="taskModal.onOk">确定</fs-button>
</template> </template>

View File

@@ -44,7 +44,7 @@
<a-form-item> <a-form-item>
<a-button type="primary" size="large" html-type="submit" :loading="loading" class="login-button">登录</a-button> <a-button type="primary" size="large" html-type="submit" :loading="loading" class="login-button">登录</a-button>
<div class="mt-2"><a href="https://certd.docmirror.cn/guide/use/forgotpasswd/" target="_blank">忘记管理员密码</a></div> <div v-if="!settingStore.isComm" class="mt-2"><a href="https://certd.docmirror.cn/guide/use/forgotpasswd/" target="_blank">忘记管理员密码</a></div>
</a-form-item> </a-form-item>
<a-form-item class="user-login-other"> <a-form-item class="user-login-other">
@@ -54,7 +54,7 @@
<a-form v-else ref="twoFactorFormRef" class="user-layout-login" :model="twoFactor" v-bind="layout"> <a-form v-else ref="twoFactorFormRef" class="user-layout-login" :model="twoFactor" v-bind="layout">
<div class="mb-10 flex flex-center">请打开您的Authenticator APP获取动态验证码</div> <div class="mb-10 flex flex-center">请打开您的Authenticator APP获取动态验证码</div>
<a-form-item name="verifyCode"> <a-form-item name="verifyCode">
<a-input v-model:value="twoFactor.verifyCode" placeholder="请输入动态验证码" allow-clear> <a-input ref="verifyCodeInputRef" v-model:value="twoFactor.verifyCode" placeholder="请输入动态验证码" allow-clear @keydown.enter="handleTwoFactorSubmit">
<template #prefix> <template #prefix>
<fs-icon icon="ion:lock-closed-outline"></fs-icon> <fs-icon icon="ion:lock-closed-outline"></fs-icon>
</template> </template>
@@ -71,7 +71,7 @@
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, reactive, ref, toRaw } from "vue"; import { defineComponent, nextTick, reactive, ref, toRaw } from "vue";
import { useUserStore } from "/src/store/user"; import { useUserStore } from "/src/store/user";
import { useSettingStore } from "/@/store/settings"; import { useSettingStore } from "/@/store/settings";
import { utils } from "@fast-crud/fast-crud"; import { utils } from "@fast-crud/fast-crud";
@@ -82,6 +82,7 @@ export default defineComponent({
name: "LoginPage", name: "LoginPage",
components: { SmsCode, ImageCode }, components: { SmsCode, ImageCode },
setup() { setup() {
const verifyCodeInputRef = ref();
const loading = ref(false); const loading = ref(false);
const userStore = useUserStore(); const userStore = useUserStore();
const settingStore = useSettingStore(); const settingStore = useSettingStore();
@@ -149,8 +150,11 @@ export default defineComponent({
} catch (e: any) { } catch (e: any) {
//@ts-ignore //@ts-ignore
if (e.code === 10020) { if (e.code === 10020) {
//双重认证
//@ts-ignore //@ts-ignore
twoFactor.loginId = e.data; twoFactor.loginId = e.data;
await nextTick();
verifyCodeInputRef.value.focus();
} else { } else {
throw e; throw e;
} }
@@ -174,6 +178,7 @@ export default defineComponent({
function hasRegisterTypeEnabled() { function hasRegisterTypeEnabled() {
return sysPublicSettings.registerEnabled && (sysPublicSettings.usernameRegisterEnabled || sysPublicSettings.emailRegisterEnabled); return sysPublicSettings.registerEnabled && (sysPublicSettings.usernameRegisterEnabled || sysPublicSettings.emailRegisterEnabled);
} }
return { return {
loading, loading,
formState, formState,
@@ -188,6 +193,8 @@ export default defineComponent({
hasRegisterTypeEnabled, hasRegisterTypeEnabled,
twoFactor, twoFactor,
handleTwoFactorSubmit, handleTwoFactorSubmit,
verifyCodeInputRef,
settingStore,
}; };
}, },
}); });

View File

@@ -3,6 +3,50 @@
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.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
* 优化阿里云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
* 修复又拍云 CDN 设置证书参数和强制 HTTPS 配置报错的bug ([7984b62](https://github.com/certd/certd/commit/7984b625ba6727132f205db8e25f790bce27b2f7))
### Performance Improvements
* 添加阿里云 ESA证书部署插件 ([1db1ffd](https://github.com/certd/certd/commit/1db1ffde99ac7e4684fa606ebc4c327f829b3a26))
* 站点证书监控增加通知设置 ([3422a1a](https://github.com/certd/certd/commit/3422a1a59fd0d2c0f17fa9c7e8988ac527ecfdd9))
## [1.34.5](https://github.com/certd/certd/compare/v1.34.4...v1.34.5) (2025-05-19)
### Performance Improvements
* 1panel增加授权测试按钮 ([566b12f](https://github.com/certd/certd/commit/566b12f5d14ce10e8f5cf1807c58f7bf27f0d199))
* 优化钉钉通知标题颜色 ([a560999](https://github.com/certd/certd/commit/a560999d13eed18d08dd32ee530166569e3f8746))
* 优化飞书通知为卡片模式 ([a818a3d](https://github.com/certd/certd/commit/a818a3d293e22fb46979bc77055c05621a6fed81))
## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16) ## [1.34.4](https://github.com/certd/certd/compare/v1.34.3...v1.34.4) (2025-05-16)
### Bug Fixes ### Bug Fixes

View File

@@ -9,6 +9,7 @@
``` ```
```shell ```shell
npm run heap npm run heap
``` ```

View File

@@ -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`);

View 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");

View 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");

View File

@@ -1,6 +1,6 @@
{ {
"name": "@certd/ui-server", "name": "@certd/ui-server",
"version": "1.34.4", "version": "1.34.8",
"description": "fast-server base midway", "description": "fast-server base midway",
"private": true, "private": true,
"type": "module", "type": "module",
@@ -41,19 +41,19 @@
"@aws-sdk/client-acm": "^3.699.0", "@aws-sdk/client-acm": "^3.699.0",
"@aws-sdk/client-cloudfront": "^3.699.0", "@aws-sdk/client-cloudfront": "^3.699.0",
"@aws-sdk/client-s3": "^3.705.0", "@aws-sdk/client-s3": "^3.705.0",
"@certd/acme-client": "^1.34.4", "@certd/acme-client": "^1.34.8",
"@certd/basic": "^1.34.4", "@certd/basic": "^1.34.8",
"@certd/commercial-core": "^1.34.4", "@certd/commercial-core": "^1.34.8",
"@certd/jdcloud": "^1.34.4", "@certd/jdcloud": "^1.34.8",
"@certd/lib-huawei": "^1.34.4", "@certd/lib-huawei": "^1.34.8",
"@certd/lib-k8s": "^1.34.4", "@certd/lib-k8s": "^1.34.8",
"@certd/lib-server": "^1.34.4", "@certd/lib-server": "^1.34.8",
"@certd/midway-flyway-js": "^1.34.4", "@certd/midway-flyway-js": "^1.34.8",
"@certd/pipeline": "^1.34.4", "@certd/pipeline": "^1.34.8",
"@certd/plugin-cert": "^1.34.4", "@certd/plugin-cert": "^1.34.8",
"@certd/plugin-lib": "^1.34.4", "@certd/plugin-lib": "^1.34.8",
"@certd/plugin-plus": "^1.34.4", "@certd/plugin-plus": "^1.34.8",
"@certd/plus-core": "^1.34.4", "@certd/plus-core": "^1.34.8",
"@corsinvest/cv4pve-api-javascript": "^8.3.0", "@corsinvest/cv4pve-api-javascript": "^8.3.0",
"@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",

View File

@@ -1,7 +1,10 @@
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core'; import { ALL, Body, Controller, Inject, Post, Provide, Query } from "@midwayjs/core";
import { Constants, CrudController } from '@certd/lib-server'; import { Constants, CrudController } from "@certd/lib-server";
import { AuthService } from '../../../modules/sys/authority/service/auth-service.js'; import { AuthService } from "../../../modules/sys/authority/service/auth-service.js";
import { SiteInfoService } from '../../../modules/monitor/service/site-info-service.js'; 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";
/** /**
*/ */
@@ -12,6 +15,8 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
service: SiteInfoService; service: SiteInfoService;
@Inject() @Inject()
authService: AuthService; authService: AuthService;
@Inject()
siteIpService: SiteIpService;
getService(): SiteInfoService { getService(): SiteInfoService {
return this.service; return this.service;
@@ -57,7 +62,10 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
async add(@Body(ALL) bean: any) { async add(@Body(ALL) bean: any) {
bean.userId = this.getUserId(); bean.userId = this.getUserId();
const res = await this.service.add(bean); 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); return this.ok(res);
} }
@@ -66,7 +74,10 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
await this.service.checkUserId(bean.id, this.getUserId()); await this.service.checkUserId(bean.id, this.getUserId());
delete bean.userId; delete bean.userId;
await this.service.update(bean); 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(); return this.ok();
} }
@Post('/info', { summary: Constants.per.authOnly }) @Post('/info', { summary: Constants.per.authOnly })
@@ -94,4 +105,42 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
await this.service.checkAllByUsers(userId); await this.service.checkAllByUsers(userId);
return this.ok(); 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() {
const userId = this.getUserId();
const setting = await this.service.getSetting(userId)
return this.ok(setting);
}
@Post("/setting/save", { summary: Constants.per.authOnly })
async save(@Body(ALL) bean: any) {
const userId = this.getUserId();
const setting = new UserSiteMonitorSetting();
merge(setting, bean);
await this.service.saveSetting(userId, setting);
return this.ok({});
}
} }

View File

@@ -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();
}
}

View File

@@ -122,4 +122,10 @@ export class PipelineController extends CrudController<PipelineService> {
await this.service.batchUpdateGroup(ids, groupId, this.getUserId()); await this.service.batchUpdateGroup(ids, groupId, this.getUserId());
return this.ok({}); 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({});
}
} }

View File

@@ -19,3 +19,10 @@ export class UserTwoFactorSetting extends BaseSettings {
} }
export class UserSiteMonitorSetting extends BaseSettings {
static __title__ = "站点监控设置";
static __key__ = "user.site.monitor";
notificationId?:number= 0;
}

View File

@@ -40,6 +40,17 @@ export class SiteInfoEntity {
@Column({ name: 'cert_info_id', comment: '证书id' }) @Column({ name: 'cert_info_id', comment: '证书id' })
certInfoId: number; 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: '禁用启用' }) @Column({ name: 'disabled', comment: '禁用启用' })
disabled: boolean; disabled: boolean;

View File

@@ -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;
}

View File

@@ -10,6 +10,10 @@ import { PeerCertificate } from 'tls';
import { NotificationService } from '../../pipeline/service/notification-service.js'; import { NotificationService } from '../../pipeline/service/notification-service.js';
import { isComm, isPlus } from '@certd/plus-core'; import { isComm, isPlus } from '@certd/plus-core';
import { UserSuiteService } from '@certd/commercial-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() @Provide()
@Scope(ScopeEnum.Request, { allowDowngrade: true }) @Scope(ScopeEnum.Request, { allowDowngrade: true })
@@ -26,6 +30,12 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
@Inject() @Inject()
userSuiteService: UserSuiteService; userSuiteService: UserSuiteService;
@Inject()
userSettingsService: UserSettingsService;
@Inject()
siteIpService: SiteIpService;
//@ts-ignore //@ts-ignore
getRepository() { getRepository() {
return this.repository; return this.repository;
@@ -88,7 +98,7 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
await this.update({ await this.update({
id: site.id, id: site.id,
checkStatus: 'checking', checkStatus: 'checking',
lastCheckTime: dayjs, lastCheckTime: dayjs().valueOf(),
}); });
const res = await siteTester.test({ const res = await siteTester.test({
host: site.domain, host: site.domain,
@@ -122,6 +132,11 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
}; };
await this.update(updateData); await this.update(updateData);
//检查ip
await this.checkAllIp(site)
if (!notify) { if (!notify) {
return; return;
} }
@@ -149,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 id
* @param notify * @param notify
* @param retryTimes * @param retryTimes
@@ -163,7 +218,7 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
return await this.doCheck(site, notify, retryTimes); 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'); const url = await this.notificationService.getBindUrl('#/certd/monitor/site');
// 发邮件 // 发邮件
await this.notificationService.send( await this.notificationService.send(
@@ -172,8 +227,9 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
logger: logger, logger: logger,
body: { body: {
url, url,
title: `站点证书检查出错<${site.name}>`, title: `站点证书${fromIpCheck?"(IP)":""}检查出错<${site.name}>`,
content: `站点名称: ${site.name} \n站点域名 ${site.domain} \n错误信息${site.error}`, content: `站点名称: ${site.name} \n站点域名 ${site.domain} \n错误信息${site.error}`,
errorMessage: site.error,
}, },
}, },
site.userId site.userId
@@ -211,6 +267,7 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
title: `站点证书已过期${-validDays}天<${site.name}>`, title: `站点证书已过期${-validDays}天<${site.name}>`,
content, content,
url, url,
errorMessage: "站点证书已过期"
}, },
}, },
site.userId site.userId
@@ -236,4 +293,35 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
await utils.sleep(200); await utils.sleep(200);
} }
} }
async getSetting(userId: number){
return await this.userSettingsService.getSetting<UserSiteMonitorSetting>(userId, UserSiteMonitorSetting);
}
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)
}
}
} }

View File

@@ -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
})
}
}

View File

@@ -1,20 +1,23 @@
import {logger, safePromise, utils} from '@certd/basic'; import { logger, safePromise, utils } from "@certd/basic";
import { merge } from 'lodash-es'; import { merge } from "lodash-es";
import https from 'https'; import https from "https";
import { PeerCertificate } from 'tls'; import { PeerCertificate } from "tls";
export type SiteTestReq = { export type SiteTestReq = {
host: string; // 只用域名部分 host: string; // 只用域名部分
port?: number; port?: number;
method?: string; method?: string;
retryTimes?: number; retryTimes?: number;
ipAddress?: string;
}; };
export type SiteTestRes = { export type SiteTestRes = {
certificate?: PeerCertificate; certificate?: PeerCertificate;
}; };
export class SiteTester { export class SiteTester {
async test(req: SiteTestReq): Promise<SiteTestRes> { async test(req: SiteTestReq): Promise<SiteTestRes> {
logger.info('测试站点:', JSON.stringify(req)); logger.info("测试站点:", JSON.stringify(req));
const maxRetryTimes = req.retryTimes ?? 3; const maxRetryTimes = req.retryTimes ?? 3;
let tryCount = 0; let tryCount = 0;
let result: SiteTestRes = {}; let result: SiteTestRes = {};
@@ -37,17 +40,28 @@ export class SiteTester {
} }
async doTestOnce(req: SiteTestReq): Promise<SiteTestRes> { async doTestOnce(req: SiteTestReq): Promise<SiteTestRes> {
const agent = new https.Agent({ keepAlive: false });
const options: any = merge( const options: any = merge(
{ {
port: 443, port: 443,
method: 'GET', method: "GET",
rejectUnauthorized: false, rejectUnauthorized: false
}, },
req 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 请求 // 创建 HTTPS 请求
const requestPromise = safePromise((resolve, reject) => { const requestPromise = safePromise((resolve, reject) => {
const req = https.request(options, res => { const req = https.request(options, res => {
@@ -56,20 +70,20 @@ export class SiteTester {
const certificate = res.socket.getPeerCertificate(); const certificate = res.socket.getPeerCertificate();
// logger.info('证书信息', certificate); // logger.info('证书信息', certificate);
if (certificate.subject == null) { if (certificate.subject == null) {
logger.warn('证书信息为空'); logger.warn("证书信息为空");
resolve({ resolve({
certificate: null, certificate: null
}); });
} }
resolve({ resolve({
certificate, certificate
}); });
res.socket.end(); res.socket.end();
// 关闭响应 // 关闭响应
res.destroy(); res.destroy();
}); });
req.on('error', e => { req.on("error", e => {
reject(e); reject(e);
}); });
req.end(); req.end();

View File

@@ -38,7 +38,7 @@ import {CnameRecordService} from "../../cname/service/cname-record-service.js";
import {PluginConfigGetter} from "../../plugin/service/plugin-config-getter.js"; import {PluginConfigGetter} from "../../plugin/service/plugin-config-getter.js";
import dayjs from "dayjs"; import dayjs from "dayjs";
import {DbAdapter} from "../../db/index.js"; 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 {logger} from "@certd/basic";
import {UrlService} from "./url-service.js"; import {UrlService} from "./url-service.js";
import {NotificationService} from "./notification-service.js"; import {NotificationService} from "./notification-service.js";
@@ -429,6 +429,12 @@ export class PipelineService extends BaseService<PipelineEntity> {
logger.info('当前定时器数量:', this.cron.getTaskSize()); logger.info('当前定时器数量:', this.cron.getTaskSize());
} }
/**
*
* @param id
* @param triggerId =null手动启动
* @param stepId 如果传入ALL清空所有状态
*/
async run(id: number, triggerId: string, stepId?: string) { async run(id: number, triggerId: string, stepId?: string) {
const entity: PipelineEntity = await this.info(id); const entity: PipelineEntity = await this.info(id);
await this.doRun(entity, triggerId, stepId); await this.doRun(entity, triggerId, stepId);
@@ -684,6 +690,42 @@ export class PipelineService extends BaseService<PipelineEntity> {
{ groupId } { 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) { async getUserPipelineCount(userId) {
return await this.repository.count({ where: { userId } }); return await this.repository.count({ where: { userId } });

View File

@@ -151,6 +151,9 @@ export class UserService extends BaseService<UserEntity> {
async buildPlainPassword(rawPassword: string) { async buildPlainPassword(rawPassword: string) {
const setting: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo); const setting: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
if (!setting.siteId) {
throw new CommonException('站点ID还未初始化');
}
const prefixSiteId = setting.siteId.substring(1, 5); const prefixSiteId = setting.siteId.substring(1, 5);
return rawPassword + prefixSiteId; return rawPassword + prefixSiteId;
} }

View File

@@ -57,15 +57,12 @@ export class SafeService {
async reloadHiddenStatus(immediate = false) { async reloadHiddenStatus(immediate = false) {
const hidden = await this.getHiddenSetting() const hidden = await this.getHiddenSetting()
if (hidden.enabled) { if (hidden.enabled) {
logger.error("启动站点隐藏"); logger.info("启动站点隐藏");
hiddenStatus.isHidden = false hiddenStatus.isHidden = immediate;
if (immediate) {
hiddenStatus.isHidden = true;
}
const autoHiddenTimes = hidden.autoHiddenTimes || 5; const autoHiddenTimes = hidden.autoHiddenTimes || 5;
hiddenStatus.startCheck(autoHiddenTimes); hiddenStatus.startCheck(autoHiddenTimes);
} else { } else {
logger.error("关闭站点隐藏"); logger.info("当前站点隐藏已关闭");
hiddenStatus.isHidden = false; hiddenStatus.isHidden = false;
hiddenStatus.stopCheck() hiddenStatus.stopCheck()
} }

View File

@@ -21,3 +21,4 @@ export * from './plugin-jdcloud/index.js'
export * from './plugin-51dns/index.js' export * from './plugin-51dns/index.js'
export * from './plugin-notification/index.js' export * from './plugin-notification/index.js'
export * from './plugin-flex/index.js' export * from './plugin-flex/index.js'
export * from './plugin-farcdn/index.js'

View File

@@ -1,5 +1,5 @@
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline'; import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
import { CertInfo ,CertApplyPluginNames} from '@certd/plugin-cert'; import { CertInfo ,CertApplyPluginNames, CertReader} from '@certd/plugin-cert';
import { AliyunAccess, AliyunClient, AliyunSslClient, createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from '@certd/plugin-lib'; import { AliyunAccess, AliyunClient, AliyunSslClient, createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from '@certd/plugin-lib';
@IsTaskPlugin({ @IsTaskPlugin({
@@ -143,8 +143,9 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin {
endpoint: this.casEndpoint, endpoint: this.casEndpoint,
}); });
const certName = this.buildCertName(CertReader.getMainDomain(this.cert.crt))
certId = await sslClient.uploadCert({ certId = await sslClient.uploadCert({
name: this.appendTimeSuffix('certd'), name: certName,
cert: this.cert, cert: this.cert,
}); });
} }

View File

@@ -1,7 +1,7 @@
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline'; import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
import { AliyunAccess, AliyunClient, AliyunSslClient, createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from '@certd/plugin-lib'; import { AliyunAccess, AliyunClient, AliyunSslClient, createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from '@certd/plugin-lib';
import { optionsUtils } from '@certd/basic/dist/utils/util.options.js'; import { optionsUtils } from '@certd/basic/dist/utils/util.options.js';
import { CertApplyPluginNames} from '@certd/plugin-cert'; import { CertApplyPluginNames, CertReader } from "@certd/plugin-cert";
@IsTaskPlugin({ @IsTaskPlugin({
name: 'DeployCertToAliyunCDN', name: 'DeployCertToAliyunCDN',
title: '阿里云-部署证书至CDN', title: '阿里云-部署证书至CDN',
@@ -107,9 +107,11 @@ export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
let certId: any = this.cert; let certId: any = this.cert;
const certName = this.appendTimeSuffix(this.certName); let certName = this.appendTimeSuffix(this.certName);
if (typeof this.cert === 'object') { if (typeof this.cert === 'object') {
// @ts-ignore
const certName = this.buildCertName(CertReader.getMainDomain(this.cert.crt))
certId = await sslClient.uploadCert({ certId = await sslClient.uploadCert({
name:certName, name:certName,
cert: this.cert, cert: this.cert,

View File

@@ -1,8 +1,14 @@
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline'; import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { AliyunAccess, AliyunClient, createCertDomainGetterInputDefine } from '@certd/plugin-lib'; import {
AliyunAccess,
AliyunClient,
createCertDomainGetterInputDefine,
createRemoteSelectInputDefine
} from "@certd/plugin-lib";
import { CertInfo } from '@certd/plugin-cert'; import { CertInfo } from '@certd/plugin-cert';
import { CertApplyPluginNames} from '@certd/plugin-cert'; import { CertApplyPluginNames} from '@certd/plugin-cert';
import { optionsUtils } from "@certd/basic/dist/utils/util.options.js";
@IsTaskPlugin({ @IsTaskPlugin({
name: 'DeployCertToAliyunDCDN', name: 'DeployCertToAliyunDCDN',
title: '阿里云-部署证书至DCDN', title: '阿里云-部署证书至DCDN',
@@ -41,12 +47,6 @@ export class DeployCertToAliyunDCDN extends AbstractTaskPlugin {
}) })
accessId!: string; accessId!: string;
@TaskInput({
title: 'DCDN加速域名',
helper: '你在阿里云上配置的CDN加速域名比如:certd.docmirror.cn',
required: true,
})
domainName!: string;
@TaskInput({ @TaskInput({
title: '证书名称', title: '证书名称',
@@ -54,13 +54,37 @@ export class DeployCertToAliyunDCDN extends AbstractTaskPlugin {
}) })
certName!: string; certName!: string;
@TaskInput(
createRemoteSelectInputDefine({
title: 'DCDN加速域名',
helper: '你在阿里云上配置的DCDN加速域名比如:certd.docmirror.cn',
action: DeployCertToAliyunDCDN.prototype.onGetDomainList.name,
watches: ['certDomains', 'accessId'],
required: true,
})
)
domainName!: string | string[];
async onInstance() {} async onInstance() {}
async execute(): Promise<void> { async execute(): Promise<void> {
this.logger.info('开始部署证书到阿里云DCDN'); this.logger.info('开始部署证书到阿里云DCDN');
if(!this.domainName){
throw new Error('您还未选择DCDN域名');
}
const access = (await this.getAccess(this.accessId)) as AliyunAccess; const access = (await this.getAccess(this.accessId)) as AliyunAccess;
const client = await this.getClient(access); const client = await this.getClient(access);
const params = await this.buildParams(); if(typeof this.domainName === 'string'){
await this.doRequest(client, params); this.domainName = [this.domainName];
}
for (const domainName of this.domainName ) {
this.logger.info(`[${this.domainName}]开始部署`)
const params = await this.buildParams(domainName);
await this.doRequest(client, params);
this.logger.info(`[${this.domainName}]部署成功`)
}
this.logger.info('部署完成'); this.logger.info('部署完成');
} }
@@ -75,14 +99,14 @@ export class DeployCertToAliyunDCDN extends AbstractTaskPlugin {
return client; return client;
} }
async buildParams() { async buildParams(domainName:string) {
const CertName = (this.certName ?? 'certd') + '-' + dayjs().format('YYYYMMDDHHmmss'); const CertName = (this.certName ?? 'certd') + '-' + dayjs().format('YYYYMMDDHHmmss');
if (typeof this.cert !== 'object') { if (typeof this.cert !== 'object') {
const certId = this.cert; const certId = this.cert;
this.logger.info('使用已上传的证书:', certId); this.logger.info('使用已上传的证书:', certId);
return { return {
DomainName: this.domainName, DomainName: domainName,
SSLProtocol: 'on', SSLProtocol: 'on',
CertType: 'cas', CertType: 'cas',
CertName: CertName, CertName: CertName,
@@ -93,7 +117,7 @@ export class DeployCertToAliyunDCDN extends AbstractTaskPlugin {
this.logger.info('上传证书:', CertName); this.logger.info('上传证书:', CertName);
const cert: any = this.cert; const cert: any = this.cert;
return { return {
DomainName: this.domainName, DomainName: domainName,
SSLProtocol: 'on', SSLProtocol: 'on',
CertName: CertName, CertName: CertName,
CertType: 'upload', CertType: 'upload',
@@ -117,5 +141,40 @@ export class DeployCertToAliyunDCDN extends AbstractTaskPlugin {
throw new Error('执行失败:' + ret.Message); throw new Error('执行失败:' + ret.Message);
} }
} }
async onGetDomainList(data: any) {
if (!this.accessId) {
throw new Error('请选择Access授权');
}
const access = await this.getAccess<AliyunAccess>(this.accessId);
const client = await this.getClient(access);
const params = {
// 'DomainName': 'aaa',
PageSize: 500,
};
const requestOption = {
method: 'POST',
formatParams: false,
};
const res = await client.request('DescribeDcdnUserDomains', params, requestOption);
this.checkRet(res);
const pageData = res?.Domains?.PageData;
if (!pageData || pageData.length === 0) {
throw new Error('找不到CDN域名您可以手动输入');
}
const options = pageData.map((item: any) => {
return {
value: item.DomainName,
label: item.DomainName,
domain: item.DomainName,
};
});
return optionsUtils.buildGroupOptions(options, this.certDomains);
}
} }
new DeployCertToAliyunDCDN(); new DeployCertToAliyunDCDN();

View File

@@ -0,0 +1,232 @@
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
import { CertApplyPluginNames, CertInfo, CertReader } from "@certd/plugin-cert";
import {
AliyunAccess, AliyunClientV2,
AliyunSslClient,
createCertDomainGetterInputDefine,
createRemoteSelectInputDefine
} from "@certd/plugin-lib";
@IsTaskPlugin({
name: "AliyunDeployCertToESA",
title: "阿里云-部署至ESA",
icon: "svg:icon-aliyun",
group: pluginGroups.aliyun.key,
desc: "部署证书到阿里云ESA(边缘安全加速)",
needPlus: false,
default: {
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed
}
}
})
export class AliyunDeployCertToESA extends AbstractTaskPlugin {
@TaskInput({
title: "域名证书",
helper: "请选择证书申请任务输出的域名证书",
component: {
name: "output-selector",
from: [...CertApplyPluginNames]
},
required: true
})
cert!: CertInfo;
@TaskInput(createCertDomainGetterInputDefine({ props: { required: false } }))
certDomains!: string[];
@TaskInput({
title: "大区",
value: "cn-hangzhou",
component: {
name: "a-auto-complete",
vModel: "value",
options: [
{ value: "cn-hangzhou", label: "华东1杭州" },
{ value: "ap-southeast-1", label: "新加坡" }
]
},
required: true
})
regionId!: string;
@TaskInput({
title: "证书接入点",
helper: "不会选就保持默认即可",
value: "cas.aliyuncs.com",
component: {
name: "a-select",
options: [
{ value: "cas.aliyuncs.com", label: "中国大陆" },
{ value: "cas.ap-southeast-1.aliyuncs.com", label: "新加坡" },
{ value: "cas.eu-central-1.aliyuncs.com", label: "德国(法兰克福)" }
]
},
required: true
})
casEndpoint!: string;
@TaskInput({
title: "Access授权",
helper: "阿里云授权AccessKeyId、AccessKeySecret",
component: {
name: "access-selector",
type: "aliyun"
},
required: true
})
accessId!: string;
@TaskInput(
createRemoteSelectInputDefine({
title: "站点",
helper: "请选择要部署证书的站点",
action: AliyunDeployCertToESA.prototype.onGetSiteList.name,
watches: ["accessId", "regionId"]
})
)
siteIds!: string[];
async onInstance() {
}
async getAliyunCertId(access: AliyunAccess) {
let certId: any = this.cert;
let certName: any = this.appendTimeSuffix("certd");
if (typeof this.cert === "object") {
const sslClient = new AliyunSslClient({
access,
logger: this.logger,
endpoint: this.casEndpoint
});
certName = this.buildCertName(CertReader.getMainDomain(this.cert.crt));
certId = await sslClient.uploadCert({
name: certName,
cert: this.cert
});
this.logger.info("上传证书成功", certId, certName);
}
return {
certId,
certName
};
}
async execute(): Promise<void> {
this.logger.info("开始部署证书到阿里云");
const access = await this.getAccess<AliyunAccess>(this.accessId);
const client = await this.getClient(access);
const { certId, certName } = await this.getAliyunCertId(access);
for (const siteId of this.siteIds) {
try {
const res = await client.doRequest({
// 接口名称
action: "SetCertificate",
// 接口版本
version: "2024-09-10",
data: {
body:{
SiteId: siteId,
CasId: certId,
Type: "cas",
Name: certName
}
}
});
this.logger.info(`部署站点[${siteId}]证书成功:${JSON.stringify(res)}`);
} catch (e) {
if (e.message.includes("Certificate.Duplicated")) {
this.logger.info(`站点[${siteId}]证书已存在,无需重复部署`);
}else{
throw e;
}
}
try{
await this.clearSiteCert(client,siteId);
}catch (e) {
this.logger.error("清理站点[${siteId}]证书失败",e)
}
}
}
async getClient(access: AliyunAccess) {
const endpoint = `esa.${this.regionId}.aliyuncs.com`;
return access.getClient(endpoint);
}
async onGetSiteList(data: any) {
if (!this.accessId) {
throw new Error("请选择Access授权");
}
const access = await this.getAccess<AliyunAccess>(this.accessId);
const client = await this.getClient(access);
const res = await client.doRequest({
action: "ListSites",
version: "2024-09-10",
method: "GET",
data: {}
});
const list = res?.Sites;
if (!list || list.length === 0) {
throw new Error("没有找到站点,请先创建站点");
}
const options = list.map((item: any) => {
return {
label: item.SiteName,
value: item.SiteId,
domain: item.SiteName
};
});
return this.ctx.utils.options.buildGroupOptions(options, this.certDomains);
}
async clearSiteCert(client: AliyunClientV2, siteId: string) {
this.logger.info(`开始清理站点[${siteId}]过期证书`);
const certListRes = await client.doRequest({
action: "ListCertificates",
version: "2024-09-10",
method: "GET",
data:{
query: {
SiteId: siteId
}
}
});
const list = certListRes.Result;
for (const item of list) {
this.logger.info(`证书${item.Name}状态:${item.Status}`);
if (item.Status === "Expired") {
this.logger.info(`证书${item.Name}已过期,执行删除`);
await client.doRequest({
action: "DeleteCertificate",
version: "2024-09-10",
// 接口 HTTP 方法
method: "GET",
data:{
query: {
SiteId: siteId,
Id: item.id
}
}
});
this.logger.info(`证书${item.Name}已删除`);
}
}
}
}
new AliyunDeployCertToESA();

View File

@@ -1,5 +1,5 @@
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline"; import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
import { CertApplyPluginNames, CertInfo } from "@certd/plugin-cert"; import { CertApplyPluginNames, CertInfo, CertReader } from "@certd/plugin-cert";
import { AliyunAccess, createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from "@certd/plugin-lib"; import { AliyunAccess, createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from "@certd/plugin-lib";
@IsTaskPlugin({ @IsTaskPlugin({
@@ -141,9 +141,11 @@ export class AliyunDeployCertToFC extends AbstractTaskPlugin {
bodyType: 'json', bodyType: 'json',
}); });
// body params // body params
const certName = this.buildCertName(CertReader.getMainDomain(this.cert.crt))
const body: { [key: string]: any } = { const body: { [key: string]: any } = {
certConfig: { certConfig: {
certName: this.appendTimeSuffix('certd_fc'), certName: certName,
certificate: this.cert.crt, certificate: this.cert.crt,
privateKey: this.cert.key, privateKey: this.cert.key,
}, },

View File

@@ -1,5 +1,5 @@
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline'; import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
import { CertInfo } from '@certd/plugin-cert'; import { CertInfo, CertReader } from "@certd/plugin-cert";
import { AliyunAccess, AliyunClient, AliyunSslClient, createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from '@certd/plugin-lib'; import { AliyunAccess, AliyunClient, AliyunSslClient, createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from '@certd/plugin-lib';
import { CertApplyPluginNames} from '@certd/plugin-cert'; import { CertApplyPluginNames} from '@certd/plugin-cert';
@IsTaskPlugin({ @IsTaskPlugin({
@@ -139,8 +139,10 @@ export class AliyunDeployCertToNLB extends AbstractTaskPlugin {
endpoint: this.casEndpoint, endpoint: this.casEndpoint,
}); });
const certName = this.buildCertName(CertReader.getMainDomain(this.cert.crt))
certId = await sslClient.uploadCert({ certId = await sslClient.uploadCert({
name: this.appendTimeSuffix('certd'), name: certName,
cert: this.cert, cert: this.cert,
}); });
} }

View File

@@ -1,5 +1,5 @@
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline"; import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
import { CertApplyPluginNames, CertInfo } from "@certd/plugin-cert"; import { CertApplyPluginNames, CertInfo, CertReader } from "@certd/plugin-cert";
import { import {
AliyunAccess, AliyunAccess,
AliyunClient, AliyunClient,
@@ -124,7 +124,7 @@ export class AliyunDeployCertToWaf extends AbstractTaskPlugin {
}); });
certId = await sslClient.uploadCert({ certId = await sslClient.uploadCert({
name: this.appendTimeSuffix('certd'), name: this.buildCertName(CertReader.getMainDomain(this.cert.crt)),
cert: this.cert, cert: this.cert,
}); });
} }

View File

@@ -1,7 +1,7 @@
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline'; import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline';
import { AliyunAccess } from '@certd/plugin-lib'; import { AliyunAccess } from '@certd/plugin-lib';
import { AliyunSslClient } from '@certd/plugin-lib'; import { AliyunSslClient } from '@certd/plugin-lib';
import { CertApplyPluginNames} from '@certd/plugin-cert'; import { CertApplyPluginNames, CertReader } from "@certd/plugin-cert";
/** /**
* 华东1杭州 cn-hangzhou cas.aliyuncs.com cas-vpc.cn-hangzhou.aliyuncs.com * 华东1杭州 cn-hangzhou cas.aliyuncs.com cas-vpc.cn-hangzhou.aliyuncs.com
* 马来西亚(吉隆坡) ap-southeast-3 cas.ap-southeast-3.aliyuncs.com cas-vpc.ap-southeast-3.aliyuncs.com * 马来西亚(吉隆坡) ap-southeast-3 cas.ap-southeast-3.aliyuncs.com cas-vpc.ap-southeast-3.aliyuncs.com
@@ -97,8 +97,9 @@ export class UploadCertToAliyun extends AbstractTaskPlugin {
logger: this.logger, logger: this.logger,
endpoint, endpoint,
}); });
const certName = this.buildCertName(CertReader.getMainDomain(this.cert.crt))
this.aliyunCertId = await client.uploadCert({ this.aliyunCertId = await client.uploadCert({
name: this.appendTimeSuffix('certd'), name: certName,
cert: this.cert, cert: this.cert,
}); });
} }

View File

@@ -0,0 +1,191 @@
import { AccessInput, BaseAccess, IsAccess } from "@certd/pipeline";
import { HttpRequestConfig } from "@certd/basic";
import { CertInfo, CertReader } from "@certd/plugin-cert";
/**
*/
@IsAccess({
name: "farcdn",
title: "farcdn授权",
desc: "",
icon: "svg:icon-lucky"
})
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",
vModel: "value"
},
required: true
})
endpoint!: string;
@AccessInput({
title: "accessKeyId",
component: {
placeholder: "accessKeyId",
component: {
name: "a-input",
vModel: "value"
}
},
encrypt: false,
required: true
})
accessKeyId!: string;
@AccessInput({
title: "accessKey",
component: {
placeholder: "accessKey",
component: {
name: "a-input",
vModel: "value"
}
},
encrypt: true,
required: true
})
accessKey!: string;
@AccessInput({
title: "HttpProxy",
component: {
placeholder: "http://192.168.x.x:10811",
component: {
name: "a-input",
vModel: "value"
}
},
encrypt: false,
required: false
})
httpProxy!: string;
@AccessInput({
title: "测试",
component: {
name: "api-test",
action: "TestRequest"
},
helper: "点击测试接口是否正常"
})
testRequest = true;
async onTestRequest() {
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) {
/**
* 接口地址
* POST /findSSLCertConfig
* 🎯 功能说明
* 根据证书ID和认证信息查询SSL证书的详细配置信息包括证书状态、域名绑定、有效期等关键信息。
*
* 📥 请求参数
* 参数名 类型 必填 说明 示例值
* sslCertId int ✅ 证书唯一标识ID 2106
* accessKeyId string ✅ 访问密钥ID u2ZF6k63dFCOS7It
* accessKey string ✅ 访问密钥 mTGaNRGUFHj3r3YxMrrg5XSGIXd6rBWG',
* 响应结构:
*
* {
* "code": 200,
* "data": {...},
* "message": "获取成功"
* }
*/
const params = {
sslCertId,
};
const res= await this.doRequest({
url: "/findSSLCertConfig",
data: params
});
this.ctx.logger.info(`找到证书${sslCertId}: name=${res.name},domain=${res.commonNames},dnsNames=${res.dnsNames}`);
return res
}
async updateSSLCert(req:{
sslCertId: number,
cert:CertInfo,
}){
/**
* isOn boolean ✅ 是否启用证书 true
* name string ✅ 证书显示名称 "example.com"
* description string ✅ 证书描述信息 "主域名SSL证书"
* serverName string ✅ 关联的服务器名称 "web-server-01"
* isCA boolean ✅ 是否为CA根证书 false
* certData string ✅ 证书内容PEM格式 "-----BEGIN CERTIFICATE-----..."
* keyData string ✅ 私钥内容PEM格式 "-----BEGIN PRIVATE KEY-----..."
* timeBeginAt int/long ✅ 证书生效时间(毫秒时间戳) 1719830400000
* timeEndAt int/long ✅ 证书过期时间(毫秒时间戳) 1751366400000
* dnsNames string[] ✅ 证书绑定的域名列表 ["example.com", "*.example.com"]
* commonNames string[] ✅ 证书的通用名称列表 ["example.com"]
*/
const oldCert = await this.findSSLCertConfig(req.sslCertId)
const certReader = new CertReader(req.cert)
const {detail} = certReader.getCrtDetail();
const params = {
sslCertId: req.sslCertId,
certData: req.cert.crt,
keyData: req.cert.key,
isOn: true,
isCA: false,
serverName: oldCert.serverName || certReader.getMainDomain(),
commonNames: [certReader.getMainDomain()],
dnsNames: certReader.getAltNames(),
timeBeginAt: detail.notBefore,
timeEndAt: detail.notAfter,
name: oldCert.name|| certReader.buildCertName(),
description:oldCert.description||""
}
return await this.doRequest({
url: "/updateSSLCert",
data: params
});
}
async doRequest(req:HttpRequestConfig){
const params = {
...req.data,
accessKeyId: this.accessKeyId,
accessKey: this.accessKey
};
const res = await this.ctx.http.request({
url: req.url,
baseURL:this.endpoint,
method: "POST",
data: params,
httpProxy: this.httpProxy||undefined,
});
if (res.code === 200) {
return res.data;
}
throw new Error(res.message || res);
}
}
new FarcdnAccess();

View File

@@ -0,0 +1,2 @@
export * from "./plugins/index.js";
export * from "./access.js";

View File

@@ -0,0 +1 @@
export * from "./plugin-refresh-cert.js";

View File

@@ -0,0 +1,111 @@
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";
import { AbstractPlusTaskPlugin } from "@certd/plugin-plus";
@IsTaskPlugin({
//命名规范,插件类型+功能就是目录plugin-demo中的demo大写字母开头驼峰命名
name: "FarcdnRefreshCert",
title: "farcdn-更新证书",
desc:"www.farcdn.net",
icon: "svg:icon-lucky",
//插件分组
group: pluginGroups.cdn.key,
needPlus: true,
default: {
//默认值配置照抄即可
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed
}
}
})
//类名规范跟上面插件名称name一致
export class FarcdnRefreshCert extends AbstractPlusTaskPlugin {
//证书选择,此项必须要有
@TaskInput({
title: "域名证书",
helper: "请选择前置任务输出的域名证书",
component: {
name: "output-selector",
from: [...CertApplyPluginNames]
}
// required: true, // 必填
})
cert!: CertInfo;
@TaskInput(createCertDomainGetterInputDefine({ props: { required: false } }))
certDomains!: string[];
//授权选择框
@TaskInput({
title: "Farcdn授权",
component: {
name: "access-selector",
type: "farcdn" //固定授权类型
},
required: true //必填
})
accessId!: string;
//
@TaskInput(
createRemoteSelectInputDefine({
title: "证书Id",
helper: "要更新的Farcdn证书id",
action: FarcdnRefreshCert.prototype.onGetCertList.name
})
)
certList!: number[];
//插件实例化时执行的方法
async onInstance() {
}
//插件执行方法
async execute(): Promise<void> {
const access = await this.getAccess<FarcdnAccess>(this.accessId);
for (const item of this.certList) {
this.logger.info(`----------- 开始更新证书:${item}`);
await access.updateSSLCert({
sslCertId:item,
cert: this.cert,
})
this.logger.info(`----------- 更新证书${item}成功`);
}
this.logger.info("部署完成");
}
async onGetCertList(data:PageReq = {}) {
const access = await this.getAccess<FarcdnAccess>(this.accessId);
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
}
}
}
//实例化一下,注册插件
new FarcdnRefreshCert();

Some files were not shown because too many files have changed in this diff Show More