Compare commits

..

79 Commits

Author SHA1 Message Date
xiaojunnuo
28449c348e v1.1.6 2023-07-10 13:00:22 +08:00
xiaojunnuo
bb9cf7b93c build: prepare to build 2023-07-10 12:58:33 +08:00
xiaojunnuo
eb861083ad build: prepare to build 2023-07-10 11:56:18 +08:00
xiaojunnuo
b133505086 chore: 2023-07-10 11:56:04 +08:00
xiaojunnuo
0f0cae713a chore: 2023-07-10 11:55:47 +08:00
xiaojunnuo
56cfce86e4 chore: 2023-07-10 11:55:28 +08:00
xiaojunnuo
e950322232 fix: 修复上传证书到腾讯云失败的bug 2023-07-10 11:52:38 +08:00
xiaojunnuo
14de21ee64 refactor: doc 2023-07-06 15:18:41 +08:00
xiaojunnuo
22712eae96 refactor: doc 2023-07-06 15:14:56 +08:00
xiaojunnuo
86d1033324 refactor: doc 2023-07-06 15:13:20 +08:00
xiaojunnuo
671f0142bc refactor: doc 2023-07-04 15:03:34 +08:00
xiaojunnuo
ab4bdc7be6 refactor: doc 2023-07-04 14:56:40 +08:00
xiaojunnuo
0859e60b23 refactor: doc 2023-07-04 14:38:41 +08:00
xiaojunnuo
e69c2d8b0c refactor: doc 2023-07-04 14:38:31 +08:00
xiaojunnuo
186e058f3d refactor: doc 2023-07-04 14:37:13 +08:00
xiaojunnuo
ed5af59040 refactor: doc 2023-07-04 14:29:18 +08:00
xiaojunnuo
0da312f755 refactor: doc 2023-07-04 14:28:27 +08:00
xiaojunnuo
dc646d9a45 refactor: doc 2023-07-04 14:21:14 +08:00
xiaojunnuo
109e01bb60 refactor: doc 2023-07-04 14:19:55 +08:00
xiaojunnuo
657fad06fb refactor: doc 2023-07-04 14:14:31 +08:00
xiaojunnuo
3e014c876d refactor: doc 2023-07-04 14:12:19 +08:00
xiaojunnuo
d14dd51359 refactor: doc 2023-07-04 14:11:43 +08:00
xiaojunnuo
70f876c445 refactor: doc 2023-07-04 14:00:40 +08:00
xiaojunnuo
9d8d51d88d refactor: doc 2023-07-04 13:57:31 +08:00
xiaojunnuo
57037f20cc refactor: doc 2023-07-04 13:46:57 +08:00
xiaojunnuo
4f2f509819 refactor: doc 2023-07-04 13:06:37 +08:00
xiaojunnuo
d2fad719fa refactor: cancel tip 2023-07-03 22:24:16 +08:00
xiaojunnuo
6a3955a1d6 refactor: cancel tip 2023-07-03 22:09:47 +08:00
xiaojunnuo
dceb33006a refactor: cacheControl 2023-07-03 18:19:00 +08:00
xiaojunnuo
a096a43c56 v1.1.5 2023-07-03 17:59:34 +08:00
xiaojunnuo
8114a33d20 build: prepare to build 2023-07-03 17:57:54 +08:00
xiaojunnuo
9f3adddd41 refactor: cacheControl 2023-07-03 17:57:26 +08:00
xiaojunnuo
05f74ab654 refactor: cacheControl 2023-07-03 17:43:21 +08:00
xiaojunnuo
0317118cd9 refactor: 1.1.4 2023-07-03 13:42:48 +08:00
xiaojunnuo
461de8d269 refactor: 1.1.4 2023-07-03 12:39:03 +08:00
xiaojunnuo
b258e92620 v1.1.4 2023-07-03 12:30:41 +08:00
xiaojunnuo
f6148ef1fb build: prepare to build 2023-07-03 12:25:26 +08:00
xiaojunnuo
457da594be build: prepare to build 2023-07-03 11:53:44 +08:00
xiaojunnuo
891a43ae67 perf: flush log 2023-07-03 11:53:11 +08:00
xiaojunnuo
bc65c0a786 perf: cancel task 2023-07-03 11:45:32 +08:00
xiaojunnuo
3eeb1f77aa perf: timeout 2023-07-03 11:16:46 +08:00
xiaojunnuo
91be6826b9 perf: flush logger 2023-07-03 10:54:03 +08:00
xiaojunnuo
f87eee3b9f fix: 成功图标转动的问题 2023-07-03 10:31:25 +08:00
xiaojunnuo
b4e17691c4 chore: index update fast 2023-07-03 10:29:06 +08:00
xiaojunnuo
cce372aeba chore: env config 2023-07-03 10:14:22 +08:00
xiaojunnuo
b5a8a9e08a chore: deploy 2023-07-03 10:05:50 +08:00
xiaojunnuo
35632da284 chore: deploy 2023-07-03 09:33:18 +08:00
xiaojunnuo
02a9b0d16c chore: 1.1.3 2023-07-03 09:25:52 +08:00
xiaojunnuo
d1809e0f7d v1.1.3 2023-07-03 09:22:33 +08:00
xiaojunnuo
abb4a7c0f9 build: prepare to build 2023-07-03 09:21:35 +08:00
xiaojunnuo
cd6fa8b15c chore: 1.1.2 2023-07-03 09:20:10 +08:00
xiaojunnuo
ecfcada802 v1.1.2 2023-07-03 09:18:03 +08:00
xiaojunnuo
f8ec5ae253 build: prepare to build 2023-07-03 09:16:50 +08:00
xiaojunnuo
832ba5c8fb chore: static cache 2023-07-03 09:15:52 +08:00
xiaojunnuo
fa8e91cdcd chore: lodash-es 2023-06-29 17:29:36 +08:00
xiaojunnuo
e5d902663b chore: lodash-es 2023-06-29 17:20:47 +08:00
xiaojunnuo
042535536e chore: pref 2023-06-29 17:19:05 +08:00
xiaojunnuo
6d3063437c chore: pref 2023-06-29 16:45:16 +08:00
xiaojunnuo
3db4d04e4c chore: pref 2023-06-29 16:42:08 +08:00
xiaojunnuo
96f9eab5cd chore: env 2023-06-29 10:34:52 +08:00
xiaojunnuo
1e641b83c1 chore: env 2023-06-29 09:31:26 +08:00
xiaojunnuo
3791d92d67 chore: token expire 2023-06-29 08:56:09 +08:00
xiaojunnuo
2bcab76f5a chore: change password 2023-06-28 23:15:37 +08:00
xiaojunnuo
f5493c542b chore: get random value 2023-06-28 22:10:52 +08:00
xiaojunnuo
68eb4198f1 v1.1.1 2023-06-28 15:48:03 +08:00
xiaojunnuo
ef94607728 build: prepare to build 2023-06-28 15:46:58 +08:00
xiaojunnuo
4ccadbd2be build: prepare to build 2023-06-28 15:42:36 +08:00
xiaojunnuo
0643063b80 chore: auth 2023-06-28 15:42:10 +08:00
xiaojunnuo
d6c6ab932a chore: auth 2023-06-28 15:35:31 +08:00
xiaojunnuo
46004d2db8 chore: login 2023-06-28 15:18:36 +08:00
xiaojunnuo
620d1d4092 chore: clear file 2023-06-28 15:16:19 +08:00
xiaojunnuo
f30afac47e chore: 同步npm镜像 2023-06-28 14:34:22 +08:00
xiaojunnuo
1779e34773 chore: 1 2023-06-28 13:55:48 +08:00
xiaojunnuo
28f535f41c chore: 1 2023-06-28 13:54:17 +08:00
xiaojunnuo
e921f58d2f chore: 1 2023-06-28 13:45:19 +08:00
xiaojunnuo
301f6cc273 chore: off cron when remove 2023-06-28 12:46:29 +08:00
xiaojunnuo
f04e497999 chore: 1.1.0 2023-06-28 11:34:37 +08:00
xiaojunnuo
8db438d76b chore: 1.0.7 2023-06-28 10:29:16 +08:00
xiaojunnuo
af75e607ec chore: 1.0.7 2023-06-28 10:27:37 +08:00
144 changed files with 1261 additions and 631 deletions

2
.gitignore vendored
View File

@@ -1,3 +1,4 @@
./packages/core/lego
# IntelliJ project files
.vscode/
node_modules/
@@ -32,3 +33,4 @@ gen
/pnpm-lock.yaml
docker/image/workspace
/packages/core/lego

View File

@@ -3,6 +3,41 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.6](https://github.com/certd/certd/compare/v1.1.5...v1.1.6) (2023-07-10)
### Bug Fixes
* 修复上传证书到腾讯云失败的bug ([e950322](https://github.com/certd/certd/commit/e950322232e19d1263b8552eefa5b0150fd7864e))
## [1.1.5](https://github.com/certd/certd/compare/v1.1.4...v1.1.5) (2023-07-03)
**Note:** Version bump only for package root
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Bug Fixes
* 成功图标转动的问题 ([f87eee3](https://github.com/certd/certd/commit/f87eee3b9ff1ef9874e79a81fe0ed7104cb9ee8c))
### Performance Improvements
* cancel task ([bc65c0a](https://github.com/certd/certd/commit/bc65c0a786360c087fe95cad93ec6a87804cc5ee))
* flush log ([891a43a](https://github.com/certd/certd/commit/891a43ae6716ff98ed06643f7da2e35199ee195c))
* flush logger ([91be682](https://github.com/certd/certd/commit/91be6826b902e0f302b1a6cbdb1d24e15914c18d))
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package root
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
**Note:** Version bump only for package root
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
**Note:** Version bump only for package root
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
### Bug Fixes

217
README.md
View File

@@ -1,139 +1,108 @@
# CertD
CertD 是一个帮助你全自动申请和部署SSL证书的工具。
CertD 是一个免费全自动申请和部署SSL证书的工具。
后缀D取自linux守护进程的命名风格意为证书守护进程。
## 特性
## 一、特性
本项目不仅支持证书申请过程自动化,还可以自动化部署证书,让你的证书永不过期。
* 全自动申请证书
* 全自动部署证书(目前支持服务器上传部署、阿里云、腾讯云等)
* 可与CI/DI工具结合使用
* 全自动申请证书(支持阿里云、腾讯云、华为云注册的域名)
* 全自动部署证书(目前支持服务器上传部署、部署到阿里云、腾讯云等)
* 支持通配符域名
* 支持多个域名打到一个证书上
* 邮件通知
* 证书自动更新
* 免费、免费、免费([阿里云单个通配符域名证书最便宜也要1800/年](https://yundun.console.aliyun.com/?p=cas#/certExtend/buy/cn-hangzhou)
## 二、在线体验
官方Demo地址自助注册后体验
https://certd.handsfree.work/
> 注意数据将不定期清理,生产使用请自行部署
> 包含敏感信息,务必自己本地部署进行生产使用
## 三、使用教程
本案例演示如何配置自动申请证书并部署到阿里云CDN然后快要到期前自动更新证书并重新部署
![演示](./doc/images/5-view.png)
![演示](./doc/images/9-start.png)
![演示](./doc/images/10-1-log.png)
![演示](./doc/images/13-3-download.png)
![演示](./doc/images/13-1-result.png)
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
-------> [点我查看详细使用步骤演示](./step.md) <--------
↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
## 四、本地docker部署
### 1. 安装docker、docker-compose
1.1 安装docker
https://docs.docker.com/engine/install/
1.2 安装docker-compose
https://docs.docker.com/compose/install/linux/
### 2. 下载docker-compose.yaml文件
```bash
mdkir certd
cd certd
wget https://github.com/certd/certd/blob/v2/docker/run/docker-compose.yaml
# 根据需要修改里面的配置
# 1.修改镜像版本号
# 2.配置数据保存路径
# 3.配置certd_auth_jwt_secret
vi docker-compose.yaml
```
> 镜像版本号与release版本号同步
https://github.com/certd/certd/releases
### 3. 运行
```bash
# 如果docker compose是插件化安装
docker compose up -d
#如果docker compose是独立安装
docker-compose up -d
```
### 4. 访问
http://your_server_ip:7001
默认账号密码admin/123456
记得修改密码
## 五、一些说明
## 免费证书申请说明
* 本项目ssl证书提供商为letencrypt
* 申请过程遵循acme协议
* 需要验证域名所有权一般有两种方式目前本项目仅支持dns-01
* http-01 在网站根目录下放置一份txt文件
* dns-01 需要给域名添加txt解析记录域名只能用这种方式
* 需要验证域名所有权一般有两种方式目前本项目仅支持dns-01
* http-01 在网站根目录下放置一份txt文件
* dns-01 需要给域名添加txt解析记录通配符域名只能用这种方式
* 证书续期:
* 实际上acme并没有续期概念。
* 我们所说的续期,其实就是按照全套流程重新申请一份新证书。
* 免费证书过期时间90天以后可能还会缩短所以自动化部署必不可少
* 设置每天自动运行当证书过期前20天会自动重新申请证书并部署
## 六、联系作者
如有疑问欢迎加入群聊请备注certd
* QQ群141236433
* 微信群:
![](https://ai.handsfree.work/images/exchange_wxqroup.png)
## 快速开始
本案例演示如何配置自动申请证书并部署到阿里云CDN然后快要到期前自动更新证书并重新部署
1. 环境准备
安装[nodejs](https://nodejs.org/zh-cn/)
2. 生成node项目
通过ui生成 https://certd.docmirror.cn/
开始生成证书,先填写域名,支持将多个域名打到一个证书上
![](./doc/step1.png)
配置证书详细信息
![](./doc/step2.png)
配置证书部署流程
![](./doc/step3.png)
配置好之后点击导出按钮导出一个node项目包
4. 运行
将导出的压缩包解压,然后执行如下命令,即可开始申请证书并部署
```
npm install
npm run certd
```
5. 执行效果
生成的证书默认会存储在 `${home}/.certd/${email}/certs/${domain}/current`目录下
```
[2021-01-08T16:15:04.681] [INFO] certd - 任务完成
[2021-01-08T16:15:04.681] [INFO] certd - ---------------------------任务结果总览--------------------------
[2021-01-08T16:15:04.682] [INFO] certd - 【更新证书】--------------------------------------- [success]
证书申请成功
[2021-01-08T16:15:04.682] [INFO] certd - 【流程1-部署到阿里云CDN】---------------------------- [success] 执行成功
[2021-01-08T16:15:04.682] [INFO] certd - └【上传到阿里云】-------------------------------- [success] 执行成功
[2021-01-08T16:15:04.682] [INFO] certd - └【部署证书到CDN】------------------------------- [success] 执行成功
```
6. 证书续期
实际上没有证书续期的概念,只有重新生成一份新的证书,然后重新部署证书
所以每天定时运行即可当证书过期日前20天时会重新申请新的证书然后执行部署任务。
7. 其他说明
证书的部署任务执行后会记录执行结果,已经成功过的不会重复执行
所以当你临时需要将证书部署到其他地方时,直接追加部署任务,然后再次运行即可
## CI/DI集成与自动续期重新部署
集成前将以上导出的node项目提交到内网git仓库或者私有git仓库由于包含敏感信息不要提交到公开git仓库
### jenkins任务
1. 创建任务
选择构建自由风格的任务
2. 配置git
配置cert-run的git地址
3. 构建触发器
配置 `H 3 * * *` 每天凌晨3点-4点执行一次
4. 构建环境
勾选 `Provide Node & npm bin/ folder to PATH`提供nodejs运行环境
如果没有此选项需要jenkins安装`nodejs`插件
5. 构建
执行shell
```
npm install --production #执行过一次之后,就可以注释掉,加快执行速度
npm run post
```
6. 构建后操作
邮件通知
配置你的邮箱地址,可以在执行失败时收到邮件通知。
## API
先列个提纲,待完善
参数示例参考https://gitee.com/certd/certd/blob/master/test/options.js
### 授权提供者
用于dns验证接口调用
#### aliyun
#### dnspod
### deploy插件
部署任务插件
#### 阿里云
##### 上传到阿里云
type = uploadCertToAliyun
##### 部署到阿里云DNS
type = deployCertToAliyunCDN
##### 部署到阿里云CLB
type = deployCertToAliyunCLB
#### 腾讯云
##### 上传到腾讯云
type = uploadCertToTencent
##### 部署到腾讯云DNS
type = deployCertToTencentDNS
##### 部署到腾讯云CLB
type = deployCertToTencentCLB
##### 部署到腾讯云TKE-ingress
type = deployCertToTencentTKEIngress
### 更多部署插件
等你来提需求
## 七、我的其他项目
* [袖手GPT](https://ai.handsfree.work/) ChatGPT国内可用无需FQ每日免费额度
* [fast-crud](https://gitee.com/fast-crud/fast-crud/) 基于vue3的crud快速开发框架
* [dev-sidecar](https://github.com/docmirror/dev-sidecar/) 直连访问github工具无需FQ解决github无法访问的问题

102
deploy.js
View File

@@ -1,58 +1,80 @@
const http = require("axios")
const exec = require('child_process').exec;
import http from 'axios'
import fs from 'fs'
//builder
function execute(cmd){
return new Promise((resolve,reject)=>{
console.log("cmd executing: " + cmd)
exec(cmd, function(error, stdout, stderr) {
if(error){
console.error(error);
console.info(stderr)
reject(error)
}
else{
console.info(stdout)
console.log("success");
resolve(true)
//读取 packages/core/pipline/package.json的版本号
import {default as packageJson} from './packages/core/pipeline/package.json' assert {type: "json"};
const certdVersion = packageJson.version
console.log("certdVersion", certdVersion)
// 同步npmmirror的包
async function getPackages(directoryPath) {
return new Promise((resolve, reject) => {
// 读取目录下的文件和目录列表
fs.readdir(directoryPath, {withFileTypes: true}, (err, files) => {
if (err) {
console.log('无法读取目录:', err);
reject(err)
return;
}
// 过滤仅保留目录
const directories = files
.filter(file => file.isDirectory())
.map(directory => directory.name);
console.log('目录列表:', directories);
resolve(directories)
});
})
}
async function build(){
await execute("cd ./packages/fast-admin/fs-admin-antdv/ && npm run build")
await execute("cd ./packages/fast-admin/fs-admin-element/ && npm run build")
await execute("cd ./packages/fast-admin/fs-admin-naive-ui/ && npm run build")
await execute("npm run docs:build")
async function getAllPackages() {
const base = await getPackages("./packages/core")
const plugins = await getPackages("./packages/plugins")
return base.concat(plugins)
}
async function sync() {
const packages = await getAllPackages()
for (const pkg of packages) {
await http({
url: `http://registry-direct.npmmirror.com/@certd/${pkg}/sync?sync_upstream=true`,
method: 'PUT',
headers: {
"Content-Type": "application/json"
},
data: {}
})
console.log(`sync success:${pkg}`)
await sleep(1000)
}
}
// curl -X PUT https://registry-direct.npmmirror.com/@certd/plugin-cert/sync?sync_upstream=true
// trigger
const certdImageBuild = "http://flow-openapi.aliyun.com/pipeline/webhook/4zgFk3i4RZEMGuQzlOcI"
const webhooks = [certdImageBuild]
const naive = "http://flow-openapi.aliyun.com/pipeline/webhook/Zm3TJyDtyFZgV4dtJiD1"
const doc = "http://flow-openapi.aliyun.com/pipeline/webhook/soOYdQ5sF3kLjTPJGmIO"
const antdv = "http://flow-openapi.aliyun.com/pipeline/webhook/HiL0uVYxfUnBzIMJZVXB"
const element = "http://flow-openapi.aliyun.com/pipeline/webhook/uFTI0XJ9RgqnofX7jpRD"
const webhooks = [doc,naive,antdv,element]
async function sleep(time){
async function sleep(time) {
return new Promise(resolve => {
setTimeout(resolve,time)
setTimeout(resolve, time)
})
}
async function trigger(){
async function triggerBuild() {
for (const webhook of webhooks) {
await http({
url:webhook,
method:'POST',
headers:{
url: webhook,
method: 'POST',
headers: {
"Content-Type": "application/json"
},
data:{}
data: {
'CERTD_VERSION': certdVersion
}
})
console.log(`webhook success:${webhook}`)
await sleep(1000)
@@ -60,11 +82,13 @@ async function trigger(){
}
async function start(){
async function start() {
// await build()
console.log("等待60秒")
await sleep(60*1000)
await trigger()
await sleep(60 * 1000)
await sync()
await sleep(60 * 1000)
await triggerBuild()
}
start()

BIN
doc/images/1-add.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
doc/images/10-1-log.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

BIN
doc/images/11-1-error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
doc/images/11-2-error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
doc/images/13-1-result.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
doc/images/13-2-result.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
doc/images/14-timer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
doc/images/15-1-email.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
doc/images/15-2-email.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
doc/images/3-add-access.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
doc/images/5-view.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
doc/images/6-1-add-task.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
doc/images/6-2-add-task.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
doc/images/6-3-add-task.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
doc/images/9-start.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

View File

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

View File

@@ -5,13 +5,14 @@ read version
echo "您输入的版本号是: $version"
echo "登录aliyun镜像仓库"
docker login --username=252959493@qq.com registry.cn-shenzhen.aliyuncs.com
sudo docker login --username=252959493@qq.com registry.cn-shenzhen.aliyuncs.com
build=$(pwd)
cd ../../
root=$(pwd)
echo "安装依赖"
pnpm install --registry=https://registry.npmmirror.com
#pnpm install --registry=https://registry.npmmirror.com
pnpm install
echo "client build"
cd $root/packages/ui/certd-client
@@ -31,4 +32,6 @@ mkdir -p $build/workspace/certd-server
\cp ./* $build/workspace/certd-server -rf
\cp ../certd-client/dist/* $build/workspace/certd-server/public/ -rf
#export TAG=$version
#sudo -E docker compose build
#sudo -E docker compose push

View File

@@ -11,4 +11,5 @@ services: # 要拉起的服务们
- "7001:7001"
environment:
- TZ=Asia/Shanghai
- node_sqlite3_binary_host_mirror=https://registry.npmmirror.com/-/binary/sqlite3

View File

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

View File

@@ -1,18 +1,23 @@
version: '3.3' # 指定docker-compose 版本
services: # 要拉起的服务们
version: '3.3'
services:
certd:
# build:
# context: ./
# dockerfile: Dockerfile
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:v${TAG}
# 镜像 # ↓↓↓↓↓ --- 1、 修改镜像版本号或者干脆写成latest
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${CERTD_VERSION}
container_name: certd # 容器名
restart: unless-stopped # 重启
volumes: # 挂载目录
volumes:
# ↓↓↓↓↓ ------------------------------------------------------- 2、 修改数据库以及证书存储路径
- /data/certd:/app/data
ports: # 端口映射
- "7001:7001"
environment:
environment: # 环境变量
- TZ=Asia/Shanghai
- certd_auth_jwt_secret=changeme
#注意修改成你的自定义密钥 ↑↑↑↑↑
# ↑↑↑↑↑ ---------------------------------- 3、 修改成你的自定义密钥
# 设置环境变量即可自定义certd配置
# 服务端配置项见: packages/ui/certd-server/src/config/config.default.ts
# 服务端配置规则: certd_ + 配置项, 点号用_代替
# 如jwt密钥配置为 auth.jwt.secret则设置环境变量 certd_auth_jwt_secret=changeme
# 客户端配置项见: packages/ui/certd-client/.env
# 按实际名称配置环境变量即可,如: VITE_APP_API=http://localhost:7001

View File

@@ -9,5 +9,5 @@
}
},
"npmClient": "pnpm",
"version": "1.1.0"
"version": "1.1.6"
}

View File

@@ -5,20 +5,22 @@
"type": "module",
"devDependencies": {
"@lerna-lite/cli": "^2.4.0",
"@lerna-lite/run": "^2.4.0",
"@lerna-lite/publish": "^2.4.0"
"@lerna-lite/publish": "^2.4.0",
"@lerna-lite/run": "^2.4.0"
},
"scripts": {
"start": "lerna bootstrap --hoist",
"i-all": "lerna link && lerna exec npm install ",
"publish": "npm run proxy && npm run prepublishOnly1 && lerna publish --conventional-commits && npm run afterpublishOnly",
"publish": "npm run proxy && npm run prepublishOnly1 && lerna publish --conventional-commits && npm run afterpublishOnly && npm run deploy1",
"afterpublishOnly": "",
"proxy": "npm config set proxy=http://127.0.0.1:10809",
"prepublishOnly1": "npm run before-build && lerna run build ",
"before-build": "cd ./packages/core/acme-client && time /t >build.md && git add ./build.md && git commit -m \"build: prepare to build\""
"before-build": "cd ./packages/core/acme-client && time /t >build.md && git add ./build.md && git commit -m \"build: prepare to build\"",
"deploy1": "node deploy.js"
},
"license": "MIT",
"dependencies": {
"axios": "^1.4.0",
"lodash": "^4.17.21"
},
"workspaces": [

View File

@@ -3,6 +3,30 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.6](https://github.com/publishlab/node-acme-client/compare/v1.1.5...v1.1.6) (2023-07-10)
**Note:** Version bump only for package @certd/acme-client
## [1.1.5](https://github.com/publishlab/node-acme-client/compare/v1.1.4...v1.1.5) (2023-07-03)
**Note:** Version bump only for package @certd/acme-client
## [1.1.4](https://github.com/publishlab/node-acme-client/compare/v1.1.3...v1.1.4) (2023-07-03)
**Note:** Version bump only for package @certd/acme-client
## [1.1.3](https://github.com/publishlab/node-acme-client/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/acme-client
## [1.1.2](https://github.com/publishlab/node-acme-client/compare/v1.1.1...v1.1.2) (2023-07-03)
**Note:** Version bump only for package @certd/acme-client
## [1.1.1](https://github.com/publishlab/node-acme-client/compare/v1.1.0...v1.1.1) (2023-06-28)
**Note:** Version bump only for package @certd/acme-client
# [1.1.0](https://github.com/publishlab/node-acme-client/compare/v1.0.6...v1.1.0) (2023-06-28)
**Note:** Version bump only for package @certd/acme-client

View File

@@ -1 +1 @@
10:22
12:58

View File

@@ -3,7 +3,7 @@
"description": "Simple and unopinionated ACME client",
"private": false,
"author": "nmorsman",
"version": "1.1.0",
"version": "1.1.6",
"main": "src/index.js",
"types": "types",
"license": "MIT",
@@ -58,5 +58,5 @@
"bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues"
},
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
"gitHead": "b258e926209fef4cc4d633b0383eb54e26c516f9"
}

View File

@@ -3,6 +3,37 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.6](https://github.com/certd/certd/compare/v1.1.5...v1.1.6) (2023-07-10)
### Bug Fixes
* 修复上传证书到腾讯云失败的bug ([e950322](https://github.com/certd/certd/commit/e950322232e19d1263b8552eefa5b0150fd7864e))
## [1.1.5](https://github.com/certd/certd/compare/v1.1.4...v1.1.5) (2023-07-03)
**Note:** Version bump only for package @certd/pipeline
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* cancel task ([bc65c0a](https://github.com/certd/certd/commit/bc65c0a786360c087fe95cad93ec6a87804cc5ee))
* flush log ([891a43a](https://github.com/certd/certd/commit/891a43ae6716ff98ed06643f7da2e35199ee195c))
* flush logger ([91be682](https://github.com/certd/certd/commit/91be6826b902e0f302b1a6cbdb1d24e15914c18d))
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/pipeline
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
**Note:** Version bump only for package @certd/pipeline
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
**Note:** Version bump only for package @certd/pipeline
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
### Bug Fixes

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/pipeline",
"private": false,
"version": "1.1.0",
"version": "1.1.6",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
@@ -20,11 +20,10 @@
"axios": "^1.4.0",
"node-forge": "^1.3.1",
"nodemailer": "^6.9.3",
"qs": "^6.11.2",
"uuid": "^8.3.2"
"qs": "^6.11.2"
},
"devDependencies": {
"@certd/acme-client": "^1.1.0",
"@certd/acme-client": "^1.1.6",
"@rollup/plugin-commonjs": "^23.0.4",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
@@ -57,5 +56,5 @@
"vite": "^4.3.8",
"vue-tsc": "^1.6.5"
},
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
"gitHead": "b258e926209fef4cc4d633b0383eb54e26c516f9"
}

View File

@@ -12,6 +12,7 @@ import { RegistryItem } from "../registry";
import { Decorator } from "../decorator";
import { IEmailService } from "../service";
import { FileStore } from "./file-store";
import { TimeoutPromise } from "../utils/util.promise";
export type ExecutorOptions = {
userId: any;
@@ -31,6 +32,7 @@ export class Executor {
lastStatusMap!: RunnableCollection;
lastRuntime!: RunHistory;
options: ExecutorOptions;
canceled = false;
onChanged: (history: RunHistory) => void;
constructor(options: ExecutorOptions) {
this.options = options;
@@ -50,6 +52,12 @@ export class Executor {
this.lastStatusMap = new RunnableCollection(lastRuntime?.pipeline);
}
async cancel() {
this.canceled = true;
this.runtime?.cancel(this.pipeline);
await this.onChanged(this.runtime);
}
async run(runtimeId: any = 0, triggerType: string) {
try {
await this.init();
@@ -99,17 +107,24 @@ export class Executor {
return ResultType.skip;
}
}
try {
await run();
this.runtime.success(runnable);
const intervalFlushLogId = setInterval(async () => {
await this.onChanged(this.runtime);
}, 5000);
const timeout = runnable.timeout ?? 20 * 60 * 1000;
try {
if (this.canceled) {
throw new Error("task canceled");
}
await TimeoutPromise(run, timeout);
this.runtime.success(runnable);
return ResultType.success;
} catch (e: any) {
this.runtime.error(runnable, e);
await this.onChanged(this.runtime);
throw e;
} finally {
this.runtime.finally(runnable);
clearInterval(intervalFlushLogId);
await this.onChanged(this.runtime);
}
}

View File

@@ -34,10 +34,17 @@ export class FileStore {
}
private buildFilePath(filename: string) {
const parentDir = path.join(this.rootDir, this.scope + "", dayjs().format("YYYY-MM-DD"), this.parent + "");
const parentDir = path.join(this.rootDir, this.scope + "", this.parent + "", dayjs().format("YYYY-MM-DD"));
if (!fs.existsSync(parentDir)) {
fs.mkdirSync(parentDir, { recursive: true });
}
return path.join(parentDir, filename);
}
deleteByParent(scope: string, parent: string) {
const dir = path.join(this.rootDir, scope, parent);
if (fs.existsSync(dir)) {
fs.unlinkSync(dir);
}
}
}

View File

@@ -2,3 +2,4 @@ export * from "./executor";
export * from "./run-history";
export * from "./context";
export * from "./storage";
export * from "./file-store";

View File

@@ -92,6 +92,19 @@ export class RunHistory {
this.logError(runnable, e);
}
cancel(runnable: Runnable) {
const now = new Date().getTime();
const status = runnable.status;
_.merge(status, {
status: ResultType.canceled,
endTime: now,
result: ResultType.canceled,
message: "用户取消",
});
this.log(runnable, "任务取消");
}
log(runnable: Runnable, text: string) {
// @ts-ignore
this._loggers[runnable.id].info(`[${runnable.title}]<id:${runnable.id}> [${runnable.runnableType}]`, text);

View File

@@ -66,6 +66,7 @@ export type Runnable = {
strategy?: RunnableStrategy;
runnableType?: string; // pipeline, stage, task , step
status?: HistoryResult;
timeout?: number;
default?: {
[key: string]: any;
};
@@ -87,7 +88,7 @@ export type Pipeline = Runnable & {
userId: any;
stages: Stage[];
triggers: Trigger[];
notifications: Notification[];
notifications?: Notification[];
};
export type Context = {
@@ -105,6 +106,7 @@ export enum ResultType {
start = "start",
success = "success",
error = "error",
canceled = "canceled",
skip = "skip",
none = "none",
}

View File

@@ -6,7 +6,7 @@ import { IAccessService } from "../access";
import { IEmailService } from "../service";
import { IContext } from "../core";
import { AxiosInstance } from "axios";
import { v4 as uuidv4 } from "uuid";
export enum ContextScope {
global,
pipeline,
@@ -78,10 +78,19 @@ export abstract class AbstractTaskPlugin implements ITaskPlugin {
this.ctx = ctx;
}
randomFileId() {
return Math.random().toString(36).substring(2, 9);
}
linkFile(file: FileItem) {
this._result.files!.push({
...file,
id: this.randomFileId(),
});
}
saveFile(filename: string, file: Buffer) {
const filePath = this.ctx.fileStore.writeFile(filename, file);
this._result.files!.push({
id: uuidv4(),
id: this.randomFileId(),
filename,
path: filePath,
});

View File

@@ -8,7 +8,6 @@ import "reflect-metadata";
export const PLUGIN_CLASS_KEY = "pipeline:plugin";
export function IsTaskPlugin(define: PluginDefine): ClassDecorator {
console.log("IsTaskPlugin");
return (target: any) => {
target = Decorator.target(target);

View File

@@ -0,0 +1,13 @@
export function TimeoutPromise(callback: () => Promise<void>, ms = 30 * 1000) {
let timeout: any;
return Promise.race([
callback(),
new Promise((resolve, reject) => {
timeout = setTimeout(() => {
reject(new Error(`Task timeout in ${ms} ms`));
}, ms);
}),
]).finally(() => {
clearTimeout(timeout);
});
}

View File

@@ -3,6 +3,32 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.6](https://github.com/certd/certd/compare/v1.1.5...v1.1.6) (2023-07-10)
**Note:** Version bump only for package @certd/plugin-aliyun
## [1.1.5](https://github.com/certd/certd/compare/v1.1.4...v1.1.5) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-aliyun
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-aliyun
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-aliyun
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
**Note:** Version bump only for package @certd/plugin-aliyun
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
### Features

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/plugin-aliyun",
"private": false,
"version": "1.1.0",
"version": "1.1.6",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
@@ -23,10 +23,10 @@
"node-forge": "^0.10.0"
},
"devDependencies": {
"@certd/acme-client": "^1.1.0",
"@certd/pipeline": "^1.1.0",
"@certd/plugin-cert": "^1.1.0",
"@certd/plugin-util": "^1.1.0",
"@certd/acme-client": "^1.1.6",
"@certd/pipeline": "^1.1.6",
"@certd/plugin-cert": "^1.1.6",
"@certd/plugin-util": "^1.1.6",
"@midwayjs/core": "^3.0.0",
"@midwayjs/decorator": "^3.0.0",
"@rollup/plugin-commonjs": "^23.0.4",
@@ -59,5 +59,5 @@
"vite": "^3.1.0",
"vue-tsc": "^0.38.9"
},
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
"gitHead": "b258e926209fef4cc4d633b0383eb54e26c516f9"
}

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.1.6](https://github.com/certd/certd/compare/v1.1.5...v1.1.6) (2023-07-10)
### Bug Fixes
* 修复上传证书到腾讯云失败的bug ([e950322](https://github.com/certd/certd/commit/e950322232e19d1263b8552eefa5b0150fd7864e))
## [1.1.5](https://github.com/certd/certd/compare/v1.1.4...v1.1.5) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-all
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-all
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-all
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
**Note:** Version bump only for package @certd/plugin-all
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
**Note:** Version bump only for package @certd/plugin-all

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/plugin-all",
"private": false,
"version": "1.1.0",
"version": "1.1.6",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
@@ -17,12 +17,12 @@
"preview": "vite preview"
},
"devDependencies": {
"@certd/pipeline": "^1.1.0",
"@certd/plugin-aliyun": "^1.1.0",
"@certd/plugin-cert": "^1.1.0",
"@certd/plugin-host": "^1.1.0",
"@certd/plugin-huawei": "^1.1.0",
"@certd/plugin-tencent": "^1.1.0",
"@certd/pipeline": "^1.1.6",
"@certd/plugin-aliyun": "^1.1.6",
"@certd/plugin-cert": "^1.1.6",
"@certd/plugin-host": "^1.1.6",
"@certd/plugin-huawei": "^1.1.6",
"@certd/plugin-tencent": "^1.1.6",
"@rollup/plugin-commonjs": "^23.0.4",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
@@ -48,5 +48,5 @@
"vite": "^3.1.0",
"vue-tsc": "^0.38.9"
},
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
"gitHead": "b258e926209fef4cc4d633b0383eb54e26c516f9"
}

View File

@@ -1,6 +1,7 @@
import { IAccessService } from "@certd/pipeline";
import { EmailSend, IAccessService, IEmailService } from "@certd/pipeline";
import { AliyunAccess } from "@certd/plugin-aliyun";
import { aliyunSecret } from "../user.secret";
export class AccessServiceTest implements IAccessService {
async getById(id: any): Promise<any> {
return {
@@ -8,3 +9,10 @@ export class AccessServiceTest implements IAccessService {
} as AliyunAccess;
}
}
export class EmailServiceTest implements IEmailService {
send(email: EmailSend): Promise<void> {
console.log("send email", email);
return Promise.resolve(undefined);
}
}

View File

@@ -58,6 +58,17 @@ export const pipeline: Pipeline = {
runStrategy: RunStrategy.SkipWhenSucceed,
},
},
{
id: generateId(),
title: "上传证书到腾讯云",
type: "EchoPlugin",
input: {
cert: "cert",
},
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed,
},
},
],
},
],

View File

@@ -1,7 +1,7 @@
import "mocha";
import { Executor, FileStorage, RunHistory } from "@certd/pipeline";
import { pipeline } from "./pipeline.define";
import { AccessServiceTest } from "./access-service-test";
import { AccessServiceTest, EmailServiceTest } from "./access-service-test";
import "../../src";
import "../plugin/echo-plugin";
@@ -13,7 +13,14 @@ describe("pipeline", function () {
console.log("changed:");
}
const executor = new Executor({ userId: "test", pipeline, onChanged, accessService: new AccessServiceTest(), storage: new FileStorage() });
const executor = new Executor({
userId: "test",
pipeline,
onChanged,
accessService: new AccessServiceTest(),
emailService: new EmailServiceTest(),
storage: new FileStorage(),
});
await executor.run(1, "user");
// expect(define.name).eq("EchoPlugin");
});

View File

@@ -3,6 +3,32 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.6](https://github.com/certd/certd/compare/v1.1.5...v1.1.6) (2023-07-10)
**Note:** Version bump only for package @certd/plugin-cert
## [1.1.5](https://github.com/certd/certd/compare/v1.1.4...v1.1.5) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-cert
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-cert
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-cert
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
**Note:** Version bump only for package @certd/plugin-cert
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
### Bug Fixes

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/plugin-cert",
"private": false,
"version": "1.1.0",
"version": "1.1.6",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
@@ -17,8 +17,8 @@
"preview": "vite preview"
},
"dependencies": {
"@certd/acme-client": "^1.1.0",
"@certd/pipeline": "^1.1.0",
"@certd/acme-client": "^1.1.6",
"@certd/pipeline": "^1.1.6",
"jszip": "^3.10.1",
"node-forge": "^0.10.0"
},
@@ -57,5 +57,5 @@
"vite": "^3.1.0",
"vue-tsc": "^0.38.9"
},
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
"gitHead": "b258e926209fef4cc4d633b0383eb54e26c516f9"
}

View File

@@ -3,6 +3,32 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.6](https://github.com/certd/certd/compare/v1.1.5...v1.1.6) (2023-07-10)
**Note:** Version bump only for package @certd/plugin-host
## [1.1.5](https://github.com/certd/certd/compare/v1.1.4...v1.1.5) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-host
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-host
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-host
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
**Note:** Version bump only for package @certd/plugin-host
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
### Features

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/plugin-host",
"private": false,
"version": "1.1.0",
"version": "1.1.6",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
@@ -17,8 +17,8 @@
"preview": "vite preview"
},
"dependencies": {
"@certd/pipeline": "^1.1.0",
"@certd/plugin-cert": "^1.1.0",
"@certd/pipeline": "^1.1.6",
"@certd/plugin-cert": "^1.1.6",
"ssh2": "^0.8.9"
},
"devDependencies": {
@@ -57,5 +57,5 @@
"vite": "^3.1.0",
"vue-tsc": "^0.38.9"
},
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
"gitHead": "b258e926209fef4cc4d633b0383eb54e26c516f9"
}

View File

@@ -3,6 +3,32 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.6](https://github.com/certd/certd/compare/v1.1.5...v1.1.6) (2023-07-10)
**Note:** Version bump only for package @certd/plugin-huawei
## [1.1.5](https://github.com/certd/certd/compare/v1.1.4...v1.1.5) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-huawei
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-huawei
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-huawei
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
**Note:** Version bump only for package @certd/plugin-huawei
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
**Note:** Version bump only for package @certd/plugin-huawei

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/plugin-huawei",
"private": false,
"version": "1.1.0",
"version": "1.1.6",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
@@ -17,10 +17,10 @@
"preview": "vite preview"
},
"dependencies": {
"@certd/acme-client": "^1.1.0",
"@certd/pipeline": "^1.1.0",
"@certd/plugin-cert": "^1.1.0",
"@certd/plugin-util": "^1.1.0",
"@certd/acme-client": "^1.1.6",
"@certd/pipeline": "^1.1.6",
"@certd/plugin-cert": "^1.1.6",
"@certd/plugin-util": "^1.1.6",
"axios": "^0.27.2",
"dayjs": "^1.11.6",
"lodash": "^4.17.21",
@@ -59,5 +59,5 @@
"vite": "^3.1.0",
"vue-tsc": "^0.38.9"
},
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
"gitHead": "b258e926209fef4cc4d633b0383eb54e26c516f9"
}

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.1.6](https://github.com/certd/certd/compare/v1.1.5...v1.1.6) (2023-07-10)
### Bug Fixes
* 修复上传证书到腾讯云失败的bug ([e950322](https://github.com/certd/certd/commit/e950322232e19d1263b8552eefa5b0150fd7864e))
## [1.1.5](https://github.com/certd/certd/compare/v1.1.4...v1.1.5) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-tencent
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-tencent
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-tencent
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
**Note:** Version bump only for package @certd/plugin-tencent
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
### Features

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/plugin-tencent",
"private": false,
"version": "1.1.0",
"version": "1.1.6",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
@@ -17,9 +17,9 @@
"preview": "vite preview"
},
"dependencies": {
"@certd/pipeline": "^1.1.0",
"@certd/plugin-cert": "^1.1.0",
"@certd/plugin-util": "^1.1.0",
"@certd/pipeline": "^1.1.6",
"@certd/plugin-cert": "^1.1.6",
"@certd/plugin-util": "^1.1.6",
"tencentcloud-sdk-nodejs": "^4.0.44"
},
"devDependencies": {
@@ -58,5 +58,5 @@
"vite": "^3.1.0",
"vue-tsc": "^0.38.9"
},
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
"gitHead": "b258e926209fef4cc4d633b0383eb54e26c516f9"
}

View File

@@ -7,13 +7,20 @@ import { IsAccess, AccessInput } from "@certd/pipeline";
})
export class DnspodAccess {
@AccessInput({
title: "token",
title: "端点",
component: {
placeholder: "开放接口token",
placeholder: "endpoint",
name: "a-select",
vModel: "value",
options: [
{ value: "https://dnsapi.cn", label: "中国站" },
{ value: "https://api.dnspod.com", label: "国际站" },
],
},
rules: [{ required: true, message: "该项必填" }],
})
token = "";
endpoint = "";
@AccessInput({
title: "账户id",
component: {
@@ -22,6 +29,15 @@ export class DnspodAccess {
rules: [{ required: true, message: "该项必填" }],
})
id = "";
@AccessInput({
title: "token",
component: {
placeholder: "开放接口token",
},
rules: [{ required: true, message: "该项必填" }],
})
token = "";
}
new DnspodAccess();

View File

@@ -20,9 +20,11 @@ export class DnspodDnsProvider implements IDnsProvider {
loginToken: any;
endpoint = "";
async onInstance() {
const access: DnspodAccess = this.access as DnspodAccess;
this.loginToken = access.id + "," + access.token;
this.endpoint = access.endpoint || "https://dnsapi.cn";
}
async doRequest(options: any, successCodes: string[] = []) {
@@ -51,7 +53,7 @@ export class DnspodDnsProvider implements IDnsProvider {
async getDomainList() {
const ret = await this.doRequest({
url: "https://dnsapi.cn/Domain.List",
url: this.access.endpoint + "/Domain.List",
});
this.logger.debug("dnspod 域名列表:", ret.domains);
return ret.domains;
@@ -66,7 +68,7 @@ export class DnspodDnsProvider implements IDnsProvider {
const ret = await this.doRequest(
{
url: "https://dnsapi.cn/Record.Create",
url: this.access.endpoint + "/Record.Create",
formData: {
domain,
sub_domain: rr,
@@ -87,7 +89,7 @@ export class DnspodDnsProvider implements IDnsProvider {
const domain = await this.matchDomain(fullRecord);
const ret = await this.doRequest({
url: "https://dnsapi.cn/Record.Remove",
url: this.access.endpoint + "/Record.Remove",
formData: {
domain,
record_id: record.id,

View File

@@ -47,6 +47,17 @@ export class DeployToCdnPlugin extends AbstractTaskPlugin {
})
domainName!: string;
@TaskInput({
title: "CDN接口",
helper: "CDN接口端点",
component: {
name: "a-select",
type: "tencent",
},
required: true,
})
endpoint!: string;
accessService!: IAccessService;
logger!: ILogger;

View File

@@ -87,7 +87,7 @@ export class DeployCertToTencentTKEIngressPlugin extends AbstractTaskPlugin {
this.logger = this.ctx.logger;
}
async execute(): Promise<void> {
const accessProvider = this.accessService.getById(this.accessId);
const accessProvider = await this.accessService.getById(this.accessId);
const tkeClient = this.getTkeClient(accessProvider, this.region);
const kubeConfigStr = await this.getTkeKubeConfig(tkeClient, this.clusterId);

View File

@@ -52,7 +52,7 @@ export class UploadToTencentPlugin extends AbstractTaskPlugin {
async execute(): Promise<void> {
const { accessId, name, cert } = this;
const accessProvider = this.accessService.getById(accessId);
const accessProvider = await this.accessService.getById(accessId);
const certName = this.appendTimeSuffix(name || cert.domain);
const client = this.getClient(accessProvider);
@@ -96,7 +96,7 @@ export class UploadToTencentPlugin extends AbstractTaskPlugin {
// async rollback({ input }) {
// const { accessId } = input;
// const accessProvider = this.accessService.getById(accessId);
// const accessProvider = await this.accessService.getById(accessId);
// const client = this.getClient(accessProvider);
//
// const { tencentCertId } = context;

View File

@@ -3,6 +3,32 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.6](https://github.com/certd/certd/compare/v1.1.5...v1.1.6) (2023-07-10)
**Note:** Version bump only for package @certd/plugin-util
## [1.1.5](https://github.com/certd/certd/compare/v1.1.4...v1.1.5) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-util
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-util
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-util
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
**Note:** Version bump only for package @certd/plugin-util
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
**Note:** Version bump only for package @certd/plugin-util

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/plugin-util",
"private": false,
"version": "1.1.0",
"version": "1.1.6",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
@@ -21,7 +21,7 @@
"shelljs": "^0.8.5"
},
"devDependencies": {
"@certd/pipeline": "^1.1.0",
"@certd/pipeline": "^1.1.6",
"@rollup/plugin-commonjs": "^23.0.4",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
@@ -44,5 +44,5 @@
"vite": "^3.1.0",
"vue-tsc": "^0.38.9"
},
"gitHead": "5950e1cae7cf30ebfc5128c15c7d1b0d101cbbb8"
"gitHead": "b258e926209fef4cc4d633b0383eb54e26c516f9"
}

View File

@@ -3,6 +3,37 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.6](https://github.com/certd/certd/compare/v1.1.5...v1.1.6) (2023-07-10)
**Note:** Version bump only for package @certd/ui-client
## [1.1.5](https://github.com/certd/certd/compare/v1.1.4...v1.1.5) (2023-07-03)
**Note:** Version bump only for package @certd/ui-client
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Bug Fixes
* 成功图标转动的问题 ([f87eee3](https://github.com/certd/certd/commit/f87eee3b9ff1ef9874e79a81fe0ed7104cb9ee8c))
### Performance Improvements
* cancel task ([bc65c0a](https://github.com/certd/certd/commit/bc65c0a786360c087fe95cad93ec6a87804cc5ee))
* flush log ([891a43a](https://github.com/certd/certd/commit/891a43ae6716ff98ed06643f7da2e35199ee195c))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/ui-client
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
**Note:** Version bump only for package @certd/ui-client
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
**Note:** Version bump only for package @certd/ui-client
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
### Bug Fixes

View File

@@ -14,8 +14,8 @@
<div class="fs-bootstrap__loading"></div>
</div>
<div class="fs-bootstrap__footer">
<a href="https://github.com/fast-crud/fast-crud" target="_blank">
https://github.com/fast-crud/fast-crud
<a href="https://github.com/certd/certd" target="_blank">
https://github.com/certd/certd
</a>
</div>
</div>

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/ui-client",
"version": "1.1.0",
"version": "1.1.6",
"private": true,
"scripts": {
"dev": "vite",
@@ -22,12 +22,11 @@
"dependencies": {
"@ant-design/colors": "^6.0.0",
"@ant-design/icons-vue": "^6.0.1",
"@certd/acme-client": "^1.1.0",
"@certd/pipeline": "^1.1.0",
"@fast-crud/fast-crud": "^1.13.8",
"@fast-crud/fast-extends": "^1.13.8",
"@fast-crud/ui-antdv": "^1.13.8",
"@fast-crud/ui-interface": "^1.13.8",
"@certd/acme-client": "^1.1.6",
"@fast-crud/fast-crud": "^1.14.4",
"@fast-crud/fast-extends": "^1.14.4",
"@fast-crud/ui-antdv": "^1.14.4",
"@fast-crud/ui-interface": "^1.14.4",
"@iconify/iconify": "^3.0.1",
"@iconify/json": "^2.1.151",
"@purge-icons/generated": "^0.9.0",
@@ -60,10 +59,11 @@
"vuedraggable": "^4.0.1"
},
"devDependencies": {
"@certd/pipeline": "^1.1.6",
"@rollup/plugin-commonjs": "^23.0.4",
"@rollup/plugin-node-resolve": "^15.0.1",
"@types/chai": "^4.3.4",
"@types/lodash": "^4.14.195",
"@types/lodash-es": "^4.17.7",
"@types/mocha": "^10.0.1",
"@types/node": "^18.11.15",
"@typescript-eslint/eslint-plugin": "^5.46.1",
@@ -107,10 +107,8 @@
"vite-plugin-package-config": "^0.1.1",
"vite-plugin-purge-icons": "^0.9.2",
"vite-plugin-theme": "^0.8.1",
"vite-plugin-windicss": "^1.8.10",
"vue-eslint-parser": "^9.1.0",
"vue-tsc": "^0.40.13",
"windicss": "^3.5.6"
"vue-tsc": "^0.40.13"
},
"husky": {
"hooks": {

View File

@@ -1,5 +1,5 @@
import axios from "axios";
import { get } from "lodash";
import { get } from "lodash-es";
import Adapter from "axios-mock-adapter";
import { errorLog, errorCreate } from "./tools";
import { env } from "/src/utils/util.env";

View File

@@ -1,20 +1,13 @@
import { createI18n } from "vue-i18n";
//
import enFsLocale from "@fast-crud/fast-crud/dist/locale/lang/en.js";
import zhFsLocale from "@fast-crud/fast-crud/dist/locale/lang/zh-cn.js";
import en from "./locale/en";
import zh from "./locale/zh_CN";
const messages = {
en: {
label: "English",
// 定义您自己的字典,但是请不要和 `fs` 重复,这样会导致 fast-crud 内部组件的翻译失效.
fs: enFsLocale.fs,
...en
},
"zh-cn": {
label: "简体中文",
// 定义您自己的字典,但是请不要和 `fs` 重复,这样会导致 fast-crud 内部组件的翻译失效.
fs: zhFsLocale.fs,
...zh
}
};

View File

@@ -25,7 +25,7 @@
<script>
import i18n from "../../../i18n";
import { computed, inject } from "vue";
import _ from "lodash";
import _ from "lodash-es";
export default {
name: "FsLocale",
setup() {

View File

@@ -1,7 +1,7 @@
import { useRoute, useRouter } from "vue-router";
import { ref, watch, onMounted, onUnmounted, resolveComponent, nextTick, defineComponent } from "vue";
import getEachDeep from "deepdash-es/getEachDeep";
import _ from "lodash";
import _ from "lodash-es";
import BScroll from "better-scroll";
import "./index.less";
const eachDeep = getEachDeep(_);

View File

@@ -3,7 +3,6 @@ import App from "./App.vue";
import router from "./router";
import Antd from "ant-design-vue";
import "./style/common.less";
import "./mock";
import i18n from "./i18n";
import store from "./store";
import components from "./components";

View File

@@ -1,4 +1,4 @@
import _ from "lodash";
import _ from "lodash-es";
function copyList(originList, newList, options, parentId) {
for (const item of originList) {
const newItem = { ...item, parentId };

View File

@@ -1,4 +1,4 @@
import _ from "lodash";
import _ from "lodash-es";
export async function getPcasData() {
const pcasData = () => import("china-division/dist/pcas-code.json");
const ret = await pcasData();

View File

@@ -1,6 +1,6 @@
import { mock } from "../api/service";
import * as tools from "../api/tools";
import _ from "lodash";
import _ from "lodash-es";
const commonMocks = import.meta.globEager("./common/mock.*.js");
const apiMocks = import.meta.globEager("../api/modules/*.mock.ts");
const viewMocks = import.meta.globEager("../views/**/mock.js");

View File

@@ -1,225 +0,0 @@
import { request, requestForMock } from "/src/api/service";
import "/src/mock";
import UiAntdv from "@fast-crud/ui-antdv";
import { FastCrud, UseCrudProps, useTypes, setLogger } from "@fast-crud/fast-crud";
import "@fast-crud/fast-crud/dist/style.css";
import { FsExtendsUploader, FsExtendsEditor, FsExtendsJson, FsExtendsCopyable, FsExtendsTime } from "@fast-crud/fast-extends";
import "@fast-crud/fast-extends/dist/style.css";
import { useCrudPermission } from "../permission";
function install(app, options: any = {}) {
app.use(UiAntdv);
//设置日志级别
setLogger({ level: "debug" });
app.use(FastCrud, {
i18n: options.i18n,
async dictRequest({ url }) {
if (url && url.startsWith("/mock")) {
//如果是crud开头的dict请求视为mock
return await requestForMock({ url, method: "post" });
}
return await request({ url, method: "post" });
},
/**
* useCrud时会被执行
* @param contextuseCrud的参数
*/
commonOptions(context: UseCrudProps) {
const crudBinding = context.expose?.crudBinding;
const opts = {
table: {
size: "small",
pagination: false,
onResizeColumn: (w, col) => {
crudBinding.value.table.columnsMap[col.key].width = w;
}
},
rowHandle: {
buttons: {
view: { type: "link", text: null, icon: "ion:eye-outline" },
edit: { type: "link", text: null, icon: "ion:create-outline" },
remove: { type: "link", style: { color: "red" }, text: null, icon: "ion:trash-outline" }
},
dropdown: {
more: {
type: "link"
}
}
},
request: {
transformQuery: ({ page, form, sort }) => {
const limit = page.pageSize;
const currentPage = page.currentPage ?? 1;
const offset = limit * (currentPage - 1);
sort = sort == null ? {} : sort;
return {
page: {
limit,
offset
},
query: form,
sort
};
},
transformRes: ({ res }) => {
const pageSize = res.limit;
let currentPage = res.offset / pageSize;
if (res.offset % pageSize === 0) {
currentPage++;
}
return { currentPage, pageSize, ...res };
}
},
form: {
display: "flex",
labelCol: {
//固定label宽度
span: null,
style: {
width: "120px"
}
},
wrapperCol: {
span: null
}
}
};
// 从 useCrud({permission}) 里获取permission参数去设置各个按钮的权限
const crudPermission = useCrudPermission({ permission: context.permission });
return crudPermission.merge(opts);
}
});
// fast-extends里面的扩展组件均为异步组件只有在使用时才会被加载并不会影响首页加载速度
//安装uploader 公共参数
app.use(FsExtendsUploader, {
defaultType: "cos",
cos: {
domain: "https://d2p-demo-1251260344.cos.ap-guangzhou.myqcloud.com",
bucket: "d2p-demo-1251260344",
region: "ap-guangzhou",
secretId: "", //
secretKey: "", // 传了secretKey 和secretId 代表使用本地签名模式(不安全,生产环境不推荐)
getAuthorization(custom) {
// 不传secretKey代表使用临时签名模式,此时此参数必传(安全,生产环境推荐)
return request({
url: "http://www.docmirror.cn:7070/api/upload/cos/getAuthorization",
method: "get"
}).then((ret) => {
// 返回结构如下
// ret.data:{
// TmpSecretId,
// TmpSecretKey,
// XCosSecurityToken,
// ExpiredTime, // SDK 在 ExpiredTime 时间前,不会再次调用 getAuthorization
// }
return ret;
});
},
successHandle(ret) {
// 上传完成后可以在此处处理结果修改url什么的
console.log("success handle:", ret);
return ret;
}
},
alioss: {
domain: "https://d2p-demo.oss-cn-shenzhen.aliyuncs.com",
bucket: "d2p-demo",
region: "oss-cn-shenzhen",
accessKeyId: "",
accessKeySecret: "",
async getAuthorization(custom, context) {
// 不传accessKeySecret代表使用临时签名模式,此时此参数必传(安全,生产环境推荐)
const ret = await request({
url: "http://www.docmirror.cn:7070/api/upload/alioss/getAuthorization",
method: "get"
});
console.log("ret", ret);
return ret;
},
sdkOpts: {
// sdk配置
secure: true // 默认为非https上传,为了安全设置为true
},
successHandle(ret) {
// 上传完成后可以在此处处理结果修改url什么的
console.log("success handle:", ret);
return ret;
}
},
qiniu: {
bucket: "d2p-demo",
async getToken(options) {
const ret = await request({
url: "http://www.docmirror.cn:7070/api/upload/qiniu/getToken",
method: "get"
});
return ret; // {token:xxx,expires:xxx}
},
successHandle(ret) {
// 上传完成后可以在此处处理结果修改url什么的
console.log("success handle:", ret);
return ret;
},
domain: "http://d2p.file.handsfree.work/"
},
form: {
action: "http://www.docmirror.cn:7070/api/upload/form/upload",
name: "file",
withCredentials: false,
uploadRequest: async ({ action, file, onProgress }) => {
// @ts-ignore
const data = new FormData();
data.append("file", file);
return await request({
url: action,
method: "post",
headers: {
"Content-Type": "multipart/form-data"
},
timeout: 60000,
data,
onUploadProgress: (p) => {
onProgress({ percent: Math.round((p.loaded / p.total) * 100) });
}
});
},
successHandle(ret) {
// 上传完成后的结果处理, 此处应返回格式为{url:xxx}
return {
url: "http://www.docmirror.cn:7070" + ret,
key: ret.replace("/api/upload/form/download?key=", "")
};
}
}
});
//安装editor
app.use(FsExtendsEditor, {
//编辑器的公共配置
wangEditor: {}
});
app.use(FsExtendsJson);
app.use(FsExtendsTime);
app.use(FsExtendsCopyable);
const { addTypes } = useTypes();
addTypes({
time2: {
//如果与官方字段类型同名,将会覆盖官方的字段类型
form: { component: { name: "a-date-picker" } },
column: { component: { name: "fs-date-format", format: "YYYY-MM-DD" } },
valueBuilder(context) {
console.log("time2,valueBuilder", context);
}
}
});
}
export default {
install
};

View File

@@ -1,17 +1,17 @@
import { request, requestForMock } from "/src/api/service";
import "/src/mock";
import { FastCrud, UseCrudProps, useTypes, setLogger, useColumns, ColumnCompositionProps, MergeColumnPlugin, CrudOptions } from "@fast-crud/fast-crud";
import { ColumnCompositionProps, CrudOptions, FastCrud, setLogger, useColumns, UseCrudProps, useTypes } from "@fast-crud/fast-crud";
import "@fast-crud/fast-crud/dist/style.css";
import { FsExtendsUploader, FsExtendsEditor, FsExtendsJson, FsExtendsCopyable, FsExtendsTime } from "@fast-crud/fast-extends";
import { FsExtendsCopyable, FsExtendsEditor, FsExtendsJson, FsExtendsTime, FsExtendsUploader } from "@fast-crud/fast-extends";
import "@fast-crud/fast-extends/dist/style.css";
import UiAntdv from "@fast-crud/ui-antdv";
import _ from "lodash";
import _ from "lodash-es";
import { useCrudPermission } from "../permission";
import { App } from "vue";
function install(app, options: any = {}) {
function install(app: App, options: any = {}) {
app.use(UiAntdv);
//设置日志级别
setLogger({ level: "debug" });
setLogger({ level: "info" });
app.use(FastCrud, {
i18n: options.i18n,
async dictRequest({ url }) {
@@ -31,7 +31,7 @@ function install(app, options: any = {}) {
table: {
size: "small",
pagination: false,
onResizeColumn: (w, col) => {
onResizeColumn: (w: any, col: any) => {
crudBinding.value.table.columnsMap[col.key].width = w;
}
},
@@ -70,7 +70,7 @@ function install(app, options: any = {}) {
if (res.offset % pageSize === 0) {
currentPage++;
}
return { currentPage, pageSize, ...res };
return { currentPage, pageSize, total: res.total, records: res.records };
}
},
form: {
@@ -96,7 +96,9 @@ function install(app, options: any = {}) {
// fast-extends里面的扩展组件均为异步组件只有在使用时才会被加载并不会影响首页加载速度
//安装uploader 公共参数
app.use(FsExtendsUploader, {
// @ts-ignore
defaultType: "cos",
cos: {
domain: "https://d2p-demo-1251260344.cos.ap-guangzhou.myqcloud.com",
@@ -109,7 +111,7 @@ function install(app, options: any = {}) {
return request({
url: "http://www.docmirror.cn:7070/api/upload/cos/getAuthorization",
method: "get"
}).then((ret) => {
}).then((ret: any) => {
// 返回结构如下
// ret.data:{
// TmpSecretId,
@@ -132,7 +134,7 @@ function install(app, options: any = {}) {
region: "oss-cn-shenzhen",
accessKeyId: "",
accessKeySecret: "",
async getAuthorization(custom, context) {
async getAuthorization(custom: any, context: any) {
// 不传accessKeySecret代表使用临时签名模式,此时此参数必传(安全,生产环境推荐)
const ret = await request({
url: "http://www.docmirror.cn:7070/api/upload/alioss/getAuthorization",
@@ -183,7 +185,7 @@ function install(app, options: any = {}) {
},
timeout: 60000,
data,
onUploadProgress: (p) => {
onUploadProgress: (p: any) => {
onProgress({ percent: Math.round((p.loaded / p.total) * 100) });
}
});
@@ -214,7 +216,7 @@ function install(app, options: any = {}) {
//如果与官方字段类型同名,将会覆盖官方的字段类型
form: { component: { name: "a-date-picker" } },
column: { component: { name: "fs-date-format", format: "YYYY-MM-DD" } },
valueBuilder(context) {
valueBuilder(context: any) {
console.log("time2,valueBuilder", context);
}
}

View File

@@ -1 +1 @@
import "./iconfont.js"
import "./iconfont.js";

View File

@@ -1,8 +1,9 @@
import "./iconify";
import "./iconfont";
import FastCrud from "./fast-crud";
import FastCrud from "./fast-crud/index";
import permission from "./permission";
function install(app, options: any = {}) {
import { App } from "vue";
function install(app: App, options: any = {}) {
app.use(FastCrud, options);
app.use(permission);
}

View File

@@ -1,5 +1,5 @@
import { usePermission } from "/@/plugin/permission";
import _ from "lodash";
import _ from "lodash-es";
/**
* 设置按钮动作权限

View File

@@ -1,5 +1,5 @@
import LayoutPass from "/src/layout/layout-pass.vue";
import _ from "lodash";
import _ from "lodash-es";
import { outsideResource } from "./source/outside";
import { headerResource } from "./source/header";
import { frameworkResource } from "./source/framework";

View File

@@ -12,7 +12,7 @@ export const frameworkResource = [
component: LayoutFramework,
meta: {
icon: "ion:accessibility",
authOnly: true
auth: true
},
children: [
{

View File

@@ -6,7 +6,7 @@ export const certdResources = [
redirect: "/certd/pipeline",
meta: {
icon: "ion:key-outline",
authOnly: true
auth: true
},
children: [
{
@@ -43,7 +43,7 @@ export const certdResources = [
redirect: "/certd/settings/email",
meta: {
icon: "ion:settings-outline",
authOnly: true
auth: true
},
children: [
{
@@ -53,7 +53,17 @@ export const certdResources = [
component: "/certd/settings/email-setting.vue",
meta: {
icon: "ion:mail-outline",
authOnly: true
auth: true
}
},
{
title: "账号信息",
name: "userProfile",
path: "/certd/mine/user-profile",
component: "/certd/mine/user-profile.vue",
meta: {
icon: "ion:person-outline",
auth: true
}
}
]

View File

@@ -1,5 +1,5 @@
import { defineStore } from "pinia";
import { cloneDeep, get, uniq } from "lodash";
import { cloneDeep, get, uniq } from "lodash-es";
import router from "/src/router";
import { frameworkRoutes } from "/src/router/resolve";
// @ts-ignore
@@ -21,7 +21,7 @@ interface PageState {
inited: boolean;
}
// 判定是否需要缓存
const isKeepAlive = (data) => get(data, "meta.cache", false);
const isKeepAlive = (data: any) => get(data, "meta.cache", false);
export const usePageStore = defineStore({
id: "app.page",
@@ -35,7 +35,7 @@ export const usePageStore = defineStore({
fullPath: "/index",
meta: {
title: "首页",
authOnly: false
auth: false
}
}
],
@@ -48,6 +48,7 @@ export const usePageStore = defineStore({
inited: false
}),
getters: {
// @ts-ignore
getOpened() {
// @ts-ignore
return this.opened;
@@ -91,7 +92,7 @@ export const usePageStore = defineStore({
const valid: Array<number> = [];
// 处理数据
this.opened = value
.map((opened) => {
.map((opened: any) => {
// 忽略首页
if (opened.fullPath === "/index") {
valid.push(1);
@@ -105,7 +106,7 @@ export const usePageStore = defineStore({
// 新的数据中一般不会携带 params 和 query, 所以旧的参数会留存
return Object.assign({}, opened, find);
})
.filter((opened, index) => valid[index] === 1);
.filter((opened: any, index: any) => valid[index] === 1);
// 标记已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201
this.openedLoaded = true;
// 根据 opened 数据生成缓存设置
@@ -132,7 +133,7 @@ export const usePageStore = defineStore({
* @param {Object} context
* @param {Object} payload { index, params, query, fullPath } 路由信息
*/
async openedUpdate({ index, params, query, fullPath }) {
async openedUpdate({ index, params, query, fullPath }: any) {
// 更新页面列表某一项
const page = this.opened[index];
page.params = params || page.params;
@@ -148,7 +149,7 @@ export const usePageStore = defineStore({
* @param {Object} context
* @param {Object} payload { oldIndex, newIndex } 位置信息
*/
async openedSort({ oldIndex, newIndex }) {
async openedSort({ oldIndex, newIndex }: any) {
// 重排页面列表某一项
const page = this.opened[oldIndex];
this.opened.splice(oldIndex, 1);
@@ -162,7 +163,7 @@ export const usePageStore = defineStore({
* @param {Object} context
* @param {Object} payload new tag info
*/
async add({ tag, params, query, fullPath }) {
async add({ tag, params, query, fullPath }: any) {
// 设置新的 tag 在新打开一个以前没打开过的页面时使用
const newTag = tag;
newTag.params = params || newTag.params;
@@ -183,7 +184,7 @@ export const usePageStore = defineStore({
* @param {Object} context
* @param {Object} payload 从路由钩子的 to 对象上获取 { name, params, query, fullPath, meta } 路由信息
*/
async open({ name, params, query, fullPath, meta }) {
async open({ name, params, query, fullPath, meta }: any) {
// 已经打开的页面
const opened = this.opened;
// 判断此页面是否已经打开 并且记录位置
@@ -227,7 +228,7 @@ export const usePageStore = defineStore({
* @param {Object} context
* @param {Object} payload { tagName: 要关闭的标签名字 }
*/
async close({ tagName }) {
async close({ tagName }: any) {
// 预定下个新页面
let newPage = {};
const isCurrent = this.current === tagName;
@@ -267,7 +268,7 @@ export const usePageStore = defineStore({
*/
async closeLeft(opts = {}) {
await this.closeByCondition({
condition({ i, currentIndex }) {
condition({ i, currentIndex }: any) {
return i >= currentIndex;
},
...opts
@@ -280,7 +281,7 @@ export const usePageStore = defineStore({
*/
async closeRight(opts = {}) {
await this.closeByCondition({
condition({ i, currentIndex }) {
condition({ i, currentIndex }: any) {
return currentIndex >= i;
},
...opts
@@ -321,7 +322,7 @@ export const usePageStore = defineStore({
*/
async closeOther(opts = {}) {
await this.closeByCondition({
condition({ i, currentIndex }) {
condition({ i, currentIndex }: any) {
return currentIndex === i;
},
...opts
@@ -364,7 +365,7 @@ export const usePageStore = defineStore({
* @param {Object} state state
* @param {String} name name
*/
keepAliveRemove(name) {
keepAliveRemove(name: any) {
const list = cloneDeep(this.keepAlive);
const index = list.findIndex((item) => item === name);
if (index !== -1) {
@@ -377,7 +378,7 @@ export const usePageStore = defineStore({
* @param {Object} state state
* @param {String} name name
*/
keepAlivePush(name) {
keepAlivePush(name: any) {
const keep = cloneDeep(this.keepAlive);
keep.push(name);
this.keepAlive = uniq(keep);
@@ -395,7 +396,7 @@ export const usePageStore = defineStore({
* @param {Object} state state
* @param {String} fullPath new fullPath
*/
currentSet(fullPath) {
currentSet(fullPath: any) {
this.current = fullPath;
},
/**
@@ -404,7 +405,7 @@ export const usePageStore = defineStore({
* @param {Object} state state
* @param {Array} routes routes
*/
async init(routes) {
async init(routes: any) {
if (this.inited) {
return;
}
@@ -414,9 +415,9 @@ export const usePageStore = defineStore({
routes = frameworkRoutes;
}
const pool = [];
const push = function (routes) {
routes.forEach((route) => {
const pool: any = [];
const push = function (routes: any) {
routes.forEach((route: any) => {
if (route.children && route.children.length > 0) {
push(route.children);
} else {

View File

@@ -1,7 +1,7 @@
import { defineStore } from "pinia";
// @ts-ignore
import { frameworkMenus, headerMenus, filterMenus, findMenus } from "/src/router/resolve";
import _ from "lodash";
import _ from "lodash-es";
import { mitter } from "/src/utils/util.mitt";
//监听注销事件
mitter.on("app.logout", () => {

View File

@@ -5,6 +5,8 @@
@import './scroll.less';
@import './transition.less';
@import './fix-windicss.less';
svg { vertical-align: baseline; }
html, body {

View File

@@ -1,4 +1,4 @@
import _ from "lodash";
import _ from "lodash-es";
export default {
arrayToMap(array: any) {
if (!array) {

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