diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml
index c648873e1..45ab6ad74 100644
--- a/.github/workflows/build-image.yml
+++ b/.github/workflows/build-image.yml
@@ -3,7 +3,7 @@ on:
push:
branches: ['v2-dev']
paths:
- - "build.trigger"
+ - "trigger/build.trigger"
# schedule:
# - # 国际时间 19:17 执行,北京时间3:17 ↙↙↙ 改成你想要每天自动执行的时间
@@ -68,7 +68,7 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
+
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
@@ -82,34 +82,4 @@ jobs:
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}}
- ghcr.io/${{ github.repository }}:latest
- ghcr.io/${{ github.repository }}:${{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
- ghcr.io/${{ github.repository }}:armv7
- ghcr.io/${{ github.repository }}:${{steps.get_certd_version.outputs.result}}-armv7
-
-# - name: Build agent
-# uses: docker/build-push-action@v6
-# with:
-# platforms: linux/amd64,linux/arm64
-# push: true
-# context: ./packages/ui/agent/
-# tags: |
-# registry.cn-shenzhen.aliyuncs.com/handsfree/certd-agent:latest
-# registry.cn-shenzhen.aliyuncs.com/handsfree/certd-agent:${{steps.get_certd_version.outputs.result}}
-# greper/certd-agent:latest
-# greper/certd-agent:${{steps.get_certd_version.outputs.result}}
diff --git a/.github/workflows/deploy-demo.yml b/.github/workflows/deploy-demo.yml
index 50fdeca79..24fdc1592 100644
--- a/.github/workflows/deploy-demo.yml
+++ b/.github/workflows/deploy-demo.yml
@@ -3,12 +3,13 @@ on:
push:
branches: ['v2-dev']
paths:
- - "deploy.trigger"
+ - "trigger/deploy.trigger"
workflow_run:
workflows: [ "build-image" ]
types:
- completed
+
# schedule:
# - # 国际时间 19:17 执行,北京时间3:17 ↙↙↙ 改成你想要每天自动执行的时间
# - cron: '17 19 * * *'
@@ -54,14 +55,3 @@ jobs:
retry-count: 3
retry-delay: 5000
- - name: deploy-certd-doc
- uses: tyrrrz/action-http-request@master
- with:
- url: http://flow-openapi.aliyun.com/pipeline/webhook/IiSxLDp9aOhgDUxJPytv
- method: POST
- body: |
- {}
- headers: |
- Content-Type: application/json
- retry-count: 3
- retry-delay: 5000
diff --git a/.github/workflows/build-image-for-test.yml b/.github/workflows/release-image.yml
similarity index 62%
rename from .github/workflows/build-image-for-test.yml
rename to .github/workflows/release-image.yml
index 85aa34726..ecc011cca 100644
--- a/.github/workflows/build-image-for-test.yml
+++ b/.github/workflows/release-image.yml
@@ -1,9 +1,13 @@
-name: build-image-for-test
+name: build-image-for-release
on:
push:
branches: ['v2-dev']
paths:
- - "build-dev.trigger"
+ - "trigger/release.trigger"
+# workflow_run:
+# workflows: [ "deploy-demo" ]
+# types:
+# - completed
# schedule:
# - # 国际时间 19:17 执行,北京时间3:17 ↙↙↙ 改成你想要每天自动执行的时间
@@ -20,7 +24,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- ref: v2-dev
+ lfs: true
- name: get_certd_version
id: get_certd_version
@@ -75,17 +79,19 @@ jobs:
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-dev:latest
-# greper/certd-dev:latest
-# ghcr.io/${{ github.repository }}:dev-latest
-
+ - 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}}
+ ghcr.io/${{ github.repository }}:latest
+ ghcr.io/${{ github.repository }}:${{steps.get_certd_version.outputs.result}}
- name: Build armv7
uses: docker/build-push-action@v6
with:
@@ -96,4 +102,30 @@ jobs:
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
\ No newline at end of file
+ greper/certd:${{steps.get_certd_version.outputs.result}}-armv7
+ ghcr.io/${{ github.repository }}:armv7
+ ghcr.io/${{ github.repository }}:${{steps.get_certd_version.outputs.result}}-armv7
+
+# - name: Build agent
+# uses: docker/build-push-action@v6
+# with:
+# platforms: linux/amd64,linux/arm64
+# push: true
+# context: ./packages/ui/agent/
+# tags: |
+# registry.cn-shenzhen.aliyuncs.com/handsfree/certd-agent:latest
+# registry.cn-shenzhen.aliyuncs.com/handsfree/certd-agent:${{steps.get_certd_version.outputs.result}}
+# greper/certd-agent:latest
+# greper/certd-agent:${{steps.get_certd_version.outputs.result}}
+
+ - name: deploy-certd-doc
+ uses: tyrrrz/action-http-request@master
+ with:
+ url: http://flow-openapi.aliyun.com/pipeline/webhook/IiSxLDp9aOhgDUxJPytv
+ method: POST
+ body: |
+ {}
+ headers: |
+ Content-Type: application/json
+ retry-count: 3
+ retry-delay: 5000
diff --git a/.gitignore b/.gitignore
index 65958ab51..9c7c6565e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
./packages/core/lego
# IntelliJ project files
-.vscode/
node_modules/
npm-debug.log
yarn-error.log
@@ -30,5 +29,5 @@ test/**/*.js
/packages/ui/certd-server/data/db.sqlite
/packages/ui/certd-server/data/keys.yaml
/packages/pro/
-
-test.js
\ No newline at end of file
+test.js
+.history
\ No newline at end of file
diff --git a/.npmrc b/.npmrc
index beae5694f..f8f4e0af2 100644
--- a/.npmrc
+++ b/.npmrc
@@ -1,2 +1,6 @@
link-workspace-packages=deep
prefer-workspace-packages=true
+better_sqlite3_binary_host=https://registry.npmmirror.com/-/binary/better-sqlite3
+better_sqlite3_binary_host_mirror=https://registry.npmmirror.com/-/binary/better-sqlite3
+better-sqlite3_binary_host=https://registry.npmmirror.com/-/binary/better-sqlite3
+better-sqlite3_binary_host_mirror=https://registry.npmmirror.com/-/binary/better-sqlite3
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 000000000..e2a5c574b
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,73 @@
+{
+ // 使用 IntelliSense 了解相关属性。
+ // 悬停以查看现有属性的描述。
+ // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+
+ {
+ "name": "client",
+ "type": "node",
+ "request": "launch",
+ "cwd": "${workspaceFolder}/packages/ui/certd-client",
+ "runtimeExecutable": "pnpm",
+ "runtimeArgs": ["dev"],
+ "console": "integratedTerminal",
+ "internalConsoleOptions": "neverOpen"
+ },
+ {
+ "name": "server",
+ "type": "node",
+ "request": "launch",
+ "cwd": "${workspaceFolder}/packages/ui/certd-server",
+ "runtimeExecutable": "pnpm",
+ "runtimeArgs": ["dev"],
+ "console": "integratedTerminal",
+ "internalConsoleOptions": "neverOpen"
+ },
+ {
+ "name": "server-mysql",
+ "type": "node",
+ "request": "launch",
+ "cwd": "${workspaceFolder}/packages/ui/certd-server",
+ "runtimeExecutable": "pnpm",
+ "runtimeArgs": ["dev-mysql"],
+ "console": "integratedTerminal",
+ "internalConsoleOptions": "neverOpen"
+ },
+ {
+ "name": "server-pg",
+ "type": "node",
+ "request": "launch",
+ "cwd": "${workspaceFolder}/packages/ui/certd-server",
+ "runtimeExecutable": "pnpm",
+ "runtimeArgs": ["dev-pg"],
+ "console": "integratedTerminal",
+ "internalConsoleOptions": "neverOpen"
+ },
+ {
+ "name": "server-common",
+ "type": "node",
+ "request": "launch",
+ "cwd": "${workspaceFolder}/packages/ui/certd-server",
+ "runtimeExecutable": "pnpm",
+ "runtimeArgs": ["dev-commpro"],
+ "console": "integratedTerminal",
+ "internalConsoleOptions": "neverOpen"
+ },
+ {
+ "name": "server-local-plus",
+ "type": "node",
+ "request": "launch",
+ "cwd": "${workspaceFolder}/packages/ui/certd-server",
+ "runtimeExecutable": "npm",
+ "runtimeArgs": ["run", "dev-localplus"],
+ "console": "integratedTerminal",
+ "internalConsoleOptions": "neverOpen",
+ "env": {
+ "plus_use_prod": "false",
+ "PLUS_SERVER_BASE_URL": "http://127.0.0.1:11007"
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 000000000..9a59ecdae
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,8 @@
+{
+ "eslint.debug": false,
+ "eslint.format.enable": true,
+ "typescript.tsc.autoDetect": "watch",
+ "git.scanRepositories": [
+ "./packages/pro"
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 000000000..abd3f50e2
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,52 @@
+{
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "label": "启动Client",
+ "type": "shell",
+ "command": "npm",
+ "args": ["run", "dev"],
+ "options": {
+ "cwd": "${workspaceFolder}/packages/ui/certd-client"
+ },
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ },
+ "presentation": {
+ "echo": true,
+ "reveal": "always",
+ "focus": false,
+ "panel": "shared"
+ }
+ },
+ {
+ "label": "启动Server",
+ "type": "shell",
+ "command": "npm",
+ "args": ["run", "dev"],
+ "options": {
+ "cwd": "${workspaceFolder}/packages/ui/certd-server"
+ },
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ },
+ "presentation": {
+ "echo": true,
+ "reveal": "always",
+ "focus": false,
+ "panel": "shared"
+ }
+ },
+ {
+ "label": "同时启动Client和Server",
+ "dependsOn": ["启动Client", "启动Server"],
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ },
+ "problemMatcher": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5cbe1f4d3..810dcfbfa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,104 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [1.37.4](https://github.com/certd/certd/compare/v1.37.3...v1.37.4) (2025-10-28)
+
+### Bug Fixes
+
+* 修复站点证书监控复制按钮无效的bug ([efa26a0](https://github.com/certd/certd/commit/efa26a067f06402f30befc016d9934cadcd5a563))
+* 修复lego模式下 私钥加密类型错误的bug ([f7cf7c1](https://github.com/certd/certd/commit/f7cf7c198d7f77b222099770f81accc637bc6619))
+
+### Performance Improvements
+
+* 优化数据备份效率,流式写入文件 ([c38dbbb](https://github.com/certd/certd/commit/c38dbbb1d72bd00a92fe275b76aea82a791e7199))
+
+## [1.37.3](https://github.com/certd/certd/compare/v1.37.2...v1.37.3) (2025-10-24)
+
+### Bug Fixes
+
+* 修复并发情况下证书申请日志混乱的bug ([bb2714f](https://github.com/certd/certd/commit/bb2714ff241f9db4a71d805b23a1b0f9f2f6413a))
+* 修复网络测试,telnet的bug ([c03a70f](https://github.com/certd/certd/commit/c03a70fde23c8e840bd0fdb4fcbca8990f6c65eb))
+* 修复站点证书监控,证书已经更新到最新日期了,仍然发出警告通知的bug ([1f42f93](https://github.com/certd/certd/commit/1f42f933f07860b27aa3d016e40916ff2b063eac))
+
+### Performance Improvements
+
+* 注册页面增加手机注册tab页签 ([6b2f1fc](https://github.com/certd/certd/commit/6b2f1fcd3e058061b814c3331cda8ce1b2d80d73))
+* 流水线创建时支持添加到证书监控 ([59ba408](https://github.com/certd/certd/commit/59ba4080706548828ef1c0a9cd893c1c9a7d591f))
+* 流水线支持有效期设置 ([911e69e](https://github.com/certd/certd/commit/911e69e3bc0cdd48b62953b5d0981d640fc1f8ac))
+* 群辉增加请求超时时长设置 ([b381492](https://github.com/certd/certd/commit/b3814920bdcabc911f860a8e19b5b9b3a04709ac))
+* 通知支持meow ([c77645e](https://github.com/certd/certd/commit/c77645e1733670214aaca5544cf8759d7e4adda4))
+* 站点证书监控增加导出和分组功能 ([2ed12c4](https://github.com/certd/certd/commit/2ed12c429eb58274a4f9dd0ed3b66e160d283ded))
+* 证书监控增加批量删除 ([e578c52](https://github.com/certd/certd/commit/e578c52fdf2f838038062aa4209b655fbae461fb))
+* esa 自动删除过期证书提示 ([8bf1f82](https://github.com/certd/certd/commit/8bf1f828b9eaa9208f32e8ee7460b86420fed0c7))
+* ssh 增加禁止-i参数提示 ([3a8931f](https://github.com/certd/certd/commit/3a8931feeffd7157163ff7d46b693e5e1a434b9c))
+
+## [1.37.2](https://github.com/certd/certd/compare/v1.37.1...v1.37.2) (2025-10-14)
+
+### Bug Fixes
+
+* 修复飞牛证书部署后无法生效的bug ([bf156a1](https://github.com/certd/certd/commit/bf156a13bd443cdadb73c9dff79bbef7231b4401))
+* aliyunoss 选择证书接入点选择新加坡无法上传的bug ([e00733a](https://github.com/certd/certd/commit/e00733a34644c23ffe926486b15dc96bf2fa4b57))
+
+### Performance Improvements
+
+* 优化start.sh脚本,去掉删除非ui目录的操作及提示 ([7993a7c](https://github.com/certd/certd/commit/7993a7cdb01885535950c63187e3f67d67ba2f75))
+* 增加飞牛证书id选择的提示 ([5a4d812](https://github.com/certd/certd/commit/5a4d8121462b1afe921d028465687be8c9679814))
+* 证书监控支持设置证书即将过期天数 ([cd35568](https://github.com/certd/certd/commit/cd35568e042e6ab928685efad51cdbed823d2d4f))
+* 支持网络测试 ([2bef608](https://github.com/certd/certd/commit/2bef608e07ceb56d52007f290667e0afef401b22))
+* 支持新网代理方式 ([f612509](https://github.com/certd/certd/commit/f612509cac87b859e81a7a52fe94b2eaccad22f9))
+* dns支持新网互联 ([f415190](https://github.com/certd/certd/commit/f41519048326d971acd9e0a30462231f77a299a6))
+* start.sh脚本支持根据当前系统判断是否使用sudo ([567cb7d](https://github.com/certd/certd/commit/567cb7d737023e26ec58403c6f28f109e212d379))
+
+## [1.37.1](https://github.com/certd/certd/compare/v1.37.0...v1.37.1) (2025-09-29)
+
+### Bug Fixes
+
+* 修复版本比较bug ([109696e](https://github.com/certd/certd/commit/109696e965d68c50c8627ffd40203edd1d2daea5))
+* 修复某些情况下cname申请证书报错主域名不一致的bug ([2671781](https://github.com/certd/certd/commit/2671781e1bb0838981728d85eacf0e1a25a0fa48))
+
+### Performance Improvements
+
+* cname主域名校验提示优化,显示不一致的两方便于排查问题 ([6ebb365](https://github.com/certd/certd/commit/6ebb3659f42155e4e8da600c493fb5227cd08137))
+* dns解析支持阿里esa ([9291fa6](https://github.com/certd/certd/commit/9291fa68aa7a88a05c2f888bf3048df36a8fbde3))
+
+# [1.37.0](https://github.com/certd/certd/compare/v1.36.25...v1.37.0) (2025-09-28)
+
+### Features
+
+* @certd/ui-server module import报错的问题 ([0c61d4c](https://github.com/certd/certd/commit/0c61d4c9788677c83c567db5381b9e257ec90bba))
+* dist打包前检查 ([8f6e5bd](https://github.com/certd/certd/commit/8f6e5bd24b3b65fbfcba36c08f532a3abad2d606))
+
+## [1.36.25](https://github.com/certd/certd/compare/v1.36.24...v1.36.25) (2025-09-27)
+
+### Bug Fixes
+
+* 固定midwayjs版本,修复ui-server import 错误的bug ([eb4d125](https://github.com/certd/certd/commit/eb4d125eaf4a41e88c752d0c68993829589f8f27))
+
+## [1.36.24](https://github.com/certd/certd/compare/v1.36.23...v1.36.24) (2025-09-27)
+
+### Bug Fixes
+
+* 修复 ui-server 加载失败问题 ([c2ccdbe](https://github.com/certd/certd/commit/c2ccdbec9dd08bca4688eeb2f34d0105eec43ba1))
+* 修复 ui-server 加载失败问题 ([063f5c3](https://github.com/certd/certd/commit/063f5c3b55e47df22543a64f02e039e84f92cd14))
+
+### Performance Improvements
+
+* 重置管理员密码同时会关闭验证码,防止验证码失效之后无法登录 ([03899d4](https://github.com/certd/certd/commit/03899d4d9c76fc2077dacc53ab88e2c9ca41af7c))
+
+## [1.36.23](https://github.com/certd/certd/compare/v1.36.22...v1.36.23) (2025-09-26)
+
+### Bug Fixes
+
+* 授权页面,id列位置不在第一列的bug ([3f1722d](https://github.com/certd/certd/commit/3f1722d54debcb4849dc14521a2da0d9b304b69f))
+
+### Performance Improvements
+
+* 动态加载验证码script ([dcc396a](https://github.com/certd/certd/commit/dcc396afb7a23aeb8af57c01014b09af5f033e61))
+* 开启子域名托管之后cname记录支持重置 ([54c8d62](https://github.com/certd/certd/commit/54c8d622437761d350db0f17e07f7517f1911211))
+* 手动上传证书优化,增加到期前报错提醒 ([3d42bfd](https://github.com/certd/certd/commit/3d42bfd479eaacc4a49c401224815a6e2a0204b0))
+* 验证码支持测试,登录验证码需要测试通过后才能开启 ([83e6476](https://github.com/certd/certd/commit/83e6476408090b741fabb1b542fb458d9a8b4134))
+* 支持腾讯云验证码 ([03f317f](https://github.com/certd/certd/commit/03f317ffdb6595ce70e8a2302b05f390c52110c8))
+
## [1.36.22](https://github.com/certd/certd/compare/v1.36.21...v1.36.22) (2025-09-23)
### Bug Fixes
diff --git a/build-dev.trigger b/build-dev.trigger
deleted file mode 100644
index 0cfbf0888..000000000
--- a/build-dev.trigger
+++ /dev/null
@@ -1 +0,0 @@
-2
diff --git a/build.trigger b/build.trigger
deleted file mode 100644
index f5702a3e3..000000000
--- a/build.trigger
+++ /dev/null
@@ -1 +0,0 @@
-01:50
diff --git a/deploy.trigger b/deploy.trigger
deleted file mode 100644
index 7ed6ff82d..000000000
--- a/deploy.trigger
+++ /dev/null
@@ -1 +0,0 @@
-5
diff --git a/docker/run/docker-compose.yaml b/docker/run/docker-compose.yaml
index 76e0eaae1..1825320be 100644
--- a/docker/run/docker-compose.yaml
+++ b/docker/run/docker-compose.yaml
@@ -11,6 +11,7 @@ services:
# ↓↓↓↓↓ -------------------------------------------------------- 数据库以及证书存储路径,默认存在宿主机的/data/certd/目录下,【您需要定时备份此目录,以保障数据容灾】
# 只要修改冒号前面的,冒号后面的/app/data不要动
- /data/certd:/app/data
+ #- /volume1/docker/certd:/app/data:delegated #群晖使用这个配置
# ↓↓↓↓↓ -------------------------------------------------------- 如果走时不准,考虑挂载localtime文件
#- /etc/localtime:/etc/localtime
#- /etc/timezone:/etc/timezone
@@ -47,6 +48,8 @@ services:
# 配置规则: certd_ + 配置项, 点号用_代替
# #↓↓↓↓ ----------------------------- 如果忘记管理员密码,可以设置为true,docker compose up -d 重建容器之后,管理员密码将改成123456,然后请及时修改回false
- certd_system_resetAdminPasswd=false
+ # ↓↓↓ 要使用ipv6,将此配置修改为::
+ - certd_koa_hostname=0.0.0.0
# 默认使用sqlite文件数据库,如果需要使用其他数据库,请设置以下环境变量
# 注意: 选定使用一种数据库之后,不支持更换数据库。
diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts
index 1ecd238c2..4cc504206 100644
--- a/docs/.vitepress/config.ts
+++ b/docs/.vitepress/config.ts
@@ -95,10 +95,10 @@ export default defineConfig({
},
{
text: "插件列表", items: [
- {text: "授权提供商", link: "/guide/plugins/access.md"},
{text: "DNS提供商", link: "/guide/plugins/dns-provider.md"},
{text: "任务插件", link: "/guide/plugins/deploy.md"},
{text: "通知插件", link: "/guide/plugins/notification.md"},
+ {text: "授权提供商", link: "/guide/plugins/access.md"},
]
},
]
diff --git a/docs/guide/changelogs/CHANGELOG.md b/docs/guide/changelogs/CHANGELOG.md
index 5cbe1f4d3..810dcfbfa 100644
--- a/docs/guide/changelogs/CHANGELOG.md
+++ b/docs/guide/changelogs/CHANGELOG.md
@@ -3,6 +3,104 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [1.37.4](https://github.com/certd/certd/compare/v1.37.3...v1.37.4) (2025-10-28)
+
+### Bug Fixes
+
+* 修复站点证书监控复制按钮无效的bug ([efa26a0](https://github.com/certd/certd/commit/efa26a067f06402f30befc016d9934cadcd5a563))
+* 修复lego模式下 私钥加密类型错误的bug ([f7cf7c1](https://github.com/certd/certd/commit/f7cf7c198d7f77b222099770f81accc637bc6619))
+
+### Performance Improvements
+
+* 优化数据备份效率,流式写入文件 ([c38dbbb](https://github.com/certd/certd/commit/c38dbbb1d72bd00a92fe275b76aea82a791e7199))
+
+## [1.37.3](https://github.com/certd/certd/compare/v1.37.2...v1.37.3) (2025-10-24)
+
+### Bug Fixes
+
+* 修复并发情况下证书申请日志混乱的bug ([bb2714f](https://github.com/certd/certd/commit/bb2714ff241f9db4a71d805b23a1b0f9f2f6413a))
+* 修复网络测试,telnet的bug ([c03a70f](https://github.com/certd/certd/commit/c03a70fde23c8e840bd0fdb4fcbca8990f6c65eb))
+* 修复站点证书监控,证书已经更新到最新日期了,仍然发出警告通知的bug ([1f42f93](https://github.com/certd/certd/commit/1f42f933f07860b27aa3d016e40916ff2b063eac))
+
+### Performance Improvements
+
+* 注册页面增加手机注册tab页签 ([6b2f1fc](https://github.com/certd/certd/commit/6b2f1fcd3e058061b814c3331cda8ce1b2d80d73))
+* 流水线创建时支持添加到证书监控 ([59ba408](https://github.com/certd/certd/commit/59ba4080706548828ef1c0a9cd893c1c9a7d591f))
+* 流水线支持有效期设置 ([911e69e](https://github.com/certd/certd/commit/911e69e3bc0cdd48b62953b5d0981d640fc1f8ac))
+* 群辉增加请求超时时长设置 ([b381492](https://github.com/certd/certd/commit/b3814920bdcabc911f860a8e19b5b9b3a04709ac))
+* 通知支持meow ([c77645e](https://github.com/certd/certd/commit/c77645e1733670214aaca5544cf8759d7e4adda4))
+* 站点证书监控增加导出和分组功能 ([2ed12c4](https://github.com/certd/certd/commit/2ed12c429eb58274a4f9dd0ed3b66e160d283ded))
+* 证书监控增加批量删除 ([e578c52](https://github.com/certd/certd/commit/e578c52fdf2f838038062aa4209b655fbae461fb))
+* esa 自动删除过期证书提示 ([8bf1f82](https://github.com/certd/certd/commit/8bf1f828b9eaa9208f32e8ee7460b86420fed0c7))
+* ssh 增加禁止-i参数提示 ([3a8931f](https://github.com/certd/certd/commit/3a8931feeffd7157163ff7d46b693e5e1a434b9c))
+
+## [1.37.2](https://github.com/certd/certd/compare/v1.37.1...v1.37.2) (2025-10-14)
+
+### Bug Fixes
+
+* 修复飞牛证书部署后无法生效的bug ([bf156a1](https://github.com/certd/certd/commit/bf156a13bd443cdadb73c9dff79bbef7231b4401))
+* aliyunoss 选择证书接入点选择新加坡无法上传的bug ([e00733a](https://github.com/certd/certd/commit/e00733a34644c23ffe926486b15dc96bf2fa4b57))
+
+### Performance Improvements
+
+* 优化start.sh脚本,去掉删除非ui目录的操作及提示 ([7993a7c](https://github.com/certd/certd/commit/7993a7cdb01885535950c63187e3f67d67ba2f75))
+* 增加飞牛证书id选择的提示 ([5a4d812](https://github.com/certd/certd/commit/5a4d8121462b1afe921d028465687be8c9679814))
+* 证书监控支持设置证书即将过期天数 ([cd35568](https://github.com/certd/certd/commit/cd35568e042e6ab928685efad51cdbed823d2d4f))
+* 支持网络测试 ([2bef608](https://github.com/certd/certd/commit/2bef608e07ceb56d52007f290667e0afef401b22))
+* 支持新网代理方式 ([f612509](https://github.com/certd/certd/commit/f612509cac87b859e81a7a52fe94b2eaccad22f9))
+* dns支持新网互联 ([f415190](https://github.com/certd/certd/commit/f41519048326d971acd9e0a30462231f77a299a6))
+* start.sh脚本支持根据当前系统判断是否使用sudo ([567cb7d](https://github.com/certd/certd/commit/567cb7d737023e26ec58403c6f28f109e212d379))
+
+## [1.37.1](https://github.com/certd/certd/compare/v1.37.0...v1.37.1) (2025-09-29)
+
+### Bug Fixes
+
+* 修复版本比较bug ([109696e](https://github.com/certd/certd/commit/109696e965d68c50c8627ffd40203edd1d2daea5))
+* 修复某些情况下cname申请证书报错主域名不一致的bug ([2671781](https://github.com/certd/certd/commit/2671781e1bb0838981728d85eacf0e1a25a0fa48))
+
+### Performance Improvements
+
+* cname主域名校验提示优化,显示不一致的两方便于排查问题 ([6ebb365](https://github.com/certd/certd/commit/6ebb3659f42155e4e8da600c493fb5227cd08137))
+* dns解析支持阿里esa ([9291fa6](https://github.com/certd/certd/commit/9291fa68aa7a88a05c2f888bf3048df36a8fbde3))
+
+# [1.37.0](https://github.com/certd/certd/compare/v1.36.25...v1.37.0) (2025-09-28)
+
+### Features
+
+* @certd/ui-server module import报错的问题 ([0c61d4c](https://github.com/certd/certd/commit/0c61d4c9788677c83c567db5381b9e257ec90bba))
+* dist打包前检查 ([8f6e5bd](https://github.com/certd/certd/commit/8f6e5bd24b3b65fbfcba36c08f532a3abad2d606))
+
+## [1.36.25](https://github.com/certd/certd/compare/v1.36.24...v1.36.25) (2025-09-27)
+
+### Bug Fixes
+
+* 固定midwayjs版本,修复ui-server import 错误的bug ([eb4d125](https://github.com/certd/certd/commit/eb4d125eaf4a41e88c752d0c68993829589f8f27))
+
+## [1.36.24](https://github.com/certd/certd/compare/v1.36.23...v1.36.24) (2025-09-27)
+
+### Bug Fixes
+
+* 修复 ui-server 加载失败问题 ([c2ccdbe](https://github.com/certd/certd/commit/c2ccdbec9dd08bca4688eeb2f34d0105eec43ba1))
+* 修复 ui-server 加载失败问题 ([063f5c3](https://github.com/certd/certd/commit/063f5c3b55e47df22543a64f02e039e84f92cd14))
+
+### Performance Improvements
+
+* 重置管理员密码同时会关闭验证码,防止验证码失效之后无法登录 ([03899d4](https://github.com/certd/certd/commit/03899d4d9c76fc2077dacc53ab88e2c9ca41af7c))
+
+## [1.36.23](https://github.com/certd/certd/compare/v1.36.22...v1.36.23) (2025-09-26)
+
+### Bug Fixes
+
+* 授权页面,id列位置不在第一列的bug ([3f1722d](https://github.com/certd/certd/commit/3f1722d54debcb4849dc14521a2da0d9b304b69f))
+
+### Performance Improvements
+
+* 动态加载验证码script ([dcc396a](https://github.com/certd/certd/commit/dcc396afb7a23aeb8af57c01014b09af5f033e61))
+* 开启子域名托管之后cname记录支持重置 ([54c8d62](https://github.com/certd/certd/commit/54c8d622437761d350db0f17e07f7517f1911211))
+* 手动上传证书优化,增加到期前报错提醒 ([3d42bfd](https://github.com/certd/certd/commit/3d42bfd479eaacc4a49c401224815a6e2a0204b0))
+* 验证码支持测试,登录验证码需要测试通过后才能开启 ([83e6476](https://github.com/certd/certd/commit/83e6476408090b741fabb1b542fb458d9a8b4134))
+* 支持腾讯云验证码 ([03f317f](https://github.com/certd/certd/commit/03f317ffdb6595ce70e8a2302b05f390c52110c8))
+
## [1.36.22](https://github.com/certd/certd/compare/v1.36.21...v1.36.22) (2025-09-23)
### Bug Fixes
diff --git a/docs/guide/img.png b/docs/guide/img.png
deleted file mode 100644
index a0adf9b51..000000000
Binary files a/docs/guide/img.png and /dev/null differ
diff --git a/docs/guide/index.md b/docs/guide/index.md
index fb38fa187..fecbbbcef 100644
--- a/docs/guide/index.md
+++ b/docs/guide/index.md
@@ -5,6 +5,9 @@ Certd 是一款开源、免费、全自动申请和部署更新SSL证书的工
关键字:证书自动申请、证书自动更新、证书自动续期、证书自动续签、证书管理工具
+
+
+
## 1、关于证书续期
>* 实际上没有办法不改变证书文件本身情况下直接续期或者续签。
>* 我们所说的续期,其实就是按照全套流程重新申请一份新证书,然后重新部署上去。
@@ -15,7 +18,7 @@ Certd 是一款开源、免费、全自动申请和部署更新SSL证书的工
本项目不仅支持证书申请过程自动化,还可以自动化部署更新证书,让你的证书永不过期。
* 全自动申请证书(支持所有注册商注册的域名,支持DNS-01、HTTP-01、CNAME代理等多种域名验证方式)
-* 全自动部署更新证书(目前支持部署到主机、阿里云、腾讯云等70+部署插件)
+* 全自动部署更新证书(目前支持部署到主机、阿里云、腾讯云等100+部署插件)
* 支持通配符域名/泛域名,支持多个域名打到一个证书上,支持pem、pfx、der、jks等多种证书格式
* 邮件通知、webhook通知、企微、钉钉、飞书、anpush等多种通知方式
* 私有化部署,数据保存本地,安装升级非常简单快捷
diff --git a/docs/guide/install/source/index.md b/docs/guide/install/source/index.md
index 3c25c889d..ef5d419b0 100644
--- a/docs/guide/install/source/index.md
+++ b/docs/guide/install/source/index.md
@@ -11,9 +11,12 @@
git clone https://github.com/certd/certd --depth=1
# git checkout v1.x.x # 当v2主干分支代码无法正常启动时,可以尝试此命令,1.x.x换成最新版本号
cd certd
+
# 启动服务
./start.sh
+
+
```
>如果是windows,请先安装`git for windows` ,然后右键,选择`open git bash here`打开终端,再执行`./start.sh`命令
diff --git a/docs/guide/open/index.md b/docs/guide/open/index.md
index d2465d0ae..b393a3628 100644
--- a/docs/guide/open/index.md
+++ b/docs/guide/open/index.md
@@ -9,6 +9,7 @@
https://apifox.com/apidoc/shared-2e76f8c4-7c58-413b-a32d-a1316529af44/254949529e0
+
## Token生成方法
header中传入x-certd-token即可调用开放接口
@@ -17,6 +18,12 @@ header中传入x-certd-token即可调用开放接口
3、将content加上keySecret进行签名: sign = md5(content + keySecret)
4、然后将content和sign分别base64后用.号连接: x-certd-token = base64(content) +"."+base64(sign)
+
+## 补充说明
+1.证书申请接口支持证书id和域名两种方式获取证书。
+2.autoApply=true将在没有证书时自动触发申请,申请过程中会提示`正在申请中`,可轮循获取状态,直到证书申请成功。
+
+
## SDK
待开发
diff --git a/docs/guide/plugins/access.md b/docs/guide/plugins/access.md
index b4e920fc3..3de5cf302 100644
--- a/docs/guide/plugins/access.md
+++ b/docs/guide/plugins/access.md
@@ -2,50 +2,69 @@
| 序号 | 名称 | 说明 |
|-----|-----|-----|
-| 1.| **阿里云授权** | |
-| 2.| **EAB授权** | ZeroSSL证书申请需要EAB授权 |
-| 3.| **google cloud** | 谷歌云授权 |
-| 4.| **主机登录授权** | |
-| 5.| **SFTP授权** | |
-| 6.| **阿里云OSS授权** | 包含地域和Bucket |
-| 7.| **FTP授权** | |
-| 8.| **腾讯云** | |
-| 9.| **腾讯云COS授权** | 腾讯云对象存储授权,包含地域和存储桶 |
-| 10.| **七牛云授权** | |
-| 11.| **七牛OSS授权** | |
-| 12.| **天翼云授权** | |
-| 13.| **s3/minio授权** | S3/minio oss授权 |
-| 14.| **baota授权** | |
-| 15.| **易盾DCDN授权** | https://user.yiduncdn.com |
-| 16.| **易盾rcdn授权** | 易盾CDN,每月免费30G,[注册即领](https://rhcdn.yiduncdn.com/register?code=8mn536rrzfbf8) |
-| 17.| **易发云短信** | sms.yfyidc.cn/ |
-| 18.| **cdnfly授权** | |
-| 19.| **群晖登录授权** | |
-| 20.| **k8s授权** | |
-| 21.| **1panel授权** | 账号和密码 |
-| 22.| **百度云授权** | |
-| 23.| **LeCDN授权** | |
-| 24.| **白山云授权** | |
-| 25.| **plesk授权** | |
-| 26.| **易支付** | |
-| 27.| **支付宝** | |
-| 28.| **微信支付** | |
-| 29.| **长亭雷池授权** | |
-| 30.| **lucky** | |
-| 31.| **括彩云cdn授权** | 括彩云CDN,每月免费30G,[注册即领](https://kuocaicdn.com/register?code=8mn536rrzfbf8) |
-| 32.| **uniCloud** | unicloud授权 |
-| 33.| **华为云授权** | |
-| 34.| **西部数码授权** | |
-| 35.| **多吉云** | |
-| 36.| **我爱云授权** | 我爱云CDN |
-| 37.| **CacheFly** | CacheFly |
-| 38.| **Gcore** | Gcore |
-| 39.| **亚马逊云aws授权** | |
-| 40.| **dns.la授权** | |
-| 41.| **又拍云** | |
-| 42.| **火山引擎** | |
-| 43.| **京东云** | |
-| 44.| **51dns授权** | |
+| 1.| **主机登录授权** | |
+| 2.| **阿里云授权** | |
+| 3.| **阿里云ESA授权** | |
+| 4.| **腾讯云** | |
+| 5.| **华为云授权** | |
+| 6.| **火山引擎** | |
+| 7.| **京东云** | |
+| 8.| **七牛云授权** | |
+| 9.| **天翼云授权** | |
+| 10.| **baota授权** | |
+| 11.| **百度云授权** | |
+| 12.| **EAB授权** | ZeroSSL证书申请需要EAB授权 |
+| 13.| **google cloud** | 谷歌云授权 |
+| 14.| **SFTP授权** | |
+| 15.| **阿里云OSS授权** | 包含地域和Bucket |
+| 16.| **FTP授权** | |
+| 17.| **腾讯云COS授权** | 腾讯云对象存储授权,包含地域和存储桶 |
+| 18.| **七牛OSS授权** | |
+| 19.| **s3/minio授权** | S3/minio oss授权 |
+| 20.| **宝塔云WAF授权** | 用于连接和管理宝塔云WAF服务的授权配置 |
+| 21.| **易盾DCDN授权** | https://user.yiduncdn.com |
+| 22.| **易盾rcdn授权** | 易盾CDN,每月免费30G,[注册即领](https://rhcdn.yiduncdn.com/register?code=8mn536rrzfbf8) |
+| 23.| **易发云短信** | sms.yfyidc.cn/ |
+| 24.| **cdnfly授权** | |
+| 25.| **群晖登录授权** | |
+| 26.| **k8s授权** | |
+| 27.| **1panel授权** | 账号和密码 |
+| 28.| **LeCDN授权** | |
+| 29.| **白山云授权** | |
+| 30.| **plesk授权** | |
+| 31.| **易支付** | |
+| 32.| **支付宝** | |
+| 33.| **微信支付** | |
+| 34.| **长亭雷池授权** | |
+| 35.| **lucky** | |
+| 36.| **括彩云cdn授权** | 括彩云CDN,每月免费30G,[注册即领](https://kuocaicdn.com/register?code=8mn536rrzfbf8) |
+| 37.| **uniCloud** | unicloud授权 |
+| 38.| **猫云授权** | |
+| 39.| **西部数码授权** | |
+| 40.| **多吉云** | |
+| 41.| **我爱云授权** | 我爱云CDN |
+| 42.| **CacheFly** | CacheFly |
+| 43.| **Gcore** | Gcore |
+| 44.| **亚马逊云aws授权** | |
+| 45.| **亚马逊云科技(国区)授权** | |
+| 46.| **dns.la授权** | |
+| 47.| **又拍云** | |
+| 48.| **51dns授权** | |
+| 49.| **FlexCDN授权** | |
+| 50.| **farcdn授权** | |
+| 51.| **cloudflare授权** | |
+| 52.| **Github授权** | |
+| 53.| **namesilo授权** | |
+| 54.| **proxmox** | |
+| 55.| **网宿授权** | |
+| 56.| **金山云授权** | |
+| 57.| **APISIX授权** | |
+| 58.| **Dokploy授权** | |
+| 59.| **godaddy授权** | |
+| 60.| **新网授权** | |
+| 61.| **新网授权(代理方式)** | |
+| 62.| **新网互联授权** | 仅支持代理账号,ip需要加入白名单 |
+| 63.| **雨云授权** | https://app.rainyun.com/ |
diff --git a/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/api.ts b/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/api.ts
index 01ffa5ecf..74ab87abb 100644
--- a/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/api.ts
+++ b/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/api.ts
@@ -45,6 +45,16 @@ export async function DoVerify(id: number) {
});
}
+export async function ResetStatus(id: number) {
+ return await request({
+ url: apiPrefix + "/resetStatus",
+ method: "post",
+ data: {
+ id,
+ },
+ });
+}
+
export async function ParseDomain(fullDomain: string) {
return await request({
url: subDomainApiPrefix + "/parseDomain",
diff --git a/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/cname-record-info.vue b/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/cname-record-info.vue
index ebee7a678..06e5e90d6 100644
--- a/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/cname-record-info.vue
+++ b/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/cname-record-info.vue
@@ -16,6 +16,9 @@
{{ resultTestLog }}
+ {{ JSON.stringify(result, null, 2) }}
+ {{ result }}
+ 暂无结果
+欢迎使用,这是 HTML 格式的消息
", + "url": "https://example.com" +} + +=== +返回值: +{ + "status": 200, + "message": "推送成功" +} + */ +@IsNotification({ + name: 'meow', + title: 'MeoW通知', + desc: 'https://api.chuckfang.com/', + needPlus: false, +}) +export class MeowNotification extends BaseNotification { + + @NotificationInput({ + title: 'MeoW接口地址', + component: { + placeholder: 'https://api.xxxxxx.com', + }, + required: true, + }) + endpoint = ''; + + @NotificationInput({ + title: '昵称', + component: { + placeholder: '', + }, + required: true, + }) + nickName = ''; + + async send(body: NotificationBody) { + if (!this.nickName) { + throw new Error('昵称不能为空'); + } + let endpoint = this.endpoint; + if (!endpoint.endsWith('/')) { + endpoint += '/'; + } + const url = `${endpoint}${this.nickName}/`; + const res = await this.http.request({ + url: url, + method: 'POST', + data: { + text: body.title, + msg: body.content, + url: body.url, + }, + }); + + if (res.status !== 200) { + throw new Error(res.message || res.msg); + } + } +} diff --git a/packages/ui/certd-server/src/plugins/plugin-notification/webhook/index.ts b/packages/ui/certd-server/src/plugins/plugin-notification/webhook/index.ts index 4e2fba05a..a173a6ab7 100644 --- a/packages/ui/certd-server/src/plugins/plugin-notification/webhook/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-notification/webhook/index.ts @@ -5,6 +5,7 @@ import qs from 'qs'; name: 'webhook', title: '自定义webhook', desc: '根据模版自定义http请求', + order: -100, }) export class WebhookNotification extends BaseNotification { @NotificationInput({ diff --git a/packages/ui/certd-server/src/plugins/plugin-qiniu/plugin/deploy-to-cdn/index.ts b/packages/ui/certd-server/src/plugins/plugin-qiniu/plugin/deploy-to-cdn/index.ts index 4e46f15a9..5516c2a99 100644 --- a/packages/ui/certd-server/src/plugins/plugin-qiniu/plugin/deploy-to-cdn/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-qiniu/plugin/deploy-to-cdn/index.ts @@ -1,7 +1,7 @@ import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline'; import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine, QiniuAccess, QiniuClient } from '@certd/plugin-lib'; import { CertInfo } from '@certd/plugin-cert'; -import { optionsUtils } from '@certd/basic/dist/utils/util.options.js'; +import { optionsUtils } from '@certd/basic'; import { CertApplyPluginNames} from '@certd/plugin-cert'; @IsTaskPlugin({ name: 'QiniuDeployCertToCDN', diff --git a/packages/ui/certd-server/src/plugins/plugin-upyun/plugins/plugin-depoy-to-cdn.ts b/packages/ui/certd-server/src/plugins/plugin-upyun/plugins/plugin-depoy-to-cdn.ts index 15584b1fb..1680d0266 100644 --- a/packages/ui/certd-server/src/plugins/plugin-upyun/plugins/plugin-depoy-to-cdn.ts +++ b/packages/ui/certd-server/src/plugins/plugin-upyun/plugins/plugin-depoy-to-cdn.ts @@ -2,7 +2,7 @@ import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput import { CertApplyPluginNames, CertInfo } from "@certd/plugin-cert"; import { UpyunAccess } from "../access.js"; import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from "@certd/plugin-lib"; -import { optionsUtils } from "@certd/basic/dist/utils/util.options.js"; +import { optionsUtils } from "@certd/basic"; import { UpyunClient } from "../client.js"; @IsTaskPlugin({ diff --git a/packages/ui/certd-server/src/plugins/plugin-volcengine/plugins/plugin-deploy-to-cdn.ts b/packages/ui/certd-server/src/plugins/plugin-volcengine/plugins/plugin-deploy-to-cdn.ts index c16411c02..123eb9671 100644 --- a/packages/ui/certd-server/src/plugins/plugin-volcengine/plugins/plugin-deploy-to-cdn.ts +++ b/packages/ui/certd-server/src/plugins/plugin-volcengine/plugins/plugin-deploy-to-cdn.ts @@ -1,7 +1,7 @@ import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline"; import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from "@certd/plugin-lib"; import { CertApplyPluginNames, CertInfo } from "@certd/plugin-cert"; -import { optionsUtils } from "@certd/basic/dist/utils/util.options.js"; +import { optionsUtils } from "@certd/basic"; import { VolcengineAccess } from "../access.js"; import { VolcengineCdnClient } from "../cdn-client.js"; diff --git a/packages/ui/certd-server/src/plugins/plugin-xinnet/access-agent.ts b/packages/ui/certd-server/src/plugins/plugin-xinnet/access-agent.ts new file mode 100644 index 000000000..93234566c --- /dev/null +++ b/packages/ui/certd-server/src/plugins/plugin-xinnet/access-agent.ts @@ -0,0 +1,157 @@ +import { IsAccess, AccessInput, BaseAccess, Pager, PageSearch } from "@certd/pipeline"; +import crypto from "crypto"; +/** + * 这个注解将注册一个授权配置 + * 在certd的后台管理系统中,用户可以选择添加此类型的授权 + */ +@IsAccess({ + name: "xinnetagent", + title: "新网授权(代理方式)", + icon: "lsicon:badge-new-filled", + desc: "" +}) +export class XinnetAgentAccess extends BaseAccess { + + /** + * 授权属性配置 + */ + @AccessInput({ + title: "代理账号", + component: { + placeholder: "代理账号,如:agent0001" + }, + required: true, + encrypt: false + }) + agentCode = ""; + + @AccessInput({ + title: "API密钥", + component: { + name: "a-input-password", + vModel: "value", + placeholder: "API密钥" + }, + required: true, + encrypt: true + }) + appSecret = ""; + + @AccessInput({ + title: "测试", + component: { + name: "api-test", + action: "TestRequest" + }, + helper: "点击测试接口是否正常" + }) + testRequest = true; + + async onTestRequest() { + + // const client = new XinnetClient({ + // access: this, + // logger: this.ctx.logger, + // http: this.ctx.http + // }); + await this.getDomainList({ pageNo: 1, pageSize: 1 }); + + return "ok"; + } + + + + async getDomainList(req:PageSearch) { + const pager = new Pager(req); + const conf = { + url: "/api/domain/list", + data: { + pageNo: String(pager.pageNo), + pageSize: String(pager.pageSize) + } + } + return await this.doRequest(conf); + } + + + /** + * 生成 UTC 0 时区的时间戳 + */ + generateTimestamp() { + const timestamp = new Date().toISOString().replace(/\.\d{3}Z$/, "Z").replaceAll(":", "").replaceAll("-", ""); + return timestamp; + } + + /** + * 字节转16进制字符串 + */ + bytesToHex(bytes:any) { + return bytes.toString('hex'); + } + + /** + * 生成签名 + */ + generateSignature(timestamp, urlPath, requestBody) { + const algorithm = 'HMAC-SHA256'; + const requestMethod = 'POST'; + + // 构建待签名字符串 + const stringToSign = `${algorithm}\n${timestamp}\n${requestMethod}\n${urlPath}\n${requestBody}`; + + // 使用 HMAC-SHA256 计算签名 + const hmac = crypto.createHmac('sha256', this.appSecret); + hmac.update(stringToSign); + const signatureBytes = hmac.digest(); + + // 转换为16进制字符串 + return this.bytesToHex(signatureBytes); + } + + /** + * 生成 authorization header + */ + generateAuthorization(timestamp, urlPath, requestBody) { + const signature = this.generateSignature(timestamp, urlPath, requestBody); + return `HMAC-SHA256 Access=${this.agentCode}, Signature=${signature}`; + } + + /** + * 查询域名分页列表 + */ + async doRequest(req:any) { + + const baseURL = 'https://apiv2.xinnet.com'; + const urlPath = req.url; + const requestURL = baseURL + urlPath; // 实际请求URL去掉最后的斜杠 + + // 请求体 + const requestBody = JSON.stringify(req.data); + + // 生成时间戳和授权头 + const timestamp = this.generateTimestamp(); + const authorization = this.generateAuthorization(timestamp, urlPath+"/", requestBody); + + // 请求配置 + const config = { + method: 'POST', + url: requestURL, + headers: { + 'Content-Type': 'application/json', + 'timestamp': timestamp, + 'authorization': authorization + }, + data: requestBody, + }; + + const res = await this.ctx.http.request(config); + + if (res.code !="0"){ + throw new Error(`API Error: ${res.code} ${res.requestId} - ${JSON.stringify(res.msg)}`); + } + return res.data; + } + +} + +new XinnetAgentAccess(); diff --git a/packages/ui/certd-server/src/plugins/plugin-xinnet/dns-provider-agent.ts b/packages/ui/certd-server/src/plugins/plugin-xinnet/dns-provider-agent.ts new file mode 100644 index 000000000..c32b8da20 --- /dev/null +++ b/packages/ui/certd-server/src/plugins/plugin-xinnet/dns-provider-agent.ts @@ -0,0 +1,90 @@ +import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from "@certd/plugin-cert"; +import { XinnetAgentAccess } from "./access-agent.js"; + +export type XinnetAgentRecord = { + recordId: number; + domainName: string; +}; + +// 这里通过IsDnsProvider注册一个dnsProvider +@IsDnsProvider({ + name: "xinnetagent", + title: "新网(代理方式)", + desc: "新网域名解析(代理方式)", + icon: "lsicon:badge-new-filled", + // 这里是对应的 cloudflare的access类型名称 + accessType: "xinnetagent", + order: 7 +}) +export class XinnetAgentProvider extends AbstractDnsProvider