Merge branch 'certd:v2' into v2

pull/244/head
origami 2024-11-16 23:32:28 +08:00 committed by GitHub
commit d6a2e4aee9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
289 changed files with 2673 additions and 7088 deletions

View File

@ -79,17 +79,17 @@ jobs:
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
# - 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
- name: Build agent
uses: docker/build-push-action@v6

View File

@ -16,6 +16,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Set git user # 2. 给git命令设置用户名和邮箱,↙↙↙ 改成你的name和email
run: |
git config --global user.name "xiaojunnuo"

View File

@ -16,6 +16,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Set git user # 2. 给git命令设置用户名和邮箱,↙↙↙ 改成你的name和email
run: |
git config --global user.name "xiaojunnuo"

2
.gitignore vendored
View File

@ -29,3 +29,5 @@ test/**/*.js
/packages/ui/certd-server/data/db.sqlite
/packages/ui/certd-server/data/keys.yaml
/packages/pro/
test.js

View File

@ -3,6 +3,58 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.27.4](https://github.com/certd/certd/compare/v1.27.3...v1.27.4) (2024-11-14)
### Bug Fixes
* 修复未设置pfx密码导致jks转换报错的bug ([c3cfbd8](https://github.com/certd/certd/commit/c3cfbd8474155aed4379f91075de37d5d8c73ef0))
### Performance Improvements
* 公共cname服务支持关闭 ([f4ae512](https://github.com/certd/certd/commit/f4ae5125dc4cd97816976779cb3586b5ee78947e))
## [1.27.3](https://github.com/certd/certd/compare/v1.27.2...v1.27.3) (2024-11-13)
### Bug Fixes
* 修复偶发性cname一直验证超时的bug ([d2ce72e](https://github.com/certd/certd/commit/d2ce72e4aaacdf726ba8b91fcd71db40a27714ba))
* 修复邮件配置忽略证书校验设置不生效的bug ([66a9690](https://github.com/certd/certd/commit/66a9690dc958732e1b3c672d965db502296446f9))
* 修复ipv6未开启情况下请求带有ipv6地址域名报ETIMEDOUT的bug ([a9a0967](https://github.com/certd/certd/commit/a9a0967a6f1d0bd27e69f3ec52c31d90d470bc23))
### Performance Improvements
* 修复站点个性化浏览器标题没有生效的bug ([bcfac02](https://github.com/certd/certd/commit/bcfac02c96ceaf23d1a0b05b48d8047da933beaf))
* 优化上传到主机插 路径选择,根据证书格式显示 ([8c3f86c](https://github.com/certd/certd/commit/8c3f86c6909ed91f48bb2880e78834e22f6f6a29))
* 支持jks ([889eaae](https://github.com/certd/certd/commit/889eaaea92818f628b922dae540c026630611707))
* ipv6支持 ([da6ac16](https://github.com/certd/certd/commit/da6ac1626b3574be2fabeeb18a1f10d60bdcbe49))
## [1.27.2](https://github.com/certd/certd/compare/v1.27.1...v1.27.2) (2024-11-08)
### Bug Fixes
* 修复某些容器管理ui无法识别端口列表的bug ([576e60a](https://github.com/certd/certd/commit/576e60a2b52315909e659d2a58cf98b130e69e6f))
* 修复删除腾讯云过期证书时间判断上的bug导致已过期仍然没有删除证书 ([1ba1007](https://github.com/certd/certd/commit/1ba10072615015d91b81fc56a3b01dae6a2ae9d1))
### Performance Improvements
* 优化部署到阿里云CDN插件支持多域名更易用 ([80c500f](https://github.com/certd/certd/commit/80c500f618b169a1f64c57fe442242a4d0d9d833))
* 优化流水线页面切换回来不丢失查询条件 ([4dcf6e8](https://github.com/certd/certd/commit/4dcf6e87bc5f7657ce8a56c5331e8723a0fee8ee))
* 支持公共cname服务 ([3c919ee](https://github.com/certd/certd/commit/3c919ee5d1aef5d26cf3620a7c49d920786bc941))
* 执行历史支持点击查看流水线详情 ([8968639](https://github.com/certd/certd/commit/89686399f90058835435b92872fc236fac990148))
* 专业版7天试用 ([c58250e](https://github.com/certd/certd/commit/c58250e1f065a9bd8b4e82acc1df754504c0010c))
## [1.27.1](https://github.com/certd/certd/compare/v1.27.0...v1.27.1) (2024-11-04)
### Bug Fixes
* 修复头像没有更新的bug ([9b4a31f](https://github.com/certd/certd/commit/9b4a31fa6a32b9cab2e22bd141cf96ca29120445))
### Performance Improvements
* 禁止页面缓存点击tab页签可以刷新数据 ([7ad4b55](https://github.com/certd/certd/commit/7ad4b55ee000c1dd0747832b11107f32b0ffb889))
* 优化时间选择器,自动填写分钟和秒钟 ([396dc34](https://github.com/certd/certd/commit/396dc34a841c7d016b033736afdba8366fb2d211))
* cname 域名映射记录可读性优化 ([b1117ed](https://github.com/certd/certd/commit/b1117ed54a3ef015752999324ff72b821ef5e4b9))
# [1.27.0](https://github.com/certd/certd/compare/v1.26.16...v1.27.0) (2024-10-31)
### Bug Fixes

View File

@ -5,13 +5,12 @@ Certd 是一个免费全自动申请和自动部署更新SSL证书的管理系
关键字:证书自动申请、证书自动更新、证书自动续期、证书自动续签、证书管理工具
## 一、特性
本项目不仅支持证书申请过程自动化,还可以自动化部署更新证书,让你的证书永不过期。
* 全自动申请证书(支持所有注册商注册的域名)
* 全自动部署更新证书目前支持部署到主机、部署到阿里云、腾讯云等目前已支持30+部署插件)
* 支持通配符域名/泛域名,支持多个域名打到一个证书上
* 支持通配符域名/泛域名,支持多个域名打到一个证书上支持pem、pfx、der、jks等多种证书格式
* 邮件通知
* 私有化部署数据保存本地镜像由Github Actions构建过程公开透明
* 支持sqlitepostgresql数据库
@ -23,30 +22,42 @@ Certd 是一个免费全自动申请和自动部署更新SSL证书的管理系
官方Demo地址自助注册后体验
https://certd.handsfree.work/
https://certd.handfree.work/
> 注意数据将不定期清理,不定期停止定时任务,生产使用请自行部署
> 包含敏感信息,务必自己本地部署进行生产使用
![首页](./docs/images/start/home.png)
## 三、使用教程
更多教程请访问文档网站 [certd.docmirror.cn](https://certd.docmirror.cn/)
仅需3步让你的证书永不过期
### 1. 创建证书流水线
![演示](packages/ui/certd-client/public/static/doc/images/1-add.png)
本案例演示如何配置自动申请证书并部署到阿里云CDN然后快要到期前自动更新证书并重新部署
> 添加成功后,就可以直接运行流水线申请证书了
![演示](packages/ui/certd-client/public/static/doc/images/5-view.png)
![演示](packages/ui/certd-client/public/static/doc/images/9-start.png)
![演示](packages/ui/certd-client/public/static/doc/images/10-1-log.png)
### 2. 添加部署任务
当然我们一般需要把证书部署到应用上certd支持海量的部署插件您可以根据自身实际情况进行选择比如部署到Nginx、阿里云、腾讯云、K8S、CDN、宝塔、1Panel等等
此处演示部署证书到主机的nginx上
![演示](packages/ui/certd-client/public/static/doc/images/5-1-add-host.png)
如果目前的部署插件都无法满足,您也可以手动下载,然后自行部署
![演示](packages/ui/certd-client/public/static/doc/images/13-3-download.png)
![演示](packages/ui/certd-client/public/static/doc/images/13-1-result.png)
### 3. 定时运行
![演示](packages/ui/certd-client/public/static/doc/images/12-1-log-success.png)
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
-------> [点我查看详细使用步骤演示](./step.md) <--------
↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
当前支持的部署插件列表
![演示](./docs/images/plugins/list.png)
更多教程请访问文档网站 [certd.docmirror.cn](https://certd.docmirror.cn/)
## 四、私有化部署
@ -54,10 +65,10 @@ https://certd.handsfree.work/
您可以根据实际情况从如下方式中选择一种方式进行私有化部署:
1. [宝塔面板方式部署](./install/baota/)
2. [1Panel面板方式部署](./install/1panel/)
2. [Docker方式部署](./install/docker/)
3. [源码方式部署](./install/source/)
1. [宝塔面板方式部署](https://certd.docmirror.cn/guide/install/docker/)
2. [1Panel面板方式部署](https://certd.docmirror.cn/guide/install/1panel/)
3. [Docker方式部署](https://certd.docmirror.cn/guide/install/docker/)
4. [源码方式部署](https://certd.docmirror.cn/guide/install/source/)
#### Docker镜像说明
* 国内镜像地址:
@ -155,7 +166,7 @@ https://afdian.com/a/greper
## 十一、贡献代码
1. 本地开发 [贡献插件教程](https://certd.docmirror.cn/guide/development/)
1. 本地开发 [贡献插件](https://certd.docmirror.cn/guide/development/)
2. 作为贡献者,代表您同意您贡献的代码如下许可:
1. 可以调整开源协议以使其更严格或更宽松。
2. 可以用于商业用途。
@ -164,7 +175,7 @@ https://afdian.com/a/greper
## 十二、 开源许可
* 本项目遵循 GNU Affero General Public LicenseAGPL开源协议。
* 允许个人和公司使用、复制、修改和分发本项目,禁止任何形式的商业用途
* 允许个人和公司内部自由使用、复制、修改和分发本项目,未获得商业授权情况下禁止任何形式的商业用途
* 未获得商业授权情况下禁止任何对logo、版权信息及授权许可相关代码的修改。
* 如需商业授权,请联系作者。

View File

@ -1 +1 @@
21:59
1

View File

@ -1 +1 @@
2
21:55

View File

@ -11,32 +11,44 @@ services:
ports: # 端口映射
# ↓↓↓↓ ---------------------------------------------------------- 如果端口有冲突可以修改第一个7001为其他不冲突的端口号
- "7001:7001"
# ↓↓↓↓ ---------------------------------------------------------- https端口可以根据实际情况是否暴露相关服务端口
# ↓↓↓↓ ---------------------------------------------------------- https端口可以根据实际情况是否暴露端口
- "7002:7002"
#↓↓↓↓ -------------------------------------------------------------- 如果出现getaddrinfo ENOTFOUND错误可以尝试设置dns
dns:
# ↓↓↓↓ ---------------------------------------------------------- 如果出现getaddrinfo ENOTFOUND等错误可以尝试修改或注释dns配置
- 223.5.5.5
- 223.5.5.5 # 阿里云公共dns
- 223.6.6.6
# ↓↓↓↓ ---------------------------------------------------------- 如果你服务器部署在国外可以用8.8.8.8替换上面的dns
# - 8.8.8.8
# # ↓↓↓↓ --------------------------------------------------------- 如果你服务器在腾讯云可以用这个替换上面阿里云的公共dns
# - 119.29.29.29 # 腾讯云公共dns
# - 182.254.116.116
# # ↓↓↓↓ --------------------------------------------------------- 如果你服务器部署在国外可以用这个替换上面阿里云的公共dns
# - 8.8.8.8 # 谷歌公共dns
# - 8.8.4.4
# extra_hosts:
# ↓↓↓↓ ---------------------------------------------------------- 这里可以配置自定义hosts外网域名可以指向本地局域网ip地址
# # ↓↓↓↓ -------------------------------------------------------- 这里可以配置自定义hosts外网域名可以指向本地局域网ip地址
# - "localdomain.comm:192.168.1.3"
environment:
- TZ=Asia/Shanghai
# 设置环境变量即可自定义certd配置
# 配置项见: packages/ui/certd-server/src/config/config.default.ts
# 配置规则: certd_ + 配置项, 点号用_代替
# ↓↓↓↓ ----------------------------- 如果忘记管理员密码可以设置为true重启之后管理员密码将改成123456然后请及时修改回false
# 设置环境变量即可自定义certd配置
# 配置项见: packages/ui/certd-server/src/config/config.default.ts
# 配置规则: certd_ + 配置项, 点号用_代替
# #↓↓↓↓ ----------------------------- 如果忘记管理员密码可以设置为true重启之后管理员密码将改成123456然后请及时修改回false
- certd_system_resetAdminPasswd=false
# ↓↓↓↓ ------------------------------- 使用postgresql数据库
# - certd_flyway_scriptDir=./db/migration-pg # 升级脚本目录
# - certd_typeorm_dataSource_default_type=postgres # 数据库类型
# - certd_typeorm_dataSource_default_host=localhost # 数据库地址
# - certd_typeorm_dataSource_default_port=5433 # 数据库端口
# - certd_typeorm_dataSource_default_username=postgres # 用户名
# - certd_typeorm_dataSource_default_password=yourpasswd # 密码
# - certd_typeorm_dataSource_default_database=certd # 数据库名
# #↓↓↓↓ ----------------------------- 使用postgresql数据库
# - certd_flyway_scriptDir=./db/migration-pg # 升级脚本目录
# - certd_typeorm_dataSource_default_type=postgres # 数据库类型
# - certd_typeorm_dataSource_default_host=localhost # 数据库地址
# - certd_typeorm_dataSource_default_port=5433 # 数据库端口
# - certd_typeorm_dataSource_default_username=postgres # 用户名
# - certd_typeorm_dataSource_default_password=yourpasswd # 密码
# - certd_typeorm_dataSource_default_database=certd # 数据库名
# #↓↓↓↓ ------------------------------------------------------------- 启用ipv6网络
# networks:
# - ip6net
#networks:
# ip6net:
# enable_ipv6: true
# ipam:
# config:
# - subnet: 2001:db8::/64

View File

@ -57,7 +57,7 @@ export default defineConfig({
nav: [
{ text: "首页", link: "/" },
{ text: "指南", link: "/guide/" },
{ text: "Demo体验", link: "https://certd.handsfree.work" }
{ text: "Demo体验", link: "https://certd.handfree.work" }
],
sidebar: {
"/guide/": [
@ -98,6 +98,9 @@ export default defineConfig({
{ text: "忘记密码", link: "/guide/use/forgotpasswd/" },
{ text: "数据备份", link: "/guide/use/backup/" },
{ text: "Certd本身的证书更新", link: "/guide/use/https/index.md" },
{ text: "js脚本插件使用", link: "/guide/use/custom-script/index.md" },
{ text: "邮箱配置", link: "/guide/use/email/index.md" },
{ text: "IPv6支持", link: "/guide/use/setting/ipv6.md" },
{ text: "如何贡献代码", link: "/guide/development/index.md" },
]
},

View File

@ -3,6 +3,175 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.27.4](https://github.com/certd/certd/compare/v1.27.3...v1.27.4) (2024-11-14)
### Bug Fixes
* 修复未设置pfx密码导致jks转换报错的bug ([c3cfbd8](https://github.com/certd/certd/commit/c3cfbd8474155aed4379f91075de37d5d8c73ef0))
### Performance Improvements
* 公共cname服务支持关闭 ([f4ae512](https://github.com/certd/certd/commit/f4ae5125dc4cd97816976779cb3586b5ee78947e))
## [1.27.3](https://github.com/certd/certd/compare/v1.27.2...v1.27.3) (2024-11-13)
### Bug Fixes
* 修复偶发性cname一直验证超时的bug ([d2ce72e](https://github.com/certd/certd/commit/d2ce72e4aaacdf726ba8b91fcd71db40a27714ba))
* 修复邮件配置忽略证书校验设置不生效的bug ([66a9690](https://github.com/certd/certd/commit/66a9690dc958732e1b3c672d965db502296446f9))
* 修复ipv6未开启情况下请求带有ipv6地址域名报ETIMEDOUT的bug ([a9a0967](https://github.com/certd/certd/commit/a9a0967a6f1d0bd27e69f3ec52c31d90d470bc23))
### Performance Improvements
* 修复站点个性化浏览器标题没有生效的bug ([bcfac02](https://github.com/certd/certd/commit/bcfac02c96ceaf23d1a0b05b48d8047da933beaf))
* 优化上传到主机插 路径选择,根据证书格式显示 ([8c3f86c](https://github.com/certd/certd/commit/8c3f86c6909ed91f48bb2880e78834e22f6f6a29))
* 支持jks ([889eaae](https://github.com/certd/certd/commit/889eaaea92818f628b922dae540c026630611707))
* ipv6支持 ([da6ac16](https://github.com/certd/certd/commit/da6ac1626b3574be2fabeeb18a1f10d60bdcbe49))
## [1.27.2](https://github.com/certd/certd/compare/v1.27.1...v1.27.2) (2024-11-08)
### Bug Fixes
* 修复某些容器管理ui无法识别端口列表的bug ([576e60a](https://github.com/certd/certd/commit/576e60a2b52315909e659d2a58cf98b130e69e6f))
* 修复删除腾讯云过期证书时间判断上的bug导致已过期仍然没有删除证书 ([1ba1007](https://github.com/certd/certd/commit/1ba10072615015d91b81fc56a3b01dae6a2ae9d1))
### Performance Improvements
* 优化部署到阿里云CDN插件支持多域名更易用 ([80c500f](https://github.com/certd/certd/commit/80c500f618b169a1f64c57fe442242a4d0d9d833))
* 优化流水线页面切换回来不丢失查询条件 ([4dcf6e8](https://github.com/certd/certd/commit/4dcf6e87bc5f7657ce8a56c5331e8723a0fee8ee))
* 支持公共cname服务 ([3c919ee](https://github.com/certd/certd/commit/3c919ee5d1aef5d26cf3620a7c49d920786bc941))
* 执行历史支持点击查看流水线详情 ([8968639](https://github.com/certd/certd/commit/89686399f90058835435b92872fc236fac990148))
* 专业版7天试用 ([c58250e](https://github.com/certd/certd/commit/c58250e1f065a9bd8b4e82acc1df754504c0010c))
## [1.27.1](https://github.com/certd/certd/compare/v1.27.0...v1.27.1) (2024-11-04)
### Bug Fixes
* 修复头像没有更新的bug ([9b4a31f](https://github.com/certd/certd/commit/9b4a31fa6a32b9cab2e22bd141cf96ca29120445))
### Performance Improvements
* 禁止页面缓存点击tab页签可以刷新数据 ([7ad4b55](https://github.com/certd/certd/commit/7ad4b55ee000c1dd0747832b11107f32b0ffb889))
* 优化时间选择器,自动填写分钟和秒钟 ([396dc34](https://github.com/certd/certd/commit/396dc34a841c7d016b033736afdba8366fb2d211))
* cname 域名映射记录可读性优化 ([b1117ed](https://github.com/certd/certd/commit/b1117ed54a3ef015752999324ff72b821ef5e4b9))
# [1.27.0](https://github.com/certd/certd/compare/v1.26.16...v1.27.0) (2024-10-31)
### Bug Fixes
* 修复历史记录不能按名称查询的bug ([6113c38](https://github.com/certd/certd/commit/6113c388b7fc58b11ca19ff05cc1286d096c8d28))
* pfx兼容windows server 2016 ([e5e468a](https://github.com/certd/certd/commit/e5e468a463f66d02f235de54b7c1e09ace5f1cb1))
### Features
* 首页全新改版 ([63ec5b5](https://github.com/certd/certd/commit/63ec5b5519c760a3330569c0da6dac157302a330))
### Performance Improvements
* 管理控制台数据统计 ([babd589](https://github.com/certd/certd/commit/babd5897ae013ff7c04ebfcbfac8a00d84dd627c))
* 增加向导 ([6d9ef26](https://github.com/certd/certd/commit/6d9ef26ecab71d752c2c55d75aed4fb5f6c05a39))
* lego 升级到 4.19.2 ([129bf53](https://github.com/certd/certd/commit/129bf53edc9bbb001fe49fbd7e239bd1d09cc128))
## [1.26.16](https://github.com/certd/certd/compare/v1.26.15...v1.26.16) (2024-10-30)
### Bug Fixes
* 修复lego No help topic for 错误 ([aaaf8d7](https://github.com/certd/certd/commit/aaaf8d7db34896cf8f2ff8f12eec1ab0cae58f0f))
### Performance Improvements
* 支持白山云cdn部署 ([b1b2cd0](https://github.com/certd/certd/commit/b1b2cd088b684eda764962abd61754c26a204d1c))
* 支持华为云cdn ([81a3fdb](https://github.com/certd/certd/commit/81a3fdbc29b71f380762008cc151493ec97458f9))
## [1.26.15](https://github.com/certd/certd/compare/v1.26.14...v1.26.15) (2024-10-28)
### Bug Fixes
* 顶部菜单变...的bug ([6dabad7](https://github.com/certd/certd/commit/6dabad76baba96be0f8af36a3fbfb9f5182aecf1))
### Performance Improvements
* 默认证书更新时间设置为35天增加腾讯云删除过期证书插件可以避免腾讯云过期证书邮件 ([51b6fed](https://github.com/certd/certd/commit/51b6fed468eaa6f28ce4497ce303ace1a52abb96))
* 授权加密支持解密查看 ([5575c83](https://github.com/certd/certd/commit/5575c839705f6987ad2bdcd33256b0962c6a9c6a))
* 重置管理员密码同时启用管理员账户,避免之前禁用了,重置密码还是登录不进去 ([f92d918](https://github.com/certd/certd/commit/f92d918a1e28e29b794ad4754661ea760c18af46))
## [1.26.14](https://github.com/certd/certd/compare/v1.26.13...v1.26.14) (2024-10-26)
### Bug Fixes
* 修复阿里云部署大杀器报插件_还未注册错误的bug ([abd2dcf](https://github.com/certd/certd/commit/abd2dcf2e85a545321bae6451406d081f773b132))
* 修复启动时自签证书无法保存的bug ([526c484](https://github.com/certd/certd/commit/526c48450bcd37b3ccded9b448f17de8140bdc6e))
### Performance Improvements
* 顶部菜单自定义 ([54d136c](https://github.com/certd/certd/commit/54d136cc6ae122f7c891b7a5c7232fe5de8e5cb5))
* 禁用readonly用户 ([d10d42e](https://github.com/certd/certd/commit/d10d42e20619bb55a50d636b8867ff33db4e3b4b))
* 限制其他用户流水线数量 ([315e437](https://github.com/certd/certd/commit/315e43746baf01682737f82e41579237a48409af))
* 用户管理优化头像上传 ([661293c](https://github.com/certd/certd/commit/661293c189a3abf3cdc953b5225192372f57930d))
## [1.26.13](https://github.com/certd/certd/compare/v1.26.12...v1.26.13) (2024-10-26)
### Bug Fixes
* 修复对话框全屏按钮与关闭按钮重叠的bug ([95df56c](https://github.com/certd/certd/commit/95df56cc5ca5e3eb843cd17cb7078cde47729f1e))
* deprecated的运行时不要报错只报警告 ([bcbefaa](https://github.com/certd/certd/commit/bcbefaaa35cf6d0eec085b3a2c5bfc7c6a8de9e1))
### Performance Improvements
* 更新certd本身的证书文档说明 ([0c50ede](https://github.com/certd/certd/commit/0c50ede129337b82df54575cbd2f4c2a783a0732))
* 支持同时监听https端口7002 ([d5a17f9](https://github.com/certd/certd/commit/d5a17f9e6afd63fda2df0981118480f25a1fac2e))
## [1.26.12](https://github.com/certd/certd/compare/v1.26.11...v1.26.12) (2024-10-25)
### Performance Improvements
* 部署到阿里云任意云资源,阿里云部署大杀器 ([4075be7](https://github.com/certd/certd/commit/4075be7849b140acb92bd8da8a9acbf4eef85180))
* 文件名特殊字符限制输入 ([c4164c6](https://github.com/certd/certd/commit/c4164c66e29f3ec799f98108a344806ca61e94ff))
* 新增部署到百度云CDN插件 ([f126f9f](https://github.com/certd/certd/commit/f126f9f932d37fa01fff1accc7bdd17d349f8db5))
* 新增部署到腾讯云CDN-v2推荐使用 ([d782655](https://github.com/certd/certd/commit/d782655cb4dfbb74138178afbffeee76fc755115))
* 优化cron选择器增加下次触发时间显示 ([5b148b7](https://github.com/certd/certd/commit/5b148b7ed960ca6f7f5b733b2eadd56eeecbd4c2))
* 支持部署到腾讯云COS ([a8a45d7](https://github.com/certd/certd/commit/a8a45d7f757820990e278533277a3deda5ba48f3))
* 支持配置公共ZeroSSL授权 ([a90d1e6](https://github.com/certd/certd/commit/a90d1e68ee9cbc3705223457b8a86f071b150968))
## [1.26.11](https://github.com/certd/certd/compare/v1.26.10...v1.26.11) (2024-10-23)
### Bug Fixes
* 申请证书没有使用到系统设置的http代理的bug ([3db216f](https://github.com/certd/certd/commit/3db216f515ba404cb4330fdab452971b22a50f08))
* 修复移动任务后出现空阶段的bug ([4ea3edd](https://github.com/certd/certd/commit/4ea3edd59e93ca4f5b2e43b20dd4ef33909caddb))
* 修复google证书*.xx.com与xx.com同时申请时报错的bug ([f8b99b8](https://github.com/certd/certd/commit/f8b99b81a23e7e9fd5e05ebd5caf355c41d67a90))
* 允许七牛云cdn插件输入.号开头的通配符域名 ([18ee87d](https://github.com/certd/certd/commit/18ee87daff6eafc2201b58e28d85aafd3cb7a5b9))
### Performance Improvements
* 申请证书启用新的反代地址 ([a705182](https://github.com/certd/certd/commit/a705182b85e51157883e48f23463263793bf3c12))
* 优化日志颜色 ([1291e98](https://github.com/certd/certd/commit/1291e98e821c5b1810aab7f0aebe3f5f5cd44a20))
* 优化证书申请速度和成功率反代地址优化google基本可以稳定请求。增加请求重试。 ([41d9c3a](https://github.com/certd/certd/commit/41d9c3ac8398def541e65351cbe920d4a927182d))
* 优化pfx密码密码输入框让浏览器不自动填写密码 ([ffeede3](https://github.com/certd/certd/commit/ffeede38afa70c5ff6f2015516bead23d2c4df87))
## [1.26.10](https://github.com/certd/certd/compare/v1.26.9...v1.26.10) (2024-10-20)
### Bug Fixes
* 修复cname服务普通用户access访问权限问题 ([c1e3e2e](https://github.com/certd/certd/commit/c1e3e2ee1f923ee5806479dd5f178c3286a01ae0))
## [1.26.9](https://github.com/certd/certd/compare/v1.26.8...v1.26.9) (2024-10-19)
### Bug Fixes
* 修复普通用户无法校验cname配置的bug ([6285497](https://github.com/certd/certd/commit/62854978bf0bdbe749b42f8e40ab227ab31ec92f))
* 修复切换普通用户登录时左侧菜单没有同步更新的bug ([12116a8](https://github.com/certd/certd/commit/12116a89f43cf8b98f16d2ea6073f6b72a643215))
* 修正邮箱设置跳转路由 ([17d8890](https://github.com/certd/certd/commit/17d88900a1f0e3af609b74597f5b1978230db32d))
### Performance Improvements
* 触发证书重新申请input变化对比规则优化减少升级版本后触发申请证书的情况 ([c46a2a9](https://github.com/certd/certd/commit/c46a2a9a399c2a9a8bb59a48b9fb6e93227cce9b))
* 任务下所有步骤都跳过时,整个任务显示跳过 ([84fd3b2](https://github.com/certd/certd/commit/84fd3b250dd1161ea06c5582fdadece4b29c2e53))
* 授权配置去除前后空格 ([57d8d48](https://github.com/certd/certd/commit/57d8d48046fbf51c52b041d2dec03d51fb018587))
* 数据库备份插件,先压缩再备份 ([304ef49](https://github.com/certd/certd/commit/304ef494fd5787c996ad0dcb6edd2f517afce9e2))
* 优化菜单 ([1f4f157](https://github.com/certd/certd/commit/1f4f15757de1015cf7563f7022599eef58cc93d7))
* 增加文档站 https://certd.docmirror.cn ([6e2ac1c](https://github.com/certd/certd/commit/6e2ac1c089f6ddccb396f1f2738509c05333e1bb))
## [1.26.8](https://github.com/certd/certd/compare/v1.26.7...v1.26.8) (2024-10-15)
### Bug Fixes

View File

@ -1,19 +1,21 @@
# 本地开发
欢迎贡献插件
## 1.本地调试运行
建议nodejs版本 `20.x` 及以上
## 一、本地调试运行
### 克隆代码
```shell
# 克隆代码
git clone https://github.com/certd/certd
git clone https://github.com/certd/certd --depth=1
#进入项目目录
cd certd
# 切换到最新版本代码
git checkout v1.26.7 # 这里换成最新版本号
# 切换到最新版本代码【如果v2分支无法编译请尝试切换到最新版tag】
# git checkout v1.27.0 # 这里换成最新版本号
```
@ -55,7 +57,7 @@ npm run dev
```
## 开发插件
## 二、开发插件
进入 `packages/ui/certd-server/src/plugins`
### 1.复制`plugin-demo`目录作为你的插件目录
@ -89,8 +91,22 @@ export * from './plugins/plugin-deploy-to-xx'
export * from "./plugin-cloudflare.js"
```
## 重启服务进行调试
### 6. 重启服务进行调试
刷新浏览器,检查你的插件是否工作正常, 确保能够正常进行证书申请和部署
## 提交PR
## 三、提交PR
我们将尽快审核PR
## 四、 注意事项
### 1. 如何让任务报错停止
```js
// 抛出异常即可使任务停止,否则会判定为成功
throw new Error("错误信息")
```
## 五、贡献插件送激活码
- PR要求插件功能完整代码规范
- PR通过后联系我们送您一个专业版激活码

View File

@ -11,7 +11,7 @@
## 2. 原理
* 假设你要申请证书的域名叫:`cert.com` ,它是在`Certd`不支持的服务商注册的
* 假设还有另外一个域名叫:`proxy.com`,它是在`Certd`支持的服务商注册的。
* 假设我们还有另外一个域名叫:`proxy.com`,它是在`Certd`支持的服务商注册的。
* 当我们按照如下进行配置时
```
CNAME记录手动、固定 TXT记录自动、随机
@ -19,20 +19,17 @@ _acme-challenge.cert.com ---> xxxxx.cname.proxy.com ----> txt-record-abcdefg
```
* 证书颁发机构就可以从`_acme-challenge.cert.com`查到TXT记录 `txt-record-abcdefg`,从而完成域名所有权校验。
* 以上可以看出 `xxxxx.cname.proxy.com ----> txt-record-abcdefg` 这一段`Certd`可以自动添加的。
* 以上可以看出 `xxxxx.cname.proxy.com ----> txt-record-abcdefg` 这一段`Certd`可以自动添加的。
* 剩下的只需要在你的`cert.com`域名中手动添加一条固定的`CNAME解析`即可
## 3. Certd CNAME使用步骤
1. 准备`一个`支持的服务商的注册的域名(`proxy.com`),或者将你众多域名其中`一个`的`DNS服务器`转到这几家服务商。
2. 然后到`Certd`的 `CNAME服务管理`界面,用`cname.proxy.com`创建一条默认的CNAME服务提供DNS提供商授权。
![](./images/cname1.png)
2. 然后创建证书流水线,输入`cert.com`,选择`CNAME`校验方式
3. 此时需要配置验证计划Certd会生成一个随机的CNAME记录例如`_acme-challenge`->`xxxxxx.cname.proxy.com`
1. 创建证书流水线,输入你要申请证书的域名,假设就是`cert.com`,然后选择`CNAME`校验方式
2. 此时需要配置验证计划Certd会生成一个随机的CNAME记录模版例如`_acme-challenge`->`xxxxxx.cname.proxy.com`
![](./images/cname2.png)
3. 您需要手动在你的`cert.com`域名中添加CNAME解析点击验,校验成功后就可以开始申请证书了 (此操作每个域名只需要做一次后续可以重复使用注意不要删除添加的CNAME记录)
3. 您需要手动在你的`cert.com`域名中添加CNAME解析点击验证校验成功后就可以开始申请证书了 (此操作每个域名只需要做一次后续可以重复使用注意不要删除添加的CNAME记录)
![](./images/cname3.png)
![](./images/cname4.png)
4. 申请过程中Certd会在`xxxxxx.cname.proxy.com`下自动添加TXT记录。

View File

@ -0,0 +1,86 @@
# 自定义脚本插件
## 1. 介绍
自定义脚本插件是一个通用的插件可以通过编写脚本来实现各种功能例如调用第三方API、执行系统命令、发送邮件等。
## 2. 使用示例
```js
const certPem = ctx.self.cert.crt
const certKey = ctx.self.cert.key
//axios发起http请求上传证书
const res = await ctx.http.request({
url:"your_cert_deploy_url",
method:"post",
data:{
crt : certPem,
key : certKey
}
})
if(!res || res.code !== 0){
//抛异常才能让任务失败
throw new Error("上传失败")
}
//不能用console.log需要用ctx.logger 才能把日志打印在ui上
ctx.logger.info("上传成功",res.data)
```
## 3. API
下面是`ctx`对象的`typescript`类型定义
```ts
type ctx = {
CertReader: typeof CertReader;
self: CustomScriptPlugin;
//流水线定义
pipeline: Pipeline;
//步骤定义
step: Step;
//日志
logger: Logger;
//当前步骤输入参数跟上一次执行比较是否有变化
inputChanged: boolean;
//授权获取服务
accessService: IAccessService;
//邮件服务
emailService: IEmailService;
//cname记录服务
cnameProxyService: ICnameProxyService;
//插件配置服务
pluginConfigService: IPluginConfigService;
//流水线上下文
pipelineContext: IContext;
//用户上下文
userContext: IContext;
//http请求客户端
http: HttpClient; // http.request(AxiosConfig)
//文件存储
fileStore: FileStore;
//上一次执行结果状态
lastStatus?: Runnable;
//用户取消信号
signal: AbortSignal;
//工具类
utils: typeof utils;
//用户信息
user: UserInfo;
}
type CertInfo = {
crt:string; //fullchain证书即 cert.pem cert.crt
key:string; // 私钥
ic: string; //中间证书
pfx: string;//PFX证书base64编码
der: string;//DER证书base64编码
}
type CustomScriptPlugin = {
//可以获取证书
cert: CertInfo
}
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -0,0 +1,23 @@
# 邮箱配置
## 腾讯企业邮箱配置
1. 开启smtp
![](./images/qq-3.png)
2. 获取授权码作为密码
![](./images/qq-1.png)
![](./images/qq-2.png)
3. 填写域名、端口和密码
![](./images/qq-0.png)
## QQ邮箱配置
1. smtp配置
```yaml
smtp域名: smtp.qq.com
smtp端口: 465
密码: 授权码,获取方式见下方
是否SSL: 是
```
2. 获取授权码
![](./images/qq-11.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -0,0 +1,21 @@
# IPv6支持
## 启用IPv6
在`docker-compose.yaml`中启用IPv6支持放开如下注释
```yaml
# #↓↓↓↓ ------------------------------------------------------------- 启用ipv6网络
networks:
- ip6net
networks:
ip6net:
enable_ipv6: true
ipam:
config:
- subnet: 2001:db8::/64
```
## 设置双栈网络优先级
可根据实际情况设置
![img.png](./images/ipv6.png)

BIN
docs/images/start/home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

View File

@ -18,7 +18,7 @@ hero:
link: /guide/tutorial.md
- theme: alt
text: demo体验
link: https://certd.handsfree.work
link: https://certd.handfree.work
features:
- title: 全自动申请证书

View File

@ -9,5 +9,5 @@
}
},
"npmClient": "pnpm",
"version": "1.27.0"
"version": "1.27.4"
}

View File

@ -14,13 +14,14 @@
},
"scripts": {
"start": "lerna bootstrap --hoist",
"devb": "lerna run dev-build",
"i-all": "lerna link && lerna exec npm install ",
"publish": "npm run prepublishOnly2 && lerna publish --force-publish=pro/plus-core --conventional-commits --create-release github && npm run afterpublishOnly && npm run commitAll",
"afterpublishOnly": "time /t >build.trigger && git add ./build.trigger && git commit -m \"build: trigger build image\" && TIMEOUT /T 10 && git push",
"afterpublishOnly": "npm run copylogs && time /t >build.trigger && git add ./build.trigger && git commit -m \"build: trigger build image\" && TIMEOUT /T 10 && git push",
"transform-sql": "cd ./packages/ui/certd-server/db/ && node --experimental-json-modules transform.js",
"commitAll": "git add . && git commit -m \"build: publish\" && git push && npm run commitPro",
"commitPro": "cd ./packages/core/ && git add . && git commit -m \"build: publish\" && git push",
"copylogs": "copyfiles \"CHANGELOG.md\" ./docs/guide/other/changelogs/",
"copylogs": "copyfiles \"CHANGELOG.md\" ./docs/guide/changelogs/",
"prepublishOnly1": "npm run check && lerna run build ",
"prepublishOnly2": "npm run check && npm run before-build && lerna run build ",
"before-build": "npm run transform-sql && cd ./packages/core/basic && time /t >build.md && git add ./build.md && git commit -m \"build: prepare to build\"",
@ -34,9 +35,11 @@
"license": "AGPL-3.0",
"dependencies": {
"axios": "^1.7.7",
"lodash-es": "^4.17.21"
"copyfiles": "^2.4.1",
"lodash-es": "^4.17.21",
"typescript": "^5.4.2"
},
"workspaces": [
"packages/**"
]
}
}

View File

@ -0,0 +1,28 @@
{
"extends": [
"plugin:prettier/recommended",
"prettier"
],
"plugins": [
"eslint-plugin-import"
],
"env": {
"mocha": true
},
"rules": {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-function": "off",
// "no-unused-expressions": "off",
"max-len": [
0,
160,
2,
{
"ignoreUrls": true
}
]
}
}

View File

@ -1,16 +0,0 @@
extends:
- 'airbnb-base'
env:
browser: false
node: true
mocha: true
rules:
indent: [2, 4, { SwitchCase: 1, VariableDeclarator: 1 }]
brace-style: [2, 'stroustrup', { allowSingleLine: true }]
func-names: 0
class-methods-use-this: 0
no-param-reassign: 0
max-len: [1, 200, 2, { ignoreUrls: true, ignoreComments: false }]
import/no-useless-path-segments: 0

View File

@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.27.4](https://github.com/publishlab/node-acme-client/compare/v1.27.3...v1.27.4) (2024-11-14)
**Note:** Version bump only for package @certd/acme-client
## [1.27.3](https://github.com/publishlab/node-acme-client/compare/v1.27.2...v1.27.3) (2024-11-13)
**Note:** Version bump only for package @certd/acme-client
## [1.27.2](https://github.com/publishlab/node-acme-client/compare/v1.27.1...v1.27.2) (2024-11-08)
**Note:** Version bump only for package @certd/acme-client
## [1.27.1](https://github.com/publishlab/node-acme-client/compare/v1.27.0...v1.27.1) (2024-11-04)
**Note:** Version bump only for package @certd/acme-client
# [1.27.0](https://github.com/publishlab/node-acme-client/compare/v1.26.16...v1.27.0) (2024-10-31)
**Note:** Version bump only for package @certd/acme-client

View File

@ -6,6 +6,38 @@
</dd>
</dl>
## Constants
<dl>
<dt><a href="#createPrivateEcdsaKey">createPrivateEcdsaKey</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Generate a private ECDSA key</p>
</dd>
<dt><a href="#getPublicKey">getPublicKey</a><code>buffer</code></dt>
<dd><p>Get a public key derived from a RSA or ECDSA key</p>
</dd>
<dt><a href="#getPemBodyAsB64u">getPemBodyAsB64u</a><code>string</code></dt>
<dd><p>Parse body of PEM encoded object and return a Base64URL string
If multiple objects are chained, the first body will be returned</p>
</dd>
<dt><a href="#readCsrDomains">readCsrDomains</a><code>object</code></dt>
<dd><p>Read domains from a Certificate Signing Request</p>
</dd>
<dt><a href="#readCertificateInfo">readCertificateInfo</a><code>object</code></dt>
<dd><p>Read information from a certificate
If multiple certificates are chained, the first will be read</p>
</dd>
<dt><a href="#createCsr">createCsr</a><code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code></dt>
<dd><p>Create a Certificate Signing Request</p>
</dd>
<dt><a href="#createAlpnCertificate">createAlpnCertificate</a><code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code></dt>
<dd><p>Create a self-signed ALPN certificate for TLS-ALPN-01 challenges</p>
<p><a href="https://datatracker.ietf.org/doc/html/rfc8737">https://datatracker.ietf.org/doc/html/rfc8737</a></p>
</dd>
<dt><a href="#isAlpnCertificateAuthorizationValid">isAlpnCertificateAuthorizationValid</a><code>boolean</code></dt>
<dd><p>Validate that a ALPN certificate contains the expected key authorization</p>
</dd>
</dl>
## Functions
<dl>
@ -15,12 +47,6 @@
<dt><a href="#createPrivateKey">createPrivateKey()</a></dt>
<dd><p>Alias of <code>createPrivateRsaKey()</code></p>
</dd>
<dt><a href="#createPrivateEcdsaKey">createPrivateEcdsaKey([namedCurve])</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Generate a private ECDSA key</p>
</dd>
<dt><a href="#getPublicKey">getPublicKey(keyPem)</a><code>buffer</code></dt>
<dd><p>Get a public key derived from a RSA or ECDSA key</p>
</dd>
<dt><a href="#getJwk">getJwk(keyPem)</a><code>object</code></dt>
<dd><p>Get a JSON Web Key derived from a RSA or ECDSA key</p>
<p><a href="https://datatracker.ietf.org/doc/html/rfc7517">https://datatracker.ietf.org/doc/html/rfc7517</a></p>
@ -28,27 +54,6 @@
<dt><a href="#splitPemChain">splitPemChain(chainPem)</a><code>Array.&lt;string&gt;</code></dt>
<dd><p>Split chain of PEM encoded objects from string into array</p>
</dd>
<dt><a href="#getPemBodyAsB64u">getPemBodyAsB64u(pem)</a><code>string</code></dt>
<dd><p>Parse body of PEM encoded object and return a Base64URL string
If multiple objects are chained, the first body will be returned</p>
</dd>
<dt><a href="#readCsrDomains">readCsrDomains(csrPem)</a><code>object</code></dt>
<dd><p>Read domains from a Certificate Signing Request</p>
</dd>
<dt><a href="#readCertificateInfo">readCertificateInfo(certPem)</a><code>object</code></dt>
<dd><p>Read information from a certificate
If multiple certificates are chained, the first will be read</p>
</dd>
<dt><a href="#createCsr">createCsr(data, [keyPem])</a><code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code></dt>
<dd><p>Create a Certificate Signing Request</p>
</dd>
<dt><a href="#createAlpnCertificate">createAlpnCertificate(authz, keyAuthorization, [keyPem])</a><code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code></dt>
<dd><p>Create a self-signed ALPN certificate for TLS-ALPN-01 challenges</p>
<p><a href="https://datatracker.ietf.org/doc/html/rfc8737">https://datatracker.ietf.org/doc/html/rfc8737</a></p>
</dd>
<dt><a href="#isAlpnCertificateAuthorizationValid">isAlpnCertificateAuthorizationValid(certPem, keyAuthorization)</a><code>boolean</code></dt>
<dd><p>Validate that a ALPN certificate contains the expected key authorization</p>
</dd>
</dl>
<a name="crypto"></a>
@ -57,40 +62,12 @@ If multiple certificates are chained, the first will be read</p>
Native Node.js crypto interface
**Kind**: global namespace
<a name="createPrivateRsaKey"></a>
## createPrivateRsaKey([modulusLength]) ⇒ <code>Promise.&lt;buffer&gt;</code>
Generate a private RSA key
**Kind**: global function
**Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded private RSA key
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [modulusLength] | <code>number</code> | <code>2048</code> | Size of the keys modulus in bits, default: `2048` |
**Example**
Generate private RSA key
```js
const privateKey = await acme.crypto.createPrivateRsaKey();
```
**Example**
Private RSA key with modulus size 4096
```js
const privateKey = await acme.crypto.createPrivateRsaKey(4096);
```
<a name="createPrivateKey"></a>
## createPrivateKey()
Alias of `createPrivateRsaKey()`
**Kind**: global function
<a name="createPrivateEcdsaKey"></a>
## createPrivateEcdsaKey([namedCurve])<code>Promise.&lt;buffer&gt;</code>
## createPrivateEcdsaKey ⇒ <code>Promise.&lt;buffer&gt;</code>
Generate a private ECDSA key
**Kind**: global function
**Kind**: global constant
**Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded private ECDSA key
| Param | Type | Description |
@ -109,10 +86,10 @@ const privateKey = await acme.crypto.createPrivateEcdsaKey('P-384');
```
<a name="getPublicKey"></a>
## getPublicKey(keyPem)<code>buffer</code>
## getPublicKey ⇒ <code>buffer</code>
Get a public key derived from a RSA or ECDSA key
**Kind**: global function
**Kind**: global constant
**Returns**: <code>buffer</code> - PEM encoded public key
| Param | Type | Description |
@ -124,44 +101,13 @@ Get public key
```js
const publicKey = acme.crypto.getPublicKey(privateKey);
```
<a name="getJwk"></a>
## getJwk(keyPem) ⇒ <code>object</code>
Get a JSON Web Key derived from a RSA or ECDSA key
https://datatracker.ietf.org/doc/html/rfc7517
**Kind**: global function
**Returns**: <code>object</code> - JSON Web Key
| Param | Type | Description |
| --- | --- | --- |
| keyPem | <code>buffer</code> \| <code>string</code> | PEM encoded private or public key |
**Example**
Get JWK
```js
const jwk = acme.crypto.getJwk(privateKey);
```
<a name="splitPemChain"></a>
## splitPemChain(chainPem) ⇒ <code>Array.&lt;string&gt;</code>
Split chain of PEM encoded objects from string into array
**Kind**: global function
**Returns**: <code>Array.&lt;string&gt;</code> - Array of PEM objects including headers
| Param | Type | Description |
| --- | --- | --- |
| chainPem | <code>buffer</code> \| <code>string</code> | PEM encoded object chain |
<a name="getPemBodyAsB64u"></a>
## getPemBodyAsB64u(pem)<code>string</code>
## getPemBodyAsB64u ⇒ <code>string</code>
Parse body of PEM encoded object and return a Base64URL string
If multiple objects are chained, the first body will be returned
**Kind**: global function
**Kind**: global constant
**Returns**: <code>string</code> - Base64URL-encoded body
| Param | Type | Description |
@ -170,10 +116,10 @@ If multiple objects are chained, the first body will be returned
<a name="readCsrDomains"></a>
## readCsrDomains(csrPem)<code>object</code>
## readCsrDomains ⇒ <code>object</code>
Read domains from a Certificate Signing Request
**Kind**: global function
**Kind**: global constant
**Returns**: <code>object</code> - {commonName, altNames}
| Param | Type | Description |
@ -190,11 +136,11 @@ console.log(`Alt names: ${altNames.join(', ')}`);
```
<a name="readCertificateInfo"></a>
## readCertificateInfo(certPem)<code>object</code>
## readCertificateInfo ⇒ <code>object</code>
Read information from a certificate
If multiple certificates are chained, the first will be read
**Kind**: global function
**Kind**: global constant
**Returns**: <code>object</code> - Certificate info
| Param | Type | Description |
@ -215,10 +161,10 @@ console.log(`Alt names: ${altNames.join(', ')}`);
```
<a name="createCsr"></a>
## createCsr(data, [keyPem])<code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code>
## createCsr ⇒ <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code>
Create a Certificate Signing Request
**Kind**: global function
**Kind**: global constant
**Returns**: <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code> - [privateKey, certificateSigningRequest]
| Param | Type | Description |
@ -276,12 +222,12 @@ const [, certificateRequest] = await acme.crypto.createCsr({
```
<a name="createAlpnCertificate"></a>
## createAlpnCertificate(authz, keyAuthorization, [keyPem])<code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code>
## createAlpnCertificate ⇒ <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code>
Create a self-signed ALPN certificate for TLS-ALPN-01 challenges
https://datatracker.ietf.org/doc/html/rfc8737
**Kind**: global function
**Kind**: global constant
**Returns**: <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code> - [privateKey, certificate]
| Param | Type | Description |
@ -303,10 +249,10 @@ const [, alpnCertificate] = await acme.crypto.createAlpnCertificate(authz, keyAu
```
<a name="isAlpnCertificateAuthorizationValid"></a>
## isAlpnCertificateAuthorizationValid(certPem, keyAuthorization)<code>boolean</code>
## isAlpnCertificateAuthorizationValid ⇒ <code>boolean</code>
Validate that a ALPN certificate contains the expected key authorization
**Kind**: global function
**Kind**: global constant
**Returns**: <code>boolean</code> - True when valid
| Param | Type | Description |
@ -314,3 +260,62 @@ Validate that a ALPN certificate contains the expected key authorization
| certPem | <code>buffer</code> \| <code>string</code> | PEM encoded certificate |
| keyAuthorization | <code>string</code> | Expected challenge key authorization |
<a name="createPrivateRsaKey"></a>
## createPrivateRsaKey([modulusLength]) ⇒ <code>Promise.&lt;buffer&gt;</code>
Generate a private RSA key
**Kind**: global function
**Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded private RSA key
| Param | Type | Description |
| --- | --- | --- |
| [modulusLength] | <code>number</code> | Size of the keys modulus in bits, default: `2048` |
**Example**
Generate private RSA key
```js
const privateKey = await acme.crypto.createPrivateRsaKey();
```
**Example**
Private RSA key with modulus size 4096
```js
const privateKey = await acme.crypto.createPrivateRsaKey(4096);
```
<a name="createPrivateKey"></a>
## createPrivateKey()
Alias of `createPrivateRsaKey()`
**Kind**: global function
<a name="getJwk"></a>
## getJwk(keyPem) ⇒ <code>object</code>
Get a JSON Web Key derived from a RSA or ECDSA key
https://datatracker.ietf.org/doc/html/rfc7517
**Kind**: global function
**Returns**: <code>object</code> - JSON Web Key
| Param | Type | Description |
| --- | --- | --- |
| keyPem | <code>buffer</code> \| <code>string</code> | PEM encoded private or public key |
**Example**
Get JWK
```js
const jwk = acme.crypto.getJwk(privateKey);
```
<a name="splitPemChain"></a>
## splitPemChain(chainPem) ⇒ <code>Array.&lt;string&gt;</code>
Split chain of PEM encoded objects from string into array
**Kind**: global function
**Returns**: <code>Array.&lt;string&gt;</code> - Array of PEM objects including headers
| Param | Type | Description |
| --- | --- | --- |
| chainPem | <code>buffer</code> \| <code>string</code> | PEM encoded object chain |

View File

@ -8,37 +8,42 @@ major release. Please migrate to the new <code>acme.crypto</code> interface at y
</dd>
</dl>
## Constants
<dl>
<dt><a href="#createPublicKey">createPublicKey</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Create public key from a private RSA key</p>
</dd>
<dt><a href="#getPemBody">getPemBody</a><code>string</code></dt>
<dd><p>Parse body of PEM encoded object from buffer or string
If multiple objects are chained, the first body will be returned</p>
</dd>
<dt><a href="#splitPemChain">splitPemChain</a><code>Array.&lt;string&gt;</code></dt>
<dd><p>Split chain of PEM encoded objects from buffer or string into array</p>
</dd>
<dt><a href="#getModulus">getModulus</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Get modulus</p>
</dd>
<dt><a href="#getPublicExponent">getPublicExponent</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Get public exponent</p>
</dd>
<dt><a href="#readCsrDomains">readCsrDomains</a><code>Promise.&lt;object&gt;</code></dt>
<dd><p>Read domains from a Certificate Signing Request</p>
</dd>
<dt><a href="#readCertificateInfo">readCertificateInfo</a><code>Promise.&lt;object&gt;</code></dt>
<dd><p>Read information from a certificate</p>
</dd>
<dt><a href="#createCsr">createCsr</a><code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code></dt>
<dd><p>Create a Certificate Signing Request</p>
</dd>
</dl>
## Functions
<dl>
<dt><a href="#createPrivateKey">createPrivateKey([size])</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Generate a private RSA key</p>
</dd>
<dt><a href="#createPublicKey">createPublicKey(key)</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Create public key from a private RSA key</p>
</dd>
<dt><a href="#getPemBody">getPemBody(str)</a><code>string</code></dt>
<dd><p>Parse body of PEM encoded object from buffer or string
If multiple objects are chained, the first body will be returned</p>
</dd>
<dt><a href="#splitPemChain">splitPemChain(str)</a><code>Array.&lt;string&gt;</code></dt>
<dd><p>Split chain of PEM encoded objects from buffer or string into array</p>
</dd>
<dt><a href="#getModulus">getModulus(input)</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Get modulus</p>
</dd>
<dt><a href="#getPublicExponent">getPublicExponent(input)</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Get public exponent</p>
</dd>
<dt><a href="#readCsrDomains">readCsrDomains(csr)</a><code>Promise.&lt;object&gt;</code></dt>
<dd><p>Read domains from a Certificate Signing Request</p>
</dd>
<dt><a href="#readCertificateInfo">readCertificateInfo(cert)</a><code>Promise.&lt;object&gt;</code></dt>
<dd><p>Read information from a certificate</p>
</dd>
<dt><a href="#createCsr">createCsr(data, [key])</a><code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code></dt>
<dd><p>Create a Certificate Signing Request</p>
</dd>
</dl>
<a name="forge"></a>
@ -50,34 +55,12 @@ DEPRECATION WARNING: This crypto interface is deprecated and will be removed fro
major release. Please migrate to the new `acme.crypto` interface at your earliest convenience.
**Kind**: global namespace
<a name="createPrivateKey"></a>
## createPrivateKey([size]) ⇒ <code>Promise.&lt;buffer&gt;</code>
Generate a private RSA key
**Kind**: global function
**Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded private RSA key
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [size] | <code>number</code> | <code>2048</code> | Size of the key, default: `2048` |
**Example**
Generate private RSA key
```js
const privateKey = await acme.forge.createPrivateKey();
```
**Example**
Private RSA key with defined size
```js
const privateKey = await acme.forge.createPrivateKey(4096);
```
<a name="createPublicKey"></a>
## createPublicKey(key)<code>Promise.&lt;buffer&gt;</code>
## createPublicKey ⇒ <code>Promise.&lt;buffer&gt;</code>
Create public key from a private RSA key
**Kind**: global function
**Kind**: global constant
**Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded public RSA key
| Param | Type | Description |
@ -91,11 +74,11 @@ const publicKey = await acme.forge.createPublicKey(privateKey);
```
<a name="getPemBody"></a>
## getPemBody(str)<code>string</code>
## getPemBody ⇒ <code>string</code>
Parse body of PEM encoded object from buffer or string
If multiple objects are chained, the first body will be returned
**Kind**: global function
**Kind**: global constant
**Returns**: <code>string</code> - PEM body
| Param | Type | Description |
@ -104,10 +87,10 @@ If multiple objects are chained, the first body will be returned
<a name="splitPemChain"></a>
## splitPemChain(str)<code>Array.&lt;string&gt;</code>
## splitPemChain ⇒ <code>Array.&lt;string&gt;</code>
Split chain of PEM encoded objects from buffer or string into array
**Kind**: global function
**Kind**: global constant
**Returns**: <code>Array.&lt;string&gt;</code> - Array of PEM bodies
| Param | Type | Description |
@ -116,10 +99,10 @@ Split chain of PEM encoded objects from buffer or string into array
<a name="getModulus"></a>
## getModulus(input)<code>Promise.&lt;buffer&gt;</code>
## getModulus ⇒ <code>Promise.&lt;buffer&gt;</code>
Get modulus
**Kind**: global function
**Kind**: global constant
**Returns**: <code>Promise.&lt;buffer&gt;</code> - Modulus
| Param | Type | Description |
@ -135,10 +118,10 @@ const m3 = await acme.forge.getModulus(certificateRequest);
```
<a name="getPublicExponent"></a>
## getPublicExponent(input)<code>Promise.&lt;buffer&gt;</code>
## getPublicExponent ⇒ <code>Promise.&lt;buffer&gt;</code>
Get public exponent
**Kind**: global function
**Kind**: global constant
**Returns**: <code>Promise.&lt;buffer&gt;</code> - Exponent
| Param | Type | Description |
@ -154,10 +137,10 @@ const e3 = await acme.forge.getPublicExponent(certificateRequest);
```
<a name="readCsrDomains"></a>
## readCsrDomains(csr)<code>Promise.&lt;object&gt;</code>
## readCsrDomains ⇒ <code>Promise.&lt;object&gt;</code>
Read domains from a Certificate Signing Request
**Kind**: global function
**Kind**: global constant
**Returns**: <code>Promise.&lt;object&gt;</code> - {commonName, altNames}
| Param | Type | Description |
@ -174,10 +157,10 @@ console.log(`Alt names: ${altNames.join(', ')}`);
```
<a name="readCertificateInfo"></a>
## readCertificateInfo(cert)<code>Promise.&lt;object&gt;</code>
## readCertificateInfo ⇒ <code>Promise.&lt;object&gt;</code>
Read information from a certificate
**Kind**: global function
**Kind**: global constant
**Returns**: <code>Promise.&lt;object&gt;</code> - Certificate info
| Param | Type | Description |
@ -198,10 +181,10 @@ console.log(`Alt names: ${altNames.join(', ')}`);
```
<a name="createCsr"></a>
## createCsr(data, [key])<code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code>
## createCsr ⇒ <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code>
Create a Certificate Signing Request
**Kind**: global function
**Kind**: global constant
**Returns**: <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code> - [privateKey, certificateSigningRequest]
| Param | Type | Description |
@ -256,3 +239,25 @@ const certificateKey = await acme.forge.createPrivateKey();
const [, certificateRequest] = await acme.forge.createCsr({
altNames: ['test.example.com'],
}, certificateKey);
<a name="createPrivateKey"></a>
## createPrivateKey([size]) ⇒ <code>Promise.&lt;buffer&gt;</code>
Generate a private RSA key
**Kind**: global function
**Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded private RSA key
| Param | Type | Description |
| --- | --- | --- |
| [size] | <code>number</code> | Size of the key, default: `2048` |
**Example**
Generate private RSA key
```js
const privateKey = await acme.forge.createPrivateKey();
```
**Example**
Private RSA key with defined size
```js
const privateKey = await acme.forge.createPrivateKey(4096);
```

View File

@ -3,7 +3,9 @@
"description": "Simple and unopinionated ACME client",
"private": false,
"author": "nmorsman",
"version": "1.27.0",
"version": "1.27.4",
"type": "module",
"module": "scr/index.js",
"main": "src/index.js",
"types": "types/index.d.ts",
"license": "MIT",
@ -16,12 +18,14 @@
"types"
],
"dependencies": {
"@certd/basic": "^1.27.4",
"@peculiar/x509": "^1.11.0",
"asn1js": "^3.0.5",
"axios": "^1.7.2",
"debug": "^4.3.5",
"http-proxy-agent": "^7.0.2",
"https-proxy-agent": "^7.0.5",
"lodash-es": "^4.17.21",
"node-forge": "^1.3.1"
},
"devDependencies": {
@ -29,14 +33,15 @@
"chai": "^4.4.1",
"chai-as-promised": "^7.1.2",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^4.2.1",
"jsdoc-to-markdown": "^8.0.1",
"mocha": "^10.6.0",
"nock": "^13.5.4",
"prettier": "^2.8.8",
"tsd": "^0.31.1",
"typescript": "^5.4.2",
"uuid": "^8.3.2"
"typescript": "^5.4.2"
},
"scripts": {
"build-docs": "jsdoc2md src/client.js > docs/client.md && jsdoc2md src/crypto/index.js > docs/crypto.md && jsdoc2md src/crypto/forge.js > docs/forge.md",
@ -60,5 +65,5 @@
"bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues"
},
"gitHead": "c643d7edc3721a6d2ac701a35ef600f6b6ff4b34"
"gitHead": "339554bdbf61c4784614747734a420e744e13bfb"
}

View File

@ -1,104 +0,0 @@
const nodeHttp = require('node:http');
const https = require('node:https');
const { HttpProxyAgent } = require('http-proxy-agent');
const { HttpsProxyAgent } = require('https-proxy-agent');
const { log } = require('./logger');
function createAgent(opts = {}) {
let httpAgent;
let
httpsAgent;
const httpProxy = opts.httpProxy || process.env.HTTP_PROXY || process.env.http_proxy;
if (httpProxy) {
log(`acme use httpProxy:${httpProxy}`);
httpAgent = new HttpProxyAgent(httpProxy, opts);
}
else {
httpAgent = new nodeHttp.Agent(opts);
}
const httpsProxy = opts.httpsProxy || process.env.HTTPS_PROXY || process.env.https_proxy;
if (httpsProxy) {
log(`acme use httpsProxy:${httpsProxy}`);
httpsAgent = new HttpsProxyAgent(httpsProxy, opts);
}
else {
httpsAgent = new https.Agent(opts);
}
return {
httpAgent,
httpsAgent,
};
}
let defaultAgents = createAgent();
function getGlobalAgents() {
return defaultAgents;
}
function setGlobalProxy(opts) {
log('acme setGlobalProxy:', opts);
defaultAgents = createAgent(opts);
}
class HttpError extends Error {
// eslint-disable-next-line constructor-super
constructor(error) {
if (!error) {
return;
}
super(error.message);
this.message = error.message;
if (this.message && this.message.indexOf('ssl3_get_record:wrong version number') >= 0) {
this.message = 'http协议错误服务端要求http协议请检查是否使用了https请求';
}
this.name = error.name;
this.code = error.code;
if (error.response) {
this.status = error.response.status;
this.statusText = error.response.statusText;
this.response = {
data: error.response.data,
};
if (!this.message) {
this.message = this.statusText;
}
}
let url = '';
if (error.config) {
this.request = {
baseURL: error.config.baseURL,
url: error.config.url,
method: error.config.method,
params: error.config.params,
data: error.config.data,
};
url = (error.config.baseURL || '') + error.config.url;
}
if (url) {
this.message = `${this.message}:${url}`;
}
// const { stack, cause } = error;
delete this.cause;
delete this.stack;
// this.cause = cause;
// this.stack = stack;
delete error.stack;
delete error.cause;
delete error.response;
delete error.config;
delete error.request;
// logger.error(error);
}
}
module.exports = {
setGlobalProxy,
createAgent,
getGlobalAgents,
HttpError,
};

View File

@ -1,9 +1,7 @@
/**
* ACME API client
*/
const util = require('./util');
const { log } = require('./logger');
import * as util from './util.js';
/**
* AcmeApi
@ -248,4 +246,4 @@ class AcmeApi {
}
/* Export API */
module.exports = AcmeApi;
export default AcmeApi;

View File

@ -1,11 +1,11 @@
/**
* ACME auto helper
*/
import { readCsrDomains } from './crypto/index.js';
import { log } from './logger.js';
import { wait } from './wait.js';
import { CancelError } from './error.js';
const { readCsrDomains } = require('./crypto');
const { log } = require('./logger');
const { wait } = require('./wait');
const { CancelError } = require('./error');
const defaultOpts = {
csr: null,
@ -30,7 +30,7 @@ const defaultOpts = {
* @returns {Promise<buffer>} Certificate
*/
module.exports = async (client, userOpts) => {
export default async (client, userOpts) => {
const opts = { ...defaultOpts, ...userOpts };
const accountPayload = { termsOfServiceAgreed: opts.termsOfServiceAgreed };

View File

@ -1,14 +1,11 @@
/**
* Axios instance
*/
const axios = require('axios');
const { parseRetryAfterHeader } = require('./util');
const { log } = require('./logger');
const pkg = require('./../package.json');
const Agents = require('./agents');
import axios from 'axios';
import { parseRetryAfterHeader } from './util.js';
import { log } from './logger.js';
const { AxiosError } = axios;
import {getGlobalAgents, HttpError} from '@certd/basic'
/**
* Defaults
*/
@ -16,7 +13,7 @@ const { AxiosError } = axios;
const instance = axios.create();
/* Default User-Agent */
instance.defaults.headers.common['User-Agent'] = `node-${pkg.name}/${pkg.version}`;
instance.defaults.headers.common['User-Agent'] = `@certd/acme-client`;
/* Default ACME settings */
instance.defaults.acmeSettings = {
@ -75,7 +72,7 @@ function validateStatus(response) {
response,
);
throw new Agents.HttpError(err);
throw new HttpError(err);
}
/* Pass all responses through the error interceptor */
@ -85,7 +82,7 @@ instance.interceptors.request.use((config) => {
}
config.validateStatus = () => false;
const agents = Agents.getGlobalAgents();
const agents = getGlobalAgents();
// if (config.skipSslVerify) {
// logger.info('跳过SSL验证');
// agents = createAgent({ rejectUnauthorized: false } as any);
@ -102,7 +99,7 @@ instance.interceptors.response.use(null, async (error) => {
const { config, response } = error;
if (!config) {
return Promise.reject(new Agents.HttpError(error));
return Promise.reject(new HttpError(error));
}
/* Pick up errors we want to retry */
@ -122,7 +119,7 @@ instance.interceptors.response.use(null, async (error) => {
const waitMinutes = (headerRetryAfter / 60).toFixed(1);
log(`Found retry-after response header with value: ${response.headers['retry-after']}, waiting ${waitMinutes} minutes`);
log(JSON.stringify(response.data));
return Promise.reject(new Agents.HttpError(error));
return Promise.reject(new HttpError(error));
}
log(`waiting ${retryAfter} seconds`);
@ -134,7 +131,7 @@ instance.interceptors.response.use(null, async (error) => {
}
if (!response) {
return Promise.reject(new Agents.HttpError(error));
return Promise.reject(new HttpError(error));
}
/* Validate and return response */
return validateStatus(response);
@ -144,4 +141,4 @@ instance.interceptors.response.use(null, async (error) => {
* Export instance
*/
module.exports = instance;
export default instance;

View File

@ -3,16 +3,17 @@
*
* @namespace Client
*/
import { createHash } from 'crypto';
import { getPemBodyAsB64u } from './crypto/index.js';
import { log } from './logger.js';
import HttpClient from './http.js';
import AcmeApi from './api.js';
import verify from './verify.js';
import * as util from './util.js';
import auto from './auto.js';
import { CancelError } from './error.js';
const { createHash } = require('crypto');
const { getPemBodyAsB64u } = require('./crypto');
const { log } = require('./logger');
const HttpClient = require('./http');
const AcmeApi = require('./api');
const verify = require('./verify');
const util = require('./util');
const auto = require('./auto');
const { CancelError } = require('./error');
/**
* ACME states
@ -719,4 +720,4 @@ class AcmeClient {
}
/* Export client */
module.exports = AcmeClient;
export default AcmeClient;

View File

@ -6,11 +6,10 @@
*
* @namespace forge
*/
const net = require('net');
const { promisify } = require('util');
const forge = require('node-forge');
const { createPrivateEcdsaKey, getPublicKey } = require('./index');
import net from 'net';
import { promisify } from 'util';
import forge from 'node-forge';
import { createPrivateEcdsaKey } from './index.js';
const generateKeyPair = promisify(forge.pki.rsa.generateKeyPair);
@ -113,13 +112,12 @@ function parseDomains(obj) {
* ```
*/
async function createPrivateKey(size = 2048) {
export async function createPrivateKey(size = 2048) {
const keyPair = await generateKeyPair({ bits: size });
const pemKey = forge.pki.privateKeyToPem(keyPair.privateKey);
return Buffer.from(pemKey);
}
exports.createPrivateKey = createPrivateKey;
/**
* Create public key from a private RSA key
@ -133,7 +131,7 @@ exports.createPrivateKey = createPrivateKey;
* ```
*/
exports.createPublicKey = async (key) => {
export const createPublicKey = async (key) => {
const privateKey = forge.pki.privateKeyFromPem(key);
const publicKey = forge.pki.rsa.setPublicKey(privateKey.n, privateKey.e);
const pemKey = forge.pki.publicKeyToPem(publicKey);
@ -148,7 +146,7 @@ exports.createPublicKey = async (key) => {
* @returns {string} PEM body
*/
exports.getPemBody = (str) => {
export const getPemBody = (str) => {
const msg = forge.pem.decode(str)[0];
return forge.util.encode64(msg.body);
};
@ -160,7 +158,7 @@ exports.getPemBody = (str) => {
* @returns {string[]} Array of PEM bodies
*/
exports.splitPemChain = (str) => forge.pem.decode(str).map(forge.pem.encode);
export const splitPemChain = (str) => forge.pem.decode(str).map(forge.pem.encode);
/**
* Get modulus
@ -176,7 +174,7 @@ exports.splitPemChain = (str) => forge.pem.decode(str).map(forge.pem.encode);
* ```
*/
exports.getModulus = async (input) => {
export const getModulus = async (input) => {
if (!Buffer.isBuffer(input)) {
input = Buffer.from(input);
}
@ -199,7 +197,7 @@ exports.getModulus = async (input) => {
* ```
*/
exports.getPublicExponent = async (input) => {
export const getPublicExponent = async (input) => {
if (!Buffer.isBuffer(input)) {
input = Buffer.from(input);
}
@ -223,7 +221,7 @@ exports.getPublicExponent = async (input) => {
* ```
*/
exports.readCsrDomains = async (csr) => {
export const readCsrDomains = async (csr) => {
if (!Buffer.isBuffer(csr)) {
csr = Buffer.from(csr);
}
@ -251,7 +249,7 @@ exports.readCsrDomains = async (csr) => {
* ```
*/
exports.readCertificateInfo = async (cert) => {
export const readCertificateInfo = async (cert) => {
if (!Buffer.isBuffer(cert)) {
cert = Buffer.from(cert);
}
@ -379,7 +377,7 @@ function formatCsrAltNames(altNames) {
* }, certificateKey);
*/
exports.createCsr = async (data, keyType = null) => {
export const createCsr = async (data, keyType = null) => {
let key = null;
if (keyType === 'ec') {
key = await createPrivateEcdsaKey();

View File

@ -3,12 +3,12 @@
*
* @namespace crypto
*/
import net from 'net';
import { promisify } from 'util';
import crypto from 'crypto';
import asn1js from 'asn1js';
import x509 from '@peculiar/x509';
const net = require('net');
const { promisify } = require('util');
const crypto = require('crypto');
const asn1js = require('asn1js');
const x509 = require('@peculiar/x509');
const randomInt = promisify(crypto.randomInt);
const generateKeyPair = promisify(crypto.generateKeyPair);
@ -67,7 +67,7 @@ function getKeyInfo(keyPem) {
* ```
*/
async function createPrivateRsaKey(modulusLength = 2048, encodingType = 'pkcs8') {
export async function createPrivateRsaKey(modulusLength = 2048, encodingType = 'pkcs8') {
const pair = await generateKeyPair('rsa', {
modulusLength,
privateKeyEncoding: {
@ -79,7 +79,6 @@ async function createPrivateRsaKey(modulusLength = 2048, encodingType = 'pkcs8')
return Buffer.from(pair.privateKey);
}
exports.createPrivateRsaKey = createPrivateRsaKey;
/**
* Alias of `createPrivateRsaKey()`
@ -87,7 +86,7 @@ exports.createPrivateRsaKey = createPrivateRsaKey;
* @function
*/
exports.createPrivateKey = createPrivateRsaKey;
export const createPrivateKey = createPrivateRsaKey;
/**
* Generate a private ECDSA key
@ -106,7 +105,7 @@ exports.createPrivateKey = createPrivateRsaKey;
* ```
*/
exports.createPrivateEcdsaKey = async (namedCurve = 'P-256', encodingType = 'pkcs8') => {
export const createPrivateEcdsaKey = async (namedCurve = 'P-256', encodingType = 'pkcs8') => {
const pair = await generateKeyPair('ec', {
namedCurve,
privateKeyEncoding: {
@ -130,7 +129,7 @@ exports.createPrivateEcdsaKey = async (namedCurve = 'P-256', encodingType = 'pkc
* ```
*/
exports.getPublicKey = (keyPem) => {
export const getPublicKey = (keyPem) => {
const info = getKeyInfo(keyPem);
const publicKey = info.publicKey.export({
@ -155,7 +154,7 @@ exports.getPublicKey = (keyPem) => {
* ```
*/
function getJwk(keyPem) {
export function getJwk(keyPem) {
const jwk = crypto.createPublicKey(keyPem).export({
format: 'jwk',
});
@ -167,7 +166,6 @@ function getJwk(keyPem) {
}, {});
}
exports.getJwk = getJwk;
/**
* Produce CryptoKeyPair and signing algorithm from a PEM encoded private key
@ -215,7 +213,7 @@ async function getWebCryptoKeyPair(keyPem) {
* @returns {string[]} Array of PEM objects including headers
*/
function splitPemChain(chainPem) {
export function splitPemChain(chainPem) {
if (Buffer.isBuffer(chainPem)) {
chainPem = chainPem.toString();
}
@ -225,7 +223,6 @@ function splitPemChain(chainPem) {
.map((params) => x509.PemConverter.encode([params]));
}
exports.splitPemChain = splitPemChain;
/**
* Parse body of PEM encoded object and return a Base64URL string
@ -235,7 +232,7 @@ exports.splitPemChain = splitPemChain;
* @returns {string} Base64URL-encoded body
*/
exports.getPemBodyAsB64u = (pem) => {
export const getPemBodyAsB64u = (pem) => {
const chain = splitPemChain(pem);
if (!chain.length) {
@ -286,7 +283,7 @@ function parseDomains(input) {
* ```
*/
exports.readCsrDomains = (csrPem) => {
export const readCsrDomains = (csrPem) => {
if (Buffer.isBuffer(csrPem)) {
csrPem = csrPem.toString();
}
@ -315,7 +312,7 @@ exports.readCsrDomains = (csrPem) => {
* ```
*/
exports.readCertificateInfo = (certPem) => {
export const readCertificateInfo = (certPem) => {
if (Buffer.isBuffer(certPem)) {
certPem = certPem.toString();
}
@ -449,7 +446,7 @@ function createSubjectAltNameExtension(altNames) {
* ```
*/
exports.createCsr = async (data, keyPem = null) => {
export const createCsr = async (data, keyPem = null) => {
if (!keyPem) {
keyPem = await createPrivateRsaKey(data.keySize);
}
@ -520,7 +517,7 @@ exports.createCsr = async (data, keyPem = null) => {
* ```
*/
exports.createAlpnCertificate = async (authz, keyAuthorization, keyPem = null) => {
export const createAlpnCertificate = async (authz, keyAuthorization, keyPem = null) => {
if (!keyPem) {
keyPem = await createPrivateRsaKey();
}
@ -583,7 +580,7 @@ exports.createAlpnCertificate = async (authz, keyAuthorization, keyPem = null) =
* @returns {boolean} True when valid
*/
exports.isAlpnCertificateAuthorizationValid = (certPem, keyAuthorization) => {
export const isAlpnCertificateAuthorizationValid = (certPem, keyAuthorization) => {
const expected = crypto.createHash('sha256').update(keyAuthorization).digest('hex');
/* Attempt to locate ALPN extension */

View File

@ -1,10 +1,7 @@
class CancelError extends Error {
export class CancelError extends Error {
constructor(message) {
super(message);
this.name = 'CancelError';
}
}
module.exports = {
CancelError,
};

View File

@ -1,11 +1,11 @@
/**
* ACME HTTP client
*/
const { createHmac, createSign, constants: { RSA_PKCS1_PADDING } } = require('crypto');
const { getJwk } = require('./crypto');
const { log } = require('./logger');
const axios = require('./axios');
import { createHmac, createSign, constants } from 'crypto';
const { RSA_PKCS1_PADDING } = constants;
import axios from './axios.js';
import { log } from './logger.js';
import { getJwk } from './crypto/index.js';
/**
* ACME HTTP client
@ -324,4 +324,4 @@ class HttpClient {
}
/* Export client */
module.exports = HttpClient;
export default HttpClient;

View File

@ -1,14 +1,14 @@
/**
* acme-client
*/
exports.Client = require('./client');
import AcmeClinet from './client.js'
export const Client = AcmeClinet
/**
* Directory URLs
*/
exports.directory = {
export const directory = {
buypass: {
staging: 'https://api.test4.buypass.no/acme/directory',
production: 'https://api.buypass.com/acme/directory',
@ -31,21 +31,18 @@ exports.directory = {
* Crypto
*/
exports.crypto = require('./crypto');
exports.forge = require('./crypto/forge');
export * as crypto from './crypto/index.js'
export * as forge from './crypto/forge.js'
/**
* Axios
*/
exports.axios = require('./axios');
exports.agents = require('./agents');
export * from './axios.js'
/**
* Logger
*/
exports.setLogger = require('./logger').setLogger;
exports.walkTxtRecord = require('./verify').walkTxtRecord;
exports.CancelError = require('./error').CancelError;
export * from './logger.js'
export * from './verify.js'
export * from './error.js'

View File

@ -2,7 +2,8 @@
* ACME logger
*/
const debug = require('debug')('acme-client');
import debugg from 'debug'
const debug = debugg('acme-client');
let logger = () => {};
@ -12,7 +13,7 @@ let logger = () => {};
* @param {function} fn Logger function
*/
exports.setLogger = (fn) => {
export const setLogger = (fn) => {
logger = fn;
};
@ -22,7 +23,7 @@ exports.setLogger = (fn) => {
* @param {string} msg Message
*/
exports.log = (...msg) => {
export const log = (...msg) => {
debug(...msg);
logger(...msg);
};

View File

@ -2,11 +2,12 @@
* Utility methods
*/
const tls = require('tls');
const dns = require('dns').promises;
const { readCertificateInfo, splitPemChain } = require('./crypto');
const { log } = require('./logger');
import tls from 'tls';
import dnsSdk from 'dns';
import { readCertificateInfo, splitPemChain }from './crypto/index.js'
import { log } from './logger.js'
const dns = dnsSdk.promises;
/**
* Exponential backoff
*
@ -329,7 +330,7 @@ async function retrieveTlsAlpnCertificate(host, port, timeout = 30000) {
* Export utils
*/
module.exports = {
export {
retry,
parseLinkHeader,
parseRetryAfterHeader,
@ -338,3 +339,4 @@ module.exports = {
getAuthoritativeDnsResolver,
retrieveTlsAlpnCertificate,
};

View File

@ -2,13 +2,15 @@
* ACME challenge verification
*/
const dns = require('dns').promises;
const https = require('https');
const { log } = require('./logger');
const axios = require('./axios');
const util = require('./util');
const { isAlpnCertificateAuthorizationValid } = require('./crypto');
import dnsSdk from "dns"
import https from 'https'
import {log} from './logger.js'
import axios from './axios.js'
import * as util from './util.js'
import {isAlpnCertificateAuthorizationValid} from './crypto/index.js'
const dns = dnsSdk.promises
/**
* Verify ACME HTTP challenge
*
@ -79,7 +81,7 @@ async function walkDnsChallengeRecord(recordName, resolver = dns) {
}
}
async function walkTxtRecord(recordName) {
export async function walkTxtRecord(recordName) {
try {
/* Default DNS resolver first */
log('Attempting to resolve TXT with default DNS resolver first');
@ -153,9 +155,8 @@ async function verifyTlsAlpnChallenge(authz, challenge, keyAuthorization) {
* Export API
*/
module.exports = {
export default {
'http-01': verifyHttpChallenge,
'dns-01': verifyDnsChallenge,
'tls-alpn-01': verifyTlsAlpnChallenge,
walkTxtRecord,
};

View File

@ -1,9 +1,5 @@
async function wait(ms) {
export async function wait(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
module.exports = {
wait,
};

View File

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

View File

@ -3,6 +3,28 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.27.4](https://github.com/certd/certd/compare/v1.27.3...v1.27.4) (2024-11-14)
**Note:** Version bump only for package @certd/basic
## [1.27.3](https://github.com/certd/certd/compare/v1.27.2...v1.27.3) (2024-11-13)
### Bug Fixes
* 修复ipv6未开启情况下请求带有ipv6地址域名报ETIMEDOUT的bug ([a9a0967](https://github.com/certd/certd/commit/a9a0967a6f1d0bd27e69f3ec52c31d90d470bc23))
## [1.27.2](https://github.com/certd/certd/compare/v1.27.1...v1.27.2) (2024-11-08)
### Performance Improvements
* 支持公共cname服务 ([3c919ee](https://github.com/certd/certd/commit/3c919ee5d1aef5d26cf3620a7c49d920786bc941))
## [1.27.1](https://github.com/certd/certd/compare/v1.27.0...v1.27.1) (2024-11-04)
### Performance Improvements
* cname 域名映射记录可读性优化 ([b1117ed](https://github.com/certd/certd/commit/b1117ed54a3ef015752999324ff72b821ef5e4b9))
# [1.27.0](https://github.com/certd/certd/compare/v1.26.16...v1.27.0) (2024-10-31)
**Note:** Version bump only for package @certd/basic

View File

@ -1 +1 @@
02:21
21:51

View File

@ -1,7 +1,7 @@
{
"name": "@certd/basic",
"private": false,
"version": "1.27.0",
"version": "1.27.4",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@ -17,52 +17,31 @@
"dependencies": {
"axios": "^1.7.2",
"dayjs": "^1.11.7",
"fix-path": "^4.0.0",
"http-proxy-agent": "^7.0.2",
"https-proxy-agent": "^7.0.5",
"iconv-lite": "^0.6.3",
"lodash-es": "^4.17.21",
"log4js": "^6.9.1",
"lru-cache": "^10.0.0",
"nanoid": "^5.0.7",
"node-forge": "^1.3.1",
"nodemailer": "^6.9.3",
"proxy-agent": "^6.4.0",
"qs": "^6.11.2"
"nodemailer": "^6.9.3"
},
"devDependencies": {
"@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.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.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",
"iconv-lite": "^0.6.3",
"log4js": "^6.9.1",
"mocha": "^10.2.0",
"prettier": "^2.8.8",
"reflect-metadata": "^0.1.13",
"rimraf": "^5.0.5",
"rollup": "^3.7.4",
"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.4.2",
"vite": "^4.3.8",
"vue-tsc": "^1.6.5"
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "c643d7edc3721a6d2ac701a35ef600f6b6ff4b34"
"gitHead": "339554bdbf61c4784614747734a420e744e13bfb"
}

View File

@ -1 +1,2 @@
export * from './utils/index.js';
export * from './utils/util.id.js';

View File

@ -7,9 +7,11 @@ export * from './util.promise.js';
export * from './util.hash.js';
export * from './util.merge.js';
export * from './util.cache.js';
export * from './util.string.js';
import { stringUtils } from './util.string.js';
import sleep from './util.sleep.js';
import { http } from './util.request.js';
import { nanoid } from 'nanoid';
import { http, download } from './util.request.js';
import { mergeUtils } from './util.merge.js';
import { sp } from './util.sp.js';
import { hashUtils } from './util.hash.js';
@ -20,10 +22,12 @@ import { cache } from './util.cache.js';
import dayjs from 'dayjs';
import { domainUtils } from './util.domain.js';
import { optionsUtils } from './util.options.js';
import { nanoid } from 'nanoid';
import * as id from './util.id.js';
export const utils = {
sleep,
http,
download,
sp,
hash: hashUtils,
promises,
@ -32,7 +36,9 @@ export const utils = {
mergeUtils,
cache,
nanoid,
id,
dayjs,
domain: domainUtils,
options: optionsUtils,
string: stringUtils,
};

View File

@ -1,6 +1,6 @@
// LRUCache
import { LRUCache } from "lru-cache";
import { LRUCache } from 'lru-cache';
export const cache = new LRUCache<string, any>({
max: 1000,

View File

@ -1,3 +1,4 @@
export function isDev() {
return process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'local';
const nodeEnv = process.env.NODE_ENV || '';
return nodeEnv === 'development' || nodeEnv.indexOf('local') >= 0;
}

View File

@ -0,0 +1,3 @@
import { customAlphabet } from 'nanoid';
export const simpleNanoId = customAlphabet('1234567890abcdefghijklmopqrstuvwxyz', 12);

View File

@ -1,4 +1,4 @@
import _ from "lodash-es";
import * as _ from 'lodash-es';
function isUnMergeable(srcValue: any) {
return srcValue != null && srcValue instanceof UnMergeable;
}

View File

@ -19,7 +19,7 @@ function groupByDomain(options: any[], inDomains: string[]) {
function buildGroupOptions(options: any[], inDomains: string[]) {
const grouped = groupByDomain(options, inDomains);
const groupOptions = [];
groupOptions.push({ value: '', disabled: true, label: '----已匹配----' });
groupOptions.push({ value: 'matched', disabled: true, label: '----已匹配----' });
if (grouped.matched.length === 0) {
options.push({ value: '', disabled: true, label: '没有可以匹配的域名' });
} else {
@ -28,7 +28,7 @@ function buildGroupOptions(options: any[], inDomains: string[]) {
}
}
if (grouped.notMatched.length > 0) {
groupOptions.push({ value: '', disabled: true, label: '----未匹配----' });
groupOptions.push({ value: 'unmatched', disabled: true, label: '----未匹配----' });
for (const notMatched of grouped.notMatched) {
groupOptions.push(notMatched);
}

View File

@ -1,11 +1,13 @@
import axios, { AxiosRequestConfig } from 'axios';
import { logger } from './util.log.js';
import { ILogger, 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';
import * as https from 'node:https';
import { merge } from 'lodash-es';
import { safePromise } from './util.promise.js';
import fs from 'fs';
export class HttpError extends Error {
status?: number;
statusText?: string;
@ -19,15 +21,23 @@ export class HttpError extends Error {
}
super(error.message || error.response?.statusText);
if (error?.message?.indexOf && error?.message?.indexOf('ssl3_get_record:wrong version number') >= 0) {
this.message = 'http协议错误服务端要求http协议请检查是否使用了https请求';
const message = error?.message;
if (message && typeof message === 'string') {
if (message.indexOf && message.indexOf('ssl3_get_record:wrong version number') >= 0) {
this.message = `${message}(http协议错误服务端要求http协议请检查是否使用了https请求)`;
} else if (message.indexOf('getaddrinfo EAI_AGAIN') >= 0) {
this.message = `${message}(无法解析域名请检查网络连接或dns配置更换docker-compose.yaml中dns配置)`;
}
}
this.name = error.name;
this.code = error.code;
this.status = error.response?.status;
this.statusText = error.response?.statusText;
this.statusText = error.response?.statusText || error.code;
if (!this.message) {
this.message = error.code;
}
this.request = {
baseURL: error.config?.baseURL,
url: error.config?.url,
@ -40,16 +50,16 @@ export class HttpError extends Error {
url = (error.config?.baseURL || '') + url;
}
if (url) {
this.message = `${this.message} : url=${url}`;
this.message = `${this.message} ${url}`;
}
this.response = {
data: error.response?.data,
};
// const { stack, cause } = error;
// this.cause = cause;
// this.stack = stack;
const { stack, cause } = error;
this.cause = cause;
this.stack = stack;
delete error.response;
delete error.config;
delete error.request;
@ -113,7 +123,12 @@ export function createAxiosService({ logger }: { logger: Logger }) {
service.interceptors.response.use(
(response: any) => {
if (response?.config?.logRes !== false) {
logger.info(`http response : status=${response?.status},data=${JSON.stringify(response?.data)}`);
let resData = response?.data;
try {
resData = JSON.stringify(response?.data);
} catch (e) {}
logger.info(`http response : status=${response?.status},data=${resData}`);
} else {
logger.info('http response status:', response?.status);
}
@ -187,26 +202,45 @@ export type HttpClient = {
request<D = any, R = any>(config: HttpRequestConfig<D>): Promise<HttpClientResponse<R>>;
};
// const http_proxy_backup = process.env.HTTP_PROXY || process.env.http_proxy;
// const https_proxy_backup = process.env.HTTPS_PROXY || process.env.https_proxy;
export type CreateAgentOptions = {
httpProxy?: string;
httpsProxy?: string;
} & nodeHttp.AgentOptions;
export function createAgent(opts: CreateAgentOptions = {}) {
opts = merge(
{
autoSelectFamily: true,
autoSelectFamilyAttemptTimeout: 1000,
},
opts
);
let httpAgent, httpsAgent;
const httpProxy = opts.httpProxy || process.env.HTTP_PROXY || process.env.http_proxy;
const httpProxy = opts.httpProxy;
if (httpProxy) {
process.env.HTTP_PROXY = httpProxy;
process.env.http_proxy = httpProxy;
logger.info('use httpProxy:', httpProxy);
httpAgent = new HttpProxyAgent(httpProxy, opts as any);
merge(httpAgent.options, opts);
} else {
process.env.HTTP_PROXY = '';
process.env.http_proxy = '';
httpAgent = new nodeHttp.Agent(opts);
}
const httpsProxy = opts.httpsProxy || process.env.HTTPS_PROXY || process.env.https_proxy;
const httpsProxy = opts.httpsProxy;
if (httpsProxy) {
process.env.HTTPS_PROXY = httpProxy;
process.env.https_proxy = httpProxy;
logger.info('use httpsProxy:', httpsProxy);
httpsAgent = new HttpsProxyAgent(httpsProxy, opts as any);
merge(httpsAgent.options, opts);
} else {
process.env.HTTPS_PROXY = '';
process.env.https_proxy = '';
httpsAgent = new https.Agent(opts);
}
return {
@ -214,3 +248,44 @@ export function createAgent(opts: CreateAgentOptions = {}) {
httpsAgent,
};
}
export async function download(req: { http: HttpClient; config: HttpRequestConfig; savePath: string; logger: ILogger }) {
const { http, config, savePath, logger } = req;
return safePromise((resolve, reject) => {
http
.request({
logRes: false,
responseType: 'stream',
...config,
})
.then(res => {
const writer = fs.createWriteStream(savePath);
res.pipe(writer);
writer.on('close', () => {
logger.info('文件下载成功');
resolve(true);
});
//error
writer.on('error', err => {
logger.error('下载失败', err);
reject(err);
});
//进度条打印
const totalLength = res.headers['content-length'];
let currentLength = 0;
// 每5%打印一次
const step = (totalLength / 100) * 5;
res.on('data', (chunk: any) => {
currentLength += chunk.length;
if (currentLength % step < chunk.length) {
const percent = ((currentLength / totalLength) * 100).toFixed(2);
logger.info(`下载进度:${percent}%`);
}
});
})
.catch(err => {
logger.info('下载失败', err);
reject(err);
});
});
}

View File

@ -0,0 +1,8 @@
export const stringUtils = {
maxLength(str?: string, length = 100) {
if (str) {
return str.length > length ? str.slice(0, length) + '...' : str;
}
return '';
},
};

View File

@ -7,28 +7,27 @@
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"inlineSourceMap":true,
"noImplicitThis": true,
"noUnusedLocals": true,
"stripInternal": true,
"importHelpers": true,
"skipLibCheck": true,
"pretty": true,
"declaration": true,
"forceConsistentCasingInFileNames": true,
"typeRoots": [ "./typings", "./node_modules/@types"],
"outDir": "dist",
"rootDir": "src",
"composite": true,
"composite": false,
"useDefineForClassFields": true,
"strict": true,
// "sourceMap": true,
"typeRoots": [ "./typings", "./node_modules/@types"],
"inlineSourceMap": true,
"resolveJsonModule": true,
"isolatedModules": false,
"lib": ["ESNext", "DOM"],
},
"include": [
"src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.json"
],
"exclude": [

View File

@ -3,6 +3,26 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.27.4](https://github.com/certd/certd/compare/v1.27.3...v1.27.4) (2024-11-14)
**Note:** Version bump only for package @certd/pipeline
## [1.27.3](https://github.com/certd/certd/compare/v1.27.2...v1.27.3) (2024-11-13)
**Note:** Version bump only for package @certd/pipeline
## [1.27.2](https://github.com/certd/certd/compare/v1.27.1...v1.27.2) (2024-11-08)
### Performance Improvements
* 支持公共cname服务 ([3c919ee](https://github.com/certd/certd/commit/3c919ee5d1aef5d26cf3620a7c49d920786bc941))
## [1.27.1](https://github.com/certd/certd/compare/v1.27.0...v1.27.1) (2024-11-04)
### Performance Improvements
* 优化时间选择器,自动填写分钟和秒钟 ([396dc34](https://github.com/certd/certd/commit/396dc34a841c7d016b033736afdba8366fb2d211))
# [1.27.0](https://github.com/certd/certd/compare/v1.26.16...v1.27.0) (2024-10-31)
**Note:** Version bump only for package @certd/pipeline

View File

@ -1,9 +1,10 @@
{
"name": "@certd/pipeline",
"private": false,
"version": "1.27.0",
"version": "1.27.4",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"dev": "vite",
@ -15,20 +16,11 @@
"test": "mocha --loader=ts-node/esm"
},
"dependencies": {
"@certd/basic": "^1.27.0",
"@certd/plus-core": "^1.27.0",
"axios": "^1.7.2",
"@certd/basic": "^1.27.4",
"@certd/plus-core": "^1.27.4",
"dayjs": "^1.11.7",
"fix-path": "^4.0.0",
"http-proxy-agent": "^7.0.2",
"https-proxy-agent": "^7.0.5",
"lodash-es": "^4.17.21",
"lru-cache": "^10.0.0",
"nanoid": "^5.0.7",
"node-forge": "^1.3.1",
"nodemailer": "^6.9.3",
"proxy-agent": "^6.4.0",
"qs": "^6.11.2"
"reflect-metadata": "^0.1.13"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^23.0.4",
@ -39,32 +31,17 @@
"@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.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",
"iconv-lite": "^0.6.3",
"log4js": "^6.9.1",
"mocha": "^10.2.0",
"prettier": "^2.8.8",
"reflect-metadata": "^0.1.13",
"rimraf": "^5.0.5",
"rollup": "^3.7.4",
"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.4.2",
"vite": "^4.3.8",
"vue-tsc": "^1.6.5"
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "c643d7edc3721a6d2ac701a35ef600f6b6ff4b34"
"gitHead": "339554bdbf61c4784614747734a420e744e13bfb"
}

View File

@ -1,7 +1,7 @@
import { Registrable } from "../registry/index.js";
import { FormItemProps } from "../dt/index.js";
import { HttpClient, ILogger, utils } from "../utils/index.js";
import _ from "lodash-es";
import { HttpClient, ILogger, utils } from "@certd/basic";
import * as _ from "lodash-es";
import { AccessRequestHandleReq } from "../core";
export type AccessInputDefine = FormItemProps & {

View File

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

View File

@ -3,8 +3,7 @@ import { RunHistory, RunnableCollection } from "./run-history.js";
import { AbstractTaskPlugin, PluginDefine, pluginRegistry, TaskInstanceContext, UserInfo } from "../plugin/index.js";
import { ContextFactory, IContext } from "./context.js";
import { IStorage } from "./storage.js";
import { createAxiosService, hashUtils, logger, utils } from "../utils/index.js";
import { Logger } from "log4js";
import { createAxiosService, hashUtils, HttpRequestConfig, ILogger, logger, utils } from "@certd/basic";
import { IAccessService } from "../access/index.js";
import { RegistryItem } from "../registry/index.js";
import { Decorator } from "../decorator/index.js";
@ -28,7 +27,7 @@ export class Executor {
pipeline: Pipeline;
runtime!: RunHistory;
contextFactory: ContextFactory;
logger: Logger;
logger: ILogger;
pipelineContext!: IContext;
currentStatusMap!: RunnableCollection;
lastStatusMap!: RunnableCollection;
@ -290,11 +289,20 @@ export class Executor {
}
const http = createAxiosService({ logger: currentLogger });
const download = async (config: HttpRequestConfig, savePath: string) => {
await utils.download({
http,
logger: currentLogger,
config,
savePath,
});
};
const taskCtx: TaskInstanceContext = {
pipeline: this.pipeline,
step,
lastStatus,
http,
download,
logger: currentLogger,
inputChanged,
accessService: this.options.accessService,

View File

@ -1,8 +1,8 @@
import { fileUtils } from "../utils/index.js";
import { fileUtils } from "@certd/basic";
import dayjs from "dayjs";
import path from "path";
import fs from "fs";
import { logger } from "../utils/index.js";
import { logger } from "@certd/basic";
export type FileStoreOptions = {
rootDir?: string;

View File

@ -1,4 +1,4 @@
import { HttpClient, ILogger, utils } from "../utils/index.js";
import { HttpClient, ILogger, utils } from "@certd/basic";
export type PluginRequestHandleReq<T = any> = {
typeName: string;

View File

@ -3,6 +3,5 @@ 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";
export * from "./exceptions.js";

View File

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

View File

@ -1,7 +1,6 @@
import { HistoryResult, Pipeline, ResultType, Runnable, RunnableMap, Stage, Step, Task } from "../dt/index.js";
import _ from "lodash-es";
import { buildLogger } from "../utils/index.js";
import { Logger } from "log4js";
import * as _ from "lodash-es";
import { buildLogger, ILogger } from "@certd/basic";
export type HistoryStatus = {
result: HistoryResult;
@ -25,7 +24,7 @@ export class RunHistory {
[runnableId: string]: string[];
} = {};
_loggers: {
[runnableId: string]: Logger;
[runnableId: string]: ILogger;
} = {};
trigger!: RunTrigger;
@ -117,10 +116,14 @@ export class RunHistory {
}
logError(runnable: Runnable, e: Error) {
const { cause, stack } = e;
delete e.stack;
delete e.cause;
const errorInfo = runnable.runnableType === "step" ? e : e.message;
this._loggers[runnable.id].error(`[${runnable.runnableType}] [${runnable.title}]<id:${runnable.id}> `, errorInfo);
if (runnable.runnableType === "step") {
this._loggers[runnable.id].error(`[${runnable.runnableType}] [${runnable.title}]<id:${runnable.id}> `, e, stack, cause);
} else {
this._loggers[runnable.id].error(`[${runnable.runnableType}] [${runnable.title}]<id:${runnable.id}> `, e.message);
}
}
finally(runnable: Runnable) {

View File

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

View File

@ -1,4 +1,4 @@
import _ from "lodash-es";
import * as _ from "lodash-es";
const propertyMap: any = {};
function attachProperty(target: any, propertyKey: string | symbol) {

View File

@ -3,7 +3,6 @@ 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,12 +1,11 @@
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/index.js";
import { ICnameProxyService, IEmailService } from "../service/index.js";
import { CancelError, IContext, PluginRequestHandleReq, RunnableCollection } from "../core/index.js";
import { ILogger, logger, utils } from "../utils/index.js";
import { HttpClient } from "../utils/index.js";
import { HttpRequestConfig, ILogger, logger, utils } from "@certd/basic";
import { HttpClient } from "@certd/basic";
import dayjs from "dayjs";
import { IPluginConfigService } from "../service/config";
import { upperFirst } from "lodash-es";
@ -68,7 +67,7 @@ export type TaskInstanceContext = {
//步骤定义
step: Step;
//日志
logger: Logger;
logger: ILogger;
//当前步骤输入参数跟上一次执行比较是否有变化
inputChanged: boolean;
//授权获取服务
@ -85,6 +84,8 @@ export type TaskInstanceContext = {
userContext: IContext;
//http请求客户端
http: HttpClient;
//下载文件方法
download: (config: HttpRequestConfig, savePath: string) => Promise<void>;
//文件存储
fileStore: FileStore;
//上一次执行结果状态

View File

@ -1,4 +1,4 @@
import { isDev, logger } from "../utils/index.js";
import { isDev, logger } from "@certd/basic";
export type Registrable = {
name: string;

View File

@ -3,9 +3,10 @@ import { IAccess } from "../access";
export type CnameProvider = {
id: any;
domain: string;
dnsProviderType: string;
title?: string;
dnsProviderType?: string;
access?: IAccess;
accessId: any;
accessId?: any;
};
export type CnameRecord = {
@ -15,6 +16,7 @@ export type CnameRecord = {
recordValue: string;
cnameProvider: CnameProvider;
status: string;
commonDnsProvider?: any;
};
export type ICnameProxyService = {
getByDomain: (domain: string) => Promise<CnameRecord>;

View File

@ -1 +0,0 @@
export * from "@certd/basic";

View File

@ -10,15 +10,15 @@
"inlineSourceMap":true,
"noImplicitThis": true,
"noUnusedLocals": true,
"importHelpers": true,
"stripInternal": true,
"skipLibCheck": true,
"pretty": true,
"declaration": true,
"forceConsistentCasingInFileNames": true,
"typeRoots": [ "./typings", "./node_modules/@types"],
"outDir": "dist",
"rootDir": "src",
"composite": true,
"composite": false,
"useDefineForClassFields": true,
"strict": true,
// "sourceMap": true,

View File

@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.27.4](https://github.com/certd/certd/compare/v1.27.3...v1.27.4) (2024-11-14)
**Note:** Version bump only for package @certd/lib-huawei
## [1.27.3](https://github.com/certd/certd/compare/v1.27.2...v1.27.3) (2024-11-13)
**Note:** Version bump only for package @certd/lib-huawei
## [1.27.2](https://github.com/certd/certd/compare/v1.27.1...v1.27.2) (2024-11-08)
**Note:** Version bump only for package @certd/lib-huawei
## [1.27.1](https://github.com/certd/certd/compare/v1.27.0...v1.27.1) (2024-11-04)
**Note:** Version bump only for package @certd/lib-huawei
# [1.27.0](https://github.com/certd/certd/compare/v1.26.16...v1.27.0) (2024-10-31)
**Note:** Version bump only for package @certd/lib-huawei

View File

@ -1,7 +1,7 @@
{
"name": "@certd/lib-huawei",
"private": false,
"version": "1.27.0",
"version": "1.27.4",
"main": "./dist/bundle.js",
"module": "./dist/bundle.js",
"types": "./dist/d/index.d.ts",
@ -17,5 +17,9 @@
"rimraf": "^5.0.5",
"rollup": "^3.7.4"
},
"gitHead": "c643d7edc3721a6d2ac701a35ef600f6b6ff4b34"
"devDependencies": {
"prettier": "^2.8.8",
"tslib": "^2.8.1"
},
"gitHead": "339554bdbf61c4784614747734a420e744e13bfb"
}

View File

@ -1,5 +1,5 @@
{
"compileOnSave": false,
"compileOnSave": true,
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
@ -7,10 +7,10 @@
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"inlineSourceMap":true,
"noImplicitThis": true,
"noUnusedLocals": true,
"stripInternal": true,
"importHelpers": true,
"skipLibCheck": true,
"pretty": true,
"declaration": true,
@ -18,7 +18,7 @@
"typeRoots": [ "./typings", "./node_modules/@types"],
"outDir": "dist",
"rootDir": "src",
"composite": true,
"composite": false,
"useDefineForClassFields": true,
"strict": false,
"sourceMap": true,

View File

@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.27.4](https://github.com/certd/certd/compare/v1.27.3...v1.27.4) (2024-11-14)
**Note:** Version bump only for package @certd/lib-iframe
## [1.27.3](https://github.com/certd/certd/compare/v1.27.2...v1.27.3) (2024-11-13)
**Note:** Version bump only for package @certd/lib-iframe
## [1.27.2](https://github.com/certd/certd/compare/v1.27.1...v1.27.2) (2024-11-08)
**Note:** Version bump only for package @certd/lib-iframe
## [1.27.1](https://github.com/certd/certd/compare/v1.27.0...v1.27.1) (2024-11-04)
**Note:** Version bump only for package @certd/lib-iframe
# [1.27.0](https://github.com/certd/certd/compare/v1.26.16...v1.27.0) (2024-10-31)
**Note:** Version bump only for package @certd/lib-iframe

View File

@ -1,9 +1,10 @@
{
"name": "@certd/lib-iframe",
"private": false,
"version": "1.27.0",
"version": "1.27.4",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"dev": "vite",
@ -18,26 +19,16 @@
"nanoid": "^4.0.0"
},
"devDependencies": {
"@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.3",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
"eslint": "^8.24.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.8.8",
"rimraf": "^5.0.5",
"rollup": "^3.7.4",
"rollup-plugin-visualizer": "^5.8.2",
"ts-node": "^10.9.1",
"tslib": "^2.5.2",
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "c643d7edc3721a6d2ac701a35ef600f6b6ff4b34"
"gitHead": "339554bdbf61c4784614747734a420e744e13bfb"
}

View File

@ -12,13 +12,14 @@
"noUnusedLocals": true,
"stripInternal": true,
"skipLibCheck": true,
"importHelpers": true,
"pretty": true,
"declaration": true,
"forceConsistentCasingInFileNames": true,
"typeRoots": [ "./typings", "./node_modules/@types"],
"outDir": "dist",
"rootDir": "src",
"composite": true,
"composite": false,
"useDefineForClassFields": true,
"strict": false,
// "sourceMap": true,

View File

@ -1,28 +0,0 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
test/user.secret.ts
.rollup.cache

View File

@ -1,3 +0,0 @@
node_modules
src
.rollup.cache

View File

@ -1,3 +0,0 @@
{
"printWidth": 160
}

View File

@ -1,139 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [1.27.0](https://github.com/certd/certd/compare/v1.26.16...v1.27.0) (2024-10-31)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.26.16](https://github.com/certd/certd/compare/v1.26.15...v1.26.16) (2024-10-30)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.26.15](https://github.com/certd/certd/compare/v1.26.14...v1.26.15) (2024-10-28)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.26.14](https://github.com/certd/certd/compare/v1.26.13...v1.26.14) (2024-10-26)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.26.13](https://github.com/certd/certd/compare/v1.26.12...v1.26.13) (2024-10-26)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.26.12](https://github.com/certd/certd/compare/v1.26.11...v1.26.12) (2024-10-25)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.26.11](https://github.com/certd/certd/compare/v1.26.10...v1.26.11) (2024-10-23)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.26.10](https://github.com/certd/certd/compare/v1.26.9...v1.26.10) (2024-10-20)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.26.9](https://github.com/certd/certd/compare/v1.26.8...v1.26.9) (2024-10-19)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.26.8](https://github.com/certd/certd/compare/v1.26.7...v1.26.8) (2024-10-15)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.26.7](https://github.com/certd/certd/compare/v1.26.6...v1.26.7) (2024-10-14)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.26.6](https://github.com/certd/certd/compare/v1.26.5...v1.26.6) (2024-10-14)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.26.5](https://github.com/certd/certd/compare/v1.26.4...v1.26.5) (2024-10-14)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.26.4](https://github.com/certd/certd/compare/v1.26.3...v1.26.4) (2024-10-14)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.26.3](https://github.com/certd/certd/compare/v1.26.2...v1.26.3) (2024-10-12)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.26.2](https://github.com/certd/certd/compare/v1.26.1...v1.26.2) (2024-10-11)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.26.1](https://github.com/certd/certd/compare/v1.26.0...v1.26.1) (2024-10-10)
**Note:** Version bump only for package @certd/lib-jdcloud
# [1.26.0](https://github.com/certd/certd/compare/v1.25.9...v1.26.0) (2024-10-10)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.25.9](https://github.com/certd/certd/compare/v1.25.8...v1.25.9) (2024-10-01)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.25.8](https://github.com/certd/certd/compare/v1.25.7...v1.25.8) (2024-09-30)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.25.7](https://github.com/certd/certd/compare/v1.25.6...v1.25.7) (2024-09-29)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.25.5](https://github.com/certd/certd/compare/v1.25.4...v1.25.5) (2024-09-26)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.25.4](https://github.com/certd/certd/compare/v1.25.3...v1.25.4) (2024-09-25)
**Note:** Version bump only for package @certd/lib-jdcloud
## [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/lib-jdcloud
## [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/lib-jdcloud
## [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/lib-jdcloud
# [1.25.0](https://github.com/certd/certd/compare/v1.24.4...v1.25.0) (2024-09-24)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
**Note:** Version bump only for package @certd/lib-huawei
## [1.24.2](https://github.com/certd/certd/compare/v1.24.1...v1.24.2) (2024-09-06)
**Note:** Version bump only for package @certd/lib-huawei
## [1.24.1](https://github.com/certd/certd/compare/v1.24.0...v1.24.1) (2024-09-02)
**Note:** Version bump only for package @certd/lib-huawei
## [1.22.1](https://github.com/certd/certd/compare/v1.22.0...v1.22.1) (2024-07-20)
**Note:** Version bump only for package @certd/lib-huawei
# [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))
* 支持postgresql ([3b19bfb](https://github.com/certd/certd/commit/3b19bfb4291e89064b3b407a80dae092d54747d5))

View File

@ -1,661 +0,0 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.

View File

@ -1,16 +0,0 @@
# Vue 3 + TypeScript + Vite
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
## Recommended IDE Setup
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
## Type Support For `.vue` Imports in TS
Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:
1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.
You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).

View File

@ -1,96 +0,0 @@
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,31 +0,0 @@
{
"name": "@certd/lib-jdcloud",
"private": false,
"version": "1.27.0",
"main": "./dist/bundle.mjs",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts",
"scripts": {
"dev": "vite",
"before-build": "rimraf dist && rimraf tsconfig.tsbuildinfo && rimraf .rollup.cache",
"build": "npm run before-build && rollup -c ",
"dev-build": "npm run build",
"preview": "vite preview"
},
"dependencies": {
"axios": "^1.7.2",
"buffer": "^5.0.8",
"create-hash": "^1.1.3",
"create-hmac": "^1.1.6",
"debug": "^3.1.0",
"node-fetch": "^2.1.2",
"url": "^0.11.0",
"uuid": "^3.1.0"
},
"devDependencies": {
"babel-register": "^6.26.0",
"rimraf": "^5.0.5",
"rollup": "^3.7.4"
},
"gitHead": "c643d7edc3721a6d2ac701a35ef600f6b6ff4b34"
}

View File

@ -1,40 +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.js",
output: {
file: "dist/bundle.mjs",
format: "es",
},
plugins: [
// 解析第三方依赖
resolve({
jsnext: true,
main: true,
browser: true,
}),
// 识别 commonjs 模式第三方依赖
commonjs({
// dynamicRequireRoot: "../../../../",
// dynamicRequireTargets: [
// // include using a glob pattern (either a string or an array of strings)
// "../../../../**/shelljs/src/*",
// ],
}),
// Typescript({
// target: "esnext",
// rootDir: "src",
// declaration: true,
// declarationDir: "dist/d",
// exclude: ["./node_modules/**", "./src/**/*.vue", "./src/**/*.spec.ts"],
// allowSyntheticDefaultImports: true,
// }),
json(),
terser(),
],
external: ["vue", "lodash-es", "dayjs", "log4js", "@midwayjs/core", "@certd/pipeline", "axios", "querystring"],
};

View File

@ -1,2 +0,0 @@
require('./lib/node_loader')
module.exports = require('./lib/core')

View File

@ -1 +0,0 @@
module.exports.DomainService = require("./repo/domainservice/v2/domainservice.js");

View File

@ -1 +0,0 @@
module.exports = require('./lib/jc')

View File

@ -1,4 +0,0 @@
require("babel-polyfill");
require("./browser_loader");
var JC = require("./core");
module.exports = JC;

View File

@ -1,13 +0,0 @@
var util = require('./util')
util.crypto.lib = {
createHash: require('create-hash'),
createHmac: require('create-hmac')
}
util.Buffer = require('buffer/').Buffer
util.url = require('url/')
util.querystring = require('querystring/')
util.environment = 'js'
var JC = require('./core')
module.exports = JC

View File

@ -1,6 +0,0 @@
require('./core')
require('./config')
require('./request')
require('./service')
require('./credentials')

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