Compare commits

...

52 Commits

Author SHA1 Message Date
xiaojunnuo
d4385ad8a5 v1.28.4 2024-12-13 00:17:10 +08:00
xiaojunnuo
da07ce419f build: prepare to build 2024-12-13 00:08:18 +08:00
xiaojunnuo
714e0206c4 build: prepare to build 2024-12-13 00:07:32 +08:00
xiaojunnuo
79f7ec4672 perf: 群晖支持6.x 2024-12-12 17:55:54 +08:00
xiaojunnuo
0f5c69040b fix: 修复证书成功通知发送失败的bug 2024-12-12 17:28:33 +08:00
xiaojunnuo
c9d1c45d97 docs: 证书成功同志 2024-12-12 16:49:40 +08:00
xiaojunnuo
ea8fdb120c docs: 证书说明 2024-12-12 16:45:40 +08:00
xiaojunnuo
f6fa830ffe docs: 2024-12-12 12:37:38 +08:00
xiaojunnuo
992e50c014 docs: 2024-12-12 12:30:26 +08:00
xiaojunnuo
bd705d91ba build: publish 2024-12-12 12:08:12 +08:00
xiaojunnuo
2656394195 build: trigger build image 2024-12-12 12:07:54 +08:00
xiaojunnuo
c8df9e698c v1.28.3 2024-12-12 12:06:46 +08:00
xiaojunnuo
19b78a1d2f build: prepare to build 2024-12-12 12:05:16 +08:00
xiaojunnuo
8039e8baf8 perf: 支持腾讯虚拟机开关机(@wujingke) 2024-12-12 11:50:01 +08:00
xiaojunnuo
9c5142c73c chore: 2024-12-12 11:42:46 +08:00
xiaojunnuo
8e3dcdde17 chore: tke挪出来 2024-12-11 22:17:11 +08:00
xiaojunnuo
34023adafb chore: 2024-12-11 17:40:34 +08:00
xiaojunnuo
79914e8d08 chore: 2024-12-11 15:06:02 +08:00
xiaojunnuo
454fbda581 perf: 点击版本红点按钮,跳转到升级帮助页面 2024-12-11 13:59:00 +08:00
xiaojunnuo
2c32703e6b chore: 2024-12-11 12:01:06 +08:00
xiaojunnuo
b561535626 Merge branch 'v2' into v2-dev 2024-12-11 11:48:34 +08:00
xiaojunnuo
1fc684d995 chore: 2024-12-11 11:48:05 +08:00
greper
7595d9fdfd pref: 腾讯云实例开机插件( @wujingke )
pr:  #265
2024-12-11 11:44:53 +08:00
w
3bf7732a21 腾讯云实例开机插件 2024-12-11 11:40:11 +08:00
xiaojunnuo
71b5aaf8ab chore: 2024-12-11 11:38:28 +08:00
xiaojunnuo
e1e5347476 chore: 2024-12-11 11:37:52 +08:00
xiaojunnuo
cdcdb6a2d9 chore: 2024-12-11 11:36:00 +08:00
xiaojunnuo
ec79104ad2 chore: 2024-12-11 11:33:33 +08:00
xiaojunnuo
ff083ce684 perf: 通知标题优化 2024-12-11 11:30:32 +08:00
xiaojunnuo
0f051e322e docs: upgrade 2024-12-11 10:25:16 +08:00
xiaojunnuo
657a2ae032 fix: 修复没有配置eab时,报order无法读取的问题 2024-12-11 09:30:21 +08:00
xiaojunnuo
0db3570026 chore: 2024-12-10 18:30:32 +08:00
xiaojunnuo
0ae39f160a perf: 支持aws cloudfront 2024-12-10 18:28:48 +08:00
xiaojunnuo
b45977c29a fix: 修复授权被删除后,无法清空的bug 2024-12-10 17:22:43 +08:00
xiaojunnuo
b7f5740c57 fix: mysql下access.setting字段改成text 2024-12-10 00:19:35 +08:00
xiaojunnuo
21e23369d3 chore: 2024-12-09 23:08:40 +08:00
xiaojunnuo
fca598991a chore: 2024-12-09 22:56:18 +08:00
xiaojunnuo
aa5b909486 build: publish 2024-12-09 22:53:08 +08:00
xiaojunnuo
0a888cf51a build: trigger build image 2024-12-09 22:52:44 +08:00
xiaojunnuo
e5c164065c v1.28.2 2024-12-09 22:45:02 +08:00
xiaojunnuo
8bc241ca14 build: prepare to build 2024-12-09 22:42:55 +08:00
xiaojunnuo
15beb79631 chore: 2024-12-09 22:40:17 +08:00
xiaojunnuo
fef1305e41 chore: 2024-12-09 21:44:37 +08:00
xiaojunnuo
498cf34999 fix: 修复创建流水线通知设置无效的bug 2024-12-09 18:04:45 +08:00
xiaojunnuo
7cde1fdc4a perf: 支持mysql 2024-12-09 17:47:01 +08:00
xiaojunnuo
228fdf0a0d perf: 优化数据表索引 2024-12-09 15:59:14 +08:00
xiaojunnuo
fdb5ea0ff4 Merge remote-tracking branch 'origin/v2-dev' into v2-dev 2024-12-09 09:34:12 +08:00
xiaojunnuo
a0e838d1ee fix: 修复流水线分组可以被所有人看见的bug 2024-12-09 02:24:30 +08:00
xiaojunnuo
30ddf5ec41 build: publish 2024-12-09 01:56:13 +08:00
xiaojunnuo
cfd3b7b3ae build: trigger build image 2024-12-09 01:55:54 +08:00
xiaojunnuo
138dc286f6 chore: 删除cloudflare cdn插件 2024-12-05 13:34:21 +08:00
xiaojunnuo
07cee2aadf chore: 2024-12-05 12:10:31 +08:00
122 changed files with 1972 additions and 387 deletions

View File

@@ -3,6 +3,43 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.4](https://github.com/certd/certd/compare/v1.28.3...v1.28.4) (2024-12-12)
### Bug Fixes
* 修复证书成功通知发送失败的bug ([0f5c690](https://github.com/certd/certd/commit/0f5c69040ba77340c909813220a26bc7ddada3ea))
### Performance Improvements
* 群晖支持6.x ([79f7ec4](https://github.com/certd/certd/commit/79f7ec4672f4fd5744cc45e4a6f104da943f4026))
## [1.28.3](https://github.com/certd/certd/compare/v1.28.2...v1.28.3) (2024-12-12)
### Bug Fixes
* 修复没有配置eab时报order无法读取的问题 ([657a2ae](https://github.com/certd/certd/commit/657a2ae032e6f61ac27fbdd26c7bf169c041219e))
* 修复授权被删除后无法清空的bug ([b45977c](https://github.com/certd/certd/commit/b45977c29a29084c11e496bec3415eaaebafdd74))
* mysql下access.setting字段改成text ([b7f5740](https://github.com/certd/certd/commit/b7f5740c57743914f754f3b4fdd94b59a2e8338c))
### Performance Improvements
* 点击版本红点按钮,跳转到升级帮助页面 ([454fbda](https://github.com/certd/certd/commit/454fbda581bbe22abca5b91e5086ea9d9d58a020))
* 通知标题优化 ([ff083ce](https://github.com/certd/certd/commit/ff083ce6848a8bee3c8248e4b881086ae1517c28))
* 支持腾讯虚拟机开关机([@wujingke](https://github.com/wujingke)) ([8039e8b](https://github.com/certd/certd/commit/8039e8baf83c82d03f1a6198cf61c372026b962b))
* 支持aws cloudfront ([0ae39f1](https://github.com/certd/certd/commit/0ae39f160a7c6b6696b3bf513d68aa28905810ad))
## [1.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
### Bug Fixes
* 修复创建流水线通知设置无效的bug ([498cf34](https://github.com/certd/certd/commit/498cf34999fddfa24ce088e2e678469fa669abb8))
* 修复流水线分组可以被所有人看见的bug ([a0e838d](https://github.com/certd/certd/commit/a0e838d1eec918e5dc92fe95dc72ac14facb930e))
### Performance Improvements
* 优化数据表索引 ([228fdf0](https://github.com/certd/certd/commit/228fdf0a0d28013f5dd156a97bbde80537e8e97e))
* 支持mysql ([7cde1fd](https://github.com/certd/certd/commit/7cde1fdc4a9ed851900d231a5460c8dbfbcd148e))
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
### Bug Fixes

View File

@@ -9,11 +9,11 @@ Certd 是一个免费全自动申请和自动部署更新SSL证书的管理系
本项目不仅支持证书申请过程自动化,还可以自动化部署更新证书,让你的证书永不过期。
* 全自动申请证书(支持所有注册商注册的域名)
* 全自动部署更新证书(目前支持部署到主机、部署到阿里云、腾讯云等,目前已支持30+部署插件)
* 全自动部署更新证书(目前支持部署到主机、阿里云、腾讯云等,目前已支持40+部署插件)
* 支持通配符域名/泛域名支持多个域名打到一个证书上支持pem、pfx、der、jks等多种证书格式
* 邮件通知
* 邮件通知、webhook通知
* 私有化部署数据保存本地镜像由Github Actions构建过程公开透明
* 支持sqlitepostgresql数据库
* 支持SQLitePostgreSQL、MySQL数据库

View File

@@ -1 +1 @@
03:24
12:07

View File

@@ -33,7 +33,7 @@ services:
# 配置规则: certd_ + 配置项, 点号用_代替
# #↓↓↓↓ ----------------------------- 如果忘记管理员密码可以设置为true重启之后管理员密码将改成123456然后请及时修改回false
- certd_system_resetAdminPasswd=false
# #↓↓↓↓ ----------------------------- 使用postgresql数据库
# #↓↓↓↓ ----------------------------- 使用postgresql数据库,需要提前创建数据库
# - certd_flyway_scriptDir=./db/migration-pg # 升级脚本目录
# - certd_typeorm_dataSource_default_type=postgres # 数据库类型
# - certd_typeorm_dataSource_default_host=localhost # 数据库地址
@@ -42,6 +42,19 @@ services:
# - certd_typeorm_dataSource_default_password=yourpasswd # 密码
# - certd_typeorm_dataSource_default_database=certd # 数据库名
# #↓↓↓↓ ----------------------------- 使用mysql数据库需要提前创建数据库 charset=utf8mb4, collation=utf8mb4_bin
# - certd_flyway_scriptDir=./db/migration-mysql # 升级脚本目录
# - certd_typeorm_dataSource_default_type=mysql # 数据库类型, 或者 mariadb
# - certd_typeorm_dataSource_default_host=localhost # 数据库地址
# - certd_typeorm_dataSource_default_port=3306 # 数据库端口
# - certd_typeorm_dataSource_default_username=root # 用户名
# - certd_typeorm_dataSource_default_password=yourpasswd # 密码
# - certd_typeorm_dataSource_default_database=certd # 数据库名
# #↓↓↓↓ ------------------------------------------------------------- 启用ipv6网络
# networks:
# - ip6net

View File

@@ -76,8 +76,8 @@ export default defineConfig({
{ text: "源码部署", link: "/guide/install/source/" }
]
},
{ text: "演示教程", link: "/guide/tutorial.md" }
{ text: "演示教程", link: "/guide/tutorial.md" },
{ text: "版本升级", link: "/guide/install/upgrade.md" }
]
},
{

View File

@@ -3,6 +3,49 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.3](https://github.com/certd/certd/compare/v1.28.2...v1.28.3) (2024-12-12)
### Bug Fixes
* 修复没有配置eab时报order无法读取的问题 ([657a2ae](https://github.com/certd/certd/commit/657a2ae032e6f61ac27fbdd26c7bf169c041219e))
* 修复授权被删除后无法清空的bug ([b45977c](https://github.com/certd/certd/commit/b45977c29a29084c11e496bec3415eaaebafdd74))
* mysql下access.setting字段改成text ([b7f5740](https://github.com/certd/certd/commit/b7f5740c57743914f754f3b4fdd94b59a2e8338c))
### Performance Improvements
* 点击版本红点按钮,跳转到升级帮助页面 ([454fbda](https://github.com/certd/certd/commit/454fbda581bbe22abca5b91e5086ea9d9d58a020))
* 通知标题优化 ([ff083ce](https://github.com/certd/certd/commit/ff083ce6848a8bee3c8248e4b881086ae1517c28))
* 支持腾讯虚拟机开关机([@wujingke](https://github.com/wujingke)) ([8039e8b](https://github.com/certd/certd/commit/8039e8baf83c82d03f1a6198cf61c372026b962b))
* 支持aws cloudfront ([0ae39f1](https://github.com/certd/certd/commit/0ae39f160a7c6b6696b3bf513d68aa28905810ad))
## [1.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
### Bug Fixes
* 修复创建流水线通知设置无效的bug ([498cf34](https://github.com/certd/certd/commit/498cf34999fddfa24ce088e2e678469fa669abb8))
* 修复流水线分组可以被所有人看见的bug ([a0e838d](https://github.com/certd/certd/commit/a0e838d1eec918e5dc92fe95dc72ac14facb930e))
### Performance Improvements
* 优化数据表索引 ([228fdf0](https://github.com/certd/certd/commit/228fdf0a0d28013f5dd156a97bbde80537e8e97e))
* 支持mysql ([7cde1fd](https://github.com/certd/certd/commit/7cde1fdc4a9ed851900d231a5460c8dbfbcd148e))
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
### Bug Fixes
* 修复cname排查方法 nslookup命令显示黑色的问题 ([3dfeeec](https://github.com/certd/certd/commit/3dfeeec899d7d0d7292695ce410f78548e076c03))
### Performance Improvements
* 通知选择器优化 ([2c0cbdd](https://github.com/certd/certd/commit/2c0cbdd29ecb74cc939b2ae7ee86b8d40f70ba31))
* 新增七牛云插件分组 ([49e7dc5](https://github.com/certd/certd/commit/49e7dc56e1a95fbdea3e30cdeb945b48415b69e3))
* 新增server酱3通知 ([6aa4872](https://github.com/certd/certd/commit/6aa487269c9f6862e188b37a0d6c73f79c937d94))
* 支持邀请奖励 ([618ec93](https://github.com/certd/certd/commit/618ec937866b24ebcf8164db43acb1ed66a5b329))
* 支持易发云短信 ([94fa77f](https://github.com/certd/certd/commit/94fa77fcd2b9bea294fb05736c0d8cdc81f56103))
* cname value优化 ([e8c9c2a](https://github.com/certd/certd/commit/e8c9c2a47d47048ae743b16f7bc932dbe18a89e9))
* favicon支持自定义 ([8b9c47d](https://github.com/certd/certd/commit/8b9c47daf194515006689a212ae9cf586bdf5993))
# [1.28.0](https://github.com/certd/certd/compare/v1.27.9...v1.28.0) (2024-11-30)
### Bug Fixes

View File

@@ -106,4 +106,4 @@ throw new Error("错误信息")
## 五、贡献插件送激活码
- PR要求插件功能完整代码规范
- PR通过后联系我们送您一个专业版激活码
- PR通过后联系我们送您一个半年期专业版激活码

View File

@@ -14,7 +14,7 @@ Certd 是一款开源、免费、全自动申请和部署更新SSL证书的工
* 支持通配符域名/泛域名,支持多个域名打到一个证书上
* 邮件通知
* 私有化部署,保障数据安全
* 支持sqlitepostgresql数据库
* 支持SQLite、Postgresql、MySQL数据库
## 二、一些说明
@@ -30,5 +30,5 @@ Certd 是一款开源、免费、全自动申请和部署更新SSL证书的工
## 三、证书颁发机构对比
* Let's Encrypt申请最简单。
* Google: 大厂光环兼容性好需要翻墙获取EAB。
* Google: 大厂光环,兼容性好,首次需要翻墙获取EAB。
* ZeroSSL 需要EAB获取EAB无需翻墙。

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -31,15 +31,12 @@ admin/123456
## 三、升级
1. 找到容器,点击编辑
![](./images/edit1.png)
1. 找到容器,点击更多->升级
![](./images/upgrade-1.png)
2. 将latest修改为最新版本号
![](https://img.shields.io/npm/v/%40certd%2Fpipeline)
2. 选择强制拉取镜像,点击确认即可
![img.png](./images/upgrade-2.png)
![img.png](./images/edit2.png)
3. 点击确定,重启容器
## 四、数据备份

View File

@@ -38,28 +38,12 @@ admin/123456
登录后请及时修改密码
## 三、如何升级
宝塔升级certd非常简单
### 1. 应用商店安装,直接更新镜像即可
`docker`->`容器编排`->`左侧选择Certd-xxxx`->`更新镜像`
`docker`->`容器编排`->`左侧选择Certd`->`更新镜像`
![img.png](./images/upgrade.png)
### 2. latest更新方式
在主机上拉取最新镜像,然后面板上重启容器
```shell
docker pull registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest
```
### 3. 固定版本号方式
修改容器编排模版中的镜像版本号,然后面板上重启容器
```shell
services:
certd:
# 镜像 # 修改最新版本号 ---- ↓↓↓↓↓
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:v1.xx.x
```
## 四、数据备份
### 4.1 应用商店部署方式

View File

@@ -8,7 +8,7 @@
```shell
# 克隆代码
git clone https://github.com/certd/certd
# git checkout v1.x.x # 1.x.x换成最新版本号当v2主干分支代码无法正常启动时可以尝试此命令
# git checkout v1.x.x # 当v2主干分支代码无法正常启动时可以尝试此命令1.x.x换成最新版本号
cd certd
# 启动服务
./start.sh
@@ -29,9 +29,15 @@ https://your_server_ip:7002
## 二、升级
```shell
# 更新代码并启动
cd certd
# 确保数据安全,备份一下数据
cp -rf ./packages/ui/certd-server/data ../certd-data-backup
git pull
# 如果提示pull失败可以尝试强制更新
# git checkout v2 -f && git pull
# 先停止旧的服务,7001是certd的默认端口
kill -9 $(lsof -t -i:7001)
# 重新编译启动

View File

@@ -0,0 +1,12 @@
# 版本升级
## 升级方法
根据不同部署方式查看升级方法
1. [Docker方式部署升级](./docker/#二、升级)
2. [宝塔面板方式部署升级](./baota/#三、如何升级)
3. [1Panel面板方式部署升级](./1panel/#三、升级)
4. [源码方式部署](./source/#二、升级)
## 升级日志
[CHANGELOG](../changelogs/CHANGELOG.md)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

@@ -3,6 +3,8 @@
## 一、群晖部署Certd
以下是群晖`7.x`的部署`certd`步骤
### 1. 打开Container Manager
![](./images/1.png)
@@ -32,6 +34,8 @@
## 二、更新群晖证书
证书部署插件支持群晖`6.x``7.x`
## 1. 前提条件
* 已经部署了certd
* 群晖上已经设置好了证书(证书建议设置好描述,插件需要根据描述查找证书)

View File

@@ -32,5 +32,5 @@ features:
- title: 支持私有化部署
details: 保障数据安全
- title: 多数据库支持
details: 支持sqlitepostgresql数据库
details: 支持SQLite、Postgresql、MySQL数据库
---

View File

@@ -9,5 +9,5 @@
}
},
"npmClient": "pnpm",
"version": "1.28.1"
"version": "1.28.4"
}

View File

@@ -3,6 +3,20 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.4](https://github.com/publishlab/node-acme-client/compare/v1.28.3...v1.28.4) (2024-12-12)
**Note:** Version bump only for package @certd/acme-client
## [1.28.3](https://github.com/publishlab/node-acme-client/compare/v1.28.2...v1.28.3) (2024-12-12)
**Note:** Version bump only for package @certd/acme-client
## [1.28.2](https://github.com/publishlab/node-acme-client/compare/v1.28.1...v1.28.2) (2024-12-09)
### Performance Improvements
* 支持mysql ([7cde1fd](https://github.com/publishlab/node-acme-client/commit/7cde1fdc4a9ed851900d231a5460c8dbfbcd148e))
## [1.28.1](https://github.com/publishlab/node-acme-client/compare/v1.28.0...v1.28.1) (2024-12-08)
**Note:** Version bump only for package @certd/acme-client

View File

@@ -3,7 +3,7 @@
"description": "Simple and unopinionated ACME client",
"private": false,
"author": "nmorsman",
"version": "1.28.1",
"version": "1.28.4",
"type": "module",
"module": "scr/index.js",
"main": "src/index.js",
@@ -18,7 +18,7 @@
"types"
],
"dependencies": {
"@certd/basic": "^1.28.1",
"@certd/basic": "^1.28.4",
"@peculiar/x509": "^1.11.0",
"asn1js": "^3.0.5",
"axios": "^1.7.2",
@@ -65,5 +65,5 @@
"bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "c8df9e698c265568e0e5e8b2f352c0599542d744"
}

View File

@@ -0,0 +1,137 @@
"use strict";
/**
* acme-client type definition tests
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var acme = require("acme-client");
(function () { return __awaiter(void 0, void 0, void 0, function () {
var accountKey, client, order, authorizations, authorization, challenge, _a, certKey, certCsr;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, acme.crypto.createPrivateKey()];
case 1:
accountKey = _b.sent();
client = new acme.Client({
accountKey: accountKey,
directoryUrl: acme.directory.letsencrypt.staging
});
/* Account */
return [4 /*yield*/, client.createAccount({
termsOfServiceAgreed: true,
contact: ['mailto:test@example.com']
})];
case 2:
/* Account */
_b.sent();
return [4 /*yield*/, client.createOrder({
identifiers: [
{ type: 'dns', value: 'example.com' },
{ type: 'dns', value: '*.example.com' },
]
})];
case 3:
order = _b.sent();
return [4 /*yield*/, client.getOrder(order)];
case 4:
_b.sent();
return [4 /*yield*/, client.getAuthorizations(order)];
case 5:
authorizations = _b.sent();
authorization = authorizations[0];
challenge = authorization.challenges[0];
return [4 /*yield*/, client.getChallengeKeyAuthorization(challenge)];
case 6:
_b.sent();
return [4 /*yield*/, client.verifyChallenge(authorization, challenge)];
case 7:
_b.sent();
return [4 /*yield*/, client.completeChallenge(challenge)];
case 8:
_b.sent();
return [4 /*yield*/, client.waitForValidStatus(challenge)];
case 9:
_b.sent();
return [4 /*yield*/, acme.crypto.createCsr({
commonName: 'example.com',
altNames: ['example.com', '*.example.com']
})];
case 10:
_a = _b.sent(), certKey = _a[0], certCsr = _a[1];
return [4 /*yield*/, client.finalizeOrder(order, certCsr)];
case 11:
_b.sent();
return [4 /*yield*/, client.getCertificate(order)];
case 12:
_b.sent();
return [4 /*yield*/, client.getCertificate(order, 'DST Root CA X3')];
case 13:
_b.sent();
/* Auto */
return [4 /*yield*/, client.auto({
csr: certCsr,
challengeCreateFn: function (authz, challenge, keyAuthorization) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/];
}); }); },
challengeRemoveFn: function (authz, challenge, keyAuthorization) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/];
}); }); }
})];
case 14:
/* Auto */
_b.sent();
return [4 /*yield*/, client.auto({
csr: certCsr,
email: 'test@example.com',
termsOfServiceAgreed: false,
skipChallengeVerification: false,
challengePriority: ['http-01', 'dns-01'],
preferredChain: 'DST Root CA X3',
challengeCreateFn: function (authz, challenge, keyAuthorization) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/];
}); }); },
challengeRemoveFn: function (authz, challenge, keyAuthorization) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/];
}); }); }
})];
case 15:
_b.sent();
return [2 /*return*/];
}
});
}); })();

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.4](https://github.com/certd/certd/compare/v1.28.3...v1.28.4) (2024-12-12)
**Note:** Version bump only for package @certd/basic
## [1.28.3](https://github.com/certd/certd/compare/v1.28.2...v1.28.3) (2024-12-12)
**Note:** Version bump only for package @certd/basic
## [1.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/basic
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
### Performance Improvements

View File

@@ -1 +1 @@
01:50
00:08

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/basic",
"private": false,
"version": "1.28.1",
"version": "1.28.4",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@@ -43,5 +43,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "c8df9e698c265568e0e5e8b2f352c0599542d744"
}

View File

@@ -3,6 +3,23 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.4](https://github.com/certd/certd/compare/v1.28.3...v1.28.4) (2024-12-12)
### Bug Fixes
* 修复证书成功通知发送失败的bug ([0f5c690](https://github.com/certd/certd/commit/0f5c69040ba77340c909813220a26bc7ddada3ea))
## [1.28.3](https://github.com/certd/certd/compare/v1.28.2...v1.28.3) (2024-12-12)
### Performance Improvements
* 通知标题优化 ([ff083ce](https://github.com/certd/certd/commit/ff083ce6848a8bee3c8248e4b881086ae1517c28))
* 支持aws cloudfront ([0ae39f1](https://github.com/certd/certd/commit/0ae39f160a7c6b6696b3bf513d68aa28905810ad))
## [1.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/pipeline
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
### Performance Improvements

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/pipeline",
"private": false,
"version": "1.28.1",
"version": "1.28.4",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@@ -16,8 +16,8 @@
"test": "mocha --loader=ts-node/esm"
},
"dependencies": {
"@certd/basic": "^1.28.1",
"@certd/plus-core": "^1.28.1",
"@certd/basic": "^1.28.4",
"@certd/plus-core": "^1.28.4",
"dayjs": "^1.11.7",
"lodash-es": "^4.17.21",
"reflect-metadata": "^0.1.13"
@@ -43,5 +43,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "c8df9e698c265568e0e5e8b2f352c0599542d744"
}

View File

@@ -10,7 +10,8 @@ import { Decorator } from "../decorator/index.js";
import { ICnameProxyService, IEmailService, IPluginConfigService, IUrlService } from "../service/index.js";
import { FileStore } from "./file-store.js";
import { cloneDeep, forEach, merge } from "lodash-es";
import { INotificationService, NotificationBody, NotificationContext, notificationRegistry } from "../notification/index.js";
import { INotificationService } from "../notification/index.js";
export type SysInfo = {
//系统标题
title?: string;
@@ -373,18 +374,17 @@ export class Executor {
let subject = "";
let content = "";
const errorMessage = error?.message;
const sysTitle = this.options.sysInfo?.title || "Certd";
if (when === "start") {
subject = `${sysTitle}开始执行,${this.pipeline.title}${this.pipeline.id}`;
subject = `开始执行,${this.pipeline.title}${this.pipeline.id}`;
content = `流水线ID:${this.pipeline.id}运行ID:${this.runtime.id}`;
} else if (when === "success") {
subject = `${sysTitle}执行成功,${this.pipeline.title}${this.pipeline.id}`;
subject = `执行成功,${this.pipeline.title}${this.pipeline.id}`;
content = `流水线ID:${this.pipeline.id}运行ID:${this.runtime.id}`;
} else if (when === "turnToSuccess") {
subject = `${sysTitle}执行成功(失败转成功),${this.pipeline.title}${this.pipeline.id}`;
subject = `执行成功(失败转成功),${this.pipeline.title}${this.pipeline.id}`;
content = `流水线ID:${this.pipeline.id}运行ID:${this.runtime.id}`;
} else if (when === "error") {
subject = `${sysTitle}执行失败,${this.pipeline.title}${this.pipeline.id}`;
subject = `执行失败,${this.pipeline.title}${this.pipeline.id}`;
content = `流水线ID:${this.pipeline.id}运行ID:${this.runtime.id}\n错误详情:${error.message}`;
} else {
return;
@@ -407,43 +407,24 @@ export class Executor {
}
} else {
try {
//构建notification插件发送通知
let notifyConfig: any;
if (notification.notificationId === 0) {
notifyConfig = await this.options.notificationService.getDefault();
} else {
notifyConfig = await this.options.notificationService.getById(notification.notificationId);
}
if (notifyConfig == null) {
throw new Error(`通知配置<id:${notification.notificationId}>不存在`);
}
const notificationPlugin = notificationRegistry.get(notifyConfig.type);
const notificationCls: any = notificationPlugin.target;
const notificationSender = new notificationCls();
const notificationCtx: NotificationContext = {
http: utils.http,
logger,
utils,
emailService: this.options.emailService,
};
//设置参数
merge(notificationSender, notifyConfig.setting);
notificationSender.setCtx(notificationCtx);
await notificationSender.onInstance();
const body: NotificationBody = {
title: subject,
content,
userId: this.pipeline.userId,
pipeline: this.pipeline,
result: this.lastRuntime.pipeline.status,
pipelineId: this.pipeline.id,
historyId: this.runtime.id,
errorMessage,
url,
};
//发送通知
await notificationSender.send(body);
await this.options.notificationService.send({
id: notification.notificationId,
useDefault: true,
useEmail: false,
logger: this.logger,
body: {
title: subject,
content,
userId: this.pipeline.userId,
pipeline: this.pipeline,
result: this.lastRuntime.pipeline.status,
pipelineId: this.pipeline.id,
historyId: this.runtime.id,
errorMessage,
url,
},
});
} catch (e) {
logger.error("send notification error", e);
}

View File

@@ -48,9 +48,18 @@ export type NotificationInstanceConfig = {
};
};
export type NotificationSendReq = {
id?: number;
useDefault?: boolean;
useEmail?: boolean;
emailAddress?: string;
logger: ILogger;
body: NotificationBody;
};
export interface INotificationService {
getById(id: number): Promise<NotificationInstanceConfig>;
getDefault(): Promise<NotificationInstanceConfig>;
send(req: NotificationSendReq): Promise<void>;
}
export interface INotification {

View File

@@ -1,9 +1,9 @@
// src/decorator/memoryCache.decorator.ts
import { Decorator } from "../decorator/index.js";
import * as _ from "lodash-es";
import { merge } from "lodash-es";
import { notificationRegistry } from "./registry.js";
import { BaseNotification, NotificationBody, NotificationContext, NotificationDefine, NotificationInputDefine, NotificationInstanceConfig } from "./api.js";
import { isPlus } from "@certd/plus-core";
// 提供一个唯一 key
export const NOTIFICATION_CLASS_KEY = "pipeline:notification";
@@ -47,9 +47,7 @@ export async function newNotification(type: string, input: any, ctx: Notificatio
// @ts-ignore
const plugin = new register.target();
for (const key in input) {
plugin[key] = input[key];
}
merge(plugin, input);
if (!ctx) {
throw new Error("ctx is required");
}
@@ -61,8 +59,5 @@ export async function newNotification(type: string, input: any, ctx: Notificatio
export async function sendNotification(opts: { config: NotificationInstanceConfig; ctx: NotificationContext; body: NotificationBody }) {
const notification: BaseNotification = await newNotification(opts.config.type, opts.config.setting, opts.ctx);
if (notification.define.needPlus && !isPlus()) {
opts.body.content = `${opts.body.content}\n\n注意此通知渠道已调整为专业版功能后续版本将不再支持发送请尽快修改或升级为专业版`;
}
await notification.doSend(opts.body);
}

View File

@@ -21,8 +21,9 @@ export const pluginGroups = {
huawei: new PluginGroup("huawei", "华为云", 3),
tencent: new PluginGroup("tencent", "腾讯云", 4),
qiniu: new PluginGroup("qiniu", "七牛云", 5),
host: new PluginGroup("host", "主机", 6),
cdn: new PluginGroup("cdn", "CDN", 7),
panel: new PluginGroup("panel", "面板", 8),
other: new PluginGroup("other", "其他", 9),
aws: new PluginGroup("aws", "亚马逊云", 6),
host: new PluginGroup("host", "主机", 7),
cdn: new PluginGroup("cdn", "CDN", 8),
panel: new PluginGroup("panel", "面板", 9),
other: new PluginGroup("other", "其他", 10),
};

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.4](https://github.com/certd/certd/compare/v1.28.3...v1.28.4) (2024-12-12)
**Note:** Version bump only for package @certd/lib-huawei
## [1.28.3](https://github.com/certd/certd/compare/v1.28.2...v1.28.3) (2024-12-12)
**Note:** Version bump only for package @certd/lib-huawei
## [1.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/lib-huawei
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
**Note:** Version bump only for package @certd/lib-huawei

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/lib-huawei",
"private": false,
"version": "1.28.1",
"version": "1.28.4",
"main": "./dist/bundle.js",
"module": "./dist/bundle.js",
"types": "./dist/d/index.d.ts",
@@ -21,5 +21,5 @@
"prettier": "^2.8.8",
"tslib": "^2.8.1"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "c8df9e698c265568e0e5e8b2f352c0599542d744"
}

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.4](https://github.com/certd/certd/compare/v1.28.3...v1.28.4) (2024-12-12)
**Note:** Version bump only for package @certd/lib-iframe
## [1.28.3](https://github.com/certd/certd/compare/v1.28.2...v1.28.3) (2024-12-12)
**Note:** Version bump only for package @certd/lib-iframe
## [1.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/lib-iframe
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
**Note:** Version bump only for package @certd/lib-iframe

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/lib-iframe",
"private": false,
"version": "1.28.1",
"version": "1.28.4",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@@ -30,5 +30,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "c8df9e698c265568e0e5e8b2f352c0599542d744"
}

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.4](https://github.com/certd/certd/compare/v1.28.3...v1.28.4) (2024-12-12)
**Note:** Version bump only for package @certd/lib-k8s
## [1.28.3](https://github.com/certd/certd/compare/v1.28.2...v1.28.3) (2024-12-12)
**Note:** Version bump only for package @certd/lib-k8s
## [1.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/lib-k8s
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
**Note:** Version bump only for package @certd/lib-k8s

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/lib-k8s",
"private": false,
"version": "1.28.1",
"version": "1.28.4",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@@ -16,7 +16,7 @@
"preview": "vite preview"
},
"dependencies": {
"@certd/basic": "^1.28.1",
"@certd/basic": "^1.28.4",
"@kubernetes/client-node": "0.21.0"
},
"devDependencies": {
@@ -31,5 +31,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "c8df9e698c265568e0e5e8b2f352c0599542d744"
}

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.4](https://github.com/certd/certd/compare/v1.28.3...v1.28.4) (2024-12-12)
**Note:** Version bump only for package @certd/lib-server
## [1.28.3](https://github.com/certd/certd/compare/v1.28.2...v1.28.3) (2024-12-12)
**Note:** Version bump only for package @certd/lib-server
## [1.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/lib-server
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
### Performance Improvements

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/lib-server",
"version": "1.28.1",
"version": "1.28.4",
"description": "midway with flyway, sql upgrade way ",
"private": false,
"type": "module",
@@ -27,10 +27,10 @@
],
"license": "AGPL",
"dependencies": {
"@certd/acme-client": "^1.28.1",
"@certd/basic": "^1.28.1",
"@certd/pipeline": "^1.28.1",
"@certd/plus-core": "^1.28.1",
"@certd/acme-client": "^1.28.4",
"@certd/basic": "^1.28.4",
"@certd/pipeline": "^1.28.4",
"@certd/plus-core": "^1.28.4",
"@midwayjs/cache": "~3.14.0",
"@midwayjs/core": "~3.17.1",
"@midwayjs/i18n": "~3.17.3",
@@ -61,5 +61,5 @@
"typeorm": "^0.3.11",
"typescript": "^5.4.2"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "c8df9e698c265568e0e5e8b2f352c0599542d744"
}

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.4](https://github.com/certd/certd/compare/v1.28.3...v1.28.4) (2024-12-12)
**Note:** Version bump only for package @certd/midway-flyway-js
## [1.28.3](https://github.com/certd/certd/compare/v1.28.2...v1.28.3) (2024-12-12)
**Note:** Version bump only for package @certd/midway-flyway-js
## [1.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/midway-flyway-js
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
**Note:** Version bump only for package @certd/midway-flyway-js

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/midway-flyway-js",
"version": "1.28.1",
"version": "1.28.4",
"description": "midway with flyway, sql upgrade way ",
"private": false,
"type": "module",
@@ -46,5 +46,5 @@
"typeorm": "^0.3.11",
"typescript": "^5.4.2"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "c8df9e698c265568e0e5e8b2f352c0599542d744"
}

View File

@@ -3,6 +3,24 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.4](https://github.com/certd/certd/compare/v1.28.3...v1.28.4) (2024-12-12)
**Note:** Version bump only for package @certd/plugin-cert
## [1.28.3](https://github.com/certd/certd/compare/v1.28.2...v1.28.3) (2024-12-12)
### Bug Fixes
* 修复没有配置eab时报order无法读取的问题 ([657a2ae](https://github.com/certd/certd/commit/657a2ae032e6f61ac27fbdd26c7bf169c041219e))
### Performance Improvements
* 通知标题优化 ([ff083ce](https://github.com/certd/certd/commit/ff083ce6848a8bee3c8248e4b881086ae1517c28))
## [1.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/plugin-cert
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
**Note:** Version bump only for package @certd/plugin-cert

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/plugin-cert",
"private": false,
"version": "1.28.1",
"version": "1.28.4",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -15,9 +15,9 @@
"preview": "vite preview"
},
"dependencies": {
"@certd/acme-client": "^1.28.1",
"@certd/basic": "^1.28.1",
"@certd/pipeline": "^1.28.1",
"@certd/acme-client": "^1.28.4",
"@certd/basic": "^1.28.4",
"@certd/pipeline": "^1.28.4",
"@google-cloud/publicca": "^1.3.0",
"dayjs": "^1.11.7",
"jszip": "^3.10.1",
@@ -40,5 +40,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "c8df9e698c265568e0e5e8b2f352c0599542d744"
}

View File

@@ -24,10 +24,11 @@ export type DomainsVerifyPlan = {
};
export type CertInfo = {
crt: string;
key: string;
csr: string;
ic?: string;
crt: string; //fullchain证书
key: string; //私钥
csr: string; //csr
oc?: string; //仅证书非fullchain证书
ic?: string; //中间证书
pfx?: string;
der?: string;
jks?: string;

View File

@@ -1,4 +1,4 @@
import { AbstractTaskPlugin, IContext, NotificationBody, sendNotification, Step, TaskInput, TaskOutput } from "@certd/pipeline";
import { AbstractTaskPlugin, IContext, NotificationBody, Step, TaskInput, TaskOutput } from "@certd/pipeline";
import dayjs from "dayjs";
import type { CertInfo } from "./acme.js";
import { CertReader } from "./cert-reader.js";
@@ -191,7 +191,7 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
zip.file("cert.crt", cert.crt);
zip.file("cert.key", cert.key);
zip.file("intermediate.crt", cert.ic);
zip.file("origin.crt", cert.oc);
if (cert.pfx) {
zip.file("cert.pfx", Buffer.from(cert.pfx, "base64"));
}
@@ -201,6 +201,20 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
if (cert.jks) {
zip.file("cert.jks", Buffer.from(cert.jks, "base64"));
}
zip.file(
"说明.txt",
`证书文件说明
cert.crt证书文件包含证书链pem格式
cert.key私钥文件pem格式
intermediate.crt中间证书文件pem格式
origin.crt原始证书文件不含证书链pem格式
cert.pfxpfx格式证书文件iis服务器使用
cert.derder格式证书文件
cert.jksjks格式证书文件java服务器使用
`
);
const content = await zip.generateAsync({ type: "nodebuffer" });
this.saveFile(filename, content);
this.logger.info(`已保存文件:${filename}`);
@@ -295,7 +309,6 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
* 检查是否过期默认提前35天
* @param expires
* @param maxDays
* @returns {boolean}
*/
isWillExpire(expires: number, maxDays = 20) {
if (expires == null) {
@@ -312,39 +325,20 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
this.logger.info("发送证书申请成功通知");
const url = await this.ctx.urlService.getPipelineDetailUrl(this.pipeline.id, this.ctx.runtime.id);
const body: NotificationBody = {
title: `【Certd】证书申请成功【${this.pipeline.title}`,
title: `证书申请成功【${this.pipeline.title}`,
content: `域名:${this.domains.join(",")}`,
url: url,
};
try {
const defNotification = await this.ctx.notificationService.getDefault();
if (defNotification) {
this.logger.info(`通知渠道:${defNotification.name}`);
const notificationCtx = {
http: this.ctx.http,
logger: this.logger,
utils: this.ctx.utils,
emailService: this.ctx.emailService,
};
await sendNotification({
config: defNotification,
ctx: notificationCtx,
body,
});
return;
}
this.logger.warn("未配置默认通知,将发送邮件通知");
await this.sendSuccessEmail(body);
await this.ctx.notificationService.send({
useDefault: true,
useEmail: true,
emailAddress: this.email,
logger: this.logger,
body,
});
} catch (e) {
this.logger.error("证书申请成功通知发送失败", e);
}
}
async sendSuccessEmail(body: NotificationBody) {
this.logger.info("发送邮件通知:" + this.email);
await this.ctx.emailService.send({
receivers: [this.email],
subject: body.title,
content: body.content,
});
}
}

View File

@@ -10,6 +10,7 @@ export type CertReaderHandleContext = {
reader: CertReader;
tmpCrtPath: string;
tmpKeyPath: string;
tmpOcPath?: string;
tmpPfxPath?: string;
tmpDerPath?: string;
tmpIcPath?: string;
@@ -19,6 +20,7 @@ export type CertReaderHandle = (ctx: CertReaderHandleContext) => Promise<void>;
export type HandleOpts = { logger: ILogger; handle: CertReaderHandle };
export class CertReader {
cert: CertInfo;
oc: string; //仅证书非fullchain证书
crt: string;
key: string;
csr: string;
@@ -38,6 +40,12 @@ export class CertReader {
this.cert.ic = this.ic;
}
this.oc = certInfo.oc;
if (!this.oc) {
this.oc = this.getOc();
this.cert.oc = this.oc;
}
const { detail, expires } = this.getCrtDetail(this.cert.crt);
this.detail = detail;
this.expires = expires.getTime();
@@ -56,6 +64,13 @@ export class CertReader {
return ic.trim();
}
getOc() {
//原始证书 就是crt的第一个 -----END CERTIFICATE----- 之前的内容
const endStr = "-----END CERTIFICATE-----";
const arr = this.crt.split(endStr);
return arr[0] + endStr;
}
toCertInfo(): CertInfo {
return this.cert;
}
@@ -73,7 +88,7 @@ export class CertReader {
return domains;
}
saveToFile(type: "crt" | "key" | "pfx" | "der" | "ic" | "jks", filepath?: string) {
saveToFile(type: "crt" | "key" | "pfx" | "der" | "oc" | "ic" | "jks", filepath?: string) {
if (!this.cert[type]) {
return;
}
@@ -87,7 +102,7 @@ export class CertReader {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
}
if (type === "crt" || type === "key" || type === "ic") {
if (type === "crt" || type === "key" || type === "ic" || type === "oc") {
fs.writeFileSync(filepath, this.cert[type]);
} else {
fs.writeFileSync(filepath, Buffer.from(this.cert[type], "base64"));
@@ -102,9 +117,10 @@ export class CertReader {
const tmpKeyPath = this.saveToFile("key");
const tmpPfxPath = this.saveToFile("pfx");
const tmpIcPath = this.saveToFile("ic");
logger.info("本地文件写入成功");
const tmpOcPath = this.saveToFile("oc");
const tmpDerPath = this.saveToFile("der");
const tmpJksPath = this.saveToFile("jks");
logger.info("本地文件写入成功");
try {
return await opts.handle({
reader: this,
@@ -114,6 +130,7 @@ export class CertReader {
tmpDerPath: tmpDerPath,
tmpIcPath: tmpIcPath,
tmpJksPath: tmpJksPath,
tmpOcPath: tmpOcPath,
});
} catch (err) {
throw err;
@@ -128,6 +145,7 @@ export class CertReader {
removeFile(tmpCrtPath);
removeFile(tmpKeyPath);
removeFile(tmpPfxPath);
removeFile(tmpOcPath);
removeFile(tmpDerPath);
removeFile(tmpIcPath);
removeFile(tmpJksPath);

View File

@@ -137,7 +137,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
{ value: "zerossl", label: "ZeroSSL", icon: "emojione:digit-zero" },
],
},
helper: "Let's Encrypt申请最简单\nGoogle大厂光环兼容性好需要翻墙获取EAB授权\nZeroSSL需要EAB授权无需翻墙",
helper: "Let's Encrypt申请最简单\nGoogle大厂光环兼容性好仅首次需要翻墙获取EAB授权\nZeroSSL需要EAB授权无需翻墙",
required: true,
})
sslProvider!: SSLProvider;
@@ -271,8 +271,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
this.logger.info("当前正在使用 google公共EAB授权");
eab = await this.ctx.accessService.getCommonById(this.googleCommonEabAccessId);
} else {
this.logger.error("google需要配置EAB授权或服务账号授权");
return;
throw new Error("google需要配置EAB授权或服务账号授权");
}
} else if (this.sslProvider === "zerossl") {
if (this.eabAccessId) {
@@ -282,8 +281,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
this.logger.info("当前正在使用 zerossl 公共EAB授权");
eab = await this.ctx.accessService.getCommonById(this.zerosslCommonEabAccessId);
} else {
this.logger.error("zerossl需要配置EAB授权");
return;
throw new Error("zerossl需要配置EAB授权");
}
}
this.eab = eab;

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.4](https://github.com/certd/certd/compare/v1.28.3...v1.28.4) (2024-12-12)
**Note:** Version bump only for package @certd/plugin-lib
## [1.28.3](https://github.com/certd/certd/compare/v1.28.2...v1.28.3) (2024-12-12)
**Note:** Version bump only for package @certd/plugin-lib
## [1.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/plugin-lib
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
**Note:** Version bump only for package @certd/plugin-lib

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/plugin-lib",
"private": false,
"version": "1.28.1",
"version": "1.28.4",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -16,9 +16,9 @@
},
"dependencies": {
"@alicloud/pop-core": "^1.7.10",
"@certd/basic": "^1.28.1",
"@certd/pipeline": "^1.28.1",
"@certd/plugin-cert": "^1.28.1",
"@certd/basic": "^1.28.4",
"@certd/pipeline": "^1.28.4",
"@certd/plugin-cert": "^1.28.4",
"@kubernetes/client-node": "0.21.0",
"dayjs": "^1.11.7",
"iconv-lite": "^0.6.3",
@@ -44,5 +44,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "c8df9e698c265568e0e5e8b2f352c0599542d744"
}

View File

@@ -9,6 +9,7 @@ RUN npm install -g pnpm@8.15.7
RUN cp /workspace/certd-client/dist/* /workspace/certd-server/public/ -rf
RUN cd /workspace/certd-server && pnpm install && npm run build-on-docker
FROM node:20-alpine
EXPOSE 7001
EXPOSE 7002

View File

@@ -3,6 +3,27 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.4](https://github.com/certd/certd/compare/v1.28.3...v1.28.4) (2024-12-12)
**Note:** Version bump only for package @certd/ui-client
## [1.28.3](https://github.com/certd/certd/compare/v1.28.2...v1.28.3) (2024-12-12)
### Bug Fixes
* 修复授权被删除后无法清空的bug ([b45977c](https://github.com/certd/certd/commit/b45977c29a29084c11e496bec3415eaaebafdd74))
### Performance Improvements
* 点击版本红点按钮,跳转到升级帮助页面 ([454fbda](https://github.com/certd/certd/commit/454fbda581bbe22abca5b91e5086ea9d9d58a020))
* 通知标题优化 ([ff083ce](https://github.com/certd/certd/commit/ff083ce6848a8bee3c8248e4b881086ae1517c28))
## [1.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
### Bug Fixes
* 修复创建流水线通知设置无效的bug ([498cf34](https://github.com/certd/certd/commit/498cf34999fddfa24ce088e2e678469fa669abb8))
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/ui-client",
"version": "1.28.1",
"version": "1.28.4",
"private": true,
"scripts": {
"dev": "vite --open",
@@ -65,8 +65,8 @@
"vuedraggable": "^4.1.0"
},
"devDependencies": {
"@certd/lib-iframe": "^1.28.1",
"@certd/pipeline": "^1.28.1",
"@certd/lib-iframe": "^1.28.4",
"@certd/pipeline": "^1.28.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.12",

View File

@@ -1,7 +1,7 @@
<template>
<div class="access-selector">
<span v-if="target?.name" class="mr-5 cd-flex-inline">
<a-tag class="mr-5" color="green">{{ target.name }}</a-tag>
<span v-if="modelValue" class="mr-5 cd-flex-inline">
<a-tag class="mr-5" color="green">{{ target.name || modelValue }}</a-tag>
<fs-icon class="cd-icon-button" icon="ion:close-circle-outline" @click="clear"></fs-icon>
</span>
<span v-else class="mlr-5 text-gray">{{ placeholder }}</span>

View File

@@ -126,14 +126,13 @@ function clear() {
}
async function emitValue(value: any) {
const target = optionsDictRef.dataMap[value];
if (value !== 0 && pipeline?.value && target && pipeline.value.userId !== target.userId) {
target.value = optionsDictRef.dataMap[value];
if (value !== 0 && pipeline?.value && target && pipeline.value.userId !== target.value.userId) {
message.error("对不起,您不能修改他人流水线的通知");
return;
}
emit("change", value);
emit("update:modelValue", value);
emit("selectedChange", target);
}
watch(
@@ -143,6 +142,7 @@ watch(
async (value) => {
await optionsDictRef.loadDict();
target.value = optionsDictRef.dataMap[value];
emit("selectedChange", target.value);
},
{
immediate: true

View File

@@ -110,7 +110,12 @@ export default function (certPlugins: any[], formWrapperRef: any): CreateCrudOpt
value: 0,
component: {
name: NotificationSelector,
vModel: "modelValue"
vModel: "modelValue",
on: {
selectedChange({ $event, form }) {
form.notificationTarget = $event;
}
}
},
order: 101,
helper: "任务执行失败实时提醒"

View File

@@ -40,6 +40,7 @@ export default {
await doSubmitRef.value({ form });
if (form.email) {
//创建一个默认的邮件通知
const notificationApi = createNotificationApi();
await notificationApi.GetOrCreateDefault({ email: form.email });
}

View File

@@ -102,12 +102,12 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
triggers.push({ title: "定时触发", type: "timer", props: { cron: form.triggerCron } });
}
const notifications = [];
if (form.notification) {
if (form.notification != null) {
notifications.push({
type: "custom",
when: ["error", "turnToSuccess"],
notificationId: 0,
title: "使用默认通知"
notificationId: form.notification,
title: form.notificationTarget?.name || "自定义通知"
});
}
let pipeline = {
@@ -182,7 +182,8 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
const downloadUrl = `${env.API}/pi/history/download?pipelineId=${row.id}&fileId=${file.id}`;
children.push(
<div>
<div>
<div class={"flex-o m-5"}>
<fs-icon icon={"ant-design:cloud-download-outlined"} class={"mr-5 fs-16"}></fs-icon>
<a href={downloadUrl} target={"_blank"}>
{file.filename}
</a>
@@ -197,7 +198,6 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
return (
<div class={"mt-3"}>
<h3></h3>
<div> {children}</div>
</div>
);

View File

@@ -15,7 +15,7 @@
<div>
<a-tag color="green" class="flex-inline pointer"> <fs-icon icon="ion:time-outline" class="mr-5"></fs-icon> {{ now }}</a-tag>
<a-badge v-if="userStore.isAdmin" :dot="hasNewVersion">
<a-tag color="blue" class="flex-inline pointer" :title="'最新版本:' + latestVersion">
<a-tag color="blue" class="flex-inline pointer" :title="'最新版本:' + latestVersion" @click="openUpgradeUrl()">
<fs-icon icon="ion:rocket-outline" class="mr-5"></fs-icon>
v{{ version }}
</a-tag>
@@ -210,6 +210,10 @@ onMounted(async () => {
await loadCount();
await loadPluginGroups();
});
function openUpgradeUrl() {
window.open("https://certd.docmirror.cn/guide/install/upgrade.html");
}
</script>
<style lang="less">

View File

@@ -0,0 +1,14 @@
flyway:
scriptDir: './db/migration-mysql'
typeorm:
dataSource:
default:
type: mysql # mariadb
host: localhost
port: 3306
username: root
password: root
database: certd

View File

@@ -1,12 +0,0 @@
{
"extends": "./node_modules/mwts/",
"ignorePatterns": ["node_modules", "dist", "test", "typings"],
"env": {
"mocha": true
},
"rules": {
"max-len": ["error", 160],
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/ban-ts-comment": "off"
}
}

View File

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

View File

@@ -1,4 +0,0 @@
module.exports = {
...require('mwts/.prettierrc.json'),
"printWidth": 160,
}

View File

@@ -3,6 +3,34 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.4](https://github.com/certd/certd/compare/v1.28.3...v1.28.4) (2024-12-12)
**Note:** Version bump only for package @certd/ui-server
## [1.28.3](https://github.com/certd/certd/compare/v1.28.2...v1.28.3) (2024-12-12)
### Bug Fixes
* mysql下access.setting字段改成text ([b7f5740](https://github.com/certd/certd/commit/b7f5740c57743914f754f3b4fdd94b59a2e8338c))
### Performance Improvements
* 通知标题优化 ([ff083ce](https://github.com/certd/certd/commit/ff083ce6848a8bee3c8248e4b881086ae1517c28))
* 支持腾讯虚拟机开关机([@wujingke](https://github.com/wujingke)) ([8039e8b](https://github.com/certd/certd/commit/8039e8baf83c82d03f1a6198cf61c372026b962b))
* 支持aws cloudfront ([0ae39f1](https://github.com/certd/certd/commit/0ae39f160a7c6b6696b3bf513d68aa28905810ad))
## [1.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
### Bug Fixes
* 修复创建流水线通知设置无效的bug ([498cf34](https://github.com/certd/certd/commit/498cf34999fddfa24ce088e2e678469fa669abb8))
* 修复流水线分组可以被所有人看见的bug ([a0e838d](https://github.com/certd/certd/commit/a0e838d1eec918e5dc92fe95dc72ac14facb930e))
### Performance Improvements
* 优化数据表索引 ([228fdf0](https://github.com/certd/certd/commit/228fdf0a0d28013f5dd156a97bbde80537e8e97e))
* 支持mysql ([7cde1fd](https://github.com/certd/certd/commit/7cde1fdc4a9ed851900d231a5460c8dbfbcd148e))
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
### Performance Improvements

View File

@@ -1,29 +1,16 @@
# my_midway_project
# certd-server
## QuickStart
## heap分析
<!-- add docs here for user -->
```shell
# node_modules\@midwayjs\bootstrap\dist\bootstrap.js
# 注释 137行
// process.once('SIGINT', this.onSignal.bind(t
see [midway docs][midway] for more detail.
### Development
```bash
$ npm i
$ npm run dev
$ open http://localhost:7001/
```
### Deploy
```shell
npm run heap
```bash
$ npm start
```
### npm scripts
- Use `npm run lint` to check code style.
- Use `npm test` to run unit test.
[midway]: https://midwayjs.org

View File

@@ -1,5 +1,24 @@
import fs from 'fs';
//读取 packages/core/pipline/package.json的版本号
//删除references
import { default as packageJson } from './tsconfig.json' assert { type: 'json' };
delete packageJson.references;
fs.writeFileSync('./tsconfig.json', JSON.stringify(packageJson, null, 2));
//瘦身
const filePath = './node_modules/typeorm/platform/PlatformTools.js';
const find = `const cli_highlight_1 = require("cli-highlight");`;
const rep = 'const cli_highlight_1 ={highlight: (str) => { return str }};';
// 在 filePath 找到 find那一行 用 rep 替换
function slimming(filePath, find, rep) {
fs.readFile(filePath, 'utf8', function (err, data) {
if (err) {
return console.log(err);
}
var result = data.replace(find, rep);
fs.writeFile(filePath, result, 'utf8', function (err) {
if (err) return console.log(err);
});
});
}
slimming(filePath, find, rep);

View File

@@ -0,0 +1,77 @@
-- 表sys_permission
CREATE TABLE `sys_permission` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `title` varchar(100) NOT NULL, `permission` varchar(100), `parent_id` bigint NOT NULL DEFAULT -1, `sort` bigint NOT NULL, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (1, '系统管理', 'sys', -1, 1 );
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (2, '权限管理', 'sys:auth', 1, 1 );
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (3, '用户管理', 'sys:auth:user', 2, 1);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (4, '查看', 'sys:auth:user:view', 3, 100);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (5, '权限管理', 'sys:auth:per', 2, 1 );
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (6, '查看', 'sys:auth:per:view', 5, 100);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (7, '角色管理', 'sys:auth:role', 2, 1 );
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (8, '查看', 'sys:auth:role:view', 7, 1);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (9, '修改', 'sys:auth:user:edit', 3, 300);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (10, '删除', 'sys:auth:user:remove', 3, 400);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (11, '添加', 'sys:auth:user:add', 3, 200);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (12, '修改', 'sys:auth:role:edit', 7, 1);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (13, '删除', 'sys:auth:role:remove', 7, 1);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (14, '添加', 'sys:auth:role:add', 7, 1);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (15, '修改', 'sys:auth:per:edit', 5, 300);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (16, '删除', 'sys:auth:per:remove', 5, 400);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (17, '添加', 'sys:auth:per:add', 5, 200);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (18,'授权','sys:auth:role:authz',7,100);
-- 表sys_role
CREATE TABLE `sys_role` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `name` varchar(100) NOT NULL, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
INSERT INTO sys_role (id, name) VALUES (1, '管理员');
INSERT INTO sys_role (id, name) VALUES (2, '只读角色');
-- 表sys_role_permission
CREATE TABLE `sys_role_permission` (`role_id` bigint NOT NULL, `permission_id` bigint NOT NULL, PRIMARY KEY (`role_id`, `permission_id`));
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 1);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 2);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 3);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 4);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 5);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 6);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 7);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 8);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 9);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 10);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 11);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 12);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 13);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 14);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 15);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 16);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 17);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 18);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, -1);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, 4);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, 6);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, 8);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, 1);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, 2);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, 3);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, 5);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, 7);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, -1);
-- 表sys_user
CREATE TABLE `sys_user` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `username` varchar(100) NOT NULL, `password` varchar(100) NOT NULL, `nick_name` varchar(50), `avatar` varchar(255), `phone_code` varchar(20), `mobile` varchar(20), `email` varchar(100),`remark` varchar(100), `status` bigint NOT NULL DEFAULT 1, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
INSERT INTO sys_user (id, username, password, nick_name, avatar, phone_code, mobile, email, status,remark) VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 'admin', NULL, NULL, NULL, NULL, 1, NULL);
INSERT INTO sys_user (id, username, password, nick_name, avatar, phone_code, mobile, email, status,remark) VALUES (2, 'readonly', 'e10adc3949ba59abbe56e057f20f883e', '只读用户', NULL, NULL, NULL, NULL, 0, '密码123456');
-- 表sys_user_role
CREATE TABLE `sys_user_role` (`role_id` bigint NOT NULL, `user_id` bigint NOT NULL, PRIMARY KEY (`role_id`, `user_id`));
INSERT INTO sys_user_role (role_id, user_id) VALUES (1, 1);
INSERT INTO sys_user_role (role_id, user_id) VALUES (2, 2);
-- 索引IDX_223de54d6badbe43a5490450c3
CREATE UNIQUE INDEX `IDX_223de54d6badbe43a5490450c3` ON `sys_role` (`name`);
-- 索引IDX_9e7164b2f1ea1348bc0eb0a7da
CREATE UNIQUE INDEX `IDX_9e7164b2f1ea1348bc0eb0a7da` ON `sys_user` (`username`);

View File

@@ -0,0 +1,4 @@
-- for preview 限制演示环境的数据修改
ALTER TABLE sys_user AUTO_INCREMENT = 1000;
ALTER TABLE sys_permission AUTO_INCREMENT = 1000;
ALTER TABLE sys_role AUTO_INCREMENT = 1000;

View File

@@ -0,0 +1,24 @@
--
-- 由SQLiteStudio v3.3.3 产生的文件 周六 7月 3 00:38:02 2021
--
-- 文本编码UTF-8
--
-- 表cd_access
CREATE TABLE `cd_access` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `name` varchar(100) NOT NULL, `type` varchar(100) NOT NULL, `setting` varchar(1024), `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
-- 表cd_cert
CREATE TABLE `cd_cert` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `domains` varchar(2048) NOT NULL, `email` varchar(100) NOT NULL, `cert_issuer_id` bigint, `challenge_type` varchar(100), `challenge_dns_type` varchar(100),`challenge_access_id` bigint, `country` varchar(100), `state` varchar(100), `locality` varchar(100), `organization` varchar(100), `organization_unit` varchar(100), `remark` varchar(100), `last_history_id` bigint, `last_success_id` bigint, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
-- 表cd_cert_apply_history
CREATE TABLE `cd_cert_apply_history` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `cert_id` bigint NOT NULL, `success` boolean, `result` varchar(1024), `cert_crt` varchar(1024), `cert_key` varchar(1024), `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
-- 表cd_cert_issuer
CREATE TABLE `cd_cert_issuer` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `type` varchar(20) NOT NULL, `account` varchar(100) NOT NULL, `private_key` varchar(1024), `setting` varchar(1024), `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
-- 表cd_task
CREATE TABLE `cd_task` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `name` varchar(100), `type` varchar(100), `setting` varchar(2048), `cert_id` bigint NOT NULL, `last_history_id` bigint, `last_success_id` bigint, `remark` varchar(100), `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
-- 表cd_task_history
CREATE TABLE `cd_task_history` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `task_id` bigint NOT NULL, `cert_id` bigint NOT NULL, `cert_apply_history_id` bigint NOT NULL, `success` boolean, `result` varchar(2048), `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);

View File

@@ -0,0 +1,7 @@
CREATE TABLE `pi_history` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `pipeline_id` bigint NOT NULL, `pipeline` TEXT, `status` varchar(20), `end_time` timestamp, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
CREATE TABLE `pi_history_log` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `pipeline_id` bigint NOT NULL, `history_id` bigint NOT NULL, `node_id` varchar(100), `logs` TEXT, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
CREATE TABLE `pi_pipeline` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `title` varchar(200) NOT NULL, `content` TEXT NOT NULL, `keep_history_count` bigint, `remark` varchar(100), `status` varchar(100), `disabled` boolean DEFAULT 0, `last_history_time` bigint, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
CREATE TABLE `pi_storage` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `scope` varchar(100) NOT NULL, `namespace` varchar(100) NOT NULL, `version` varchar(100),`key` varchar(100), `value` TEXT, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);

View File

@@ -0,0 +1,9 @@
CREATE TABLE `sys_settings` (
`id` bigint NOT NULL PRIMARY KEY AUTO_INCREMENT,
`user_id` bigint NOT NULL,
`key` varchar(100) NOT NULL,
`title` varchar(100) NOT NULL,
`setting` varchar(1024),
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);

View File

@@ -0,0 +1 @@
INSERT INTO sys_role (id, name) VALUES (3, '普通用户');

View File

@@ -0,0 +1,22 @@
ALTER TABLE `sys_settings` RENAME TO `user_settings`;
CREATE TABLE `sys_settings` (
`id` bigint NOT NULL PRIMARY KEY AUTO_INCREMENT,
`key` varchar(100) NOT NULL,
`title` varchar(100) NOT NULL,
`setting` varchar(1024),
`access` varchar(100) NOT NULL,
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);
SET @parent_id = (SELECT id FROM sys_permission WHERE permission = 'sys');
INSERT INTO sys_permission (title, permission, parent_id, sort) VALUES ('系统设置', 'sys:settings', @parent_id, 1);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, LAST_INSERT_ID());
SET @parent_id = (SELECT id FROM sys_permission WHERE permission = 'sys:settings');
INSERT INTO sys_permission (title, permission, parent_id, sort) VALUES ('查看', 'sys:settings:view',@parent_id, 1);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, LAST_INSERT_ID());
INSERT INTO sys_permission (title, permission, parent_id, sort) VALUES ('编辑', 'sys:settings:edit', @parent_id, 1);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, LAST_INSERT_ID());

View File

@@ -0,0 +1,10 @@
INSERT INTO sys_settings (`key`, title, setting, access)
VALUES (
'sys.install',
'安装信息',
CONCAT('{"installTime":', (SELECT timestamp FROM flyway_history WHERE id = 1), '}'),
'private'
);
ALTER TABLE sys_user ADD COLUMN password_version bigint DEFAULT 1;
ALTER TABLE sys_user ADD COLUMN password_salt varchar(36);

View File

@@ -0,0 +1,3 @@
alter table pi_pipeline add COLUMN `order` bigint default 0;

View File

@@ -0,0 +1,2 @@
alter table cd_access add COLUMN `encrypt_setting` text;

View File

@@ -0,0 +1,27 @@
CREATE TABLE `cd_cname_provider`
(
`id` bigint NOT NULL PRIMARY KEY AUTO_INCREMENT,
`domain` varchar(100) NOT NULL,
`dns_provider_type` varchar(100) NOT NULL,
`access_id` bigint NOT NULL,
`is_default` boolean NOT NULL,
`remark` varchar(200),
`disabled` boolean NOT NULL,
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE `cd_cname_record`
(
`id` bigint NOT NULL PRIMARY KEY AUTO_INCREMENT,
`user_id` bigint NOT NULL,
`domain` varchar(100) NOT NULL,
`host_record` varchar(100) NOT NULL,
`record_value` varchar(200) NOT NULL,
`cname_provider_id` bigint NOT NULL,
`status` varchar(100) NOT NULL,
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);

View File

@@ -0,0 +1,18 @@
CREATE TABLE `pi_plugin`
(
`id` bigint NOT NULL PRIMARY KEY AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`icon` varchar(100),
`title` varchar(200),
`desc` varchar(500),
`group` varchar(100),
`version` varchar(100),
`setting` text,
`sys_setting` text,
`content` text,
`type` varchar(100) NOT NULL,
`disabled` boolean NOT NULL,
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);

View File

@@ -0,0 +1,4 @@
ALTER TABLE cd_cname_provider ADD COLUMN user_id bigint;
update cd_cname_provider set user_id = 1;

View File

@@ -0,0 +1,3 @@
update sys_user set status = 0 where id = 2;

View File

@@ -0,0 +1,2 @@
CREATE TABLE `pi_notification` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `name` varchar(100) NOT NULL, `type` varchar(100) NOT NULL, `setting` text, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);

View File

@@ -0,0 +1 @@
ALTER TABLE pi_notification ADD COLUMN is_default boolean DEFAULT 0;

View File

@@ -0,0 +1,13 @@
CREATE TABLE `pi_pipeline_group`
(
`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL,
`user_id` bigint NOT NULL,
`name` varchar(100) NOT NULL,
`icon` varchar(100),
`favorite` boolean NOT NULL DEFAULT false,
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);
ALTER TABLE pi_pipeline
ADD COLUMN group_id bigint;

View File

@@ -0,0 +1,30 @@
CREATE INDEX `index_access_user_id` ON `cd_access` (`user_id`);
CREATE INDEX `index_cname_record_user_id` ON `cd_cname_record` (`user_id`);
CREATE INDEX `index_history_user_id` ON `pi_history` (`user_id`);
CREATE INDEX `index_history_log_user_id` ON `pi_history_log` (`user_id`);
CREATE INDEX `index_history_log_pipeline_id` ON `pi_history_log` (`pipeline_id`);
CREATE INDEX `index_notification_user_id` ON `pi_notification` (`user_id`);
CREATE INDEX `index_pipeline_user_id` ON `pi_pipeline` (`user_id`);
CREATE INDEX `index_pipeline_group_user_id` ON `pi_pipeline_group` (`user_id`);
CREATE INDEX `index_storage_default_get` ON `pi_storage` (`scope`(50), `namespace`(50), `key`(50));
CREATE INDEX `index_storage_user_id` ON `pi_storage` (`user_id`);
CREATE INDEX `index_user_email` ON `sys_user` (`email`);
CREATE INDEX `index_user_mobile` ON `sys_user` (`mobile`);
CREATE INDEX `index_permission` ON `sys_permission` (`permission`);
CREATE INDEX `index_user_settings_user_id` ON `user_settings` (`user_id`);

View File

@@ -0,0 +1,3 @@
ALTER TABLE `cd_access` MODIFY COLUMN `setting` text NULL AFTER `type`;
ALTER TABLE `pi_pipeline` MODIFY COLUMN `content` longtext NULL AFTER `title`;

View File

@@ -0,0 +1,31 @@
CREATE INDEX "index_access_user_id" ON "cd_access" ("user_id");
CREATE INDEX "index_cname_record_user_id" ON "cd_cname_record" ("user_id");
CREATE INDEX "index_history_user_id" ON "pi_history" ("user_id");
CREATE INDEX "index_history_log_user_id" ON "pi_history_log" ("user_id");
CREATE INDEX "index_history_log_pipeline_id" ON "pi_history_log" ("pipeline_id");
CREATE INDEX "index_notification_user_id" ON "pi_notification" ("user_id");
CREATE INDEX "index_pipeline_user_id" ON "pi_pipeline" ("user_id");
CREATE INDEX "index_pipeline_group_user_id" ON "pi_pipeline_group" ("user_id");
CREATE INDEX "index_storage_default_get" ON "pi_storage" ("scope", "namespace", "key");
CREATE INDEX "index_storage_user_id" ON "pi_storage" ("user_id");
CREATE INDEX "index_user_email" ON "sys_user" ("email");
CREATE INDEX "index_user_mobile" ON "sys_user" ("mobile");
CREATE INDEX "index_permission" ON "sys_permission" ("permission");
CREATE INDEX "index_user_settings_user_id" ON "user_settings" ("user_id");

View File

@@ -0,0 +1,31 @@
CREATE INDEX "index_access_user_id" ON "cd_access" ("user_id");
CREATE INDEX "index_cname_record_user_id" ON "cd_cname_record" ("user_id");
CREATE INDEX "index_history_user_id" ON "pi_history" ("user_id");
CREATE INDEX "index_history_log_user_id" ON "pi_history_log" ("user_id");
CREATE INDEX "index_history_log_pipeline_id" ON "pi_history_log" ("pipeline_id");
CREATE INDEX "index_notification_user_id" ON "pi_notification" ("user_id");
CREATE INDEX "index_pipeline_user_id" ON "pi_pipeline" ("user_id");
CREATE INDEX "index_pipeline_group_user_id" ON "pi_pipeline_group" ("user_id");
CREATE INDEX "index_storage_default_get" ON "pi_storage" ("scope", "namespace", "key");
CREATE INDEX "index_storage_user_id" ON "pi_storage" ("user_id");
CREATE INDEX "index_user_email" ON "sys_user" ("email");
CREATE INDEX "index_user_mobile" ON "sys_user" ("mobile");
CREATE INDEX "index_permission" ON "sys_permission" ("permission");
CREATE INDEX "index_user_settings_user_id" ON "user_settings" ("user_id");

View File

@@ -25,21 +25,21 @@ import fs from 'fs';
* sqlite: integer
* postgresql: bigint
*/
function transform() {
function transformPG() {
// 读取文件列表
const sqliteFiles = fs.readdirSync('./migration/');
const pgFiles = fs.readdirSync('./migration-pg');
const pgFiles = fs.readdirSync('./migration-pg/');
//找出pg里面没有的文件
const notFiles = sqliteFiles.filter(file => !pgFiles.includes(file));
for (const notFile of notFiles) {
//开始转换
const sqliteSql = fs.readFileSync(`./migration/${notFile}`, 'utf-8');
let pgSql = sqliteSql.replace(/AUTOINCREMENT/g, 'GENERATED BY DEFAULT AS IDENTITY');
pgSql = pgSql.replace(/datetime/g, 'timestamp');
pgSql = pgSql.replace(/boolean DEFAULT \(0\)/g, 'boolean DEFAULT (false)');
pgSql = pgSql.replace(/boolean.*NOT NULL DEFAULT \(0\)/g, 'boolean NOT NULL DEFAULT (false)');
pgSql = pgSql.replace(/integer/g, 'bigint');
pgSql = pgSql.replace(/last_insert_rowid\(\)/g, 'LASTVAL()');
let pgSql = sqliteSql.replaceAll(/AUTOINCREMENT/g, 'GENERATED BY DEFAULT AS IDENTITY');
pgSql = pgSql.replaceAll(/datetime/g, 'timestamp');
pgSql = pgSql.replaceAll(/boolean DEFAULT \(0\)/g, 'boolean DEFAULT (false)');
pgSql = pgSql.replaceAll(/boolean.*NOT NULL DEFAULT \(0\)/g, 'boolean NOT NULL DEFAULT (false)');
pgSql = pgSql.replaceAll(/integer/g, 'bigint');
pgSql = pgSql.replaceAll(/last_insert_rowid\(\)/g, 'LASTVAL()');
fs.writeFileSync(`./migration-pg/${notFile}`, pgSql);
}
@@ -51,4 +51,37 @@ function transform() {
console.log('sql无需更新');
}
}
transform();
function transformMysql() {
// 读取文件列表
const sqliteFiles = fs.readdirSync('./migration/');
const pgFiles = fs.readdirSync('./migration-mysql/');
//找出pg里面没有的文件
const notFiles = sqliteFiles.filter(file => !pgFiles.includes(file));
for (const notFile of notFiles) {
//开始转换
const sqliteSql = fs.readFileSync(`./migration/${notFile}`, 'utf-8');
let pgSql = sqliteSql.replaceAll(/AUTOINCREMENT/g, 'AUTO_INCREMENT');
pgSql = pgSql.replaceAll(/datetime/g, 'timestamp');
//DEFAULT (xxx) 替换成 DEFAULT xxx
pgSql = pgSql.replaceAll(/DEFAULT \(([^)]*)\)/g, 'DEFAULT $1');
pgSql = pgSql.replaceAll(/integer/g, 'bigint');
pgSql = pgSql.replaceAll(/last_insert_rowid\(\)/g, 'LAST_INSERT_ID()');
//双引号 替换成反引号
pgSql = pgSql.replaceAll(/"/g, '`');
fs.writeFileSync(`./migration-mysql/${notFile}`, pgSql);
}
if (notFiles.length > 0) {
console.log('sqlite->mysql 转换完成');
throw new Error('sqlite->mysql 转换完成有更新需要测试mysql');
} else {
console.log('sql无需更新');
}
}
transformPG();
transformMysql();

View File

@@ -1 +0,0 @@
CREATE INDEX "index_user_id" ON "pi_pipeline" ("user_id");

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/ui-server",
"version": "1.28.1",
"version": "1.28.4",
"description": "fast-server base midway",
"private": true,
"type": "module",
@@ -10,6 +10,7 @@
"commdev": "cross-env NODE_ENV=commdev mwtsc --watch --run @midwayjs/mock/app",
"commpro": "cross-env NODE_ENV=commpro mwtsc --watch --run @midwayjs/mock/app",
"pgdev": "cross-env NODE_ENV=pgdev mwtsc --watch --run @midwayjs/mock/app",
"mysqldev": "cross-env NODE_ENV=mysqldev mwtsc --watch --run @midwayjs/mock/app",
"local-plus": "cross-env NODE_ENV=localplus mwtsc --watch --run @midwayjs/mock/app",
"pgpl": "cross-env NODE_ENV=pgpl mwtsc --watch --run @midwayjs/mock/app",
"dev-new": "cross-env NODE_ENV=devnew mwtsc --watch --run @midwayjs/mock/app",
@@ -23,24 +24,28 @@
"dev-build": "echo 1",
"build-on-docker": "node ./before-build.js && npm run build",
"up-mw-deps": "npx midway-version -u -w",
"heap": "cross-env NODE_ENV=pgpl clinic heapprofiler -- node ./bootstrap.js",
"heap": "cross-env NODE_ENV=local clinic heapprofiler -- node ./bootstrap.js",
"flame": "clinic flame -- node ./bootstrap.js",
"tsc": "tsc --skipLibCheck"
"tsc": "tsc --skipLibCheck",
"slimming": "node ./slimming.js"
},
"dependencies": {
"@alicloud/pop-core": "^1.7.10",
"@certd/acme-client": "^1.28.1",
"@certd/basic": "^1.28.1",
"@certd/commercial-core": "^1.28.1",
"@certd/lib-huawei": "^1.28.1",
"@certd/lib-k8s": "^1.28.1",
"@certd/lib-server": "^1.28.1",
"@certd/midway-flyway-js": "^1.28.1",
"@certd/pipeline": "^1.28.1",
"@certd/plugin-cert": "^1.28.1",
"@certd/plugin-lib": "^1.28.1",
"@certd/plugin-plus": "^1.28.1",
"@certd/plus-core": "^1.28.1",
"@aws-sdk/client-acm": "^3.699.0",
"@aws-sdk/client-cloudfront": "^3.699.0",
"@aws-sdk/client-s3": "^3.705.0",
"@certd/acme-client": "^1.28.4",
"@certd/basic": "^1.28.4",
"@certd/commercial-core": "^1.28.4",
"@certd/lib-huawei": "^1.28.4",
"@certd/lib-k8s": "^1.28.4",
"@certd/lib-server": "^1.28.4",
"@certd/midway-flyway-js": "^1.28.4",
"@certd/pipeline": "^1.28.4",
"@certd/plugin-cert": "^1.28.4",
"@certd/plugin-lib": "^1.28.4",
"@certd/plugin-plus": "^1.28.4",
"@certd/plus-core": "^1.28.4",
"@huaweicloud/huaweicloud-sdk-cdn": "^3.1.120",
"@huaweicloud/huaweicloud-sdk-core": "^3.1.120",
"@koa/cors": "^5.0.0",
@@ -79,6 +84,7 @@
"lru-cache": "^11.0.1",
"mwts": "^1.3.0",
"mwtsc": "^1.4.0",
"mysql": "^2.18.1",
"nanoid": "^5.0.7",
"node-forge": "^1.3.1",
"nodemailer": "^6.9.3",

View File

@@ -71,7 +71,8 @@ const development = {
type: 'better-sqlite3',
database: './data/db.sqlite',
synchronize: false, // 如果第一次使用,不存在表,有同步的需求可以写 true
logging: true,
logging: false,
highlightSql: false,
// 配置实体模型 或者 entities: '/entity',
entities: ['**/modules/**/entity/*.js', ...libServerEntities, ...commercialEntities, PipelineEntity, FlywayHistory, UserEntity],

View File

@@ -12,10 +12,7 @@ export class EmailController extends BaseController {
emailService: EmailService;
@Post('/test', { summary: Constants.per.authOnly })
public async test(
@Body('receiver')
receiver
) {
public async test(@Body('receiver') receiver) {
const userId = super.getUserId();
await this.emailService.test(userId, receiver);
return this.ok({});

View File

@@ -20,7 +20,8 @@ export class CnameProviderController extends BaseController {
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body: any) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
const res = await this.providerService.list({});
return this.ok(res);
}

View File

@@ -39,7 +39,8 @@ export class CnameRecordController extends CrudController<CnameRecordService> {
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body: any) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
const list = await this.getService().list(body);
return this.ok(list);
}

View File

@@ -25,7 +25,8 @@ export class UserSettingsController extends CrudController<UserSettingsService>
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.list(body);
}

View File

@@ -37,7 +37,8 @@ export class AccessController extends CrudController<AccessService> {
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.list(body);
}

View File

@@ -56,18 +56,6 @@ export class HandleController extends BaseController {
@Post('/notification', { summary: Constants.per.authOnly })
async notificationRequest(@Body(ALL) body: NotificationRequestHandleReq) {
const input = body.input.body;
// if (body.input.id > 0) {
// const oldEntity = await this.notificationService.info(body.input.id);
// if (oldEntity) {
// if (oldEntity.userId !== this.getUserId()) {
// throw new Error('notification not found');
// }
// const param: any = {
// type: body.typeName,
// setting: JSON.stringify(body.input.access),
// };
// }
// }
const notification = await newNotification(body.typeName, input, {
http,

View File

@@ -38,7 +38,8 @@ export class NotificationController extends CrudController<NotificationService>
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.list(body);
}

View File

@@ -36,7 +36,8 @@ export class PipelineGroupController extends CrudController<PipelineGroupService
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body: any) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return await super.list(body);
}
@@ -67,7 +68,9 @@ export class PipelineGroupController extends CrudController<PipelineGroupService
@Post('/all', { summary: Constants.per.authOnly })
async all() {
const list: any = await this.service.find({
userId: this.getUserId(),
where: {
userId: this.getUserId(),
},
});
return this.ok(list);
}

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