Compare commits

...

436 Commits

Author SHA1 Message Date
xiaojunnuo
c2650d308c v1.25.3 2024-09-25 03:32:30 +08:00
xiaojunnuo
a616101ad0 chore: 1 2024-09-25 03:30:50 +08:00
xiaojunnuo
9fdb560528 chore: 1 2024-09-25 03:22:14 +08:00
xiaojunnuo
0f0ddb9c59 fix: 修复upload to host trim错误 2024-09-25 03:20:21 +08:00
xiaojunnuo
50e027ca80 chore: 1 2024-09-25 03:02:37 +08:00
xiaojunnuo
37aa7f5dfc chore: 1 2024-09-25 03:00:07 +08:00
xiaojunnuo
9c3709106b build: trigger build image 2024-09-25 02:56:59 +08:00
xiaojunnuo
66fb689ac5 v1.25.2 2024-09-25 02:56:09 +08:00
xiaojunnuo
8e01360a22 chore: 1 2024-09-25 02:54:30 +08:00
xiaojunnuo
3bbf8f4a03 build: trigger build image 2024-09-25 02:43:14 +08:00
xiaojunnuo
c7f7910fa9 v1.25.1 2024-09-25 02:42:21 +08:00
xiaojunnuo
211548fd53 build: prepare to build 2024-09-25 02:40:51 +08:00
xiaojunnuo
4d4c77129f chore: 1 2024-09-25 02:40:45 +08:00
xiaojunnuo
7500fb3b1c build: prepare to build 2024-09-25 02:39:27 +08:00
xiaojunnuo
1906c310f5 v1.25.0 2024-09-25 02:37:15 +08:00
xiaojunnuo
59695cee88 build: prepare to build 2024-09-25 02:35:57 +08:00
xiaojunnuo
36975b37e3 Merge branch 'v2-dev' into v2
# Conflicts:
#	packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/notification-form/index.vue
2024-09-25 02:35:26 +08:00
xiaojunnuo
5724c04bc3 Merge remote-tracking branch 'origin/v2' into v2
# Conflicts:
#	packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/notification-form/index.vue
#	packages/ui/certd-server/src/plugins/plugin-other/plugins/plugin-restart.ts
2024-09-25 02:34:56 +08:00
xiaojunnuo
2e22f69bde build: prepare to build 2024-09-25 02:32:59 +08:00
xiaojunnuo
298c2c8bc7 chore: 1 2024-09-25 02:32:14 +08:00
xiaojunnuo
86e291c5a3 chore: 支持dynadot,会覆盖原有的dns解析,京东云也有问题,没有测试通过,这两个目前都有缺陷 2024-09-25 02:31:45 +08:00
xiaojunnuo
f9a3ac2cb1 chore: 2024-09-24 23:25:39 +08:00
xiaojunnuo
8ecc2f9446 perf: 支持七牛云 2024-09-24 13:50:06 +08:00
xiaojunnuo
8de56feeb7 chore: 优化性能 2024-09-24 11:11:08 +08:00
xiaojunnuo
10ff783982 chore: 1 2024-09-24 10:44:20 +08:00
xiaojunnuo
c46b2c3cb7 chore: 宝塔面板一键部署说明 2024-09-24 10:43:24 +08:00
xiaojunnuo
9a3ff8ad1a chore: 2024-09-24 03:08:24 +08:00
xiaojunnuo
92aa4a6d63 chore: 2024-09-24 02:42:08 +08:00
xiaojunnuo
154f627f2a Merge remote-tracking branch 'origin/v2-dev' into v2-dev 2024-09-24 01:31:40 +08:00
xiaojunnuo
a624a3f065 Merge remote-tracking branch 'origin/v2-dev' into v2-dev 2024-09-23 17:39:53 +08:00
xiaojunnuo
361e8fe7ae feat: 支持vip转移 2024-09-23 17:39:18 +08:00
xiaojunnuo
3d9c3ecb3e perf: 证书支持旧版RSA,pkcs1 2024-09-23 14:32:57 +08:00
xiaojunnuo
f9ff9191a1 chore: env 2024-09-23 14:04:33 +08:00
xiaojunnuo
e85b4da2e3 Merge remote-tracking branch 'origin/v2-dev' into v2-dev 2024-09-23 13:34:36 +08:00
xiaojunnuo
ab53c601bf chore: 2024-09-23 13:33:46 +08:00
xiaojunnuo
8e03e8463f chore: 2024-09-23 13:23:49 +08:00
xiaojunnuo
81d6c0ebdf chore: env 2024-09-23 11:27:53 +08:00
xiaojunnuo
e0466409d0 feat: 账号绑定 2024-09-23 01:52:42 +08:00
xiaojunnuo
e86756e4c6 feat: 支持中间证书 2024-09-22 23:19:10 +08:00
xiaojunnuo
bdc0227c08 chore: account 2024-09-22 02:06:34 +08:00
xiaojunnuo
0451fa7573 chore: 2024-09-22 00:33:09 +08:00
xiaojunnuo
8b8039f42b perf: 群晖支持OTP双重验证登录 2024-09-20 19:29:16 +08:00
xiaojunnuo
df55299e6f Merge branch 'v2' into v2-dev
# Conflicts:
#	packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/notification-form/index.vue
#	packages/ui/certd-server/src/plugins/plugin-other/plugins/plugin-restart.ts
2024-09-20 15:19:22 +08:00
xiaojunnuo
9c773aaa05 chore: 2024-09-20 15:15:24 +08:00
xiaojunnuo
4e4bbee8c2 chore: 1 2024-09-20 13:27:07 +08:00
xiaojunnuo
d331fea477 perf: 支持阿里云ACK证书部署 2024-09-20 12:34:41 +08:00
xiaojunnuo
9de77b327d perf: 优化主机登录失败提示 2024-09-20 11:11:25 +08:00
xiaojunnuo
ab41eea7a9 chore: 2024-09-20 10:26:48 +08:00
xiaojunnuo
22ef28f633 perf: 优化收件邮箱输入 2024-09-20 10:23:20 +08:00
xiaojunnuo
a8da658a97 perf: plugins增加图标 2024-09-19 17:38:51 +08:00
xiaojunnuo
e5a5d0a607 perf: 支持k8s ingress secret 2024-09-19 14:23:15 +08:00
xiaojunnuo
60ea9106f1 chore: 1 2024-09-19 10:17:31 +08:00
xiaojunnuo
7549b9443f Merge remote-tracking branch 'origin/v2' into v2 2024-09-18 18:17:49 +08:00
xiaojunnuo
5021a2081e chore: 1 2024-09-18 17:22:08 +08:00
xiaojunnuo
ce3426368b chore: 定时任务提示优化 2024-09-18 17:04:16 +08:00
xiaojunnuo
7aa3d8e5d9 chore: 证书输出选择器优化 2024-09-18 14:58:59 +08:00
xiaojunnuo
4c37ec3222 Merge remote-tracking branch 'origin/v2' into v2
# Conflicts:
#	packages/ui/certd-server/src/plugins/plugin-other/plugins/index.ts
2024-09-16 15:52:35 +08:00
xiaojunnuo
830de90317 chore: 代理初步 2024-09-14 10:29:47 +08:00
xiaojunnuo
d5956072f0 chore: 代理初步 2024-09-14 10:28:06 +08:00
xiaojunnuo
2309b07d85 chore: 2024-09-14 09:19:10 +08:00
xiaojunnuo
3a6e067ea3 chore: 2024-09-12 09:26:00 +08:00
xiaojunnuo
bb8f0bed6d chore: 2024-09-12 09:16:43 +08:00
xiaojunnuo
6fee28c9e9 chore: 2024-09-12 09:14:10 +08:00
xiaojunnuo
b6e3b96d56 chore: 2024-09-11 18:04:19 +08:00
xiaojunnuo
ecd83ee136 fix: 修复首次创建任务运行时不自动设置当前运行情况的bug 2024-09-11 18:01:46 +08:00
xiaojunnuo
8ed16b3ea2 perf: 任务支持禁用 2024-09-11 16:49:50 +08:00
xiaojunnuo
5b0f5f75d0 chore: 2024-09-11 11:16:22 +08:00
xiaojunnuo
a89fe4702d chore: 2024-09-10 17:39:41 +08:00
xiaojunnuo
664bd863e5 perf: http请求增加默认超时时间 2024-09-10 11:58:58 +08:00
xiaojunnuo
e0241686dc chore: 2024-09-09 17:36:09 +08:00
xiaojunnuo
9092f05985 chore: 2024-09-09 17:35:10 +08:00
xiaojunnuo
eb1ab0992f chore: 2024-09-09 17:31:15 +08:00
xiaojunnuo
f22ff2296c build: trigger build image 2024-09-09 17:30:22 +08:00
xiaojunnuo
6fe2d2c328 v1.24.4 2024-09-09 17:30:04 +08:00
xiaojunnuo
20f5865bb9 build: prepare to build 2024-09-09 17:29:13 +08:00
xiaojunnuo
2b224c712f chore: 2024-09-09 17:29:09 +08:00
xiaojunnuo
c446e24f1a build: prepare to build 2024-09-09 17:27:50 +08:00
xiaojunnuo
2623f45a3b chore: 2024-09-09 17:03:46 +08:00
xiaojunnuo
52e7208e8f chore: 2024-09-09 17:01:00 +08:00
xiaojunnuo
d1498a7160 perf: 插件选择支持搜索 2024-09-09 16:55:14 +08:00
xiaojunnuo
5c270b6b9d perf: 支持群晖 2024-09-09 16:01:42 +08:00
xiaojunnuo
18718f6a25 chore: 2024-09-09 10:39:29 +08:00
xiaojunnuo
653f409d91 fix: 修复腾讯云tke证书部署报错的bug
https://github.com/certd/certd/issues/162
2024-09-09 10:24:20 +08:00
xiaojunnuo
0f0af2f309 perf: 群晖部署教程 2024-09-09 10:17:40 +08:00
xiaojunnuo
7908ab79da fix: 修复腾讯云cdn证书部署后会自动关闭hsts,http2.0等配置的bug
https://github.com/certd/certd/issues/161
2024-09-09 10:17:25 +08:00
xiaojunnuo
ae3daa9bcf perf: 前置任务步骤增加错误提示 2024-09-09 09:27:38 +08:00
xiaojunnuo
48238d929e perf: 增加重启certd插件 2024-09-07 11:55:23 +08:00
xiaojunnuo
01df4d0f1d chore: 1 2024-09-07 11:45:46 +08:00
xiaojunnuo
25ff6906c6 chore: 1 2024-09-07 11:44:52 +08:00
xiaojunnuo
695548eade chore: 支持armv7 2024-09-07 11:43:21 +08:00
xiaojunnuo
6221a4e464 chore: node版本设置为18 2024-09-07 11:40:45 +08:00
xiaojunnuo
115b819c66 chore: 测试armv7 2024-09-07 11:35:02 +08:00
xiaojunnuo
bceb8cce0d chore: 测试armv7 2024-09-07 11:34:10 +08:00
xiaojunnuo
8d2cf2095c chore: 测试armv7 2024-09-07 11:30:28 +08:00
xiaojunnuo
1b1a1a5bc2 chore: 测试armv7 2024-09-07 11:21:10 +08:00
xiaojunnuo
935ebe022a chore: 测试armv7 2024-09-06 23:48:40 +08:00
xiaojunnuo
ff356571c8 chore: 测试armv7 2024-09-06 23:48:01 +08:00
xiaojunnuo
76fb2141e4 chore: 测试armv7 2024-09-06 23:44:43 +08:00
xiaojunnuo
b220500f40 chore: 测试armv7 2024-09-06 23:39:37 +08:00
xiaojunnuo
1cbf70fb6a chore: 测试armv7 2024-09-06 23:39:22 +08:00
xiaojunnuo
52ec48656d chore: 测试armv7 2024-09-06 23:33:29 +08:00
xiaojunnuo
fddf3a0f68 chore: 2024-09-06 23:31:47 +08:00
xiaojunnuo
98520a1213 build: trigger build image 2024-09-06 23:21:50 +08:00
xiaojunnuo
d65d94b784 v1.24.3 2024-09-06 23:21:11 +08:00
xiaojunnuo
00f1e0da59 build: prepare to build 2024-09-06 23:19:58 +08:00
xiaojunnuo
65ef685729 perf: 支持多吉云cdn证书部署 2024-09-06 23:19:34 +08:00
xiaojunnuo
6e344140c6 chore: 1 2024-09-06 22:45:08 +08:00
xiaojunnuo
97a01b6f6d build: trigger build image 2024-09-06 22:35:27 +08:00
xiaojunnuo
c49ccbde93 v1.24.2 2024-09-06 22:34:49 +08:00
xiaojunnuo
fc73d9d615 build: prepare to build 2024-09-06 22:33:30 +08:00
xiaojunnuo
1133d6b0f7 chore: 2024-09-06 22:32:29 +08:00
xiaojunnuo
b80210f24b perf: 优化跳过处理逻辑 2024-09-06 10:19:03 +08:00
xiaojunnuo
3bad0b2685 chore: 1 2024-09-06 00:13:21 +08:00
xiaojunnuo
af388ec39f Merge remote-tracking branch 'origin/v2' into v2 2024-09-05 18:01:04 +08:00
xiaojunnuo
8d7c2c8e29 Merge branch 'v2' of https://github.com/certd/certd into v2 2024-09-05 18:01:05 +08:00
xiaojunnuo
8088cd6d58 1 2024-09-05 18:00:51 +08:00
xiaojunnuo
590ce9642e 1 2024-09-05 18:00:45 +08:00
xiaojunnuo
99302b8ff2 chore: 2024-09-05 16:19:00 +08:00
xiaojunnuo
14b108f09e chore: 2024-09-05 16:18:42 +08:00
xiaojunnuo
0669835d4e chore: 2024-09-05 16:11:03 +08:00
xiaojunnuo
fbeaed2035 perf: 支持pfx、der 2024-09-05 15:36:35 +08:00
xiaojunnuo
ecad7f58c1 chore: 2024-09-05 14:33:45 +08:00
xiaojunnuo
1dd9a8d4d3 docs: 2024-09-05 11:00:21 +08:00
xiaojunnuo
bd73a163cd perf: 阶段、任务、步骤全面支持拖动排序 2024-09-05 10:47:03 +08:00
xiaojunnuo
1e9b5638aa perf: 任务支持拖动排序 2024-09-05 01:39:46 +08:00
xiaojunnuo
71ac8aae4a fix: 修复windows下无法执行第二条命令的bug 2024-09-05 00:04:31 +08:00
xiaojunnuo
d5bfcdb6de perf: 修复windows下无法执行第二条命令的bug 2024-09-04 18:29:39 +08:00
xiaojunnuo
1480efb43d pref: 支持https启动 2024-09-04 16:15:42 +08:00
xiaojunnuo
1c17b41e16 perf: 西部数据支持用户级的apikey 2024-09-04 15:49:15 +08:00
xiaojunnuo
192d9dc7e3 perf: 任务配置不需要的字段可以自动隐藏 2024-09-04 15:49:00 +08:00
xiaojunnuo
d0d3c2b588 Merge remote-tracking branch 'origin/v2' into v2 2024-09-04 11:28:22 +08:00
Greper
b8a8f20448 perf: 支持西部数码DNS
perf: 支持西部数码DNS
2024-09-04 11:28:07 +08:00
xiaojunnuo
28a32aed7d chore: 2024-09-04 11:26:56 +08:00
xiaojunnuo
ff46771d8d perf: client 请求超时时间延长为10s 2024-09-03 22:09:48 +08:00
xiaojunnuo
87a2673e8c perf: 支持阿里云oss 2024-09-03 18:21:02 +08:00
Moeyuuko
c59cab1aae perf: 支持西部数码DNS 2024-09-03 15:40:45 +08:00
xiaojunnuo
6314e8d7eb fix: 修复复制流水线出现的各种问题 2024-09-03 11:42:05 +08:00
xiaojunnuo
5ade12d700 chore: 2024-09-03 00:26:35 +08:00
xiaojunnuo
ceb210b1b7 chore: 2024-09-03 00:06:13 +08:00
xiaojunnuo
5e084db038 build: trigger build image 2024-09-02 23:58:23 +08:00
xiaojunnuo
bef6b981e2 v1.24.1 2024-09-02 23:57:42 +08:00
xiaojunnuo
a77cd65789 build: prepare to build 2024-09-02 23:56:04 +08:00
xiaojunnuo
415b731d9a chore: 2024-09-02 23:55:38 +08:00
xiaojunnuo
6c0099d600 chore: 2024-09-02 23:47:15 +08:00
xiaojunnuo
98b77f8084 perf: 支持阿里云 DCDN 2024-09-02 23:46:28 +08:00
Greper
2f47ffb76b Merge pull request #148 from wujingke/v2
pref: 添加阿里云DCDN 废弃SetDomainServerCertificate接口 改为SetCdnDomainSSLCertificate
2024-09-02 22:00:36 +08:00
w
35a3603c41 添加阿里云DCDN 废弃SetDomainServerCertificate接口 改为SetCdnDomainSSLCertificate 2024-09-02 19:33:17 +08:00
xiaojunnuo
ea775adae1 perf: 支持已跳过的步骤重新运行 2024-09-02 18:36:12 +08:00
xiaojunnuo
724a85028b perf: 支持cdnfly 2024-09-02 16:59:49 +08:00
xiaojunnuo
b2d595e85c Merge remote-tracking branch 'origin/v2' into v2 2024-09-02 15:50:43 +08:00
xiaojunnuo
d9b1ff8c5c chore: 2024-09-02 15:49:56 +08:00
xiaojunnuo
1c17970b98 fix: 激活仅限管理员 2024-09-02 01:02:41 +08:00
xiaojunnuo
b9bddbfabb perf: 支持ftp上传 2024-09-01 04:49:26 +08:00
xiaojunnuo
ee617095ef perf: 部署插件支持宝塔、易盾云等 2024-08-30 18:52:31 +08:00
xiaojunnuo
bee20c7f51 chore: 1 2024-08-29 11:15:45 +08:00
xiaojunnuo
b8e05e9b44 chore: 2024-08-29 10:09:22 +08:00
xiaojunnuo
869e14bad9 pref: 自动优化数据库,释放被删除空间 2024-08-29 09:57:27 +08:00
xiaojunnuo
952e01ab7d chore: 2024-08-28 14:45:57 +08:00
xiaojunnuo
db61033633 perf: 优化内存占用 2024-08-28 14:40:50 +08:00
xiaojunnuo
42a56b581d perf: 授权配置支持加密
原本已经添加的授权配置,再次编辑保存即变成加密配置
2024-08-27 13:46:19 +08:00
xiaojunnuo
d6bb9f6af4 chore: 2024-08-26 12:37:42 +08:00
xiaojunnuo
a430b27034 chore: 2024-08-26 12:32:36 +08:00
xiaojunnuo
0f6679425f fix: 修复在没有勾选使用代理的情况下,仍然会使用代理的bug 2024-08-26 11:34:01 +08:00
xiaojunnuo
4b9d1eb4b5 chore: 2024-08-26 11:06:46 +08:00
xiaojunnuo
ca4a1b8d92 chore: 2024-08-26 11:06:28 +08:00
xiaojunnuo
08a702a758 chore: 2024-08-26 10:19:06 +08:00
xiaojunnuo
589191244f chore: 2024-08-26 10:09:53 +08:00
xiaojunnuo
f3ddcd3054 Merge remote-tracking branch 'origin/v2' into v2 2024-08-26 09:59:10 +08:00
xiaojunnuo
f923655d91 chore: 2024-08-26 09:58:51 +08:00
xiaojunnuo
879e2609ca chore: 2024-08-25 15:35:04 +08:00
xiaojunnuo
d227dd64e3 chore: 2024-08-25 15:34:00 +08:00
xiaojunnuo
d2997624b0 build: trigger build image 2024-08-25 14:28:10 +08:00
xiaojunnuo
f17b08ddab v1.24.0 2024-08-25 14:27:41 +08:00
xiaojunnuo
893b853fd4 build: prepare to build 2024-08-25 14:26:34 +08:00
xiaojunnuo
15846eda85 chore: 2024-08-25 12:07:47 +08:00
xiaojunnuo
19ddf61127 chore: 2024-08-25 11:57:07 +08:00
xiaojunnuo
a7424e02f5 feat: 支持ECC类型 2024-08-25 11:56:15 +08:00
xiaojunnuo
d4092e4929 chore: 1 2024-08-25 03:27:38 +08:00
xiaojunnuo
62ef54c7c3 chore: 1 2024-08-25 03:14:07 +08:00
xiaojunnuo
85ae80c882 Merge remote-tracking branch 'origin/acme_sync' into v2
# Conflicts:
#	packages/core/acme-client/package.json
2024-08-25 03:01:13 +08:00
xiaojunnuo
a593056e79 feat: 支持google证书申请(需要使用代理) 2024-08-25 02:59:49 +08:00
xiaojunnuo
22a336370a fix: 修复执行日志没有清理的bug 2024-08-25 01:55:34 +08:00
xiaojunnuo
86ebbcb9bb chore: 1 2024-08-24 23:48:26 +08:00
xiaojunnuo
c28f3cdcf7 chore: 1 2024-08-24 01:05:06 +08:00
xiaojunnuo
41b9837582 fix: 修复ssh无法连接成功,无法执行命令的bug 2024-08-24 00:00:27 +08:00
xiaojunnuo
37eb762afe fix: 修复成功后跳过之后丢失腾讯云证书id的bug 2024-08-23 23:26:31 +08:00
xiaojunnuo
3345c145b8 fix: 部署到腾讯云cdn选择证书任务步骤限制只能选证书 2024-08-23 18:02:14 +08:00
xiaojunnuo
17ead547aa fix: 修复创建流水线后立即运行时报no id错误的bug
Closes https://github.com/certd/certd/issues/135
2024-08-23 17:41:02 +08:00
xiaojunnuo
e358a88696 fix: 修复重置密码参数配置后无效的bug 2024-08-23 17:16:52 +08:00
xiaojunnuo
968c4690a0 perf: 优化证书申请成功率 2024-08-23 13:15:06 +08:00
xiaojunnuo
453f1baa0b perf: email proxy 2024-08-23 11:35:34 +08:00
xiaojunnuo
14ab93dc2f chore: 1 2024-08-21 12:38:09 +08:00
xiaojunnuo
790bf11af0 perf: 优化dnspod的token id 说明 2024-08-21 10:36:10 +08:00
xiaojunnuo
95122e2860 fix: 修复使用代理的情况下申请证书失败的bug 2024-08-21 10:34:50 +08:00
xiaojunnuo
ab7a1673ff chore: plus 2024-08-21 08:36:03 +08:00
xiaojunnuo
db9d27468e chore: license说明 2024-08-14 21:24:12 +08:00
xiaojunnuo
746bb9d385 perf: 更新k8s底层api库 2024-08-14 15:10:55 +08:00
xiaojunnuo
7b451bbf6e perf: 优化成功后跳过的提示 2024-08-13 20:30:42 +08:00
xiaojunnuo
ffc4e71783 build: trigger build image 2024-08-06 11:39:34 +08:00
xiaojunnuo
7eb6d7d053 v1.23.1 2024-08-06 11:39:21 +08:00
xiaojunnuo
93b6431369 build: prepare to build 2024-08-06 11:38:30 +08:00
xiaojunnuo
d301ac6832 chore: 2024-08-06 11:37:46 +08:00
xiaojunnuo
1af19f0ac0 perf: 优化默认值设置 2024-08-06 11:32:25 +08:00
xiaojunnuo
24c7be2c9c perf: 优化插件字段的default value 2024-08-06 11:23:23 +08:00
xiaojunnuo
c3f04a80fd chore: pg 改成bigint 2024-08-06 11:10:33 +08:00
xiaojunnuo
bf6c5d690e chore: 权益 2024-08-06 10:32:07 +08:00
xiaojunnuo
7c92762f48 chore: k8s logger 2024-08-06 10:23:09 +08:00
xiaojunnuo
efacfd6b2c chore: k8s logger 2024-08-06 10:22:28 +08:00
xiaojunnuo
93559174c7 fix: 修复模糊查询无效的bug 2024-08-06 10:12:02 +08:00
xiaojunnuo
1b0ae8654f chore: 2024-08-06 09:12:25 +08:00
xiaojunnuo
d11a19ce59 chore: 2024-08-06 09:12:14 +08:00
xiaojunnuo
9a68b0fb61 chore: 2024-08-06 09:11:31 +08:00
xiaojunnuo
79bbdce1e1 chore: 2024-08-06 09:04:38 +08:00
xiaojunnuo
916ee4a089 chore: 2024-08-06 09:00:45 +08:00
xiaojunnuo
ac9313da38 build: trigger build image 2024-08-05 18:08:50 +08:00
xiaojunnuo
ed01ef1eb7 v1.23.0 2024-08-05 18:08:44 +08:00
xiaojunnuo
7ec2218c9f fix: 修复环境变量多个下划线不生效的bug 2024-08-05 17:47:56 +08:00
xiaojunnuo
e8ed97206b feat: use node 20 2024-08-05 16:27:01 +08:00
xiaojunnuo
c45d85e612 chore: 2024-08-05 16:24:16 +08:00
xiaojunnuo
b3ff0fd880 chore: 2024-08-05 16:19:28 +08:00
xiaojunnuo
2fbc7459e2 build: trigger build image 2024-08-05 16:10:45 +08:00
xiaojunnuo
fbf4959463 v1.22.9 2024-08-05 16:10:39 +08:00
xiaojunnuo
02bb0be06a chore: 2024-08-05 16:07:28 +08:00
xiaojunnuo
87e440ee2a perf: 优化定时任务 2024-08-05 16:00:04 +08:00
xiaojunnuo
2182dce07c chore: 修复pipelineid为空被注册任务 2024-08-05 15:08:24 +08:00
xiaojunnuo
3f0a10007c build: trigger build image 2024-08-05 13:20:09 +08:00
xiaojunnuo
67934cdebd v1.22.8 2024-08-05 13:19:57 +08:00
xiaojunnuo
6765a48706 chore: 2024-08-05 13:04:36 +08:00
xiaojunnuo
b4252033d5 perf: 优化pipeline删除时,删除其他history 2024-08-05 12:57:13 +08:00
xiaojunnuo
f78ae93eed perf: 修复删除历史记录没有删除log的bug,新增history管理页面,演示站点启动时不自动启动非管理员用户的定时任务 2024-08-05 12:49:44 +08:00
xiaojunnuo
0227155ab4 chore: 2024-08-04 22:46:08 +08:00
xiaojunnuo
330b84de33 build: trigger build image 2024-08-04 22:33:08 +08:00
xiaojunnuo
f47f86b669 v1.22.7 2024-08-04 22:32:13 +08:00
xiaojunnuo
95eeb93822 build: prepare to build 2024-08-04 22:30:36 +08:00
xiaojunnuo
367f807313 fix: 修复保存配置报id不能为空的bug 2024-08-04 22:25:51 +08:00
xiaojunnuo
a954629ff9 build: trigger build image 2024-08-04 02:55:27 +08:00
xiaojunnuo
3bbbc41062 v1.22.6 2024-08-04 02:53:50 +08:00
xiaojunnuo
bf63b0d73f build: prepare to build 2024-08-04 02:51:30 +08:00
xiaojunnuo
5362df55f4 chore: 1 2024-08-04 02:49:40 +08:00
xiaojunnuo
59897c4cea perf: 流水线支持名称模糊查询 2024-08-04 02:35:45 +08:00
xiaojunnuo
a9717b9a0d fix: 修复pg下pipeline title 类型问题 2024-08-04 00:04:55 +08:00
xiaojunnuo
680941af11 fix: 修复在相同的cron时偶尔无法触发定时任务的bug 2024-08-03 23:32:50 +08:00
xiaojunnuo
1cf8d4e5e7 chore: 2024-08-02 23:59:08 +08:00
xiaojunnuo
70ce6be0bf chore: 单元测试 2024-08-02 22:58:29 +08:00
xiaojunnuo
9187e87419 chore: 2024-08-02 09:29:26 +08:00
xiaojunnuo
6ed1e18c7d perf: 优化前置任务输出为空的提示 2024-08-02 09:26:54 +08:00
xiaojunnuo
8d27f07213 Merge remote-tracking branch 'origin/v2' into v2 2024-07-31 14:01:30 +08:00
xiaojunnuo
e4f4570b29 perf: 腾讯云clb支持更多大区选择 2024-07-31 14:01:06 +08:00
xiaojunnuo
d86fc9569a chore: 增加dns地址配置 2024-07-31 13:46:48 +08:00
xiaojunnuo
fa7a983bcb chore: 2024-07-26 23:48:15 +08:00
xiaojunnuo
9ac908ebee chore: 2024-07-26 23:44:57 +08:00
xiaojunnuo
6e594ee66e chore: 2024-07-26 23:43:41 +08:00
xiaojunnuo
c26d3e9c38 chore: 2024-07-26 23:38:51 +08:00
xiaojunnuo
5db5607faa chore: 2024-07-26 23:36:33 +08:00
xiaojunnuo
728f27e0a0 build: trigger build image 2024-07-26 23:16:17 +08:00
xiaojunnuo
3d8f329e2d v1.22.5 2024-07-26 23:15:20 +08:00
xiaojunnuo
351fb70d5d build: prepare to build 2024-07-26 23:14:05 +08:00
xiaojunnuo
b5cbeb9bde chore: 2024-07-26 23:13:50 +08:00
xiaojunnuo
e7e89b8de7 fix: 修复用户管理无法添加用户的bug 2024-07-26 23:07:01 +08:00
xiaojunnuo
225894d15c chore: 2024-07-26 22:48:18 +08:00
xiaojunnuo
64ba485b0f chore: 2024-07-26 22:46:05 +08:00
xiaojunnuo
3a666db36c chore: 2024-07-26 22:16:24 +08:00
xiaojunnuo
ce7e5a2461 chore: 2024-07-26 22:13:49 +08:00
xiaojunnuo
b22f94b079 chore: 2024-07-26 22:11:41 +08:00
xiaojunnuo
3408465df6 chore: 2024-07-26 22:01:42 +08:00
xiaojunnuo
e97dfb456b chore: 2024-07-26 21:42:52 +08:00
xiaojunnuo
439c6c8b6c chore: 2024-07-26 21:42:25 +08:00
xiaojunnuo
afa2b0307a chore: 2024-07-26 21:40:32 +08:00
xiaojunnuo
56867fa777 chore: 2024-07-26 21:37:34 +08:00
xiaojunnuo
9c2e33fa39 chore: 2024-07-26 21:36:25 +08:00
xiaojunnuo
2ca72f838b chore: 2024-07-26 20:56:48 +08:00
xiaojunnuo
37a9e6aae0 v1.22.4 2024-07-26 20:56:06 +08:00
xiaojunnuo
6a8a02dae5 build: prepare to build 2024-07-26 20:55:02 +08:00
xiaojunnuo
eaee5db69e Merge remote-tracking branch 'origin/v2' into v2 2024-07-26 20:54:24 +08:00
xiaojunnuo
25d06904c6 build: prepare to build 2024-07-26 20:54:11 +08:00
xiaojunnuo
fa14f87a80 perf: 支持arm64 2024-07-26 20:53:59 +08:00
xiaojunnuo
4404f99642 Merge remote-tracking branch 'origin/v2' into v2 2024-07-26 09:47:38 +08:00
xiaojunnuo
bafab905b4 chore: 2024-07-25 23:53:00 +08:00
xiaojunnuo
44d5e54550 chore: 2024-07-25 23:42:25 +08:00
xiaojunnuo
a23c13d7d9 chore: 2024-07-25 23:41:19 +08:00
xiaojunnuo
17a7a1432f chore: 2024-07-25 23:38:51 +08:00
xiaojunnuo
26e8932b85 chore: 2024-07-25 23:37:49 +08:00
xiaojunnuo
32beb02d40 chore: 2024-07-25 23:35:34 +08:00
xiaojunnuo
af7177e6bb chore: 2024-07-25 23:29:17 +08:00
xiaojunnuo
69ac0fd0a8 chore: 1.22.3 2024-07-25 23:17:51 +08:00
xiaojunnuo
e0998f35e8 chore: 1.22.3 2024-07-25 23:09:13 +08:00
xiaojunnuo
6d371b38c3 chore: 1.22.3 2024-07-25 23:01:20 +08:00
xiaojunnuo
587f11138a chore: 1.22.3 2024-07-25 22:38:01 +08:00
xiaojunnuo
aa936c279e v1.22.3 2024-07-25 22:34:00 +08:00
xiaojunnuo
5b11d351b2 build: prepare to build 2024-07-25 22:32:48 +08:00
xiaojunnuo
b45b97d3c6 chore: 2024-07-25 22:32:15 +08:00
xiaojunnuo
338eb3bdfe fix: lege 无执行权限问题 2024-07-25 22:25:34 +08:00
Greper
f059e91efc fix: 修复可选链问题导致的响应错误输出报错
修复可选链问题导致的响应错误输出报错
2024-07-25 18:52:17 +08:00
ltxhhz
1cdf1c433f 7.25 patch 2024-07-25 18:13:17 +08:00
xiaojunnuo
a7b8bac4c8 chore: 2024-07-25 11:17:44 +08:00
xiaojunnuo
b7b5df0587 perf: 证书申请支持反向代理,letsencrypt无法访问时的备用方案 2024-07-25 10:38:45 +08:00
xiaojunnuo
4060f6ecbc Merge remote-tracking branch 'origin/v2' into v2
# Conflicts:
#	.github/workflows/build-image.yml
#	build.trigger
2024-07-24 10:55:21 +08:00
xiaojunnuo
7cb5f21444 chore: 2024-07-24 02:29:53 +08:00
xiaojunnuo
e5da46cfc3 v1.22.2 2024-07-24 02:25:12 +08:00
xiaojunnuo
eabb3e38b5 chore: 2024-07-24 02:24:37 +08:00
xiaojunnuo
46140c8efa build: prepare to build 2024-07-24 02:24:04 +08:00
xiaojunnuo
95d071ba56 chore: 2024-07-24 02:23:09 +08:00
xiaojunnuo
3c9c3ca3b0 build: prepare to build 2024-07-24 02:19:05 +08:00
xiaojunnuo
e7c4ade57d build: prepare to build 2024-07-24 02:18:13 +08:00
xiaojunnuo
ca524657b6 build: prepare to build 2024-07-24 02:17:12 +08:00
xiaojunnuo
bc02559bc7 chore: 2024-07-24 02:17:06 +08:00
xiaojunnuo
741172fd98 chore: 2024-07-24 02:16:12 +08:00
xiaojunnuo
83d0209775 chore: 2024-07-24 02:11:38 +08:00
xiaojunnuo
6693d1acfb chore: 2024-07-24 00:42:50 +08:00
xiaojunnuo
a2c43b50a6 fix: 修复创建流水线时,无法根据dns类型默认正确的dns授权的bug
Closes https://github.com/certd/certd/issues/97
2024-07-24 00:42:33 +08:00
xiaojunnuo
f7fc06e657 chore: 2024-07-23 23:39:13 +08:00
xiaojunnuo
b9fe3b9c87 chore: github action build image 2024-07-23 23:23:45 +08:00
xiaojunnuo
06be993afc chore: github action build image 2024-07-23 23:16:55 +08:00
xiaojunnuo
b6ef39fb30 chore: github action build image 2024-07-23 23:12:50 +08:00
xiaojunnuo
0b131c00ed chore: github action build image 2024-07-23 23:06:11 +08:00
xiaojunnuo
b6b8661c36 chore: github action build image 2024-07-23 23:03:15 +08:00
xiaojunnuo
7bf19f8f6f chore: github action build image 2024-07-23 23:00:56 +08:00
xiaojunnuo
c9d9c6513b chore: github action build image 2024-07-23 22:59:23 +08:00
xiaojunnuo
4e7b7ae974 chore: github action build image 2024-07-23 22:57:55 +08:00
xiaojunnuo
dfcabc02a4 chore: github action build image 2024-07-23 22:56:16 +08:00
xiaojunnuo
6f2c5674c9 chore: github action build image 2024-07-23 22:54:23 +08:00
xiaojunnuo
2877b9b505 chore: github action build image 2024-07-23 22:52:56 +08:00
xiaojunnuo
e40bb9e14d chore: github action build image 2024-07-23 22:50:15 +08:00
xiaojunnuo
d456ff9830 chore: github action build image 2024-07-23 22:48:30 +08:00
xiaojunnuo
ffddb3b4ac chore: github action build image 2024-07-23 22:40:05 +08:00
xiaojunnuo
a6113f237b chore: 2024-07-23 22:38:38 +08:00
xiaojunnuo
093520b686 chore: 2024-07-23 22:37:32 +08:00
xiaojunnuo
3a8d44b8e9 chore: github action build 2024-07-23 13:38:52 +08:00
xiaojunnuo
72bff652f7 chore: github action build 2024-07-23 13:30:36 +08:00
xiaojunnuo
9559bdf817 chore: github action build 2024-07-23 13:27:17 +08:00
xiaojunnuo
5a88b8c24e chore: github action build 2024-07-23 12:44:42 +08:00
xiaojunnuo
a9ebac82c7 chore: github action build 2024-07-23 12:43:10 +08:00
xiaojunnuo
cfd8836083 chore: github action build 2024-07-23 12:42:48 +08:00
xiaojunnuo
e01e59b188 chore: github action build 2024-07-23 12:41:36 +08:00
xiaojunnuo
d2fd729961 chore: github action build 2024-07-23 12:40:36 +08:00
xiaojunnuo
5d4ff2e3b7 chore: github action build 2024-07-23 12:39:03 +08:00
xiaojunnuo
6e5133f6b8 chore: github action build 2024-07-23 12:37:21 +08:00
xiaojunnuo
a96d5839b2 chore: github action build 2024-07-23 12:35:24 +08:00
xiaojunnuo
a827bc306a chore: 2024-07-21 03:21:51 +08:00
xiaojunnuo
d8b3d7a6e0 v1.22.1 2024-07-21 03:11:54 +08:00
xiaojunnuo
b8f072909b build: prepare to build 2024-07-21 03:10:14 +08:00
xiaojunnuo
fa48f2b2f0 build: prepare to build 2024-07-21 03:07:32 +08:00
xiaojunnuo
019a1fe24e chore: 2024-07-21 03:02:13 +08:00
xiaojunnuo
427620d34f perf: 创建证书任务增加定时任务和邮件通知输入 2024-07-21 02:59:02 +08:00
xiaojunnuo
a5a0c1f6e7 perf: 支持配置启动后自动触发一次任务 2024-07-21 02:32:03 +08:00
xiaojunnuo
affef13037 perf: 创建证书任务可以选择lege插件 2024-07-21 02:26:03 +08:00
xiaojunnuo
4afbf20c1a chore: 重构image build 2024-07-20 19:38:15 +08:00
xiaojunnuo
0ef7b036dd chore: 1 2024-07-20 19:27:07 +08:00
xiaojunnuo
17ef7b8b9e chore: 1 2024-07-20 19:25:54 +08:00
xiaojunnuo
15eba52fad chore: 1 2024-07-20 19:25:45 +08:00
xiaojunnuo
f2d894b036 chore: 1 2024-07-20 18:39:51 +08:00
xiaojunnuo
d9da27710e chore: 1 2024-07-20 18:33:11 +08:00
xiaojunnuo
981bff70c3 chore: 1 2024-07-20 18:28:19 +08:00
xiaojunnuo
bb30d6e02f chore: 1 2024-07-20 18:18:34 +08:00
xiaojunnuo
b09ccda54d chore: 1 2024-07-20 18:17:48 +08:00
xiaojunnuo
a5de8d79ec chore: 1 2024-07-20 18:11:56 +08:00
xiaojunnuo
a092a1e843 chore: 1 2024-07-20 18:11:38 +08:00
xiaojunnuo
1c6740feff chore: sqlite换成better-sqlite 2024-07-20 18:07:32 +08:00
xiaojunnuo
79c6e05e02 chore: sqlite换成better-sqlite 2024-07-20 18:04:07 +08:00
xiaojunnuo
31e2085c16 chore: 1 2024-07-20 17:53:19 +08:00
xiaojunnuo
64fda2f1a0 chore: 1 2024-07-20 17:35:07 +08:00
xiaojunnuo
a674719a8b chore: 1 2024-07-20 17:27:12 +08:00
xiaojunnuo
2f7ef0620b chore: 1 2024-07-20 14:27:41 +08:00
xiaojunnuo
153e98b593 chore: 1 2024-07-20 14:26:01 +08:00
xiaojunnuo
d62ea41671 chore: 1 2024-07-20 10:17:38 +08:00
xiaojunnuo
8fcd9813d3 chore: 1 2024-07-20 10:11:05 +08:00
xiaojunnuo
dcbf8c85dd chore: 1 2024-07-20 10:09:18 +08:00
xiaojunnuo
ea0eafdb16 chore: 1 2024-07-20 10:05:39 +08:00
xiaojunnuo
eda89a057a chore: 1 2024-07-20 09:22:20 +08:00
xiaojunnuo
21e6eef1d3 chore: mv libs 2024-07-19 18:08:51 +08:00
xiaojunnuo
54a27c1840 chore: mv libs 2024-07-19 17:22:54 +08:00
xiaojunnuo
a3be0a1618 chore: 1 2024-07-19 16:01:55 +08:00
xiaojunnuo
8e19e44f4c chore: 1 2024-07-19 15:44:10 +08:00
xiaojunnuo
e5d93bd114 chore: 1 2024-07-19 15:41:36 +08:00
xiaojunnuo
47fe3d5826 v1.22.0 2024-07-19 15:28:41 +08:00
xiaojunnuo
8409f5fd4a build: prepare to build 2024-07-19 15:27:50 +08:00
xiaojunnuo
634a468ec4 build: prepare to build 2024-07-19 15:26:29 +08:00
xiaojunnuo
7ed0544664 build: prepare to build 2024-07-19 15:23:59 +08:00
xiaojunnuo
3d4a046634 build: prepare to build 2024-07-19 15:20:13 +08:00
xiaojunnuo
96954b4aaa chore: 1 2024-07-19 15:15:35 +08:00
xiaojunnuo
d77fc11552 chore: 1 2024-07-19 15:14:03 +08:00
xiaojunnuo
5bad0bbde8 build: prepare to build 2024-07-19 15:13:46 +08:00
xiaojunnuo
cd85ac611b build: prepare to build 2024-07-19 15:03:40 +08:00
xiaojunnuo
0bc6d0a211 feat: 支持lego,海量DNS提供商 2024-07-18 21:10:13 +08:00
xiaojunnuo
b1cd055342 chore: lfs 2024-07-18 21:09:22 +08:00
xiaojunnuo
303097b835 chore: 1 2024-07-18 11:17:13 +08:00
xiaojunnuo
a438028002 chore: 1 2024-07-17 13:14:49 +08:00
GitHub Actions Bot
e5edfbfa6d 🔱: [acme] sync upgrade with 6 commits [trident-sync]
Bump v5.4.0
Bump dependencies
Retry HTTP requests on server errors or when rate limited
Forgot to refresh directory timestamp after successful get
Add utility method tests
2024-07-16 19:24:08 +00:00
xiaojunnuo
4813872bcc chore: 1 2024-07-17 01:33:55 +08:00
xiaojunnuo
3b19bfb429 feat: 支持postgresql 2024-07-17 01:30:00 +08:00
Greper
a917a7bca6 Merge pull request #93 from certd/acme_sync
[acme] sync upgrade [trident-sync]
2024-07-16 03:24:25 +08:00
GitHub Actions Bot
86e64af35c 🔱: [acme] sync upgrade with 5 commits [trident-sync]
Temp remove Node v22 from matrix, broke CNAME tests
Invalidate ACME directory cache after 24 hours
Directory URLs for Google ACME provider
Bump Pebble v2.6.0
2024-07-15 19:24:17 +00:00
xiaojunnuo
bf6f1d8137 chore: 2024-07-15 02:13:53 +08:00
xiaojunnuo
b1688525db perf: 优化一些小细节 2024-07-15 02:05:26 +08:00
xiaojunnuo
2fd14430a2 Merge remote-tracking branch 'origin/v2' into v2
# Conflicts:
#	package.json
#	packages/core/pipeline/package.json
#	packages/libs/k8s/package.json
#	packages/plugins/plugin-cert/package.json
#	packages/ui/certd-server/package.json
#	packages/ui/certd-server/src/plugins/plugin-host/lib/ssh.ts
#	packages/ui/certd-server/src/plugins/plugin-host/plugin/upload-to-host/index.ts
2024-07-15 01:33:04 +08:00
xiaojunnuo
bd3d959944 perf: 增加备案号设置 2024-07-15 01:29:35 +08:00
xiaojunnuo
390e4853a5 perf: 自动生成jwtkey,无需手动配置 2024-07-15 01:29:19 +08:00
xiaojunnuo
485e603b51 feat: 升级midway,支持esm 2024-07-15 00:30:33 +08:00
Greper
3ccd7ad95d Merge pull request #89 from certd/client_sync
[client] sync upgrade [trident-sync]
2024-07-13 03:23:54 +08:00
GitHub Actions Bot
54d9050483 🔱: [client] sync upgrade with 2 commits [trident-sync]
perf: 优化editorwang示例
2024-07-12 19:23:47 +00:00
Greper
6d58c68e9b Merge pull request #87 from certd/client_sync
[client] sync upgrade [trident-sync]
2024-07-12 03:23:58 +08:00
GitHub Actions Bot
80019d4dc1 🔱: [client] sync upgrade with 3 commits [trident-sync]
docs: 1
docs: 1
2024-07-11 19:23:48 +00:00
xiaojunnuo
031df8fc35 v1.21.2 2024-07-08 15:58:51 +08:00
xiaojunnuo
62419a8212 build: prepare to build 2024-07-08 15:57:13 +08:00
xiaojunnuo
09d93af853 build: prepare to build 2024-07-08 15:47:51 +08:00
xiaojunnuo
b6ab178de9 chore: 1 2024-07-08 15:47:36 +08:00
xiaojunnuo
5a08f27d2c build: prepare to build 2024-07-08 15:36:18 +08:00
xiaojunnuo
fe91d94090 perf: 申请证书时可以选择跳过本地dns校验 2024-07-08 15:35:58 +08:00
xiaojunnuo
56ab3269d2 chore: 1 2024-07-08 12:05:56 +08:00
xiaojunnuo
c8243c573f chore: 1 2024-07-08 12:04:59 +08:00
xiaojunnuo
0b769a1c86 v1.21.1 2024-07-08 11:58:09 +08:00
xiaojunnuo
a8189a974d build: prepare to build 2024-07-08 11:46:13 +08:00
xiaojunnuo
322875d241 chore: 1 2024-07-08 11:45:31 +08:00
xiaojunnuo
ed8a54a2bc chore: 1 2024-07-08 11:29:11 +08:00
xiaojunnuo
5ba9831ed1 perf: 上传到主机,支持设置不mkdirs 2024-07-08 11:19:02 +08:00
xiaojunnuo
f9c9fce581 docs: 1 2024-07-08 11:10:08 +08:00
xiaojunnuo
bc650a32cd docs: 1 2024-07-08 10:59:19 +08:00
xiaojunnuo
c6d3e3fe5b docs: 1 2024-07-08 10:57:42 +08:00
xiaojunnuo
73acc62af1 docs: 1 2024-07-08 10:56:19 +08:00
xiaojunnuo
0d4491f3a0 docs: 1 2024-07-08 10:55:55 +08:00
xiaojunnuo
85248044ab docs: 1 2024-07-08 10:53:55 +08:00
xiaojunnuo
c532449102 docs: 1 2024-07-05 10:56:29 +08:00
xiaojunnuo
970c7fd8a0 perf: 说明优化,默认值优化 2024-07-04 02:22:52 +08:00
xiaojunnuo
4656019898 v1.21.0 2024-07-04 01:15:51 +08:00
xiaojunnuo
7eceabb2d8 build: prepare to build 2024-07-04 01:14:33 +08:00
xiaojunnuo
eade2c2b68 feat: 支持zero ssl 2024-07-04 01:14:09 +08:00
xiaojunnuo
6ec950818c v1.20.17 2024-07-03 23:45:57 +08:00
xiaojunnuo
7058b20df4 build: prepare to build 2024-07-03 23:43:55 +08:00
xiaojunnuo
a09b0e48c1 perf: 文件上传提示由cert.crt改为cert.pem 2024-07-03 23:39:12 +08:00
xiaojunnuo
664bb66a91 Merge branch 'client_sync' into v2
# Conflicts:
#	packages/ui/certd-client/CHANGELOG.md
#	packages/ui/certd-client/package.json
2024-07-03 23:37:08 +08:00
xiaojunnuo
eba333de7a perf: 优化cname verify 2024-07-03 23:36:06 +08:00
xiaojunnuo
f47b35f6d5 perf: 创建dns解析后,强制等待60s 2024-07-03 23:27:35 +08:00
Greper
c04707c0f7 fix: 修复对Windows powershell 的支持
修复对Windows powershell 的支持 #73
2024-07-03 23:22:29 +08:00
ltxhhz
22ebcd4dd1 fixed #73 2024-07-03 18:30:38 +08:00
GitHub Actions Bot
692e2b5b96 🔱: [client] sync upgrade with 2 commits [trident-sync]
perf: 增加示例,FsInDrawer
2024-06-26 19:24:03 +00:00
GitHub Actions Bot
586d23fc55 🔱: [client] sync upgrade with 6 commits [trident-sync]
build: publish success
fix: 修复多级表头时列设置的问题

https://github.com/fast-crud/fast-crud/issues/175
chore: 1
fix: 修复element示例中远程搜索下拉框label不显示的bug

https://github.com/fast-crud/fast-crud/issues/422
fix: 修复独立使用对话框 openDialog方法await无返回值的bug
2024-06-23 19:23:47 +00:00
966 changed files with 19875 additions and 33716 deletions

89
.github/workflows/build-image.yml vendored Normal file
View File

@@ -0,0 +1,89 @@
name: build-image
on:
push:
branches: ['v2']
paths:
- "build.trigger"
# schedule:
# - # 国际时间 19:17 执行北京时间3:17 ↙↙↙ 改成你想要每天自动执行的时间
# - cron: '17 19 * * *'
permissions:
contents: read
jobs:
build-certd-image:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: get_certd_version
id: get_certd_version
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const fs = require('fs');
const path = require('path');
const pnpmWorkspace = "./pnpm-workspace.yaml";
fs.unlinkSync(pnpmWorkspace)
const jsonFilePath = "./packages/ui/certd-server/package.json";
const jsonContent = fs.readFileSync(jsonFilePath, 'utf-8');
const pkg = JSON.parse(jsonContent)
console.log("certd_version:",pkg.version);
return pkg.version
# - name: Use Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 18
# cache: 'npm'
# working-directory: ./packages/ui/certd-client
- run: |
npm install -g pnpm@8.15.7
pnpm install
npm run build
working-directory: ./packages/ui/certd-client
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to aliyun container Registry
uses: docker/login-action@v3
with:
registry: registry.cn-shenzhen.aliyuncs.com
username: ${{ secrets.aliyun_cs_username }}
password: ${{ secrets.aliyun_cs_password }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.dockerhub_username }}
password: ${{ secrets.dockerhub_password }}
- name: Build default platforms
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
context: ./packages/ui/
tags: |
registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest
registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${{steps.get_certd_version.outputs.result}}
greper/certd:latest
greper/certd:${{steps.get_certd_version.outputs.result}}
- name: Build armv7
uses: docker/build-push-action@v6
with:
platforms: linux/arm/v7
push: true
context: ./packages/ui/
tags: |
registry.cn-shenzhen.aliyuncs.com/handsfree/certd:armv7
registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${{steps.get_certd_version.outputs.result}}-armv7
greper/certd:armv7
greper/certd:${{steps.get_certd_version.outputs.result}}-armv7

55
.github/workflows/deploy-demo.yml vendored Normal file
View File

@@ -0,0 +1,55 @@
name: deploy-demo
on:
push:
branches: ['v2']
paths:
- "deploy.trigger"
workflow_run:
workflows: [ "build-image" ]
types:
- completed
# schedule:
# - # 国际时间 19:17 执行北京时间3:17 ↙↙↙ 改成你想要每天自动执行的时间
# - cron: '17 19 * * *'
permissions:
contents: read
jobs:
deploy-certd-demo:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: get_certd_version
id: get_certd_version
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const fs = require('fs');
const path = require('path');
const jsonFilePath = "./packages/ui/certd-server/package.json";
const jsonContent = fs.readFileSync(jsonFilePath, 'utf-8');
const pkg = JSON.parse(jsonContent)
console.log("certd_version:",pkg.version);
return pkg.version
- uses: GuillaumeFalourd/wait-sleep-action@v1
with:
time: '10' # for 60 seconds
- name: Send HTTP request
id: request
uses: tyrrrz/action-http-request@master
with:
url: http://flow-openapi.aliyun.com/pipeline/webhook/lzCzlGrLCOHQaTMMt0mG
method: POST
headers: |
Content-Type: application/json
body: |
{
"CERTD_VERSION": "${{steps.get_certd_version.outputs.result}}"
}
retry-count: 3
retry-delay: 5000

View File

@@ -2,8 +2,6 @@ name: sync-to-gitee
on:
push:
branches: ['v2']
pull_request:
branches: ['v2']
# schedule:
# - # 国际时间 19:17 执行北京时间3:17 ↙↙↙ 改成你想要每天自动执行的时间
# - cron: '17 19 * * *'

17
.gitignore vendored
View File

@@ -19,18 +19,13 @@ gen
/*.log
/packages/ui/*/.idea
/packages/ui/*/node_modules
/packages/*/node_modules
/packages/ui/certd-server/tmp/
/packages/ui/certd-ui/dist/
/other
/dev-sidecar-test
/packages/core/certd/yarn.lock
/packages/test
/test/own
/pnpm-lock.yaml
docker/image/workspace
/packages/core/lego
tsconfig.tsbuildinfo
test/**/*.js
/packages/ui/certd-server/data/db.sqlite
/packages/ui/certd-server/data/keys.yaml
/packages/pro/

3
.npmrc
View File

@@ -1 +1,2 @@
link-workspace-packages=deep
link-workspace-packages=true
prefer-workspace-packages=true

7
.prettierrc Normal file
View File

@@ -0,0 +1,7 @@
{
"printWidth": 160,
"bracketSpacing": true,
"singleQuote": true,
"trailingComma": "es5",
"arrowParens": "avoid"
}

View File

@@ -3,6 +3,255 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.3](https://github.com/certd/certd/compare/v1.25.2...v1.25.3) (2024-09-24)
### Bug Fixes
* 修复upload to host trim错误 ([0f0ddb9](https://github.com/certd/certd/commit/0f0ddb9c5963fd643d6d203334efac471c43ec3b))
## [1.25.2](https://github.com/certd/certd/compare/v1.25.1...v1.25.2) (2024-09-24)
**Note:** Version bump only for package root
## [1.25.1](https://github.com/certd/certd/compare/v1.25.0...v1.25.1) (2024-09-24)
**Note:** Version bump only for package root
# [1.25.0](https://github.com/certd/certd/compare/v1.24.4...v1.25.0) (2024-09-24)
### Bug Fixes
* 修复首次创建任务运行时不自动设置当前运行情况的bug ([ecd83ee](https://github.com/certd/certd/commit/ecd83ee136abdd3df9ed2f21ec2ff0f24c0ed9d9))
### Features
* 账号绑定 ([e046640](https://github.com/certd/certd/commit/e0466409d0c021bb415abd94df448c8a0d4799e9))
* 支持中间证书 ([e86756e](https://github.com/certd/certd/commit/e86756e4c65a53dd23106d7ecbfe2fa987cc13f3))
* 支持vip转移 ([361e8fe](https://github.com/certd/certd/commit/361e8fe7ae5877e23fd5de31bc919bedd09c57f5))
### Performance Improvements
* 群晖支持OTP双重验证登录 ([8b8039f](https://github.com/certd/certd/commit/8b8039f42bbce10a4d0e737cdeeeef9bb17bee5a))
* 任务支持禁用 ([8ed16b3](https://github.com/certd/certd/commit/8ed16b3ea2dfe847357863a0bfa614e4fa5fc041))
* 优化收件邮箱输入 ([22ef28f](https://github.com/certd/certd/commit/22ef28f6338a78465bd52ccbad13e66e80263b2f))
* 优化主机登录失败提示 ([9de77b3](https://github.com/certd/certd/commit/9de77b327d39cff5ed6660ec53b58ba0eea18e5a))
* 增加重启certd插件 ([48238d9](https://github.com/certd/certd/commit/48238d929e6c4afa1d428e4d35b9159d37a47ae0))
* 证书支持旧版RSApkcs1 ([3d9c3ec](https://github.com/certd/certd/commit/3d9c3ecb3eb604b2458154f608bde0f01915d116))
* 支持阿里云ACK证书部署 ([d331fea](https://github.com/certd/certd/commit/d331fea47789122650e057ec7c9e85ee8e66f09b))
* 支持七牛云 ([8ecc2f9](https://github.com/certd/certd/commit/8ecc2f9446a9ebd11b9bfbffbb6cf7812a043495))
* 支持k8s ingress secret ([e5a5d0a](https://github.com/certd/certd/commit/e5a5d0a607bb6b4e1a1f7a1a419bada5f2dee59f))
* http请求增加默认超时时间 ([664bd86](https://github.com/certd/certd/commit/664bd863e5b4895aabe2384277c0c65f5902fdb2))
* plugins增加图标 ([a8da658](https://github.com/certd/certd/commit/a8da658a9723342b4f43a579f7805bfef0648efb))
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
### Bug Fixes
* 修复腾讯云cdn证书部署后会自动关闭hstshttp2.0等配置的bug ([7908ab7](https://github.com/certd/certd/commit/7908ab79da624c94fa05849925b15e480e3317c4))
* 修复腾讯云tke证书部署报错的bug ([653f409](https://github.com/certd/certd/commit/653f409d91a441850d6381f89a8dd390831f0d5e))
### Performance Improvements
* 插件选择支持搜索 ([d1498a7](https://github.com/certd/certd/commit/d1498a71601b74d38343b1d070eadd03705dd9d5))
* 前置任务步骤增加错误提示 ([ae3daa9](https://github.com/certd/certd/commit/ae3daa9bcf4fc363825aad9b77f5d3879aeeff70))
* 群晖部署教程 ([0f0af2f](https://github.com/certd/certd/commit/0f0af2f309390f388e7a272cea3a1dd30c01977d))
* 支持群晖 ([5c270b6](https://github.com/certd/certd/commit/5c270b6b9d45a2152f9fdb3c07bd98b7c803cb8e))
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
### Performance Improvements
* 支持多吉云cdn证书部署 ([65ef685](https://github.com/certd/certd/commit/65ef6857296784ca765926e09eafcb6fc8b6ecde))
## [1.24.2](https://github.com/certd/certd/compare/v1.24.1...v1.24.2) (2024-09-06)
### Bug Fixes
* 修复复制流水线出现的各种问题 ([6314e8d](https://github.com/certd/certd/commit/6314e8d7eb58cd52e2a7bd3b5ffb9112b0b69577))
* 修复windows下无法执行第二条命令的bug ([71ac8aa](https://github.com/certd/certd/commit/71ac8aae4aa694e1a23761e9761c9fba30b43a21))
### Performance Improvements
* 阶段、任务、步骤全面支持拖动排序 ([bd73a16](https://github.com/certd/certd/commit/bd73a163cd0497f062bd424ddc6bc9bbc95f81ea))
* 任务配置不需要的字段可以自动隐藏 ([192d9dc](https://github.com/certd/certd/commit/192d9dc7e36737d684c769f255f407c28b1152ac))
* 任务支持拖动排序 ([1e9b563](https://github.com/certd/certd/commit/1e9b5638aa36a8ce70019a9c750230ba41938327))
* 西部数据支持用户级的apikey ([1c17b41](https://github.com/certd/certd/commit/1c17b41e160944b073e1849e6f9467c3659a4bfc))
* 修复windows下无法执行第二条命令的bug ([d5bfcdb](https://github.com/certd/certd/commit/d5bfcdb6de1dcc1702155442e2e00237d0bbb6e5))
* 优化跳过处理逻辑 ([b80210f](https://github.com/certd/certd/commit/b80210f24bf5db1c958d06ab27c9e5d3db452eda))
* 支持阿里云oss ([87a2673](https://github.com/certd/certd/commit/87a2673e8c33dff6eda1b836d92ecc121564ed78))
* 支持西部数码DNS ([c59cab1](https://github.com/certd/certd/commit/c59cab1aaeb19f86df8e3e0d8127cbd0a9ef77f3))
* 支持pfx、der ([fbeaed2](https://github.com/certd/certd/commit/fbeaed203519f59b6d9396c4e8953353ccb5e723))
* client 请求超时时间延长为10s ([ff46771](https://github.com/certd/certd/commit/ff46771d8dd43e71c1ca70e3ba783945750342cc))
## [1.24.1](https://github.com/certd/certd/compare/v1.24.0...v1.24.1) (2024-09-02)
### Bug Fixes
* 激活仅限管理员 ([1c17970](https://github.com/certd/certd/commit/1c17970b981f0987c506744ee6b2283fd5e40493))
* 修复在没有勾选使用代理的情况下仍然会使用代理的bug ([0f66794](https://github.com/certd/certd/commit/0f6679425f6a736bb0128527dd99c085fac17d84))
### Performance Improvements
* 部署插件支持宝塔、易盾云等 ([ee61709](https://github.com/certd/certd/commit/ee617095efa1171548cf52fd45f0f98a368555a3))
* 授权配置支持加密 ([42a56b5](https://github.com/certd/certd/commit/42a56b581d754c3e5f9838179d19ab0d004ef2eb))
* 优化内存占用 ([db61033](https://github.com/certd/certd/commit/db6103363364440b650bc10bb334834e4a9470c7))
* 支持阿里云 DCDN ([98b77f8](https://github.com/certd/certd/commit/98b77f80843834616fb26f83b4c42245326abd06))
* 支持已跳过的步骤重新运行 ([ea775ad](https://github.com/certd/certd/commit/ea775adae18d57a04470cfba6b9460d761d74035))
* 支持cdnfly ([724a850](https://github.com/certd/certd/commit/724a85028b4a7146c9e3b4df4497dcf2a7bf7c67))
* 支持ftp上传 ([b9bddbf](https://github.com/certd/certd/commit/b9bddbfabb5664365f1232e9432532187c98006c))
# [1.24.0](https://github.com/certd/certd/compare/v1.23.1...v1.24.0) (2024-08-25)
### Bug Fixes
* 部署到腾讯云cdn选择证书任务步骤限制只能选证书 ([3345c14](https://github.com/certd/certd/commit/3345c145b802170f75a098a35d0c4b8312efcd17))
* 修复成功后跳过之后丢失腾讯云证书id的bug ([37eb762](https://github.com/certd/certd/commit/37eb762afe25c5896b75dee25f32809f8426e7b7))
* 修复创建流水线后立即运行时报no id错误的bug ([17ead54](https://github.com/certd/certd/commit/17ead547aab25333603980304aa3aad3db1f73d5))
* 修复使用代理的情况下申请证书失败的bug ([95122e2](https://github.com/certd/certd/commit/95122e28609333f4df55c266e5434897954c0fb3))
* 修复执行日志没有清理的bug ([22a3363](https://github.com/certd/certd/commit/22a336370a88a7df2a23c967043bae153da71ed5))
* 修复重置密码参数配置后无效的bug ([e358a88](https://github.com/certd/certd/commit/e358a8869696578687306e4cd0dcda53f898fe13))
* 修复ssh无法连接成功无法执行命令的bug ([41b9837](https://github.com/certd/certd/commit/41b9837582323fb400ef8525ce65e8b37ad4b36f))
### Features
* 支持ECC类型 ([a7424e0](https://github.com/certd/certd/commit/a7424e02f5c7e02ac1688791040785920ce67473))
* 支持google证书申请需要使用代理 ([a593056](https://github.com/certd/certd/commit/a593056e79e99dd6a74f75b5eab621af7248cfbe))
### Performance Improvements
* 更新k8s底层api库 ([746bb9d](https://github.com/certd/certd/commit/746bb9d385e2f397daef4976eca1d4782a2f5ebd))
* 优化成功后跳过的提示 ([7b451bb](https://github.com/certd/certd/commit/7b451bbf6e6337507f4627b5a845f5bd96ab4f7b))
* 优化证书申请成功率 ([968c469](https://github.com/certd/certd/commit/968c4690a07f69c08dcb3d3a494da4e319627345))
* 优化dnspod的token id 说明 ([790bf11](https://github.com/certd/certd/commit/790bf11af06d6264ef74bc1bb919661f0354239a))
* email proxy ([453f1ba](https://github.com/certd/certd/commit/453f1baa0b9eb0f648aa1b71ccf5a95b202ce13f))
## [1.23.1](https://github.com/certd/certd/compare/v1.23.0...v1.23.1) (2024-08-06)
### Bug Fixes
* 修复模糊查询无效的bug ([9355917](https://github.com/certd/certd/commit/93559174c780173f0daec7cdbd1f72f8d5c504d5))
### Performance Improvements
* 优化插件字段的default value ([24c7be2](https://github.com/certd/certd/commit/24c7be2c9cb39c14f7a97b674127c88033280b02))
* 优化默认值设置 ([1af19f0](https://github.com/certd/certd/commit/1af19f0ac053fe109782882964533636b5969d6b))
# [1.23.0](https://github.com/certd/certd/compare/v1.22.9...v1.23.0) (2024-08-05)
### Bug Fixes
* 修复环境变量多个下划线不生效的bug ([7ec2218](https://github.com/certd/certd/commit/7ec2218c9fee5bee2bf0aa31f3e3a4301575f247))
### Features
* use node 20 ([e8ed972](https://github.com/certd/certd/commit/e8ed97206bf28e83f942db2ef4ea07fa76fd3567))
## [1.22.9](https://github.com/certd/certd/compare/v1.22.8...v1.22.9) (2024-08-05)
### Performance Improvements
* 优化定时任务 ([87e440e](https://github.com/certd/certd/commit/87e440ee2a8b10dc571ce619f28bc83c1e5eb147))
## [1.22.8](https://github.com/certd/certd/compare/v1.22.7...v1.22.8) (2024-08-05)
### Performance Improvements
* 修复删除历史记录没有删除log的bug新增history管理页面演示站点启动时不自动启动非管理员用户的定时任务 ([f78ae93](https://github.com/certd/certd/commit/f78ae93eedfe214008c3d071ca3d77c962137a64))
* 优化pipeline删除时删除其他history ([b425203](https://github.com/certd/certd/commit/b4252033d56a9ad950f3e204ff021497c3978015))
## [1.22.7](https://github.com/certd/certd/compare/v1.22.6...v1.22.7) (2024-08-04)
### Bug Fixes
* 修复保存配置报id不能为空的bug ([367f807](https://github.com/certd/certd/commit/367f80731396003416665c22853dfbc09c2c03a0))
## [1.22.6](https://github.com/certd/certd/compare/v1.22.5...v1.22.6) (2024-08-03)
### Bug Fixes
* 修复在相同的cron时偶尔无法触发定时任务的bug ([680941a](https://github.com/certd/certd/commit/680941af119619006b592e3ab6fb112cb5556a8b))
* 修复pg下pipeline title 类型问题 ([a9717b9](https://github.com/certd/certd/commit/a9717b9a0df7b5a64d4fe03314fecad4f59774cc))
### Performance Improvements
* 流水线支持名称模糊查询 ([59897c4](https://github.com/certd/certd/commit/59897c4ceae992ebe2972ca9e8f9196616ffdfd7))
* 腾讯云clb支持更多大区选择 ([e4f4570](https://github.com/certd/certd/commit/e4f4570b29f26c60f1ee9660a4c507cbeaba3d7e))
* 优化前置任务输出为空的提示 ([6ed1e18](https://github.com/certd/certd/commit/6ed1e18c7d9c46d964ecc6abc90f3908297b7632))
## [1.22.5](https://github.com/certd/certd/compare/v1.22.4...v1.22.5) (2024-07-26)
### Bug Fixes
* 修复用户管理无法添加用户的bug ([e7e89b8](https://github.com/certd/certd/commit/e7e89b8de7386e84c0d6b8e217e2034909657d68))
## [1.22.4](https://github.com/certd/certd/compare/v1.22.3...v1.22.4) (2024-07-26)
### Performance Improvements
* 证书申请支持反向代理letsencrypt无法访问时的备用方案 ([b7b5df0](https://github.com/certd/certd/commit/b7b5df0587e0f7ea288c1b2af6f87211f207395f))
* 支持arm64 ([fa14f87](https://github.com/certd/certd/commit/fa14f87a8093ef3addc5e5f3315ce1bfc9982782))
## [1.22.3](https://github.com/certd/certd/compare/v1.22.2...v1.22.3) (2024-07-25)
### Bug Fixes
* lege 无执行权限问题 ([338eb3b](https://github.com/certd/certd/commit/338eb3bdfeb461e9b3bc7eee97b97a59f5642ffe))
## [1.22.2](https://github.com/certd/certd/compare/v1.22.1...v1.22.2) (2024-07-23)
### Bug Fixes
* 修复创建流水线时无法根据dns类型默认正确的dns授权的bug ([a2c43b5](https://github.com/certd/certd/commit/a2c43b50a6069ed48958fd142844a8568c2af452))
## [1.22.1](https://github.com/certd/certd/compare/v1.22.0...v1.22.1) (2024-07-20)
### Performance Improvements
* 创建证书任务可以选择lege插件 ([affef13](https://github.com/certd/certd/commit/affef130378030c517250c58a4e787b0fc85d7d1))
* 创建证书任务增加定时任务和邮件通知输入 ([427620d](https://github.com/certd/certd/commit/427620d34f3b8ad6933005faf1878908441a2453))
* 支持配置启动后自动触发一次任务 ([a5a0c1f](https://github.com/certd/certd/commit/a5a0c1f6e7a3f05e581005e491d5b102ee854412))
# [1.22.0](https://github.com/certd/certd/compare/v1.21.2...v1.22.0) (2024-07-19)
### Features
* 升级midway支持esm ([485e603](https://github.com/certd/certd/commit/485e603b5165c28bc08694997726eaf2a585ebe7))
* 支持lego海量DNS提供商 ([0bc6d0a](https://github.com/certd/certd/commit/0bc6d0a211920fb0084d705e1db67ee1e7262c44))
* 支持postgresql ([3b19bfb](https://github.com/certd/certd/commit/3b19bfb4291e89064b3b407a80dae092d54747d5))
### Performance Improvements
* 优化一些小细节 ([b168852](https://github.com/certd/certd/commit/b1688525dbbbfd67e0ab1cf5b4ddfbe9d394f370))
* 增加备案号设置 ([bd3d959](https://github.com/certd/certd/commit/bd3d959944db63a5690b55ee150e1007133868b9))
* 自动生成jwtkey无需手动配置 ([390e485](https://github.com/certd/certd/commit/390e4853a570390a97df6a3b3882579f9547eeb4))
## [1.21.2](https://github.com/certd/certd/compare/v1.21.1...v1.21.2) (2024-07-08)
### Performance Improvements
* 申请证书时可以选择跳过本地dns校验 ([fe91d94](https://github.com/certd/certd/commit/fe91d94090d22ed0a3ea753ba74dfaa1bf057c17))
## [1.21.1](https://github.com/certd/certd/compare/v1.21.0...v1.21.1) (2024-07-08)
### Performance Improvements
* 上传到主机支持设置不mkdirs ([5ba9831](https://github.com/certd/certd/commit/5ba9831ed1aa6ec6057df246f1035b36b9c41d2e))
* 说明优化,默认值优化 ([970c7fd](https://github.com/certd/certd/commit/970c7fd8a0f557770e973d8462ee5684ef742810))
# [1.21.0](https://github.com/certd/certd/compare/v1.20.17...v1.21.0) (2024-07-03)
### Features
* 支持zero ssl ([eade2c2](https://github.com/certd/certd/commit/eade2c2b681569f03e9cd466e7d5bcd6703ed492))
## [1.20.17](https://github.com/certd/certd/compare/v1.20.16...v1.20.17) (2024-07-03)
### Performance Improvements
* 创建dns解析后强制等待60s ([f47b35f](https://github.com/certd/certd/commit/f47b35f6d5bd7d675005c3e286b7e9a029201f8b))
* 文件上传提示由cert.crt改为cert.pem ([a09b0e4](https://github.com/certd/certd/commit/a09b0e48c176f3ed763791bd50322c29729f7c1c))
* 优化cname verify ([eba333d](https://github.com/certd/certd/commit/eba333de7a5b5ef4b0b7eaa904f578720102fa61))
## [1.20.16](https://github.com/certd/certd/compare/v1.20.15...v1.20.16) (2024-07-01)
### Bug Fixes

30
LICENSE.md Normal file
View File

@@ -0,0 +1,30 @@
# Certd Open Source License
- This project is licensed under the **GNU Affero General Public License (AGPL)** with the following additional terms.
- 本项目遵循 GNU Affero General Public LicenseAGPL并附加以下条款。
## 1. License Terms ( 许可证条款 )
1. **Freedom to Use** (自由使用)
- You are free to use, copy, modify, and distribute the source code of this project for personal or organizational use, provided that you comply with the terms of this license.
- 您可以自由使用、复制、修改和分发本项目的源代码,前提是您遵循本许可证的条款。
2. **Modification for Personal Use** (个人使用的修改)
- Individuals and companies are allowed to modify the project according to their needs for non-commercial purposes. However, modifications to the logo, copyright information, or any code related to licensing are strictly prohibited.
- 个人和公司允许根据自身需求对本项目进行修改以供非商业用途。但任何对logo、版权信息或与许可相关代码的修改都是严格禁止的。
3. **Commercial Authorization** (商业授权)
- If you wish to make any form of monetary gain from this project, you must first obtain commercial authorization from the original author. Users should contact the author directly to negotiate the relevant licensing terms.
- 如果您希望从本项目获得任何形式的经济收益,您必须首先从原作者处获得商业授权,用户应直接与作者联系,以协商相关许可条款。
4. **Retention of Rights** (保留权利)
- All rights, title, and interest in the project remain with the original author.
- 本项目的所有权利、标题和利益仍归原作者所有。
## 2. As a contributor ( 作为贡献者 )
- you should agree that your contributed code:
- 您应同意您贡献的代码:
1. - The original author can adjust the open-source agreement to be more strict or relaxed.
- 原作者可以调整开源协议以使其更严格或更宽松。
2. - Can be used for commercial purposes.
- 可用于商业用途。

202
README.md
View File

@@ -1,28 +1,45 @@
# CertD
# Certd
CertD 是一个免费全自动申请和部署SSL证书的工具。
后缀D取自linux守护进程的命名风格意为证书守护进程。
Certd 是一个免费全自动申请和自动部署更新SSL证书的工具。
后缀d取自linux守护进程的命名风格意为证书守护进程。
关键字:证书自动申请、证书自动更新、证书自动续期、证书自动续签
************************
支持开源,为爱发电,我已入驻爱发电
https://afdian.com/a/greper
发电权益:
1. 可加入发电专属群,可以获得作者一对一技术支持
2. 您的需求我们将优先实现,并且将作为专业版功能提供
3. 一年期专业版激活码
4. 赠送国外免费服务器部署方案0成本使用Certd可能需要翻墙不过现在性能越来越差了
专业版特权
1. 证书流水线条数无限制免费版限制10条
2. 免配置发邮件功能
3. FTP上传、cdnfly、宝塔等部署插件
4. 更多功能增加中...
************************
## 一、特性
本项目不仅支持证书申请过程自动化,还可以自动化部署证书,让你的证书永不过期。
本项目不仅支持证书申请过程自动化,还可以自动化部署更新证书,让你的证书永不过期。
* 全自动申请证书支持阿里云、腾讯云、华为云、Cloudflare注册的域名
* 全自动部署证书(目前支持服务器上传部署、部署到阿里云、腾讯云等)
* 支持通配符域名
* 支持多个域名打到一个证书上
* 全自动申请证书支持阿里云、腾讯云、华为云、Cloudflare等各种途径注册的域名)
* 全自动部署更新证书(目前支持部署到主机、部署到阿里云、腾讯云等)
* 支持通配符域名/泛域名,支持多个域名打到一个证书上
* 邮件通知
* 证书自动更新
* 私有化部署,保障安全
* 免费、免费、免费([阿里云单个通配符域名证书最便宜也要1800/年](https://yundun.console.aliyun.com/?p=cas#/certExtend/buy/cn-hangzhou)
## 二、在线体验
官方Demo地址自助注册后体验
https://certd.handsfree.work/
> 注意数据将不定期清理,生产使用请自行部署
> 注意数据将不定期清理,不定期停止定时任务,生产使用请自行部署
> 包含敏感信息,务必自己本地部署进行生产使用
## 三、使用教程
@@ -38,97 +55,135 @@ https://certd.handsfree.work/
-------> [点我查看详细使用步骤演示](./step.md) <--------
↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
## 四、本地docker部署
当前支持的部署插件列表
![演示](./doc/images/plugins.png)
### 1. 安装docker、docker-compose
## 四、私有化部署
由于证书、授权信息等属于高度敏感数据,请务必私有化部署,保障数据安全
### 4.1 宝塔面板一键部署【推荐】
1. 安装宝塔面板,前往 [宝塔面板](https://www.bt.cn/u/CL3JHS) 官网,选择正式版的脚本下载安装
2. 安装后登录宝塔面板,在菜单栏中点击 Docker首次进入会提示安装Docker服务点击立即安装按提示完成安装
3. 安装完成后在应用商店中找到`certd`,点击安装,配置域名等基本信息即可完成安装
### 4.2 Docker部署
#### 1. 安装docker、docker-compose
1.1 准备一台云服务器
* 【阿里云】云服务器2核2G新老用户同享99元/年,续费同价!【 [立即购买](https://www.aliyun.com/benefit?scm=20140722.M_10244282._.V_1&source=5176.11533457&userCode=qya11txb )】
* 【腾讯云】云服务器2核2G新老用户同享99元/年,续费同价!【 [立即购买](https://cloud.tencent.com/act/cps/redirect?redirect=6094&cps_key=b3ef73330335d7a6efa4a4bbeeb6b2c9&from=console)】
1.2 安装docker
https://docs.docker.com/engine/install/
选择对应的操作系统,按照官方文档执行命令即可
1.2 安装docker
https://docs.docker.com/engine/install/
选择对应的操作系统,按照官方文档执行命令即可
### 2. 下载docker-compose.yaml文件
#### 2. 运行certd
[docker-compose.yaml下载](https://gitee.com/certd/certd/raw/v2/docker/run/docker-compose.yaml)
[docker-compose.yaml 下载](https://gitee.com/certd/certd/raw/v2/docker/run/docker-compose.yaml)
当前版本号: ![](https://img.shields.io/npm/v/%40certd%2Fpipeline)
```bash
# 随便创建一个目录
mkdir certd
# 进入目录
cd certd
# wget下载docker-compose.yaml文件
wget https://raw.githubusercontent.com/certd/certd/v2/docker/run/docker-compose.yaml
# 或者使用gitee地址
# 下载docker-compose.yaml文件或者手动下载放到certd目录下
wget https://gitee.com/certd/certd/raw/v2/docker/run/docker-compose.yaml
# 根据需要修改里面的配置
# 可以根据需要修改里面的配置
# 1.修改镜像版本号【可选】
# 2.配置数据保存路径【可选】
# 3.配置certd_auth_jwt_secret【必须
vi docker-compose.yaml
# 3.修改端口号【可选
vi docker-compose.yaml # 【可选】
# 启动certd
docker compose up -d
```
> 镜像版本号与release版本号同步
https://github.com/certd/certd/releases
> 如果提示 没有compose命令,请安装docker-compose
> https://docs.docker.com/compose/install/linux/
#### 镜像说明:
* 国内镜像地址:
* `registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest`
* `registry.cn-shenzhen.aliyuncs.com/handsfree/certd:armv7``[version]-armv7`
* DockerHub地址
* `https://hub.docker.com/r/greper/certd`
* `greper/certd:latest`
* `greper/certd:armv7``greper/certd:[version]-armv7`
* 镜像构建通过`Actions`自动执行,过程公开透明,请放心使用
* [点我查看镜像构建日志](https://github.com/certd/certd/actions/workflows/build-image.yml)
![](./doc/images/action-build.jpg)
#### 3. 访问
http://your_server_ip:7001
默认账号密码admin/123456
记得修改密码
### 3. 运行
```bash
# 如果docker compose是插件化安装
export CERTD_VERSION=latest
## 五、 升级
如果使用固定版本号
1. 修改`docker-compose.yaml`中的镜像版本号
2. 运行`docker compose up -d` 即可
如果使用`latest`版本
```shell
#重新拉取镜像
docker pull registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest
# 重新启动容器
docker compose down
docker compose up -d
```
如果提示 没有compose命令,请安装docker-compose
https://docs.docker.com/compose/install/linux/
> 数据默认存在`/data/certd`目录下,不用担心数据丢失
### 4. 访问
http://your_server_ip:7001
默认账号密码admin/123456
记得修改密码
更新日志: [CHANGELOG](./CHANGELOG.md)
### 5. 升级
* 修改版本号,重新运行 `docker compose up -d` 即可
* 数据存在`/data/certd`目录下,不用担心数据丢失
## 五、一些说明
## 六、一些说明
* 本项目ssl证书提供商为letencrypt
* 申请过程遵循acme协议
* 需要验证域名所有权一般有两种方式目前本项目仅支持dns-01
* http-01 在网站根目录下放置一份txt文件
* dns-01 需要给域名添加txt解析记录通配符域名只能用这种方式
* 证书续期:
* 实际上acme并没有续期概念
* 我们所说的续期,其实就是按照全套流程重新申请一份新证书。
* 实际上没有办法不改变证书文件本身情况下直接续期或者续签
* 我们所说的续期,其实就是按照全套流程重新申请一份新证书,然后重新部署上去
* 免费证书过期时间90天以后可能还会缩短所以自动化部署必不可少
* 设置每天自动运行当证书过期前20天会自动重新申请证书并部署
## 六、不同平台的设置说明
## 七、不同平台的设置说明
* [Cloudflare](./doc/cf/cf.md)
* [腾讯云](./doc/tencent/tencent.md)
* [windows主机](./doc/host/host.md)
* [google证书](./doc/google/google.md)
* [群晖部署certd及证书更新教程](./doc/synology/index.md)
## 、问题处理
## 、问题处理
### 7.1 忘记管理员密码
解决方法如下:
1. 修改docker-compose.yaml文件将环境变量`certd_system_resetAdminPassword`改为`true`
1. 修改docker-compose.yaml文件将环境变量`certd_system_resetAdminPasswd`改为`true`
```yaml
services:
certd:
environment: # 环境变量
- certd_system_resetAdminPassword=false
- certd_system_resetAdminPasswd=false
```
2. 重启容器
```shell
@@ -136,14 +191,14 @@ docker compose up -d
docker logs -f --tail 500 certd
# 观察日志当日志中输出“重置1号管理员用户的密码完成”即可操作下一步
```
3. 修改docker-compose.yaml`certd_system_resetAdminPassword`改回`false`
3. 修改docker-compose.yaml`certd_system_resetAdminPasswd`改回`false`
4. 再次重启容器
```shell
docker compose up -d
```
5. 使用admin/123456登录系统请及时修改管理员密码
5. 使用`admin/123456`登录系统,请及时修改管理员密码
## 、联系作者
## 、联系作者
如有疑问欢迎加入群聊请备注certd
* QQ群141236433
* 微信群:
@@ -155,20 +210,39 @@ docker compose up -d
<img height="230" src="./doc/images/me.png">
</p>
## 、捐赠
媳妇儿说:“一天到晚搞开源,也不管管老婆孩子!😡😡😡”
拜托各位捐赠支持一下,让媳妇儿开心开心,我也能有更多时间进行开源项目,感谢🙏🙏🙏
<p align="center">
<img height="380" src="./doc/images/donate.png">
</p>
## 、捐赠
支持开源,为爱发电,我已入驻爱发电
https://afdian.com/a/greper
发电权益:
1. 可加入发电专属群(先加我好友,发送发电截图,我拉你进群)
2. 你的需求优先实现
3. 可以获得作者一对一技术支持
4. 更多权益陆续增加中...
## 十、贡献代码
## 十、贡献代码
[贡献插件教程](./plugin.md)
1. [贡献插件教程](./plugin.md)
2. 作为贡献者,代表您同意您贡献的代码如下许可:
1. 可以调整开源协议以使其更严格或更宽松。
2. 可以用于商业用途。
## 十二、 开源许可
* 本项目遵循 GNU Affero General Public LicenseAGPL开源协议。
* 允许个人和公司使用、复制、修改和分发本项目,禁止任何形式的商业用途
* 未获得商业授权情况下禁止任何对logo、版权信息及授权许可相关代码的修改。
* 如需商业授权,请联系作者。
## 十、我的其他项目
## 十、我的其他项目求Star
* [袖手GPT](https://ai.handsfree.work/) ChatGPT国内可用无需FQ每日免费额度
* [fast-crud](https://gitee.com/fast-crud/fast-crud/) 基于vue3的crud快速开发框架
* [dev-sidecar](https://github.com/docmirror/dev-sidecar/) 直连访问github工具无需FQ解决github无法访问的问题
## 十四、更新日志
更新日志:[CHANGELOG](./CHANGELOG.md)

1
build.trigger Normal file
View File

@@ -0,0 +1 @@
1

View File

@@ -1,6 +1,5 @@
import http from 'axios'
import fs from 'fs'
//读取 packages/core/pipline/package.json的版本号
import {default as packageJson} from './packages/core/pipeline/package.json' assert { type: "json" };
@@ -33,8 +32,9 @@ async function getPackages(directoryPath) {
async function getAllPackages() {
const base = await getPackages("./packages/core")
const plugins = await getPackages("./packages/plugins")
const libs = await getPackages("./packages/libs")
return base.concat(plugins)
return base.concat(plugins).concat(libs)
}
async function sync() {
@@ -49,7 +49,7 @@ async function sync() {
data: {}
})
console.log(`sync success:${pkg}`)
await sleep(100*1000)
await sleep(30*1000)
}
}
@@ -79,7 +79,7 @@ async function triggerBuild() {
}
})
console.log(`webhook success:${webhook}`)
await sleep(10*60*1000)
await sleep(30*60*1000)
}
}
@@ -87,9 +87,9 @@ async function triggerBuild() {
async function start() {
// await build()
console.log("等待60秒")
await sleep(200 * 1000)
await sleep(100* 1000)
await sync()
await sleep(60 * 1000)
await sleep(100 * 1000)
await triggerBuild()
}

1
deploy.trigger Normal file
View File

@@ -0,0 +1 @@
5

0
doc/deploy/koyeb.md Normal file
View File

37
doc/google/google.md Normal file
View File

@@ -0,0 +1,37 @@
# google证书申请教程
## 1、启用API
打开如下链接,启用 API
https://console.cloud.google.com/apis/library/publicca.googleapis.com
打开该链接后点击“启用”随后等待右侧出现“API已启用”则可以关闭该页。
## 2、 申请Key
随后打开“Google Cloud Shell”在右上角点击激活CloudShell图标
等待分配完成后在 Shell 窗口内输入如下命令:
```shell
gcloud beta publicca external-account-keys create
```
此时会弹出“为 Cloud Shell 提供授权”,点击授权即可。
执行完成后会返回类似如下输出;注意不要在没有收到 Google 的邮件时执行该命令,会返回命令不存在。
```shell
Created an external account key
[b64MacKey: xxxxxxxxxxxxxxxx
keyId: xxxxxxxxxxxxx]
```
记录以上信息备用注意keyId是不带中括号的
## 3、 创建证书流水线
选择证书提供商为google 开启使用代理
## 4、 将key信息作为EAB授权信息
google证书需要EAB授权 使用第二步中的 keyId 和 b64MacKey 信息创建一条EAB授权记录
注意keyId没有`]`结尾,不要把`]`也复制了
## 5、 其他就跟正常申请证书一样了

BIN
doc/images/action-build.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
doc/images/plugins.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 KiB

BIN
doc/synology/images/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

BIN
doc/synology/images/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

BIN
doc/synology/images/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
doc/synology/images/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
doc/synology/images/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
doc/synology/images/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

41
doc/synology/index.md Normal file
View File

@@ -0,0 +1,41 @@
# 群晖部署和证书更新
## 一、群晖系统上部署Certd教程
### 1. 打开Container Manager
![](./images/1.png)
### 2. 新增项目
![](./images/2.png)
### 3. 配置Certd项目
![](./images/3.png)
### 4. 外网访问设置
![](./images/4.png)
### 5. 确认项目信息
![](./images/5.png)
点击完成安装等待certd启动完成即可
### 6. 门户配置向导【可选】
![](./images/6.png)
## 二、更新群晖证书
## 1. 前提条件
* 已经部署了certd
* 群晖上已经设置好了证书(证书建议设置好描述,插件需要根据描述查找证书)
## 2. 在certd上配置自动更新群晖证书插件
![](./images/deploy.png)

View File

@@ -1,20 +0,0 @@
FROM registry.cn-shenzhen.aliyuncs.com/handsfree/node:18-alpine
EXPOSE 7001
ENV NODE_ENV production
ENV MIDWAY_SERVER_ENV production
WORKDIR /app/
#RUN npm install -g pnpm
#RUN npm install cross-env -g --registry=https://registry.npmmirror.com
#RUN npm install pm2 -g --registry=https://registry.npmmirror.com
#RUN pm2 install pm2-logrotate
ADD ./workspace/certd-server/ /app/
RUN sed -i "s/workspace://g" "/app/package.json"
RUN yarn install --production --registry=https://registry.npmmirror.com
#RUN yarn install --production
RUN npm run build
#CMD ["pm2-runtime", "start", "./bootstrap.js","--name", "certd","-i","1"]
CMD ["npm", "run","start"]

View File

@@ -1,37 +0,0 @@
#!/bin/bash
set -e
echo "请先输入一个版本号:"
read version
echo "您输入的版本号是: $version"
echo "登录aliyun镜像仓库"
sudo docker login --username=252959493@qq.com registry.cn-shenzhen.aliyuncs.com
build=$(pwd)
cd ../../
root=$(pwd)
echo "安装依赖"
#pnpm install --registry=https://registry.npmmirror.com
pnpm install
echo "client build"
cd $root/packages/ui/certd-client
pnpm run build
echo "client build success"
echo "server build"
cd $root/packages/ui/certd-server
pnpm run build
echo "server build success"
echo "rm node_modules"
rm ./node_modules -rf
echo "copy to workspace"
mkdir -p $build/workspace/certd-server
\cp ./* $build/workspace/certd-server -rf
\cp ../certd-client/dist/* $build/workspace/certd-server/public/ -rf
#export TAG=$version
#sudo -E docker compose build
#sudo -E docker compose push

View File

@@ -1,26 +1,43 @@
version: '3.3'
#version: '3.3'
services:
certd:
# 镜像 # ↓↓↓↓↓ --- 1、 修改镜像版本号,或者干脆写成latest 如果设置了环境变量 export CERTD_VERSION=latest这里可以不修改
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${CERTD_VERSION}
# 镜像 # ↓↓↓↓↓ --- 镜像版本号,建议改成固定版本号
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest
container_name: certd # 容器名
restart: unless-stopped # 自动重启
volumes:
# ↓↓↓↓↓ ------------------------------------------------------- 2、 修改数据库以及证书存储路径【可选
# ↓↓↓↓↓ -------------------------------------------------------- 数据库以及证书存储路径,默认存在宿主机的/data/certd/目录下,【您需要定时备份此目录,以保障数据容灾
- /data/certd:/app/data
ports: # 端口映射
# ↓↓↓↓ 如果端口有冲突可以修改第一个7001为其他不冲突的端口号
# ↓↓↓↓ ---------------------------------------------------------- 如果端口有冲突可以修改第一个7001为其他不冲突的端口号
- "7001:7001"
dns:
# ↓↓↓↓ ---------------------------------------------------------- 如果出现getaddrinfo ENOTFOUND等错误可以尝试修改或注释dns配置
- 223.5.5.5
- 223.6.6.6
# ↓↓↓↓ ---------------------------------------------------------- 如果你服务器部署在国外可以用8.8.8.8替换上面的dns
# - 8.8.8.8
# - 8.8.4.4
# extra_hosts:
# ↓↓↓↓ ---------------------------------------------------------- 这里可以配置自定义hosts外网域名可以指向本地局域网ip地址
# - "localdomain.comm:192.168.1.3"
environment: # 环境变量
- TZ=Asia/Shanghai
- certd_auth_jwt_secret=changeme
# ↑↑↑↑↑ ---------------------------------- 3、 修改成你的自定义密钥【必须,安全需要】
- certd_system_resetAdminPassword=false
# ↑↑↑↑↑ 如果忘记管理员密码可以设置为true重启之后管理员密码将改成123456然后请及时修改回false
#- HTTPS_PROXY=http://xxxxxx:xx
#- HTTP_PROXY=http://xxxxxx:xx
# ↑↑↑↑↑ ------------------------------------- 这里可以设置http代理
- certd_system_resetAdminPasswd=false
# ↑↑↑↑↑--------------------------- 如果忘记管理员密码可以设置为true重启之后管理员密码将改成123456然后请及时修改回false
- certd_cron_immediateTriggerOnce=false
# ↑↑↑↑↑--------------------------- 如果设置为true启动后所有配置了cron的流水线任务都将被立即触发一次
- VITE_APP_ICP_NO=
# ↑↑↑↑↑ ----------------------------------------- 这里可以设置备案号
#- certd_koa_key=./data/ssl/cert.key
#- certd_koa_cert=./data/ssl/cert.crt
# ↑↑↑↑↑ ----------------------------------------- 配置证书和key则表示https方式启动使用https协议访问https://your.domain:7001
# 设置环境变量即可自定义certd配置
# 服务端配置项见: packages/ui/certd-server/src/config/config.default.ts
# 服务端配置规则: certd_ + 配置项, 点号用_代替
# 如jwt密钥配置为 auth.jwt.secret则设置环境变量 certd_auth_jwt_secret=changeme
# 客户端配置项见: packages/ui/certd-client/.env
# 按实际名称配置环境变量即可,如: VITE_APP_API=http://localhost:7001

View File

@@ -1,13 +0,0 @@
#!/bin/bash
set -e
# 判断$CERTD_VERSION 是否存在
if [ -n "$CERTD_VERSION" ]; then
echo "CERTD_VERSION is set = $CERTD_VERSION"
else
echo "CERTD_VERSION is not set"
echo "请先输入一个版本号(如 1.0.6)"
read CERTD_VERSION
fi
echo "您输入的版本号是: $CERTD_VERSION"
sudo -E docker compose up -d

20
init.sh Normal file
View File

@@ -0,0 +1,20 @@
current_pwd=$(pwd)
echo "开始设置git配置"
read -p "请输入username" username
git config user.name $username
read -p "请输入email" email
git config user.email $email
git config credential.helper "store --file=$current_pwd/.git/credential.store"
echo "已设置记住git账号密码"
git config core.autocrlf input
echo "已设置auto crlf = input"
git config core.filemode false
echo "已设置忽略文件模式变化"
echo "git配置完成"

View File

@@ -9,5 +9,5 @@
}
},
"npmClient": "pnpm",
"version": "1.20.16"
"version": "1.25.3"
}

View File

@@ -12,16 +12,19 @@
"scripts": {
"start": "lerna bootstrap --hoist",
"i-all": "lerna link && lerna exec npm install ",
"publish": "npm run prepublishOnly1 && lerna publish --conventional-commits && npm run afterpublishOnly && npm run deploy1",
"afterpublishOnly": "",
"prepublishOnly1": "npm run before-build && lerna run build ",
"before-build": "cd ./packages/core/acme-client && time /t >build.md && git add ./build.md && git commit -m \"build: prepare to build\"",
"deploy1": "node --experimental-json-modules deploy.js "
"publish": "npm run prepublishOnly2 && lerna publish --conventional-commits --create-release github && npm run afterpublishOnly",
"afterpublishOnly": "time /t >build.trigger && git add ./build.trigger && git commit -m \"build: trigger build image\" && TIMEOUT /T 10 && git push",
"prepublishOnly1": "npm run check && lerna run build ",
"prepublishOnly2": "npm run check && npm run before-build && lerna run build ",
"before-build": "cd ./packages/pro/plus && time /t >build.md && git add ./build.md && git commit -m \"build: prepare to build\"",
"deploy1": "node --experimental-json-modules deploy.js ",
"check": "node --experimental-json-modules publish-check.js",
"init": "lerna run build"
},
"license": "AGPL-3.0",
"dependencies": {
"axios": "^1.4.0",
"lodash": "^4.17.21"
"axios": "^1.7.2",
"lodash-es": "^4.17.21"
},
"workspaces": [
"packages/**"

View File

@@ -5,8 +5,10 @@
set -euo pipefail
# Download and install
wget -nv "https://github.com/letsencrypt/pebble/releases/download/v${PEBBLECTS_VERSION}/pebble-challtestsrv_linux-amd64" -O /usr/local/bin/pebble-challtestsrv
wget -nv "https://github.com/letsencrypt/pebble/releases/download/v${PEBBLECTS_VERSION}/pebble-challtestsrv-linux-amd64.tar.gz" -O /tmp/pebble-challtestsrv.tar.gz
tar zxvf /tmp/pebble-challtestsrv.tar.gz -C /tmp
mv /tmp/pebble-challtestsrv-linux-amd64/linux/amd64/pebble-challtestsrv /usr/local/bin/pebble-challtestsrv
chown root:root /usr/local/bin/pebble-challtestsrv
chmod 0755 /usr/local/bin/pebble-challtestsrv

View File

@@ -22,8 +22,10 @@ wget -nv "https://raw.githubusercontent.com/letsencrypt/pebble/v${PEBBLE_VERSION
wget -nv "https://raw.githubusercontent.com/letsencrypt/pebble/v${PEBBLE_VERSION}/test/config/${CONFIG_NAME}" -O /etc/pebble/pebble.json
# Download and install Pebble
wget -nv "https://github.com/letsencrypt/pebble/releases/download/v${PEBBLE_VERSION}/pebble_linux-amd64" -O /usr/local/bin/pebble
wget -nv "https://github.com/letsencrypt/pebble/releases/download/v${PEBBLE_VERSION}/pebble-linux-amd64.tar.gz" -O /tmp/pebble.tar.gz
tar zxvf /tmp/pebble.tar.gz -C /tmp
mv /tmp/pebble-linux-amd64/linux/amd64/pebble /usr/local/bin/pebble
chown root:root /usr/local/bin/pebble
chmod 0755 /usr/local/bin/pebble

View File

@@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
node: [16, 18, 20, 22]
node: [16, 18, 20]
eab: [0, 1]
#
@@ -19,9 +19,9 @@ jobs:
FORCE_COLOR: 1
NPM_CONFIG_COLOR: always
PEBBLE_VERSION: 2.3.1
PEBBLE_VERSION: 2.6.0
PEBBLE_ALTERNATE_ROOTS: 2
PEBBLECTS_VERSION: 2.3.1
PEBBLECTS_VERSION: 2.6.0
PEBBLECTS_DNS_PORT: 8053
COREDNS_VERSION: 1.11.1

View File

@@ -3,6 +3,115 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.3](https://github.com/publishlab/node-acme-client/compare/v1.25.2...v1.25.3) (2024-09-24)
**Note:** Version bump only for package @certd/acme-client
## [1.25.2](https://github.com/publishlab/node-acme-client/compare/v1.25.1...v1.25.2) (2024-09-24)
**Note:** Version bump only for package @certd/acme-client
## [1.25.1](https://github.com/publishlab/node-acme-client/compare/v1.25.0...v1.25.1) (2024-09-24)
**Note:** Version bump only for package @certd/acme-client
# [1.25.0](https://github.com/publishlab/node-acme-client/compare/v1.24.4...v1.25.0) (2024-09-24)
### Performance Improvements
* 证书支持旧版RSApkcs1 ([3d9c3ec](https://github.com/publishlab/node-acme-client/commit/3d9c3ecb3eb604b2458154f608bde0f01915d116))
* 支持七牛云 ([8ecc2f9](https://github.com/publishlab/node-acme-client/commit/8ecc2f9446a9ebd11b9bfbffbb6cf7812a043495))
## [1.24.4](https://github.com/publishlab/node-acme-client/compare/v1.24.3...v1.24.4) (2024-09-09)
**Note:** Version bump only for package @certd/acme-client
## [1.24.3](https://github.com/publishlab/node-acme-client/compare/v1.24.2...v1.24.3) (2024-09-06)
**Note:** Version bump only for package @certd/acme-client
## [1.24.2](https://github.com/publishlab/node-acme-client/compare/v1.24.1...v1.24.2) (2024-09-06)
### Performance Improvements
* 修复windows下无法执行第二条命令的bug ([d5bfcdb](https://github.com/publishlab/node-acme-client/commit/d5bfcdb6de1dcc1702155442e2e00237d0bbb6e5))
## [1.24.1](https://github.com/publishlab/node-acme-client/compare/v1.24.0...v1.24.1) (2024-09-02)
### Bug Fixes
* 修复在没有勾选使用代理的情况下仍然会使用代理的bug ([0f66794](https://github.com/publishlab/node-acme-client/commit/0f6679425f6a736bb0128527dd99c085fac17d84))
### Performance Improvements
* 部署插件支持宝塔、易盾云等 ([ee61709](https://github.com/publishlab/node-acme-client/commit/ee617095efa1171548cf52fd45f0f98a368555a3))
* 授权配置支持加密 ([42a56b5](https://github.com/publishlab/node-acme-client/commit/42a56b581d754c3e5f9838179d19ab0d004ef2eb))
# [1.24.0](https://github.com/publishlab/node-acme-client/compare/v1.23.1...v1.24.0) (2024-08-25)
### Bug Fixes
* 修复成功后跳过之后丢失腾讯云证书id的bug ([37eb762](https://github.com/publishlab/node-acme-client/commit/37eb762afe25c5896b75dee25f32809f8426e7b7))
* 修复创建流水线后立即运行时报no id错误的bug ([17ead54](https://github.com/publishlab/node-acme-client/commit/17ead547aab25333603980304aa3aad3db1f73d5))
* 修复使用代理的情况下申请证书失败的bug ([95122e2](https://github.com/publishlab/node-acme-client/commit/95122e28609333f4df55c266e5434897954c0fb3))
### Features
* 支持google证书申请需要使用代理 ([a593056](https://github.com/publishlab/node-acme-client/commit/a593056e79e99dd6a74f75b5eab621af7248cfbe))
### Performance Improvements
* 优化证书申请成功率 ([968c469](https://github.com/publishlab/node-acme-client/commit/968c4690a07f69c08dcb3d3a494da4e319627345))
## [1.22.6](https://github.com/publishlab/node-acme-client/compare/v1.22.5...v1.22.6) (2024-08-03)
**Note:** Version bump only for package @certd/acme-client
## [1.22.4](https://github.com/publishlab/node-acme-client/compare/v1.22.3...v1.22.4) (2024-07-26)
### Performance Improvements
* 证书申请支持反向代理letsencrypt无法访问时的备用方案 ([b7b5df0](https://github.com/publishlab/node-acme-client/commit/b7b5df0587e0f7ea288c1b2af6f87211f207395f))
## [1.22.3](https://github.com/publishlab/node-acme-client/compare/v1.22.2...v1.22.3) (2024-07-25)
**Note:** Version bump only for package @certd/acme-client
## [1.22.2](https://github.com/publishlab/node-acme-client/compare/v1.22.1...v1.22.2) (2024-07-23)
**Note:** Version bump only for package @certd/acme-client
## [1.22.1](https://github.com/publishlab/node-acme-client/compare/v1.22.0...v1.22.1) (2024-07-20)
**Note:** Version bump only for package @certd/acme-client
# [1.22.0](https://github.com/publishlab/node-acme-client/compare/v1.21.2...v1.22.0) (2024-07-19)
### Features
* 升级midway支持esm ([485e603](https://github.com/publishlab/node-acme-client/commit/485e603b5165c28bc08694997726eaf2a585ebe7))
## [1.21.2](https://github.com/publishlab/node-acme-client/compare/v1.21.1...v1.21.2) (2024-07-08)
**Note:** Version bump only for package @certd/acme-client
## [1.21.1](https://github.com/publishlab/node-acme-client/compare/v1.21.0...v1.21.1) (2024-07-08)
**Note:** Version bump only for package @certd/acme-client
# [1.21.0](https://github.com/publishlab/node-acme-client/compare/v1.20.17...v1.21.0) (2024-07-03)
### Features
* 支持zero ssl ([eade2c2](https://github.com/publishlab/node-acme-client/commit/eade2c2b681569f03e9cd466e7d5bcd6703ed492))
## [1.20.17](https://github.com/publishlab/node-acme-client/compare/v1.20.16...v1.20.17) (2024-07-03)
### Performance Improvements
* 创建dns解析后强制等待60s ([f47b35f](https://github.com/publishlab/node-acme-client/commit/f47b35f6d5bd7d675005c3e286b7e9a029201f8b))
* 优化cname verify ([eba333d](https://github.com/publishlab/node-acme-client/commit/eba333de7a5b5ef4b0b7eaa904f578720102fa61))
## [1.20.16](https://github.com/publishlab/node-acme-client/compare/v1.20.15...v1.20.16) (2024-07-01)
### Bug Fixes
@@ -61,6 +170,12 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
# Changelog
## v5.4.0 (2024-07-16)
* `added` Directory URLs for [Google](https://cloud.google.com/certificate-manager/docs/overview) ACME provider
* `fixed` Invalidate ACME provider directory cache after 24 hours
* `fixed` Retry HTTP requests on server errors or when rate limited - [#89](https://github.com/publishlab/node-acme-client/issues/89)
## v5.3.1 (2024-05-22)
* `fixed` Allow `client.auto()` being called with an empty CSR common name
@@ -69,7 +184,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
## v5.3.0 (2024-02-05)
* `added` Support and tests for satisfying `tls-alpn-01` challenges
* `changed` Replace `jsrsasign` with `@peculiar/x509` for certificate and CSR generation and parsing
* `changed` Replace `jsrsasign` with `@peculiar/x509` for certificate and CSR handling
* `changed` Method `getChallengeKeyAuthorization()` now returns `$token.$thumbprint` when called with a `tls-alpn-01` challenge
* Previously returned base64url encoded SHA256 digest of `$token.$thumbprint` erroneously
* This change is not considered breaking since the previous behavior was incorrect

View File

@@ -59,6 +59,9 @@ const client = new acme.Client({
acme.directory.buypass.staging;
acme.directory.buypass.production;
acme.directory.google.staging;
acme.directory.google.production;
acme.directory.letsencrypt.staging;
acme.directory.letsencrypt.production;

View File

@@ -1 +1 @@
00:35
20:55

View File

@@ -3,37 +3,37 @@
"description": "Simple and unopinionated ACME client",
"private": false,
"author": "nmorsman",
"version": "1.20.16",
"version": "1.25.3",
"main": "src/index.js",
"types": "types/index.d.ts",
"license": "MIT",
"homepage": "https://github.com/publishlab/node-acme-client",
"engines": {
"node": ">= 16"
"node": ">= 18"
},
"files": [
"src",
"types"
],
"dependencies": {
"@peculiar/x509": "^1.10.0",
"@peculiar/x509": "^1.11.0",
"asn1js": "^3.0.5",
"axios": "^1.7.2",
"debug": "^4.1.1",
"debug": "^4.3.5",
"https-proxy-agent": "^7.0.4",
"node-forge": "^1.3.1"
},
"devDependencies": {
"@types/node": "^20.12.12",
"@types/node": "^20.14.10",
"chai": "^4.4.1",
"chai-as-promised": "^7.1.2",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.29.1",
"jsdoc-to-markdown": "^8.0.1",
"mocha": "^10.4.0",
"mocha": "^10.6.0",
"nock": "^13.5.4",
"tsd": "^0.31.0",
"tsd": "^0.31.1",
"typescript": "^4.8.4",
"uuid": "^8.3.2"
},
@@ -59,5 +59,5 @@
"bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues"
},
"gitHead": "a31f1c7f5e71fa946de9bf0283e11d6ce049b3e9"
"gitHead": "66fb689ac5da29b6ec5ee42d7762fd755bb81f9e"
}

View File

@@ -3,6 +3,7 @@
*/
const util = require('./util');
const { log } = require('./logger');
/**
* AcmeApi
@@ -17,6 +18,21 @@ class AcmeApi {
this.accountUrl = accountUrl;
}
getLocationFromHeader(resp) {
let locationUrl = resp.headers.location;
const mapping = this.http.urlMapping;
if (mapping.mappings) {
// eslint-disable-next-line guard-for-in,no-restricted-syntax
for (const key in mapping.mappings) {
const url = mapping.mappings[key];
if (locationUrl.indexOf(url) > -1) {
locationUrl = locationUrl.replace(url, key);
}
}
}
return locationUrl;
}
/**
* Get account URL
*
@@ -103,7 +119,7 @@ class AcmeApi {
/* Set account URL */
if (resp.headers.location) {
this.accountUrl = resp.headers.location;
this.accountUrl = this.getLocationFromHeader(resp);
}
return resp;

View File

@@ -13,8 +13,12 @@ const defaultOpts = {
termsOfServiceAgreed: false,
skipChallengeVerification: false,
challengePriority: ['http-01', 'dns-01'],
challengeCreateFn: async () => { throw new Error('Missing challengeCreateFn()'); },
challengeRemoveFn: async () => { throw new Error('Missing challengeRemoveFn()'); },
challengeCreateFn: async () => {
throw new Error('Missing challengeCreateFn()');
},
challengeRemoveFn: async () => {
throw new Error('Missing challengeRemoveFn()');
},
};
/**
@@ -36,6 +40,9 @@ module.exports = async (client, userOpts) => {
if (opts.email) {
accountPayload.contact = [`mailto:${opts.email}`];
}
if (opts.externalAccountBinding) {
accountPayload.externalAccountBinding = opts.externalAccountBinding;
}
/**
* Register account
@@ -129,13 +136,18 @@ module.exports = async (client, userOpts) => {
// throw new Error('测试异常');
/* Challenge verification */
if (opts.skipChallengeVerification === true) {
log(`[auto] [${d}] Skipping challenge verification since skipChallengeVerification=true`);
log(`[auto] [${d}] Skipping challenge verification since skipChallengeVerification=truewait 60s`);
await wait(60 * 1000);
}
else {
log(`[auto] [${d}] Running challenge verification`);
await client.verifyChallenge(authz, challenge);
try {
await client.verifyChallenge(authz, challenge);
}
catch (e) {
log(`[auto] [${d}] challenge verification threw error: ${e.message}`);
}
}
/* Complete challenge and wait for valid status */
log(`[auto] [${d}] Completing challenge with ACME provider and waiting for valid status`);
await client.completeChallenge(challenge);
@@ -166,11 +178,42 @@ module.exports = async (client, userOpts) => {
throw e;
}
};
const domainSets = [];
const challengePromises = authorizations.map((authz) => async () => {
await challengeFunc(authz);
authorizations.forEach((authz) => {
const d = authz.identifier.value;
let setd = false;
// eslint-disable-next-line no-restricted-syntax
for (const group of domainSets) {
if (!group[d]) {
group[d] = authz;
setd = true;
}
}
if (!setd) {
const group = {};
group[d] = authz;
domainSets.push(group);
}
});
const allChallengePromises = [];
// eslint-disable-next-line no-restricted-syntax
for (const domainSet of domainSets) {
const challengePromises = [];
// eslint-disable-next-line guard-for-in,no-restricted-syntax
for (const domain in domainSet) {
const authz = domainSet[domain];
challengePromises.push(async () => {
log(`[auto] [${domain}] Starting challenge`);
await challengeFunc(authz);
});
}
allChallengePromises.push(challengePromises);
}
log(`[auto] challengeGroups:${allChallengePromises.length}`);
function runAllPromise(tasks) {
let promise = Promise.resolve();
tasks.forEach((task) => {
@@ -190,39 +233,48 @@ module.exports = async (client, userOpts) => {
return Promise.all(results);
}
try {
log('开始challenge');
await runPromisePa(challengePromises);
log(`开始challenge${allChallengePromises.length}`);
let i = 0;
// eslint-disable-next-line no-restricted-syntax
for (const challengePromises of allChallengePromises) {
i += 1;
log(`开始第${i}`);
if (opts.signal && opts.signal.aborted) {
throw new Error('用户取消');
}
log('challenge结束');
// log('[auto] Waiting for challenge valid status');
// await Promise.all(challengePromises);
/**
* Finalize order and download certificate
*/
log('[auto] Finalizing order and downloading certificate');
const finalized = await client.finalizeOrder(order, opts.csr);
return await client.getCertificate(finalized, opts.preferredChain);
}
catch (e) {
log('证书申请失败');
log(e);
throw new Error(`证书申请失败:${e.message}`);
}
finally {
log(`清理challenge痕迹length:${clearTasks.length}`);
try {
await runAllPromise(clearTasks);
// eslint-disable-next-line no-await-in-loop
await runPromisePa(challengePromises);
}
catch (e) {
log('清理challenge失败');
log(e);
log(`证书申请失败${e.message}`);
throw e;
}
finally {
log(`清理challenge痕迹length:${clearTasks.length}`);
try {
// eslint-disable-next-line no-await-in-loop
await runAllPromise(clearTasks);
}
catch (e) {
log('清理challenge失败');
log(e);
}
}
}
log('challenge结束');
// log('[auto] Waiting for challenge valid status');
// await Promise.all(challengePromises);
/**
* Finalize order and download certificate
*/
log('[auto] Finalizing order and downloading certificate');
const finalized = await client.finalizeOrder(order, opts.csr);
const res = await client.getCertificate(finalized, opts.preferredChain);
return res;
// try {
// await Promise.allSettled(challengePromises);
// }

View File

@@ -3,10 +3,14 @@
*/
const axios = require('axios');
const { parseRetryAfterHeader } = require('./util');
const { log } = require('./logger');
const pkg = require('./../package.json');
const { AxiosError } = axios;
/**
* Instance
* Defaults
*/
const instance = axios.create();
@@ -19,6 +23,9 @@ instance.defaults.acmeSettings = {
httpChallengePort: 80,
httpsChallengePort: 443,
tlsAlpnChallengePort: 443,
retryMaxAttempts: 5,
retryDefaultDelay: 5,
};
// instance.defaults.proxy = {
// host: '192.168.34.139',
@@ -33,6 +40,85 @@ instance.defaults.acmeSettings = {
instance.defaults.adapter = 'http';
/**
* Retry requests on server errors or when rate limited
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-6.6
*/
function isRetryableError(error) {
return (error.code !== 'ECONNABORTED')
&& (error.code !== 'ERR_NOCK_NO_MATCH')
&& (!error.response
|| (error.response.status === 429)
|| ((error.response.status >= 500) && (error.response.status <= 599)));
}
/* https://github.com/axios/axios/blob/main/lib/core/settle.js */
function validateStatus(response) {
const validator = response.config.retryValidateStatus;
if (!response.status || !validator || validator(response.status)) {
return response;
}
throw new AxiosError(
`Request failed with status code ${response.status}`,
(Math.floor(response.status / 100) === 4) ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE,
response.config,
response.request,
response,
);
}
/* Pass all responses through the error interceptor */
instance.interceptors.request.use((config) => {
if (!('retryValidateStatus' in config)) {
config.retryValidateStatus = config.validateStatus;
}
config.validateStatus = () => false;
return config;
});
/* Handle request retries if applicable */
instance.interceptors.response.use(null, async (error) => {
const { config, response } = error;
if (!config) {
return Promise.reject(error);
}
/* Pick up errors we want to retry */
if (isRetryableError(error)) {
const { retryMaxAttempts, retryDefaultDelay } = instance.defaults.acmeSettings;
config.retryAttempt = ('retryAttempt' in config) ? (config.retryAttempt + 1) : 1;
if (config.retryAttempt <= retryMaxAttempts) {
const code = response ? `HTTP ${response.status}` : error.code;
log(`Caught ${code}, retry attempt ${config.retryAttempt}/${retryMaxAttempts} to URL ${config.url}`);
/* Attempt to parse Retry-After header, fallback to default delay */
let retryAfter = response ? parseRetryAfterHeader(response.headers['retry-after']) : 0;
if (retryAfter > 0) {
log(`Found retry-after response header with value: ${response.headers['retry-after']}, waiting ${retryAfter} seconds`);
}
else {
retryAfter = (retryDefaultDelay * config.retryAttempt);
log(`Unable to locate or parse retry-after response header, waiting ${retryAfter} seconds`);
}
/* Wait and retry the request */
await new Promise((resolve) => { setTimeout(resolve, (retryAfter * 1000)); });
return instance(config);
}
}
/* Validate and return response */
return validateStatus(response);
});
/**
* Export instance
*/

View File

@@ -100,7 +100,7 @@ class AcmeClient {
max: this.opts.backoffMax,
};
this.http = new HttpClient(this.opts.directoryUrl, this.opts.accountKey, this.opts.externalAccountBinding);
this.http = new HttpClient(this.opts.directoryUrl, this.opts.accountKey, this.opts.externalAccountBinding, this.opts.urlMapping);
this.api = new AcmeApi(this.http, this.opts.accountUrl);
}
@@ -300,7 +300,8 @@ class AcmeClient {
}
/* Add URL to response */
resp.data.url = resp.headers.location;
resp.data.url = this.api.getLocationFromHeader(resp);
return resp.data;
}
@@ -490,6 +491,9 @@ class AcmeClient {
const keyAuthorization = await this.getChallengeKeyAuthorization(challenge);
const verifyFn = async () => {
if (this.opts.signal && this.opts.signal.aborted) {
throw new Error('用户取消');
}
await verify[challenge.type](authz, challenge, keyAuthorization);
};
@@ -513,6 +517,9 @@ class AcmeClient {
*/
async completeChallenge(challenge) {
if (this.opts.signal && this.opts.signal.aborted) {
throw new Error('用户取消');
}
const resp = await this.api.completeChallenge(challenge.url, {});
return resp.data;
}
@@ -550,6 +557,10 @@ class AcmeClient {
}
const verifyFn = async (abort) => {
if (this.opts.signal && this.opts.signal.aborted) {
throw new Error('用户取消');
}
const resp = await this.api.apiRequest(item.url, null, [200]);
/* Verify status */

View File

@@ -10,6 +10,7 @@
const net = require('net');
const { promisify } = require('util');
const forge = require('node-forge');
const { createPrivateEcdsaKey, getPublicKey } = require('./index');
const generateKeyPair = promisify(forge.pki.rsa.generateKeyPair);
@@ -378,13 +379,17 @@ function formatCsrAltNames(altNames) {
* }, certificateKey);
*/
exports.createCsr = async (data, key = null) => {
if (!key) {
exports.createCsr = async (data, keyType = null) => {
let key = null;
if (keyType === 'ec') {
key = await createPrivateEcdsaKey();
}
else {
key = await createPrivateKey(data.keySize);
}
else if (!Buffer.isBuffer(key)) {
key = Buffer.from(key);
}
// else if (!Buffer.isBuffer(key)) {
// key = Buffer.from(key);
// }
if (typeof data.altNames === 'undefined') {
data.altNames = [];
@@ -396,6 +401,8 @@ exports.createCsr = async (data, key = null) => {
const privateKey = forge.pki.privateKeyFromPem(key);
const publicKey = forge.pki.rsa.setPublicKey(privateKey.n, privateKey.e);
csr.publicKey = publicKey;
// const privateKey = key;
// csr.publicKey = getPublicKey(key);
/* Ensure subject common name is present in SAN - https://cabforum.org/wp-content/uploads/BRv1.2.3.pdf */
if (data.commonName && !data.altNames.includes(data.commonName)) {

View File

@@ -67,11 +67,11 @@ function getKeyInfo(keyPem) {
* ```
*/
async function createPrivateRsaKey(modulusLength = 2048) {
async function createPrivateRsaKey(modulusLength = 2048, encodingType = 'pkcs8') {
const pair = await generateKeyPair('rsa', {
modulusLength,
privateKeyEncoding: {
type: 'pkcs8',
type: encodingType,
format: 'pem',
},
});
@@ -106,11 +106,11 @@ exports.createPrivateKey = createPrivateRsaKey;
* ```
*/
exports.createPrivateEcdsaKey = async (namedCurve = 'P-256') => {
exports.createPrivateEcdsaKey = async (namedCurve = 'P-256', encodingType = 'pkcs8') => {
const pair = await generateKeyPair('ec', {
namedCurve,
privateKeyEncoding: {
type: 'pkcs8',
type: encodingType,
format: 'pem',
},
});
@@ -290,7 +290,6 @@ exports.readCsrDomains = (csrPem) => {
if (Buffer.isBuffer(csrPem)) {
csrPem = csrPem.toString();
}
const dec = x509.PemConverter.decodeFirst(csrPem);
const csr = new x509.Pkcs10CertificateRequest(dec);
return parseDomains(csr);

View File

@@ -12,10 +12,11 @@ const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy;
let httpsAgent = null;
if (httpsProxy) {
httpsAgent = new HttpsProxyAgent(httpsProxy);
log(`use https_proxy:${httpsProxy}`);
}
const axios = axios1.create({
proxy: false,
httpsAgent
httpsAgent,
});
/**
@@ -30,14 +31,18 @@ const axios = axios1.create({
*/
class HttpClient {
constructor(directoryUrl, accountKey, externalAccountBinding = {}) {
constructor(directoryUrl, accountKey, externalAccountBinding = {}, urlMapping = {}) {
this.directoryUrl = directoryUrl;
this.accountKey = accountKey;
this.externalAccountBinding = externalAccountBinding;
this.maxBadNonceRetries = 5;
this.directory = null;
this.jwk = null;
this.directoryCache = null;
this.directoryMaxAge = 86400;
this.directoryTimestamp = 0;
this.urlMapping = urlMapping;
}
/**
@@ -50,6 +55,16 @@ class HttpClient {
*/
async request(url, method, opts = {}) {
if (this.urlMapping && this.urlMapping.enabled && this.urlMapping.mappings) {
// eslint-disable-next-line no-restricted-syntax
for (const key in this.urlMapping.mappings) {
if (url.includes(key)) {
const newUrl = url.replace(key, this.urlMapping.mappings[key]);
log(`use reverse proxy: ${newUrl}`);
url = newUrl;
}
}
}
opts.url = url;
opts.method = method;
opts.validateStatus = null;
@@ -70,15 +85,19 @@ class HttpClient {
}
/**
* Ensure provider directory exists
* Get ACME provider directory
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.1.1
*
* @returns {Promise}
* @returns {Promise<object>} ACME directory contents
*/
async getDirectory() {
if (!this.directory) {
const now = Math.floor(Date.now() / 1000);
const age = (now - this.directoryTimestamp);
if (!this.directoryCache || (age > this.directoryMaxAge)) {
log(`Refreshing ACME directory, age: ${age}`);
const resp = await this.request(this.directoryUrl, 'get');
if (resp.status >= 400) {
@@ -89,8 +108,11 @@ class HttpClient {
throw new Error('Attempting to read ACME directory returned no data');
}
this.directory = resp.data;
this.directoryCache = resp.data;
this.directoryTimestamp = now;
}
return this.directoryCache;
}
/**
@@ -112,7 +134,7 @@ class HttpClient {
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.2
*
* @returns {Promise<string>} nonce
* @returns {Promise<string>} Nonce
*/
async getNonce() {
@@ -134,13 +156,13 @@ class HttpClient {
*/
async getResourceUrl(resource) {
await this.getDirectory();
const dir = await this.getDirectory();
if (!this.directory[resource]) {
if (!dir[resource]) {
throw new Error(`Unable to locate API resource URL in ACME directory: "${resource}"`);
}
return this.directory[resource];
return dir[resource];
}
/**
@@ -151,10 +173,10 @@ class HttpClient {
*/
async getMetaField(field) {
await this.getDirectory();
const dir = await this.getDirectory();
if (('meta' in this.directory) && (field in this.directory.meta)) {
return this.directory.meta[field];
if (('meta' in dir) && (field in dir.meta)) {
return dir.meta[field];
}
return null;

View File

@@ -13,11 +13,16 @@ exports.directory = {
staging: 'https://api.test4.buypass.no/acme/directory',
production: 'https://api.buypass.com/acme/directory',
},
google: {
staging: 'https://dv.acme-v02.test-api.pki.goog/directory',
production: 'https://dv.acme-v02.api.pki.goog/directory',
},
letsencrypt: {
staging: 'https://acme-staging-v02.api.letsencrypt.org/directory',
production: 'https://acme-v02.api.letsencrypt.org/directory',
},
zerossl: {
staging: 'https://acme.zerossl.com/v2/DV90',
production: 'https://acme.zerossl.com/v2/DV90',
},
};

View File

@@ -84,9 +84,12 @@ function retry(fn, { attempts = 5, min = 5000, max = 30000 } = {}) {
}
/**
* Parse URLs from link header
* Parse URLs from Link header
*
* @param {string} header Link header contents
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.4.2
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link
*
* @param {string} header Header contents
* @param {string} rel Link relation, default: `alternate`
* @returns {string[]} Array of URLs
*/
@@ -102,6 +105,37 @@ function parseLinkHeader(header, rel = 'alternate') {
return results.filter((r) => r);
}
/**
* Parse date or duration from Retry-After header
*
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
*
* @param {string} header Header contents
* @returns {number} Retry duration in seconds
*/
function parseRetryAfterHeader(header) {
const sec = parseInt(header, 10);
const date = new Date(header);
/* Seconds into the future */
if (Number.isSafeInteger(sec) && (sec > 0)) {
return sec;
}
/* Future date string */
if (date instanceof Date && !Number.isNaN(date)) {
const now = new Date();
const diff = Math.ceil((date.getTime() - now.getTime()) / 1000);
if (diff > 0) {
return diff;
}
}
return 0;
}
/**
* Find certificate chain with preferred issuer common name
* - If issuer is found in multiple chains, the closest to root wins
@@ -161,14 +195,16 @@ function findCertificateChainForIssuer(chains, issuer) {
function formatResponseError(resp) {
let result;
if (resp.data.error) {
result = resp.data.error.detail || resp.data.error;
}
else {
result = resp.data.detail || JSON.stringify(resp.data);
if (resp.data) {
if (resp.data.error) {
result = resp.data.error.detail || resp.data.error;
}
else {
result = resp.data.detail || JSON.stringify(resp.data);
}
}
return result.replace(/\n/g, '');
return (result || '').replace(/\n/g, '');
}
/**
@@ -296,6 +332,7 @@ async function retrieveTlsAlpnCertificate(host, port, timeout = 30000) {
module.exports = {
retry,
parseLinkHeader,
parseRetryAfterHeader,
findCertificateChainForIssuer,
formatResponseError,
getAuthoritativeDnsResolver,

View File

@@ -48,18 +48,18 @@ async function verifyHttpChallenge(authz, challenge, keyAuthorization, suffix =
async function walkDnsChallengeRecord(recordName, resolver = dns) {
/* Resolve CNAME record first */
try {
log(`Checking name for CNAME records: ${recordName}`);
const cnameRecords = await resolver.resolveCname(recordName);
if (cnameRecords.length) {
log(`CNAME record found at ${recordName}, new challenge record name: ${cnameRecords[0]}`);
return walkDnsChallengeRecord(cnameRecords[0]);
}
}
catch (e) {
log(`No CNAME records found for name: ${recordName}`);
}
// try {
// log(`Checking name for CNAME records: ${recordName}`);
// const cnameRecords = await resolver.resolveCname(recordName);
//
// if (cnameRecords.length) {
// log(`CNAME record found at ${recordName}, new challenge record name: ${cnameRecords[0]}`);
// return walkDnsChallengeRecord(cnameRecords[0]);
// }
// }
// catch (e) {
// log(`No CNAME records found for name: ${recordName}`);
// }
/* Resolve TXT records */
try {
@@ -111,7 +111,7 @@ async function verifyDnsChallenge(authz, challenge, keyAuthorization, prefix = '
log(`DNS query finished successfully, found ${recordValues.length} TXT records`);
if (!recordValues.length || !recordValues.includes(keyAuthorization)) {
throw new Error(`Authorization not found in DNS TXT record: ${recordName}`);
throw new Error(`Authorization not found in DNS TXT record: ${recordName}need:${keyAuthorization},found:${recordValues}`);
}
log(`Key authorization match for ${challenge.type}/${recordName}, ACME challenge verified`);

View File

@@ -12,33 +12,12 @@ const pkg = require('./../package.json');
describe('http', () => {
let testClient;
const endpoint = `http://${uuid()}.example.com`;
const defaultUserAgent = `node-${pkg.name}/${pkg.version}`;
const customUserAgent = 'custom-ua-123';
const primaryEndpoint = `http://${uuid()}.example.com`;
const defaultUaEndpoint = `http://${uuid()}.example.com`;
const customUaEndpoint = `http://${uuid()}.example.com`;
/**
* HTTP mocking
*/
before(() => {
const defaultUaOpts = { reqheaders: { 'User-Agent': defaultUserAgent } };
const customUaOpts = { reqheaders: { 'User-Agent': customUserAgent } };
nock(primaryEndpoint)
.persist().get('/').reply(200, 'ok');
nock(defaultUaEndpoint, defaultUaOpts)
.persist().get('/').reply(200, 'ok');
nock(customUaEndpoint, customUaOpts)
.persist().get('/').reply(200, 'ok');
});
after(() => {
axios.defaults.headers.common['User-Agent'] = defaultUserAgent;
afterEach(() => {
nock.cleanAll();
});
/**
@@ -54,7 +33,8 @@ describe('http', () => {
*/
it('should http get', async () => {
const resp = await testClient.request(primaryEndpoint, 'get');
nock(endpoint).get('/').reply(200, 'ok');
const resp = await testClient.request(endpoint, 'get');
assert.isObject(resp);
assert.strictEqual(resp.status, 200);
@@ -66,28 +46,76 @@ describe('http', () => {
*/
it('should request using default user-agent', async () => {
const resp = await testClient.request(defaultUaEndpoint, 'get');
nock(endpoint).matchHeader('user-agent', defaultUserAgent).get('/').reply(200, 'ok');
axios.defaults.headers.common['User-Agent'] = defaultUserAgent;
const resp = await testClient.request(endpoint, 'get');
assert.isObject(resp);
assert.strictEqual(resp.status, 200);
assert.strictEqual(resp.data, 'ok');
});
it('should not request using custom user-agent', async () => {
await assert.isRejected(testClient.request(customUaEndpoint, 'get'));
it('should reject using custom user-agent', async () => {
nock(endpoint).matchHeader('user-agent', defaultUserAgent).get('/').reply(200, 'ok');
axios.defaults.headers.common['User-Agent'] = customUserAgent;
await assert.isRejected(testClient.request(endpoint, 'get'));
});
it('should request using custom user-agent', async () => {
nock(endpoint).matchHeader('user-agent', customUserAgent).get('/').reply(200, 'ok');
axios.defaults.headers.common['User-Agent'] = customUserAgent;
const resp = await testClient.request(customUaEndpoint, 'get');
const resp = await testClient.request(endpoint, 'get');
assert.isObject(resp);
assert.strictEqual(resp.status, 200);
assert.strictEqual(resp.data, 'ok');
});
it('should not request using default user-agent', async () => {
axios.defaults.headers.common['User-Agent'] = customUserAgent;
await assert.isRejected(testClient.request(defaultUaEndpoint, 'get'));
it('should reject using default user-agent', async () => {
nock(endpoint).matchHeader('user-agent', customUserAgent).get('/').reply(200, 'ok');
axios.defaults.headers.common['User-Agent'] = defaultUserAgent;
await assert.isRejected(testClient.request(endpoint, 'get'));
});
/**
* Retry on HTTP errors
*/
it('should retry on 429 rate limit', async () => {
let rateLimitCount = 0;
nock(endpoint).persist().get('/').reply(() => {
rateLimitCount += 1;
if (rateLimitCount < 3) {
return [429, 'Rate Limit Exceeded', { 'Retry-After': 1 }];
}
return [200, 'ok'];
});
assert.strictEqual(rateLimitCount, 0);
const resp = await testClient.request(endpoint, 'get');
assert.isObject(resp);
assert.strictEqual(resp.status, 200);
assert.strictEqual(resp.data, 'ok');
assert.strictEqual(rateLimitCount, 3);
});
it('should retry on 5xx server error', async () => {
let serverErrorCount = 0;
nock(endpoint).persist().get('/').reply(() => {
serverErrorCount += 1;
return [500, 'Internal Server Error', { 'Retry-After': 1 }];
});
assert.strictEqual(serverErrorCount, 0);
const resp = await testClient.request(endpoint, 'get');
assert.isObject(resp);
assert.strictEqual(resp.status, 500);
assert.strictEqual(serverErrorCount, 4);
});
});

View File

@@ -0,0 +1,145 @@
/**
* Utility method tests
*/
const dns = require('dns').promises;
const fs = require('fs').promises;
const path = require('path');
const { assert } = require('chai');
const util = require('./../src/util');
const { readCertificateInfo } = require('./../src/crypto');
describe('util', () => {
const testCertPath1 = path.join(__dirname, 'fixtures', 'certificate.crt');
const testCertPath2 = path.join(__dirname, 'fixtures', 'letsencrypt.crt');
it('retry()', async () => {
let attempts = 0;
const backoffOpts = {
min: 100,
max: 500,
};
await assert.isRejected(util.retry(() => {
throw new Error('oops');
}, backoffOpts));
const r = await util.retry(() => {
attempts += 1;
if (attempts < 3) {
throw new Error('oops');
}
return 'abc';
}, backoffOpts);
assert.strictEqual(r, 'abc');
assert.strictEqual(attempts, 3);
});
it('parseLinkHeader()', () => {
const r1 = util.parseLinkHeader('<https://example.com/a>;rel="alternate"');
assert.isArray(r1);
assert.strictEqual(r1.length, 1);
assert.strictEqual(r1[0], 'https://example.com/a');
const r2 = util.parseLinkHeader('<https://example.com/b>;rel="test"');
assert.isArray(r2);
assert.strictEqual(r2.length, 0);
const r3 = util.parseLinkHeader('<http://example.com/c>; rel="test"', 'test');
assert.isArray(r3);
assert.strictEqual(r3.length, 1);
assert.strictEqual(r3[0], 'http://example.com/c');
const r4 = util.parseLinkHeader(`<https://example.com/a>; rel="alternate",
<https://example.com/x>; rel="nope",
<https://example.com/b>;rel="alternate",
<https://example.com/c>; rel="alternate"`);
assert.isArray(r4);
assert.strictEqual(r4.length, 3);
assert.strictEqual(r4[0], 'https://example.com/a');
assert.strictEqual(r4[1], 'https://example.com/b');
assert.strictEqual(r4[2], 'https://example.com/c');
});
it('parseRetryAfterHeader()', () => {
const r1 = util.parseRetryAfterHeader('');
assert.strictEqual(r1, 0);
const r2 = util.parseRetryAfterHeader('abcdef');
assert.strictEqual(r2, 0);
const r3 = util.parseRetryAfterHeader('123');
assert.strictEqual(r3, 123);
const r4 = util.parseRetryAfterHeader('123.456');
assert.strictEqual(r4, 123);
const r5 = util.parseRetryAfterHeader('-555');
assert.strictEqual(r5, 0);
const r6 = util.parseRetryAfterHeader('Wed, 21 Oct 2015 07:28:00 GMT');
assert.strictEqual(r6, 0);
const now = new Date();
const future = new Date(now.getTime() + 123000);
const r7 = util.parseRetryAfterHeader(future.toUTCString());
assert.isTrue(r7 > 100);
});
it('findCertificateChainForIssuer()', async () => {
const certs = [
(await fs.readFile(testCertPath1)).toString(),
(await fs.readFile(testCertPath2)).toString(),
];
const r1 = util.findCertificateChainForIssuer(certs, 'abc123');
const r2 = util.findCertificateChainForIssuer(certs, 'example.com');
const r3 = util.findCertificateChainForIssuer(certs, 'E6');
[r1, r2, r3].forEach((r) => {
assert.isString(r);
assert.isNotEmpty(r);
});
assert.strictEqual(readCertificateInfo(r1).issuer.commonName, 'example.com');
assert.strictEqual(readCertificateInfo(r2).issuer.commonName, 'example.com');
assert.strictEqual(readCertificateInfo(r3).issuer.commonName, 'E6');
});
it('formatResponseError()', () => {
const e1 = util.formatResponseError({ data: { error: 'aaa' } });
assert.strictEqual(e1, 'aaa');
const e2 = util.formatResponseError({ data: { error: { detail: 'bbb' } } });
assert.strictEqual(e2, 'bbb');
const e3 = util.formatResponseError({ data: { detail: 'ccc' } });
assert.strictEqual(e3, 'ccc');
const e4 = util.formatResponseError({ data: { a: 123 } });
assert.strictEqual(e4, '{"a":123}');
const e5 = util.formatResponseError({});
assert.isString(e5);
assert.isEmpty(e5);
});
it('getAuthoritativeDnsResolver()', async () => {
/* valid domain - should not use global default */
const r1 = await util.getAuthoritativeDnsResolver('example.com');
assert.instanceOf(r1, dns.Resolver);
assert.isNotEmpty(r1.getServers());
assert.notDeepEqual(r1.getServers(), dns.getServers());
/* invalid domain - fallback to global default */
const r2 = await util.getAuthoritativeDnsResolver('invalid.xtldx');
assert.instanceOf(r2, dns.Resolver);
assert.deepStrictEqual(r2.getServers(), dns.getServers());
});
/* TODO: Figure out how to test this */
it('retrieveTlsAlpnCertificate()');
});

View File

@@ -414,7 +414,7 @@ describe('client.auto', () => {
const info = acme.crypto.readCertificateInfo(testCertificate);
spec.crypto.certificateInfo(info);
assert.strictEqual(info.domains.commonName, testDomain);
assert.isNull(info.domains.commonName);
assert.deepStrictEqual(info.domains.altNames, [testDomain]);
});
@@ -422,7 +422,7 @@ describe('client.auto', () => {
const info = acme.crypto.readCertificateInfo(testSanCertificate);
spec.crypto.certificateInfo(info);
assert.strictEqual(info.domains.commonName, testSanDomains[0]);
assert.isNull(info.domains.commonName);
assert.deepStrictEqual(info.domains.altNames, testSanDomains);
});
@@ -430,7 +430,7 @@ describe('client.auto', () => {
const info = acme.crypto.readCertificateInfo(testWildcardCertificate);
spec.crypto.certificateInfo(info);
assert.strictEqual(info.domains.commonName, testWildcardDomain);
assert.isNull(info.domains.commonName);
assert.deepStrictEqual(info.domains.altNames, [testWildcardDomain, `*.${testWildcardDomain}`]);
});
});

View File

@@ -0,0 +1,23 @@
-----BEGIN CERTIFICATE-----
MIIDzzCCA1WgAwIBAgISA0ghDoSv5DpT3Pd3lqwjbVDDMAoGCCqGSM49BAMDMDIx
CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQDEwJF
NjAeFw0yNDA2MTAxNzEyMjZaFw0yNDA5MDgxNzEyMjVaMBQxEjAQBgNVBAMTCWxl
bmNyLm9yZzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABEHJ3DjN7pYV3mftHzaP
V/WI0RhOJnSI5AIFEPFHDi8UowOINRGIfm9FHGIDqrb4Rmyvr9JrrqBdFGDen8BW
6OGjggJnMIICYzAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0lBBYwFAYIKwYBBQUHAwEG
CCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFIdCTnxqmpOELDyzPaEM
seB36lUOMB8GA1UdIwQYMBaAFJMnRpgDqVFojpjWxEJI2yO/WJTSMFUGCCsGAQUF
BwEBBEkwRzAhBggrBgEFBQcwAYYVaHR0cDovL2U2Lm8ubGVuY3Iub3JnMCIGCCsG
AQUFBzAChhZodHRwOi8vZTYuaS5sZW5jci5vcmcvMG8GA1UdEQRoMGaCCWxlbmNy
Lm9yZ4IPbGV0c2VuY3J5cHQuY29tgg9sZXRzZW5jcnlwdC5vcmeCDXd3dy5sZW5j
ci5vcmeCE3d3dy5sZXRzZW5jcnlwdC5jb22CE3d3dy5sZXRzZW5jcnlwdC5vcmcw
EwYDVR0gBAwwCjAIBgZngQwBAgEwggEFBgorBgEEAdZ5AgQCBIH2BIHzAPEAdgA/
F0tP1yJHWJQdZRyEvg0S7ZA3fx+FauvBvyiF7PhkbgAAAZADWfneAAAEAwBHMEUC
IGlp+dPU2hLT2suTMYkYMlt/xbzSnKLZDA/wYSsPACP7AiEAxbAzx6mkzn0cs0hh
ti6sLf0pcbmDhxHdlJRjuo6SQZEAdwDf4VbrqgWvtZwPhnGNqMAyTq5W2W6n9aVq
AdHBO75SXAAAAZADWfqrAAAEAwBIMEYCIQCrAmDUrlX3oGhri1qCIb65Cuf8h2GR
LC1VfXBenX7dCAIhALXwbhCQ1vO1WLv4CqyihMHOwFaICYqN/N6ylaBlVAM4MAoG
CCqGSM49BAMDA2gAMGUCMFdgjOXGl+hE2ABDsAeuNq8wi34yTMUHk0KMTOjRAfy9
rOCGQqvP0myoYlyzXOH9uQIxAMdkG1ZWBZS1dHavbPf1I/MjYpzX6gy0jVHIXXu5
aYWylBi/Uf2RPj0LWFZh8tNa1Q==
-----END CERTIFICATE-----

View File

@@ -29,6 +29,13 @@ if (process.env.ACME_TLSALPN_PORT) {
axios.defaults.acmeSettings.tlsAlpnChallengePort = process.env.ACME_TLSALPN_PORT;
}
/**
* Greatly reduce retry duration while testing
*/
axios.defaults.acmeSettings.retryMaxAttempts = 3;
axios.defaults.acmeSettings.retryDefaultDelay = 1;
/**
* External account binding
*/

View File

@@ -1,11 +1,13 @@
{
"compileOnSave": false,
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"strict": true,
"noEmit": true,
"noEmit": false,
"esModuleInterop": true,
"baseUrl": ".",
"composite": true,
"paths": { "acme-client": ["."] }
}
}

View File

@@ -27,6 +27,11 @@ export interface Authorization extends rfc8555.Authorization {
url: string;
}
export type UrlMapping={
enabled: boolean
mappings: Record<string, string>
}
/**
* Client
*/
@@ -39,6 +44,8 @@ export interface ClientOptions {
backoffAttempts?: number;
backoffMin?: number;
backoffMax?: number;
urlMapping?: UrlMapping;
signal?: AbortSignal;
}
export interface ClientExternalAccountBindingOptions {
@@ -55,6 +62,7 @@ export interface ClientAutoOptions {
skipChallengeVerification?: boolean;
challengePriority?: string[];
preferredChain?: string;
signal?: AbortSignal;
}
export class Client {
@@ -87,11 +95,16 @@ export const directory: {
staging: string,
production: string
},
google: {
staging: string,
production: string
},
letsencrypt: {
staging: string,
production: string
},
zerossl: {
staging: string,
production: string
}
};
@@ -142,16 +155,16 @@ export interface EcdsaPublicJwk {
}
export interface CryptoInterface {
createPrivateKey(keySize?: number): Promise<PrivateKeyBuffer>;
createPrivateRsaKey(keySize?: number): Promise<PrivateKeyBuffer>;
createPrivateEcdsaKey(namedCurve?: 'P-256' | 'P-384' | 'P-521'): Promise<PrivateKeyBuffer>;
createPrivateKey(keySize?: number,encodingType?:string): Promise<PrivateKeyBuffer>;
createPrivateRsaKey(keySize?: number,encodingType?:string): Promise<PrivateKeyBuffer>;
createPrivateEcdsaKey(namedCurve?: 'P-256' | 'P-384' | 'P-521',encodingType?:string): Promise<PrivateKeyBuffer>;
getPublicKey(keyPem: PrivateKeyBuffer | PrivateKeyString | PublicKeyBuffer | PublicKeyString): PublicKeyBuffer;
getJwk(keyPem: PrivateKeyBuffer | PrivateKeyString | PublicKeyBuffer | PublicKeyString): RsaPublicJwk | EcdsaPublicJwk;
splitPemChain(chainPem: CertificateBuffer | CertificateString): string[];
getPemBodyAsB64u(pem: CertificateBuffer | CertificateString): string;
readCsrDomains(csrPem: CsrBuffer | CsrString): CertificateDomains;
readCertificateInfo(certPem: CertificateBuffer | CertificateString): CertificateInfo;
createCsr(data: CsrOptions, keyPem?: PrivateKeyBuffer | PrivateKeyString): Promise<[PrivateKeyBuffer, CsrBuffer]>;
createCsr(data: CsrOptions, keyPem?: PrivateKeyBuffer | PrivateKeyString,encodingType?:string): Promise<[PrivateKeyBuffer, CsrBuffer]>;
createAlpnCertificate(authz: Authorization, keyAuthorization: string, keyPem?: PrivateKeyBuffer | PrivateKeyString): Promise<[PrivateKeyBuffer, CertificateBuffer]>;
isAlpnCertificateAuthorizationValid(certPem: CertificateBuffer | CertificateString, keyAuthorization: string): boolean;
}

View File

@@ -23,4 +23,6 @@ dist-ssr
*.sln
*.sw?
test/user.secret.ts
test/user.secret.*
test/**/*.js
src/**/*.spec.ts

View File

@@ -1,5 +1,4 @@
{
"extension": ["ts"],
"spec": "test/**/*.test.ts",
"require": "ts-node/register"
}
"spec": "src/**/*.spec.ts"
}

View File

@@ -1,2 +1,3 @@
node_modules
src
src
dist/**/*.spec.*

View File

@@ -0,0 +1,2 @@
link-workspace-packages=true
prefer-workspace-packages=true

View File

@@ -3,6 +3,148 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.3](https://github.com/certd/certd/compare/v1.25.2...v1.25.3) (2024-09-24)
**Note:** Version bump only for package @certd/pipeline
## [1.25.2](https://github.com/certd/certd/compare/v1.25.1...v1.25.2) (2024-09-24)
**Note:** Version bump only for package @certd/pipeline
## [1.25.1](https://github.com/certd/certd/compare/v1.25.0...v1.25.1) (2024-09-24)
**Note:** Version bump only for package @certd/pipeline
# [1.25.0](https://github.com/certd/certd/compare/v1.24.4...v1.25.0) (2024-09-24)
### Bug Fixes
* 修复首次创建任务运行时不自动设置当前运行情况的bug ([ecd83ee](https://github.com/certd/certd/commit/ecd83ee136abdd3df9ed2f21ec2ff0f24c0ed9d9))
### Performance Improvements
* 群晖支持OTP双重验证登录 ([8b8039f](https://github.com/certd/certd/commit/8b8039f42bbce10a4d0e737cdeeeef9bb17bee5a))
* 任务支持禁用 ([8ed16b3](https://github.com/certd/certd/commit/8ed16b3ea2dfe847357863a0bfa614e4fa5fc041))
* 支持阿里云ACK证书部署 ([d331fea](https://github.com/certd/certd/commit/d331fea47789122650e057ec7c9e85ee8e66f09b))
* 支持七牛云 ([8ecc2f9](https://github.com/certd/certd/commit/8ecc2f9446a9ebd11b9bfbffbb6cf7812a043495))
* 支持k8s ingress secret ([e5a5d0a](https://github.com/certd/certd/commit/e5a5d0a607bb6b4e1a1f7a1a419bada5f2dee59f))
* http请求增加默认超时时间 ([664bd86](https://github.com/certd/certd/commit/664bd863e5b4895aabe2384277c0c65f5902fdb2))
* plugins增加图标 ([a8da658](https://github.com/certd/certd/commit/a8da658a9723342b4f43a579f7805bfef0648efb))
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
### Performance Improvements
* 前置任务步骤增加错误提示 ([ae3daa9](https://github.com/certd/certd/commit/ae3daa9bcf4fc363825aad9b77f5d3879aeeff70))
* 群晖部署教程 ([0f0af2f](https://github.com/certd/certd/commit/0f0af2f309390f388e7a272cea3a1dd30c01977d))
* 支持群晖 ([5c270b6](https://github.com/certd/certd/commit/5c270b6b9d45a2152f9fdb3c07bd98b7c803cb8e))
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
### Performance Improvements
* 支持多吉云cdn证书部署 ([65ef685](https://github.com/certd/certd/commit/65ef6857296784ca765926e09eafcb6fc8b6ecde))
## [1.24.2](https://github.com/certd/certd/compare/v1.24.1...v1.24.2) (2024-09-06)
### Performance Improvements
* 优化跳过处理逻辑 ([b80210f](https://github.com/certd/certd/commit/b80210f24bf5db1c958d06ab27c9e5d3db452eda))
* 支持pfx、der ([fbeaed2](https://github.com/certd/certd/commit/fbeaed203519f59b6d9396c4e8953353ccb5e723))
## [1.24.1](https://github.com/certd/certd/compare/v1.24.0...v1.24.1) (2024-09-02)
### Performance Improvements
* 部署插件支持宝塔、易盾云等 ([ee61709](https://github.com/certd/certd/commit/ee617095efa1171548cf52fd45f0f98a368555a3))
* 授权配置支持加密 ([42a56b5](https://github.com/certd/certd/commit/42a56b581d754c3e5f9838179d19ab0d004ef2eb))
* 支持阿里云 DCDN ([98b77f8](https://github.com/certd/certd/commit/98b77f80843834616fb26f83b4c42245326abd06))
* 支持已跳过的步骤重新运行 ([ea775ad](https://github.com/certd/certd/commit/ea775adae18d57a04470cfba6b9460d761d74035))
# [1.24.0](https://github.com/certd/certd/compare/v1.23.1...v1.24.0) (2024-08-25)
### Bug Fixes
* 修复成功后跳过之后丢失腾讯云证书id的bug ([37eb762](https://github.com/certd/certd/commit/37eb762afe25c5896b75dee25f32809f8426e7b7))
* 修复执行日志没有清理的bug ([22a3363](https://github.com/certd/certd/commit/22a336370a88a7df2a23c967043bae153da71ed5))
### Features
* 支持google证书申请需要使用代理 ([a593056](https://github.com/certd/certd/commit/a593056e79e99dd6a74f75b5eab621af7248cfbe))
### Performance Improvements
* 优化成功后跳过的提示 ([7b451bb](https://github.com/certd/certd/commit/7b451bbf6e6337507f4627b5a845f5bd96ab4f7b))
* 优化证书申请成功率 ([968c469](https://github.com/certd/certd/commit/968c4690a07f69c08dcb3d3a494da4e319627345))
* email proxy ([453f1ba](https://github.com/certd/certd/commit/453f1baa0b9eb0f648aa1b71ccf5a95b202ce13f))
## [1.23.1](https://github.com/certd/certd/compare/v1.23.0...v1.23.1) (2024-08-06)
**Note:** Version bump only for package @certd/pipeline
## [1.22.8](https://github.com/certd/certd/compare/v1.22.7...v1.22.8) (2024-08-05)
### Performance Improvements
* 优化pipeline删除时删除其他history ([b425203](https://github.com/certd/certd/commit/b4252033d56a9ad950f3e204ff021497c3978015))
## [1.22.7](https://github.com/certd/certd/compare/v1.22.6...v1.22.7) (2024-08-04)
**Note:** Version bump only for package @certd/pipeline
## [1.22.6](https://github.com/certd/certd/compare/v1.22.5...v1.22.6) (2024-08-03)
### Bug Fixes
* 修复在相同的cron时偶尔无法触发定时任务的bug ([680941a](https://github.com/certd/certd/commit/680941af119619006b592e3ab6fb112cb5556a8b))
### Performance Improvements
* 流水线支持名称模糊查询 ([59897c4](https://github.com/certd/certd/commit/59897c4ceae992ebe2972ca9e8f9196616ffdfd7))
* 优化前置任务输出为空的提示 ([6ed1e18](https://github.com/certd/certd/commit/6ed1e18c7d9c46d964ecc6abc90f3908297b7632))
## [1.22.5](https://github.com/certd/certd/compare/v1.22.4...v1.22.5) (2024-07-26)
**Note:** Version bump only for package @certd/pipeline
## [1.22.3](https://github.com/certd/certd/compare/v1.22.2...v1.22.3) (2024-07-25)
**Note:** Version bump only for package @certd/pipeline
## [1.22.2](https://github.com/certd/certd/compare/v1.22.1...v1.22.2) (2024-07-23)
**Note:** Version bump only for package @certd/pipeline
## [1.22.1](https://github.com/certd/certd/compare/v1.22.0...v1.22.1) (2024-07-20)
### Performance Improvements
* 创建证书任务可以选择lege插件 ([affef13](https://github.com/certd/certd/commit/affef130378030c517250c58a4e787b0fc85d7d1))
# [1.22.0](https://github.com/certd/certd/compare/v1.21.2...v1.22.0) (2024-07-19)
### Features
* 升级midway支持esm ([485e603](https://github.com/certd/certd/commit/485e603b5165c28bc08694997726eaf2a585ebe7))
* 支持lego海量DNS提供商 ([0bc6d0a](https://github.com/certd/certd/commit/0bc6d0a211920fb0084d705e1db67ee1e7262c44))
* 支持postgresql ([3b19bfb](https://github.com/certd/certd/commit/3b19bfb4291e89064b3b407a80dae092d54747d5))
## [1.21.2](https://github.com/certd/certd/compare/v1.21.1...v1.21.2) (2024-07-08)
**Note:** Version bump only for package @certd/pipeline
## [1.21.1](https://github.com/certd/certd/compare/v1.21.0...v1.21.1) (2024-07-08)
**Note:** Version bump only for package @certd/pipeline
# [1.21.0](https://github.com/certd/certd/compare/v1.20.17...v1.21.0) (2024-07-03)
**Note:** Version bump only for package @certd/pipeline
## [1.20.17](https://github.com/certd/certd/compare/v1.20.16...v1.20.17) (2024-07-03)
**Note:** Version bump only for package @certd/pipeline
## [1.20.16](https://github.com/certd/certd/compare/v1.20.15...v1.20.16) (2024-07-01)
**Note:** Version bump only for package @certd/pipeline

View File

@@ -0,0 +1 @@
02:40

View File

@@ -0,0 +1,96 @@
import * as fs from "fs";
import * as path from "path";
// https://gist.github.com/lovasoa/8691344
async function* walk(dir) {
for await (const d of await fs.promises.opendir(dir)) {
const entry = path.join(dir, d.name);
if (d.isDirectory()) {
yield* walk(entry);
} else if (d.isFile()) {
yield entry;
}
}
}
function resolveImportPath(sourceFile, importPath, options) {
const sourceFileAbs = path.resolve(process.cwd(), sourceFile);
const root = path.dirname(sourceFileAbs);
const { moduleFilter = defaultModuleFilter } = options;
if (moduleFilter(importPath)) {
const importPathAbs = path.resolve(root, importPath);
let possiblePath = [path.resolve(importPathAbs, "./index.ts"), path.resolve(importPathAbs, "./index.js"), importPathAbs + ".ts", importPathAbs + ".js"];
if (possiblePath.length) {
for (let i = 0; i < possiblePath.length; i++) {
let entry = possiblePath[i];
if (fs.existsSync(entry)) {
const resolved = path.relative(root, entry.replace(/\.ts$/, ".js"));
if (!resolved.startsWith(".")) {
return "./" + resolved;
}
return resolved;
}
}
}
}
return null;
}
function replace(filePath, outFilePath, options) {
const code = fs.readFileSync(filePath).toString();
const newCode = code.replace(/(import|export) (.+?) from ('[^\n']+'|"[^\n"]+");/gs, function (found, action, imported, from) {
const importPath = from.slice(1, -1);
let resolvedPath = resolveImportPath(filePath, importPath, options);
if (resolvedPath) {
resolvedPath = resolvedPath.replaceAll("\\", "/");
console.log("\t", importPath, resolvedPath);
return `${action} ${imported} from "${resolvedPath}";`;
}
return found;
});
if (code !== newCode) {
fs.writeFileSync(outFilePath, newCode);
}
}
// Then, use it with a simple async for loop
async function run(srcDir, options = defaultOptions) {
const { sourceFileFilter = defaultSourceFileFilter } = options;
for await (const entry of walk(srcDir)) {
if (sourceFileFilter(entry)) {
console.log(entry);
replace(entry, entry, options);
}
}
}
const defaultSourceFileFilter = function (sourceFilePath) {
return /\.(js|ts)$/.test(sourceFilePath) && !/node_modules/.test(sourceFilePath);
};
const defaultModuleFilter = function (importedModule) {
return !path.isAbsolute(importedModule) && !importedModule.startsWith("@") && !importedModule.endsWith(".js");
};
const defaultOptions = {
sourceFileFilter: defaultSourceFileFilter,
moduleFilter: defaultModuleFilter,
};
// Switch this to test on one file or directly run on a directory.
const DEBUG = false;
if (DEBUG) {
replace("./src/index.ts", "./out.ts", defaultOptions);
} else {
await run("./src/", defaultOptions);
}

View File

@@ -1,49 +1,51 @@
{
"name": "@certd/pipeline",
"private": false,
"version": "1.20.16",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
"publishConfig": {
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts"
},
"version": "1.25.3",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"dev": "vite",
"build": "rollup -c",
"build": "tsc --skipLibCheck",
"build3": "rollup -c",
"build2": "vue-tsc --noEmit && vite build",
"preview": "vite preview"
"preview": "vite preview",
"test": "mocha --loader=ts-node/esm"
},
"dependencies": {
"axios": "^1.4.0",
"@certd/plus": "1.25.1",
"axios": "^1.7.2",
"fix-path": "^4.0.0",
"http-proxy-agent": "^7.0.2",
"https-proxy-agent": "^7.0.5",
"lodash-es": "^4.17.21",
"node-forge": "^1.3.1",
"nodemailer": "^6.9.3",
"proxy-agent": "^6.4.0",
"qs": "^6.11.2"
},
"devDependencies": {
"@certd/acme-client": "workspace:^1.20.16",
"@rollup/plugin-commonjs": "^23.0.4",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.0.0",
"@types/chai": "^4.3.5",
"@types/lodash": "^4.14.194",
"@types/chai": "^4.3.10",
"@types/lodash-es": "^4.17.12",
"@types/mocha": "^10.0.1",
"@types/node-forge": "^1.3.2",
"@types/uuid": "^9.0.2",
"@typescript-eslint/eslint-plugin": "^5.59.7",
"@typescript-eslint/parser": "^5.59.7",
"chai": "^4.3.7",
"chai": "4.3.10",
"dayjs": "^1.11.7",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"lodash": "^4.17.21",
"iconv-lite": "^0.6.3",
"log4js": "^6.9.1",
"mocha": "^10.2.0",
"prettier": "^2.8.8",
@@ -52,10 +54,11 @@
"rollup-plugin-typescript2": "^0.34.1",
"rollup-plugin-visualizer": "^5.8.2",
"ts-node": "^10.9.1",
"tsc-esm-fix": "^3.0.0",
"tslib": "^2.5.2",
"typescript": "^5.0.4",
"vite": "^4.3.8",
"vue-tsc": "^1.6.5"
},
"gitHead": "a31f1c7f5e71fa946de9bf0283e11d6ce049b3e9"
"gitHead": "66fb689ac5da29b6ec5ee42d7762fd755bb81f9e"
}

View File

@@ -1,43 +0,0 @@
const resolve = require("@rollup/plugin-node-resolve");
const commonjs = require("@rollup/plugin-commonjs");
//const Typescript = require("rollup-plugin-typescript2");
const Typescript = require("@rollup/plugin-typescript");
const json = require("@rollup/plugin-json");
const terser = require("@rollup/plugin-terser");
module.exports = {
input: "src/index.ts",
output: {
file: "dist/bundle.js",
format: "cjs",
},
plugins: [
// 解析第三方依赖
resolve(),
// 识别 commonjs 模式第三方依赖
commonjs(),
Typescript({
target: "esnext",
rootDir: "src",
declaration: true,
declarationDir: "dist/d",
exclude: ["./node_modules/**", "./src/**/*.vue"],
allowSyntheticDefaultImports: true,
}),
json(),
terser(),
],
external: [
"vue",
"lodash",
"dayjs",
"@certd/acme-client",
"@certd/pipeline",
"@certd/plugin-cert",
"@certd/plugin-aliyun",
"@certd/plugin-tencent",
"@certd/plugin-huawei",
"@certd/plugin-host",
"@certd/plugin-tencent",
"@certd/plugin-util",
],
};

View File

@@ -1,9 +1,10 @@
import { Registrable } from "../registry";
import { FormItemProps } from "../d.ts";
import { Registrable } from "../registry/index.js";
import { FormItemProps } from "../dt/index.js";
export type AccessInputDefine = FormItemProps & {
title: string;
required?: boolean;
encrypt?: boolean;
};
export type AccessDefine = Registrable & {
input?: {
@@ -11,7 +12,7 @@ export type AccessDefine = Registrable & {
};
};
export interface IAccessService {
getById(id: any): Promise<any>;
getById<T = any>(id: any): Promise<T>;
}
// eslint-disable-next-line @typescript-eslint/no-empty-interface

View File

@@ -1,8 +1,8 @@
// src/decorator/memoryCache.decorator.ts
import { AccessDefine, AccessInputDefine } from "./api";
import { Decorator } from "../decorator";
import _ from "lodash";
import { accessRegistry } from "./registry";
import { AccessDefine, AccessInputDefine } from "./api.js";
import { Decorator } from "../decorator/index.js";
import _ from "lodash-es";
import { accessRegistry } from "./registry.js";
// 提供一个唯一 key
export const ACCESS_CLASS_KEY = "pipeline:access";

View File

@@ -1,3 +1,3 @@
export * from "./api";
export * from "./registry";
export * from "./decorator";
export * from "./api.js";
export * from "./registry.js";
export * from "./decorator.js";

View File

@@ -1,4 +1,4 @@
import { Registry } from "../registry";
import { Registry } from "../registry/index.js";
// @ts-ignore
export const accessRegistry = new Registry("access");

View File

@@ -1,6 +1,4 @@
import { AxiosInstance } from "axios";
import { IContext } from "../core";
import { IContext } from "../core/index.js";
export type HttpClient = AxiosInstance;
export type UserContext = IContext;
export type PipelineContext = IContext;

View File

@@ -1,4 +1,5 @@
import { IStorage, MemoryStorage } from "./storage";
import { IStorage, MemoryStorage } from "./storage.js";
const CONTEXT_VERSION_KEY = "contextVersion";
export interface IContext {
getInt(key: string): Promise<number>;
@@ -20,13 +21,11 @@ export class ContextFactory {
}
getContext(scope: string, namespace: string): IContext {
const context = new StorageContext(scope, namespace, this.storage);
return context;
return new StorageContext(scope, namespace, this.storage);
}
getMemoryContext(scope: string, namespace: string): IContext {
const context = new StorageContext(scope, namespace, this.memoryStorage);
return context;
return new StorageContext(scope, namespace, this.memoryStorage);
}
}

View File

@@ -1,18 +1,19 @@
import { ConcurrencyStrategy, NotificationWhen, Pipeline, ResultType, Runnable, RunStrategy, Stage, Step, Task } from "../d.ts";
import _ from "lodash";
import { RunHistory, RunnableCollection } from "./run-history";
import { AbstractTaskPlugin, PluginDefine, pluginRegistry, TaskInstanceContext } from "../plugin";
import { ContextFactory, IContext } from "./context";
import { IStorage } from "./storage";
import { logger } from "../utils/util.log";
import { ConcurrencyStrategy, NotificationWhen, Pipeline, ResultType, Runnable, RunStrategy, Stage, Step, Task } from "../dt/index.js";
import _ from "lodash-es";
import { RunHistory, RunnableCollection } from "./run-history.js";
import { AbstractTaskPlugin, PluginDefine, pluginRegistry, TaskInstanceContext } from "../plugin/index.js";
import { ContextFactory, IContext } from "./context.js";
import { IStorage } from "./storage.js";
import { logger } from "../utils/util.log.js";
import { Logger } from "log4js";
import { createAxiosService } from "../utils/util.request";
import { IAccessService } from "../access";
import { RegistryItem } from "../registry";
import { Decorator } from "../decorator";
import { IEmailService } from "../service";
import { FileStore } from "./file-store";
import { TimeoutPromise } from "../utils/util.promise";
import { createAxiosService } from "../utils/util.request.js";
import { IAccessService } from "../access/index.js";
import { RegistryItem } from "../registry/index.js";
import { Decorator } from "../decorator/index.js";
import { IEmailService } from "../service/index.js";
import { FileStore } from "./file-store.js";
import { hashUtils, utils } from "../utils/index.js";
// import { TimeoutPromise } from "../utils/util.promise.js";
export type ExecutorOptions = {
userId: any;
@@ -23,17 +24,22 @@ export type ExecutorOptions = {
emailService: IEmailService;
fileRootDir?: string;
};
export class Executor {
pipeline: Pipeline;
runtime!: RunHistory;
contextFactory: ContextFactory;
logger: Logger;
pipelineContext!: IContext;
currentStatusMap!: RunnableCollection;
lastStatusMap!: RunnableCollection;
lastRuntime!: RunHistory;
options: ExecutorOptions;
canceled = false;
onChanged: (history: RunHistory) => void;
abort: AbortController = new AbortController();
_inited = false;
onChanged: (history: RunHistory) => Promise<void>;
constructor(options: ExecutorOptions) {
this.options = options;
this.pipeline = _.cloneDeep(options.pipeline);
@@ -47,18 +53,24 @@ export class Executor {
}
async init() {
if (this._inited) {
return;
}
this._inited = true;
const lastRuntime = await this.pipelineContext.getObj(`lastRuntime`);
this.lastRuntime = lastRuntime;
this.lastStatusMap = new RunnableCollection(lastRuntime?.pipeline);
this.currentStatusMap = new RunnableCollection(this.pipeline);
}
async cancel() {
this.canceled = true;
this.abort.abort();
this.runtime?.cancel(this.pipeline);
await this.onChanged(this.runtime);
}
async run(runtimeId: any = 0, triggerType: string) {
let intervalFlushLogId: any = undefined;
try {
await this.init();
const trigger = { type: triggerType };
@@ -66,56 +78,57 @@ export class Executor {
this.runtime = new RunHistory(runtimeId, trigger, this.pipeline);
this.logger.info(`pipeline.${this.pipeline.id} start`);
await this.notification("start");
this.runtime.start(this.pipeline);
intervalFlushLogId = setInterval(async () => {
await this.onChanged(this.runtime);
}, 5000);
await this.runWithHistory(this.pipeline, "pipeline", async () => {
await this.runStages(this.pipeline);
return await this.runStages(this.pipeline);
});
if (this.lastRuntime && this.lastRuntime.pipeline.status?.status === ResultType.error) {
await this.notification("turnToSuccess");
}
await this.notification("success");
} catch (e) {
} catch (e: any) {
await this.notification("error", e);
this.logger.error("pipeline 执行失败", e);
} finally {
clearInterval(intervalFlushLogId);
await this.onChanged(this.runtime);
await this.pipelineContext.setObj("lastRuntime", this.runtime);
this.logger.info(`pipeline.${this.pipeline.id} end`);
}
}
async runWithHistory(runnable: Runnable, runnableType: string, run: () => Promise<void>) {
async runWithHistory(runnable: Runnable, runnableType: string, run: () => Promise<ResultType | void>) {
runnable.runnableType = runnableType;
this.runtime.start(runnable);
await this.onChanged(this.runtime);
if (runnable.strategy?.runStrategy === RunStrategy.SkipWhenSucceed) {
//如果是成功后跳过策略
const lastNode = this.lastStatusMap.get(runnable.id);
const lastResult = lastNode?.status?.status;
const lastInput = JSON.stringify(lastNode?.status?.input);
let inputChanged = false;
if (runnableType === "step") {
const step = runnable as Step;
const input = JSON.stringify(step.input);
if (input != null && lastInput !== input) {
//参数有变化
inputChanged = true;
}
}
if (lastResult != null && lastResult === ResultType.success && !inputChanged) {
this.runtime.skip(runnable);
await this.onChanged(this.runtime);
return ResultType.skip;
}
}
const intervalFlushLogId = setInterval(async () => {
await this.onChanged(this.runtime);
}, 5000);
const timeout = runnable.timeout ?? 20 * 60 * 1000;
this.runtime.start(runnable);
try {
if (this.canceled) {
throw new Error("task canceled");
if (runnable.disabled) {
//该任务被禁用
this.runtime.disabled(runnable);
return ResultType.disabled;
}
await this.onChanged(this.runtime);
if (this.abort.signal.aborted) {
this.runtime.cancel(runnable);
return ResultType.canceled;
}
const resultType = await run();
if (this.abort.signal.aborted) {
this.runtime.cancel(runnable);
return ResultType.canceled;
}
if (resultType == ResultType.skip) {
this.runtime.skip(runnable);
return resultType;
}
await TimeoutPromise(run, timeout);
this.runtime.success(runnable);
return ResultType.success;
} catch (e: any) {
@@ -123,7 +136,6 @@ export class Executor {
throw e;
} finally {
this.runtime.finally(runnable);
clearInterval(intervalFlushLogId);
await this.onChanged(this.runtime);
}
}
@@ -132,7 +144,7 @@ export class Executor {
const resList: ResultType[] = [];
for (const stage of pipeline.stages) {
const res: ResultType = await this.runWithHistory(stage, "stage", async () => {
await this.runStage(stage);
return await this.runStage(stage);
});
resList.push(res);
}
@@ -142,19 +154,26 @@ export class Executor {
async runStage(stage: Stage) {
const runnerList = [];
for (const task of stage.tasks) {
const runner = this.runWithHistory(task, "task", async () => {
await this.runTask(task);
});
const runner = async () => {
return this.runWithHistory(task, "task", async () => {
await this.runTask(task);
return ResultType.success;
});
};
runnerList.push(runner);
}
let resList: ResultType[] = [];
if (stage.concurrency === ConcurrencyStrategy.Parallel) {
resList = await Promise.all(runnerList);
const pList = [];
for (const item of runnerList) {
pList.push(item());
}
resList = await Promise.all(pList);
} else {
for (let i = 0; i < runnerList.length; i++) {
const runner = runnerList[i];
resList[i] = await runner;
resList[i] = await runner();
}
}
return this.compositionResultType(resList);
@@ -181,7 +200,7 @@ export class Executor {
for (const step of task.steps) {
step.runnableType = "step";
const res: ResultType = await this.runWithHistory(step, "step", async () => {
await this.runStep(step);
return await this.runStep(step);
});
resList.push(res);
}
@@ -190,7 +209,7 @@ export class Executor {
private async runStep(step: Step) {
const currentLogger = this.runtime._loggers[step.id];
this.currentStatusMap.add(step);
const lastStatus = this.lastStatusMap.get(step.id);
//执行任务
const plugin: RegistryItem<AbstractTaskPlugin> = pluginRegistry.get(step.type);
@@ -200,19 +219,45 @@ export class Executor {
// @ts-ignore
const define: PluginDefine = plugin.define;
//从outputContext读取输入参数
Decorator.inject(define.input, instance, step.input, (item, key) => {
const input = _.cloneDeep(step.input);
Decorator.inject(define.input, instance, input, (item, key) => {
if (item.component?.name === "pi-output-selector") {
const contextKey = step.input[key];
const contextKey = input[key];
if (contextKey != null) {
const value = this.runtime.context[contextKey];
if (value == null) {
currentLogger.warn(`[step init] input ${define.title} is null`);
if (typeof contextKey !== "string") {
throw new Error(`步骤${step.title}${item.title}属性必须为String类型请重新配置该属性`);
}
// "cert": "step.-BNFVPMKPu2O-i9NiOQxP.cert",
const arr = contextKey.split(".");
const id = arr[1];
const outputKey = arr[2];
input[key] = this.currentStatusMap.get(id)?.status?.output[outputKey] ?? this.lastStatusMap.get(id)?.status?.output[outputKey];
if (input[key] == null) {
this.logger.warn(`${item.title}的配置未找到对应的输出值,请确认对应的前置任务是否存在或者是否执行正确`);
}
step.input[key] = value;
}
}
});
const newInputHash = hashUtils.md5(JSON.stringify(input));
step.status!.inputHash = newInputHash;
//判断是否需要跳过
const lastNode = this.lastStatusMap.get(step.id);
const lastResult = lastNode?.status?.status;
let inputChanged = true;
const lastInputHash = lastNode?.status?.inputHash;
if (lastInputHash && newInputHash && lastInputHash === newInputHash) {
//参数有变化
inputChanged = false;
}
if (step.strategy?.runStrategy === RunStrategy.SkipWhenSucceed) {
if (lastResult != null && lastResult === ResultType.success && !inputChanged) {
step.status!.output = lastNode?.status?.output;
step.status!.files = lastNode?.status?.files;
return ResultType.skip;
}
}
const http = createAxiosService({ logger: currentLogger });
const taskCtx: TaskInstanceContext = {
pipeline: this.pipeline,
@@ -220,6 +265,7 @@ export class Executor {
lastStatus,
http,
logger: currentLogger,
inputChanged,
accessService: this.options.accessService,
emailService: this.options.emailService,
pipelineContext: this.pipelineContext,
@@ -229,23 +275,32 @@ export class Executor {
parent: this.runtime.id,
rootDir: this.options.fileRootDir,
}),
signal: this.abort.signal,
utils,
};
instance.setCtx(taskCtx);
await instance.onInstance();
await instance.execute();
//执行结果处理
if (instance._result.clearLastStatus) {
//是否需要清除所有状态
this.lastStatusMap.clear();
}
//输出到output context
_.forEach(define.output, (item, key) => {
//输出上下文变量到output context
_.forEach(define.output, (item: any, key: any) => {
step.status!.output[key] = instance[key];
const stepOutputKey = `step.${step.id}.${key}`;
this.runtime.context[stepOutputKey] = instance[key];
// const stepOutputKey = `step.${step.id}.${key}`;
// this.runtime.context[stepOutputKey] = instance[key];
});
step.status!.files = instance.getFiles();
//更新pipeline vars
if (Object.keys(instance._result.pipelineVars).length > 0) {
// 判断 pipelineVars 有值时更新
const vars = this.pipelineContext.getObj("vars");
_.merge(vars, instance._result.pipelineVars);
await this.pipelineContext.setObj("vars", vars);
}
}
async notification(when: NotificationWhen, error?: any) {
@@ -255,17 +310,17 @@ export class Executor {
let subject = "";
let content = "";
if (when === "start") {
subject = `【CertD】开始执行${this.pipeline.title}, buildId:${this.runtime.id}`;
content = subject;
subject = `【CertD】开始执行${this.pipeline.id}${this.pipeline.title}`;
content = `buildId:${this.runtime.id}`;
} else if (when === "success") {
subject = `【CertD】执行成功${this.pipeline.title}, buildId:${this.runtime.id}`;
content = subject;
subject = `【CertD】执行成功${this.pipeline.id}${this.pipeline.title}`;
content = `buildId:${this.runtime.id}`;
} else if (when === "turnToSuccess") {
subject = `【CertD】执行成功错误转成功${this.pipeline.title}, buildId:${this.runtime.id}`;
content = subject;
subject = `【CertD】执行成功错误转成功${this.pipeline.id}${this.pipeline.title}`;
content = `buildId:${this.runtime.id}`;
} else if (when === "error") {
subject = `【CertD】执行失败${this.pipeline.title}, buildId:${this.runtime.id}`;
content = `<pre>${error.message}</pre>`;
subject = `【CertD】执行失败${this.pipeline.id}${this.pipeline.title}`;
content = `buildId:${this.runtime.id}\nerror:${error.message}`;
} else {
return;
}
@@ -275,13 +330,21 @@ export class Executor {
continue;
}
if (notification.type === "email") {
this.options.emailService?.send({
userId: this.pipeline.userId,
subject,
content,
receivers: notification.options.receivers,
});
try {
await this.options.emailService?.send({
userId: this.pipeline.userId,
subject,
content,
receivers: notification.options.receivers,
});
} catch (e) {
logger.error("send email error", e);
}
}
}
}
clearLastStatus(stepId: string) {
this.lastStatusMap.clearById(stepId);
}
}

View File

@@ -1,8 +1,8 @@
import { fileUtils } from "../utils";
import { fileUtils } from "../utils/index.js";
import dayjs from "dayjs";
import path from "path";
import fs from "fs";
import { logger } from "../utils";
import { logger } from "../utils/index.js";
export type FileStoreOptions = {
rootDir?: string;
@@ -10,9 +10,17 @@ export type FileStoreOptions = {
parent: string;
};
export interface IFileStore {
readFile(filePath: string): Buffer | null;
writeFile(filename: string, file: Buffer): string;
deleteByParent(scope: string, parent: string): void;
}
export class FileStore {
rootDir: string;
// pipelineId
scope: string;
// historyId
parent: string;
constructor(options?: FileStoreOptions) {
this.rootDir = fileUtils.getFileRootDir(options?.rootDir);
@@ -35,7 +43,7 @@ export class FileStore {
return localPath;
}
private buildFilePath(filename: string) {
protected buildFilePath(filename: string) {
const parentDir = path.join(this.rootDir, this.scope + "", this.parent + "", dayjs().format("YYYY-MM-DD"));
if (!fs.existsSync(parentDir)) {
fs.mkdirSync(parentDir, { recursive: true });
@@ -46,7 +54,10 @@ export class FileStore {
deleteByParent(scope: string, parent: string) {
const dir = path.join(this.rootDir, scope, parent);
if (fs.existsSync(dir)) {
fs.unlinkSync(dir);
fs.rmSync(dir, {
recursive: true,
force: true,
});
}
}
}

View File

@@ -0,0 +1,33 @@
import _ from "lodash-es";
import { HttpClient, ILogger } from "../utils";
export type PluginRequest = {
type: "plugin" | "access";
typeName: string;
action: string;
input: any;
data: any;
};
export type RequestHandleContext = {
http: HttpClient;
logger: ILogger;
};
export class RequestHandler {
async onRequest(req: PluginRequest, ctx: RequestHandleContext) {
if (!req.action) {
throw new Error("action is required");
}
const methodName = `on${_.upperFirst(req.action)}`;
// @ts-ignore
const method = this[methodName];
if (method) {
// @ts-ignore
return await this[methodName](req.data, ctx);
}
throw new Error(`action ${req.action} not found`);
}
}

View File

@@ -1,5 +1,7 @@
export * from "./executor";
export * from "./run-history";
export * from "./context";
export * from "./storage";
export * from "./file-store";
export * from "./executor.js";
export * from "./run-history.js";
export * from "./context.js";
export * from "./storage.js";
export * from "./file-store.js";
export * from "./license.js";
export * from "./handler.js";

View File

@@ -0,0 +1,10 @@
import { logger } from "../utils/index.js";
import { setLogger, isPlus } from "@certd/plus";
setLogger(logger);
export * from "@certd/plus";
export function checkPlus() {
if (!isPlus()) {
throw new Error("此为专业版功能,请升级到专业版");
}
}

View File

@@ -1,6 +1,6 @@
import { Context, HistoryResult, Pipeline, ResultType, Runnable, RunnableMap, Stage, Step, Task } from "../d.ts";
import _ from "lodash";
import { buildLogger } from "../utils/util.log";
import { HistoryResult, Pipeline, ResultType, Runnable, RunnableMap, Stage, Step, Task } from "../dt/index.js";
import _ from "lodash-es";
import { buildLogger } from "../utils/util.log.js";
import { Logger } from "log4js";
export type HistoryStatus = {
@@ -14,15 +14,12 @@ export type RunTrigger = {
export function NewRunHistory(obj: any) {
const history = new RunHistory(obj.id, obj.trigger, obj.pipeline);
history.context = obj.context;
history.logs = obj.logs;
history._loggers = obj.loggers;
return history;
}
export class RunHistory {
id!: string;
//运行时上下文变量
context: Context = {};
pipeline!: Pipeline;
logs: {
[runnableId: string]: string[];
@@ -44,10 +41,8 @@ export class RunHistory {
this._loggers[runnable.id] = buildLogger((text) => {
this.logs[runnable.id].push(text);
});
const input = (runnable as Step).input;
const status: HistoryResult = {
output: {},
input: _.cloneDeep(input),
status: ResultType.start,
startTime: now,
result: ResultType.start,
@@ -79,6 +74,17 @@ export class RunHistory {
this.log(runnable, `跳过`);
}
disabled(runnable: Runnable) {
const now = new Date().getTime();
const status = runnable.status;
_.merge(status, {
status: "canceled",
endTime: now,
result: "disabled",
});
this.log(runnable, `禁用`);
}
error(runnable: Runnable, e: Error) {
const now = new Date().getTime();
const status = runnable.status;
@@ -107,12 +113,13 @@ export class RunHistory {
log(runnable: Runnable, text: string) {
// @ts-ignore
this._loggers[runnable.id].info(`[${runnable.title}]<id:${runnable.id}> [${runnable.runnableType}]`, text);
this._loggers[runnable.id].info(`[${runnable.runnableType}] [${runnable.title}]<id:${runnable.id}> `, text);
}
logError(runnable: Runnable, e: Error) {
// @ts-ignore
this._loggers[runnable.id].error(`[${runnable.title}]<id:${runnable.id}> [${runnable.runnableType}]`, e);
const errorInfo = runnable.runnableType === "step" ? e : e.message;
this._loggers[runnable.id].error(`[${runnable.runnableType}] [${runnable.title}]<id:${runnable.id}> `, errorInfo);
}
finally(runnable: Runnable) {
@@ -168,4 +175,16 @@ export class RunnableCollection {
item.status = undefined;
});
}
clearById(id: string) {
const runnable = this.collection[id];
if (runnable?.status) {
runnable.status.status = ResultType.none;
runnable.status.result = ResultType.none;
}
}
add(runnable: Runnable) {
this.collection[runnable.id] = runnable;
}
}

View File

@@ -1,6 +1,6 @@
import fs from "fs";
import path from "path";
import { fileUtils } from "../utils/util.file";
import { fileUtils } from "../utils/util.file.js";
export interface IStorage {
get(scope: string, namespace: string, version: string, key: string): Promise<string | null>;

View File

@@ -70,6 +70,7 @@ export type Runnable = {
default?: {
[key: string]: any;
};
context?: Context;
};
export type EmailOptions = {

View File

@@ -1,4 +1,4 @@
import { Decorator } from "./index";
import { Decorator } from "./index.js";
export type AutowireProp = {
name?: string;

View File

@@ -1,2 +1,2 @@
export * from "./utils";
export * from "./common";
export * from "./utils.js";
export * from "./common.js";

View File

@@ -1,4 +1,4 @@
import _ from "lodash";
import _ from "lodash-es";
const propertyMap: any = {};
function attachProperty(target: any, propertyKey: string | symbol) {
@@ -11,7 +11,11 @@ function attachProperty(target: any, propertyKey: string | symbol) {
}
function getClassProperties(target: any) {
return propertyMap[target] || {};
//获取父类
const parent = Object.getPrototypeOf(target);
const parentMap = propertyMap[parent] || {};
const current = propertyMap[target] || {};
return _.merge({}, parentMap, current);
}
function target(target: any, propertyKey?: string | symbol) {
@@ -25,7 +29,7 @@ function target(target: any, propertyKey?: string | symbol) {
}
function inject(define: any, instance: any, context: any, preHandler?: (item: any, key: string, instance: any, context: any) => void) {
_.forEach(define, (item, key) => {
_.forEach(define, (item: any, key: any) => {
if (preHandler) {
preHandler(item, key, instance, context);
}

View File

@@ -0,0 +1,115 @@
/**
* [x]-col的配置
*/
export type ColProps = {
span?: number;
[props: string]: any;
};
export type FormItemProps = {
/**
* 字段label
*/
title?: string;
/**
* 表单字段组件配置
*/
component?: ComponentProps;
/**
* 表单字段 [a|el|n]-col的配置
* 一般用来配置跨列:{span:24} 占满一行
*/
col?: ColProps;
/**
* 默认值
*/
value?: any;
/**
* 帮助提示配置
*/
helper?: string | FormItemHelperProps;
/**
* 排序号
*/
order?: number;
/**
* 是否显示此字段
*/
show?: boolean;
/**
* 是否是空白占位栏
*/
blank?: boolean;
[key: string]: any;
};
/**
* 表单字段帮助说明配置
*/
export type FormItemHelperProps = {
/**
* 自定义渲染帮助说明
* @param scope
*/
render?: (scope: any) => any;
/**
* 帮助文本
*/
text?: string;
/**
* 帮助说明所在的位置,[ undefined | label]
*/
position?: string;
/**
* [a|el|n]-tooltip配置
*/
tooltip?: object;
[key: string]: any;
};
/**
* 组件配置
*/
export type ComponentProps = {
/**
* 组件的名称
*/
name?: string | object;
/**
* vmodel绑定的目标属性名
*/
vModel?: string;
/**
* 当原始组件名的参数被以上属性名占用时,可以配置在这里
* 例如:原始组件有一个叫name的属性你想要配置它则可以按如下配置
* ```
* component:{
* name:"组件的名称"
* props:{
* name:"组件的name属性" <-----------
* }
* }
* ```
*/
props?: {
[key: string]: any;
};
/**
* 组件事件监听
*/
on?: {
[key: string]: (context?: any) => void;
};
/**
* 组件其他参数
* 事件onXxx:(event)=>void 组件原始事件监听
* on.onXxx:(context)=>void 组件事件监听(对原始事件包装)
* 样式style、class等
*/
[key: string]: any;
};

View File

@@ -0,0 +1,2 @@
export * from "./pipeline.js";
export * from "./fast-crud.js";

View File

@@ -0,0 +1,143 @@
export enum RunStrategy {
AlwaysRun,
SkipWhenSucceed,
}
export enum ConcurrencyStrategy {
Serial,
Parallel,
}
export enum NextStrategy {
AllSuccess,
OneSuccess,
}
export enum HandlerType {
//清空后续任务的状态
ClearFollowStatus,
SendEmail,
}
export type EventHandler = {
type: HandlerType;
params: {
[key: string]: any;
};
};
export type RunnableStrategy = {
runStrategy?: RunStrategy;
onSuccess?: EventHandler[];
onError?: EventHandler[];
};
export type Step = Runnable & {
type: string; //插件类型
input: {
[key: string]: any;
};
};
export type Task = Runnable & {
steps: Step[];
};
export type Stage = Runnable & {
tasks: Task[];
concurrency: ConcurrencyStrategy;
next: NextStrategy;
maxTaskCount?: number;
};
export type Trigger = {
id: string;
title: string;
cron: string;
type: string;
};
export type FileItem = {
id: string;
filename: string;
path: string;
};
export type Runnable = {
id: string;
title: string;
strategy?: RunnableStrategy;
runnableType?: string; // pipeline, stage, task , step
status?: HistoryResult;
timeout?: number;
default?: {
[key: string]: any;
};
disabled?: boolean;
};
export type EmailOptions = {
receivers: string[];
};
export type NotificationWhen = "error" | "success" | "turnToSuccess" | "start";
export type NotificationType = "email" | "url";
export type Notification = {
type: NotificationType;
when: NotificationWhen[];
options: EmailOptions;
};
export type Pipeline = Runnable & {
version?: number;
userId: any;
stages: Stage[];
triggers: Trigger[];
notifications?: Notification[];
};
export type Context = {
[key: string]: any;
};
export type Log = {
title: string;
time: number;
level: string;
text: string;
};
export enum ResultType {
start = "start",
success = "success",
error = "error",
canceled = "canceled",
skip = "skip",
disabled = "disabled",
none = "none",
}
export type HistoryResultGroup = {
[key: string]: {
runnable: Runnable;
res: HistoryResult;
};
};
export type HistoryResult = {
// input: any;
inputHash?: string;
output: any;
files?: FileItem[];
/**
* 任务状态
*/
status: ResultType;
startTime: number;
endTime?: number;
/**
* 处理结果
*/
result?: ResultType; //success, error,skip
message?: string;
};
export type RunnableMap = {
[id: string]: Runnable;
};

View File

@@ -1,10 +1,10 @@
import "util";
export * from "./core";
export * from "./d.ts";
export * from "./access";
export * from "./registry";
export * from "./plugin";
export * from "./utils";
export * from "./context";
export * from "./decorator";
export * from "./service";
export * from "./core/index.js";
export * from "./dt/index.js";
export * from "./access/index.js";
export * from "./registry/index.js";
export * from "./plugin/index.js";
export * from "./utils/index.js";
export * from "./context/index.js";
export * from "./decorator/index.js";
export * from "./service/index.js";

View File

@@ -1,13 +1,14 @@
import { Registrable } from "../registry";
import { FileItem, FormItemProps, Pipeline, Runnable, Step } from "../d.ts";
import { FileStore } from "../core/file-store";
import { Registrable } from "../registry/index.js";
import { FileItem, FormItemProps, Pipeline, Runnable, Step } from "../dt/index.js";
import { FileStore } from "../core/file-store.js";
import { Logger } from "log4js";
import { IAccessService } from "../access";
import { IEmailService } from "../service";
import { IContext } from "../core";
import { AxiosInstance } from "axios";
import { logger } from "../utils";
import { IAccessService } from "../access/index.js";
import { IEmailService } from "../service/index.js";
import { IContext } from "../core/index.js";
import { ILogger, logger } from "../utils/index.js";
import { HttpClient } from "../utils/util.request";
import { utils } from "../utils/index.js";
import dayjs from "dayjs";
export enum ContextScope {
global,
pipeline,
@@ -17,12 +18,15 @@ export enum ContextScope {
export type TaskOutputDefine = {
title: string;
value?: any;
type?: string;
};
export type TaskInputDefine = FormItemProps;
export type PluginDefine = Registrable & {
default?: any;
group?: string;
icon?: string;
input?: {
[key: string]: TaskInputDefine;
};
@@ -39,6 +43,8 @@ export type PluginDefine = Registrable & {
dest: string;
type: "computed";
}[];
needPlus?: boolean;
};
export type ITaskPlugin = {
@@ -50,23 +56,43 @@ export type ITaskPlugin = {
export type TaskResult = {
clearLastStatus?: boolean;
files?: FileItem[];
pipelineVars: Record<string, any>;
};
export type TaskInstanceContext = {
//流水线定义
pipeline: Pipeline;
//步骤定义
step: Step;
//日志
logger: Logger;
//当前步骤输入参数跟上一次执行比较是否有变化
inputChanged: boolean;
//授权获取服务
accessService: IAccessService;
//邮件服务
emailService: IEmailService;
//流水线上下文
pipelineContext: IContext;
//用户上下文
userContext: IContext;
http: AxiosInstance;
//http请求客户端
http: HttpClient;
//文件存储
fileStore: FileStore;
//上一次执行结果状态
lastStatus?: Runnable;
//用户取消信号
signal: AbortSignal;
//工具类
utils: typeof utils;
};
export abstract class AbstractTaskPlugin implements ITaskPlugin {
_result: TaskResult = { clearLastStatus: false, files: [] };
_result: TaskResult = { clearLastStatus: false, files: [], pipelineVars: {} };
ctx!: TaskInstanceContext;
logger!: ILogger;
accessService!: IAccessService;
clearLastStatus() {
this._result.clearLastStatus = true;
}
@@ -77,27 +103,30 @@ export abstract class AbstractTaskPlugin implements ITaskPlugin {
setCtx(ctx: TaskInstanceContext) {
this.ctx = ctx;
this.logger = ctx.logger;
this.accessService = ctx.accessService;
}
randomFileId() {
return Math.random().toString(36).substring(2, 9);
}
linkFile(file: FileItem) {
this._result.files!.push({
...file,
id: this.randomFileId(),
});
}
saveFile(filename: string, file: Buffer) {
const filePath = this.ctx.fileStore.writeFile(filename, file);
logger.info(`saveFile:${filePath}`);
this._result.files!.push({
this._result.files?.push({
id: this.randomFileId(),
filename,
path: filePath,
});
}
extendsFiles() {
if (this._result.files == null) {
this._result.files = [];
}
this._result.files.push(...(this.ctx.lastStatus?.status?.files || []));
}
get pipeline() {
return this.ctx.pipeline;
}
@@ -111,6 +140,13 @@ export abstract class AbstractTaskPlugin implements ITaskPlugin {
}
abstract execute(): Promise<void>;
appendTimeSuffix(name?: string) {
if (name == null) {
name = "certd";
}
return name + "_" + dayjs().format("YYYYMMDDHHmmss");
}
}
export type OutputVO = {

View File

@@ -1,8 +1,8 @@
import _ from "lodash";
import { pluginRegistry } from "./registry";
import { PluginDefine, TaskInputDefine, TaskOutputDefine } from "./api";
import { Decorator } from "../decorator";
import { AUTOWIRE_KEY } from "../decorator";
import _ from "lodash-es";
import { pluginRegistry } from "./registry.js";
import { PluginDefine, TaskInputDefine, TaskOutputDefine } from "./api.js";
import { Decorator } from "../decorator/index.js";
import { AUTOWIRE_KEY } from "../decorator/index.js";
import "reflect-metadata";
// 提供一个唯一 key
export const PLUGIN_CLASS_KEY = "pipeline:plugin";
@@ -31,7 +31,24 @@ export function IsTaskPlugin(define: PluginDefine): ClassDecorator {
outputs[property] = output;
}
}
_.merge(define, { input: inputs, autowire: autowires, output: outputs });
// inputs 转换为array根据order排序然后再转换为map
let inputArray = [];
for (const key in inputs) {
const _input = inputs[key];
if (_input.order == null) {
_input.order = 0;
}
inputArray.push([key, _input]);
}
inputArray = _.sortBy(inputArray, (item: any) => item[1].order);
const inputMap: any = {};
inputArray.forEach((item: any) => {
inputMap[item[0]] = item[1];
});
_.merge(define, { input: inputMap, autowire: autowires, output: outputs });
Reflect.defineMetadata(PLUGIN_CLASS_KEY, define, target);

View File

@@ -0,0 +1,26 @@
import { PluginDefine } from "./api";
export class PluginGroup {
key: string;
title: string;
desc?: string;
order: number;
plugins: PluginDefine[];
constructor(key: string, title: string, order = 0, desc = "") {
this.key = key;
this.title = title;
this.order = order;
this.desc = desc;
this.plugins = [];
}
}
export const pluginGroups = {
cert: new PluginGroup("cert", "证书申请", 1),
aliyun: new PluginGroup("aliyun", "阿里云", 2),
huawei: new PluginGroup("huawei", "华为云", 3),
tencent: new PluginGroup("tencent", "腾讯云", 4),
host: new PluginGroup("host", "主机", 5),
cdn: new PluginGroup("cdn", "CDN", 6),
other: new PluginGroup("other", "其他", 7),
};

View File

@@ -1,3 +1,4 @@
export * from "./api";
export * from "./registry";
export * from "./decorator";
export * from "./api.js";
export * from "./registry.js";
export * from "./decorator.js";
export * from "./group.js";

View File

@@ -1,4 +1,16 @@
import { Registry } from "../registry";
import { AbstractTaskPlugin } from "./api";
import { OnRegisterContext, Registry } from "../registry/index.js";
import { AbstractTaskPlugin } from "./api.js";
import { pluginGroups } from "./group.js";
export const pluginRegistry = new Registry<AbstractTaskPlugin>("plugin");
const onRegister = ({ key, value }: OnRegisterContext<AbstractTaskPlugin>) => {
const group = value?.define?.group as string;
if (group) {
if (pluginGroups.hasOwnProperty(group)) {
// @ts-ignore
pluginGroups[group].plugins.push(value.define);
} else {
pluginGroups.other.plugins.push(value.define);
}
}
};
export const pluginRegistry = new Registry<AbstractTaskPlugin>("plugin", onRegister);

View File

@@ -1,6 +1,5 @@
import { ITaskPlugin } from "../api";
import { IsTaskPlugin, TaskInput } from "../decorator";
import { Autowire } from "../../decorator";
import { ITaskPlugin } from "../api.js";
import { IsTaskPlugin, TaskInput } from "../decorator.js";
@IsTaskPlugin({
name: "EchoPlugin",

View File

@@ -1 +1 @@
export * from "./registry";
export * from "./registry.js";

View File

@@ -1,23 +1,34 @@
import { logger } from "../utils";
import { logger } from "../utils/index.js";
export type Registrable = {
name: string;
title: string;
desc?: string;
group?: string;
};
export type RegistryItem<T> = {
define: Registrable;
target: T;
};
export type OnRegisterContext<T> = {
registry: Registry<T>;
key: string;
value: RegistryItem<T>;
};
export type OnRegister<T> = (ctx: OnRegisterContext<T>) => void;
export class Registry<T> {
type = "";
storage: {
[key: string]: RegistryItem<T>;
} = {};
constructor(type: string) {
onRegister?: OnRegister<T>;
constructor(type: string, onRegister?: OnRegister<T>) {
this.type = type;
this.onRegister = onRegister;
}
register(key: string, value: RegistryItem<T>) {
@@ -25,6 +36,13 @@ export class Registry<T> {
return;
}
this.storage[key] = value;
if (this.onRegister) {
this.onRegister({
registry: this,
key,
value,
});
}
logger.info(`注册插件:${this.type}:${key}`);
}

View File

@@ -1 +1 @@
export * from "./email";
export * from "./email.js";

View File

@@ -1,8 +1,22 @@
import sleep from "./util.sleep";
import { request } from "./util.request";
export * from "./util.log";
export * from "./util.file";
import sleep from "./util.sleep.js";
import { http } from "./util.request.js";
export * from "./util.request.js";
export * from "./util.log.js";
export * from "./util.file.js";
export * from "./util.sp.js";
export * from "./util.promise.js";
export * from "./util.hash.js";
import { sp } from "./util.sp.js";
import { hashUtils } from "./util.hash.js";
import { promises } from "./util.promise.js";
import { fileUtils } from "./util.file.js";
import _ from "lodash-es";
export const utils = {
sleep,
http: request,
http,
sp,
hash: hashUtils,
promises,
file: fileUtils,
_,
};

View File

@@ -0,0 +1,9 @@
import crypto from "crypto";
function md5(data: string) {
return crypto.createHash("md5").update(data).digest("hex");
}
export const hashUtils = {
md5,
};

View File

@@ -1,3 +1,5 @@
import { logger } from "./util.log.js";
export function TimeoutPromise(callback: () => Promise<void>, ms = 30 * 1000) {
let timeout: any;
return Promise.race([
@@ -11,3 +13,19 @@ export function TimeoutPromise(callback: () => Promise<void>, ms = 30 * 1000) {
clearTimeout(timeout);
});
}
export function safePromise<T>(callback: (resolve: (ret: T) => void, reject: (ret: any) => void) => void): Promise<T> {
return new Promise((resolve, reject) => {
try {
callback(resolve, reject);
} catch (e) {
logger.error(e);
reject(e);
}
});
}
export const promises = {
TimeoutPromise,
safePromise,
};

View File

@@ -1,25 +1,69 @@
import axios from "axios";
// @ts-ignore
import qs from "qs";
import { logger } from "./util.log";
import axios, { AxiosRequestConfig } from "axios";
import { logger } from "./util.log.js";
import { Logger } from "log4js";
import { HttpProxyAgent } from "http-proxy-agent";
import { HttpsProxyAgent } from "https-proxy-agent";
import nodeHttp from "http";
export class HttpError extends Error {
status?: number;
statusText?: string;
code?: string;
request?: { url: string; method: string; params?: any; data?: any };
response?: { data: any };
cause?: any;
constructor(error: any) {
if (!error) {
return;
}
super(error.message);
this.name = error.name;
this.code = error.code;
this.cause = error.cause;
this.status = error.response?.status;
this.statusText = error.response?.statusText;
this.request = {
url: error.config?.url,
method: error.config?.method,
params: error.config?.params,
data: error.config?.data,
};
this.response = {
data: error.response?.data,
};
delete error.response;
delete error.config;
delete error.request;
// logger.error(error);
}
}
export const HttpCommonError = HttpError;
/**
* @description 创建请求实例
*/
export function createAxiosService({ logger }: { logger: Logger }) {
// 创建一个 axios 实例
const service = axios.create();
const defaultAgents = createAgent();
// 请求拦截
service.interceptors.request.use(
(config: any) => {
if (config.formData) {
config.data = qs.stringify(config.formData, {
arrayFormat: "indices",
allowDots: true,
}); // 序列化请求参数
delete config.formData;
logger.info(`http request:${config.url}method:${config.method}params:${JSON.stringify(config.params)}`);
if (config.timeout == null) {
config.timeout = 15000;
}
logger.info(`http request:${config.url}method:${config.method}`);
let agents = defaultAgents;
if (config.skipSslVerify) {
logger.info("跳过SSL验证");
agents = createAgent({ rejectUnauthorized: false } as any);
}
delete config.skipSslVerify;
config.httpsAgent = agents.httpsAgent;
config.httpAgent = agents.httpAgent;
return config;
},
(error: Error) => {
@@ -35,29 +79,83 @@ export function createAxiosService({ logger }: { logger: Logger }) {
return response.data;
},
(error: any) => {
// const status = _.get(error, 'response.status')
// switch (status) {
// case 400: error.message = '请求错误'; break
// case 401: error.message = '未授权,请登录'; break
// case 403: error.message = '拒绝访问'; break
// case 404: error.message = `请求地址出错: ${error.response.config.url}`; break
// case 408: error.message = '请求超时'; break
// case 500: error.message = '服务器内部错误'; break
// case 501: error.message = '服务未实现'; break
// case 502: error.message = '网关错误'; break
// case 503: error.message = '服务不可用'; break
// case 504: error.message = '网关超时'; break
// case 505: error.message = 'HTTP版本不受支持'; break
// default: break
// }
logger.error(`请求出错url:${error?.response?.config.url},method:${error.response.config.method},status:${error?.response?.status}`);
logger.info("返回数据:", JSON.stringify(error?.response?.data));
delete error.config;
delete error.response;
return Promise.reject(error);
const status = error.response?.status;
switch (status) {
case 400:
error.message = "请求错误";
break;
case 401:
error.message = "未授权,请登录";
break;
case 403:
error.message = "拒绝访问";
break;
case 404:
error.message = `请求地址出错: ${error.response.config.url}`;
break;
case 408:
error.message = "请求超时";
break;
case 500:
error.message = "服务器内部错误";
break;
case 501:
error.message = "服务未实现";
break;
case 502:
error.message = "网关错误";
break;
case 503:
error.message = "服务不可用";
break;
case 504:
error.message = "网关超时";
break;
case 505:
error.message = "HTTP版本不受支持";
break;
default:
break;
}
logger.error(
`请求出错status:${error.response?.status},statusText:${error.response?.statusText},url:${error.config?.url},method:${error.config?.method}`
);
logger.error("返回数据:", JSON.stringify(error.response?.data));
if (error.response?.data) {
error.message = error.response.data.message || error.response.data.msg || error.response.data.error || error.response.data;
}
if (error instanceof AggregateError) {
logger.error("AggregateError", error);
}
const err = new HttpError(error);
return Promise.reject(err);
}
);
return service;
}
export const request = createAxiosService({ logger });
export const http = createAxiosService({ logger }) as HttpClient;
export type HttpClientResponse<R> = any;
export type HttpRequestConfig<D> = {
skipSslVerify?: boolean;
} & AxiosRequestConfig<D>;
export type HttpClient = {
request<D = any, R = any>(config: HttpRequestConfig<D>): Promise<HttpClientResponse<R>>;
};
export function createAgent(opts: nodeHttp.AgentOptions = {}) {
let httpAgent, httpsAgent;
const httpProxy = process.env.HTTP_PROXY || process.env.http_proxy;
if (httpProxy) {
httpAgent = new HttpProxyAgent(httpProxy, opts as any);
}
const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy;
if (httpsProxy) {
httpsAgent = new HttpsProxyAgent(httpsProxy, opts as any);
}
return {
httpAgent,
httpsAgent,
};
}

View File

@@ -0,0 +1,112 @@
//转换为import
import childProcess from "child_process";
import { safePromise } from "./util.promise.js";
import { ILogger, logger } from "./util.log.js";
export type ExecOption = {
cmd: string | string[];
env: any;
logger?: ILogger;
options?: any;
};
async function exec(opts: ExecOption): Promise<string> {
let cmd = "";
const log = opts.logger || logger;
if (opts.cmd instanceof Array) {
for (const item of opts.cmd) {
if (cmd) {
cmd += " && " + item;
} else {
cmd = item;
}
}
}
log.info(`执行命令: ${cmd}`);
return safePromise((resolve, reject) => {
childProcess.exec(
cmd,
{
env: {
...process.env,
...opts.env,
},
...opts.options,
},
(error, stdout, stderr) => {
if (error) {
log.error(`exec error: ${error}`);
reject(error);
} else {
const res = stdout.toString("utf-8");
log.info(`stdout: ${res}`);
resolve(res);
}
}
);
});
}
export type SpawnOption = {
cmd: string | string[];
onStdout?: (data: string) => void;
onStderr?: (data: string) => void;
env?: any;
logger?: ILogger;
options?: any;
};
async function spawn(opts: SpawnOption): Promise<string> {
let cmd = "";
const log = opts.logger || logger;
if (opts.cmd instanceof Array) {
for (const item of opts.cmd) {
if (cmd) {
cmd += " && " + item;
} else {
cmd = item;
}
}
} else {
cmd = opts.cmd;
}
log.info(`执行命令: ${cmd}`);
let stdout = "";
let stderr = "";
return safePromise((resolve, reject) => {
const ls = childProcess.spawn(cmd, {
shell: true,
env: {
...process.env,
...opts.env,
},
...opts.options,
});
ls.stdout.on("data", (data) => {
log.info(`stdout: ${data}`);
stdout += data;
});
ls.stderr.on("data", (data) => {
log.error(`stderr: ${data}`);
stderr += data;
});
ls.on("error", (error) => {
log.error(`child process error: ${error}`);
reject(error);
});
ls.on("close", (code: number) => {
if (code !== 0) {
log.error(`child process exited with code ${code}`);
reject(new Error(stderr));
} else {
resolve(stdout);
}
});
});
}
export const sp = {
spawn,
exec,
};

View File

@@ -1,6 +1,6 @@
import { expect } from "chai";
import "mocha";
import { EchoPlugin } from "./echo-plugin";
import { EchoPlugin } from "./echo-plugin.js";
describe("task_plugin", function () {
it("#taskplugin", function () {
console.log("before new plugin");

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