Compare commits

...

15 Commits

Author SHA1 Message Date
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
43 changed files with 258 additions and 118 deletions

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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

100
deploy.js
View File

@@ -1,58 +1,79 @@
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" };
console.log("certdVersion", packageJson.version)
// 同步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: `https://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)
}
await sleep(60000)
}
// 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 +81,12 @@ 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 triggerBuild()
}
start()

View File

@@ -7,6 +7,7 @@ WORKDIR /app/
#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

@@ -4,15 +4,17 @@ services: # 要拉起的服务们
# build:
# context: ./
# dockerfile: Dockerfile
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:v${TAG}
# ↓↓↓↓↓ 修改镜像版本号
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${TAG}
container_name: certd # 容器名
restart: unless-stopped # 重启
volumes: # 挂载目录
volumes:
# ↓↓↓↓↓ 修改数据库以及证书存储路径
- /data/certd:/app/data
ports: # 端口映射
- "7001:7001"
environment:
- TZ=Asia/Shanghai
- certd_auth_jwt_secret=changeme
#注意修改成你的自定义密钥 ↑↑↑↑↑
# ↑↑↑↑↑ 注意修改成你的自定义密钥

View File

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

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 deploy",
"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\"",
"deploy": "node deploy.js"
},
"license": "MIT",
"dependencies": {
"axios": "^1.4.0",
"lodash": "^4.17.21"
},
"workspaces": [

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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
15:46

View File

@@ -3,7 +3,7 @@
"description": "Simple and unopinionated ACME client",
"private": false,
"author": "nmorsman",
"version": "1.1.0",
"version": "1.1.1",
"main": "src/index.js",
"types": "types",
"license": "MIT",

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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.1",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
@@ -24,7 +24,7 @@
"uuid": "^8.3.2"
},
"devDependencies": {
"@certd/acme-client": "^1.1.0",
"@certd/acme-client": "^1.1.1",
"@rollup/plugin-commonjs": "^23.0.4",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",

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

@@ -78,6 +78,12 @@ export abstract class AbstractTaskPlugin implements ITaskPlugin {
this.ctx = ctx;
}
linkFile(file: FileItem) {
this._result.files!.push({
...file,
id: uuidv4(),
});
}
saveFile(filename: string, file: Buffer) {
const filePath = this.ctx.fileStore.writeFile(filename, file);
this._result.files!.push({

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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.1",
"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.1",
"@certd/pipeline": "^1.1.1",
"@certd/plugin-cert": "^1.1.1",
"@certd/plugin-util": "^1.1.1",
"@midwayjs/core": "^3.0.0",
"@midwayjs/decorator": "^3.0.0",
"@rollup/plugin-commonjs": "^23.0.4",

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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.1",
"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.1",
"@certd/plugin-aliyun": "^1.1.1",
"@certd/plugin-cert": "^1.1.1",
"@certd/plugin-host": "^1.1.1",
"@certd/plugin-huawei": "^1.1.1",
"@certd/plugin-tencent": "^1.1.1",
"@rollup/plugin-commonjs": "^23.0.4",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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.1",
"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.1",
"@certd/pipeline": "^1.1.1",
"jszip": "^3.10.1",
"node-forge": "^0.10.0"
},

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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.1",
"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.1",
"@certd/plugin-cert": "^1.1.1",
"ssh2": "^0.8.9"
},
"devDependencies": {

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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.1",
"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.1",
"@certd/pipeline": "^1.1.1",
"@certd/plugin-cert": "^1.1.1",
"@certd/plugin-util": "^1.1.1",
"axios": "^0.27.2",
"dayjs": "^1.11.6",
"lodash": "^4.17.21",

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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.1",
"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.1",
"@certd/plugin-cert": "^1.1.1",
"@certd/plugin-util": "^1.1.1",
"tencentcloud-sdk-nodejs": "^4.0.44"
},
"devDependencies": {

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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.1",
"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.1",
"@rollup/plugin-commonjs": "^23.0.4",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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.1",
"private": true,
"scripts": {
"dev": "vite",
@@ -22,8 +22,8 @@
"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",
"@certd/acme-client": "^1.1.1",
"@certd/pipeline": "^1.1.1",
"@fast-crud/fast-crud": "^1.13.8",
"@fast-crud/fast-extends": "^1.13.8",
"@fast-crud/ui-antdv": "^1.13.8",

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,7 @@ export const certdResources = [
component: "/certd/settings/email-setting.vue",
meta: {
icon: "ion:mail-outline",
authOnly: true
auth: true
}
}
]

View File

@@ -35,7 +35,7 @@ export const usePageStore = defineStore({
fullPath: "/index",
meta: {
title: "首页",
authOnly: false
auth: false
}
}
],

View File

@@ -75,15 +75,15 @@
import { defineComponent, reactive, ref, toRaw, computed } from "vue";
import { useUserStore } from "/src/store/modules/user";
export default defineComponent({
name: "Login",
name: "LoginPage",
setup() {
const loading = ref(false);
const userStore = useUserStore();
const formRef = ref();
const formState = reactive({
username: "admin",
username: "",
mobile: "",
password: "123456",
password: "",
loginType: "password", //password
imgCode: "",
smsCode: ""

View File

@@ -1,24 +1,25 @@
<template>
<div class="main">
<a-form ref="formRef" class="user-layout-register" name="custom-validation" :model="formState" :rules="rules" v-bind="layout" @finish="handleFinish" @finishFailed="handleFinishFailed">
<div class="login-title">用户注册</div>
<a-form-item required has-feedback name="username">
<a-input v-model:value="formState.username" size="large" autocomplete="off">
<a-tabs :tab-bar-style="{ textAlign: 'center', borderBottom: 'unset' }">
<a-tab-pane key="register" tab="用户注册"> </a-tab-pane>
</a-tabs>
<a-form-item required has-feedback name="username" label="用户名">
<a-input v-model:value="formState.username" placeholder="用户名" size="large" autocomplete="off">
<template #prefix>
<span class="iconify" data-icon="ion:person" data-inline="false"></span>
</template>
</a-input>
</a-form-item>
<a-form-item has-feedback name="password">
<a-input-password v-model:value="formState.password" size="large" autocomplete="off">
<a-form-item has-feedback name="password" label="密码">
<a-input-password v-model:value="formState.password" placeholder="密码" size="large" autocomplete="off">
<template #prefix>
<span class="iconify" data-icon="ion:lock-closed" data-inline="false"></span>
</template>
</a-input-password>
</a-form-item>
<a-form-item has-feedback name="confirmPassword">
<a-input-password v-model:value="formState.confirmPassword" size="large" autocomplete="off">
<a-form-item has-feedback name="confirmPassword" label="确认密码">
<a-input-password v-model:value="formState.confirmPassword" placeholder="确认密码" size="large" autocomplete="off">
<template #prefix>
<span class="iconify" data-icon="ion:lock-closed" data-inline="false"></span>
</template>

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.1](https://github.com/fast-crud/fast-server-js/compare/v1.1.0...v1.1.1) (2023-06-28)
**Note:** Version bump only for package @certd/ui-server
# [1.1.0](https://github.com/fast-crud/fast-server-js/compare/v1.0.6...v1.1.0) (2023-06-28)
### Features

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/ui-server",
"version": "1.1.0",
"version": "1.1.1",
"description": "fast-server base midway",
"private": true,
"scripts": {
@@ -21,15 +21,15 @@
"mig": "typeorm migration:create -n name"
},
"dependencies": {
"@certd/acme-client": "^1.1.0",
"@certd/pipeline": "^1.1.0",
"@certd/plugin-aliyun": "^1.1.0",
"@certd/plugin-all": "^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/plugin-util": "^1.1.0",
"@certd/acme-client": "^1.1.1",
"@certd/pipeline": "^1.1.1",
"@certd/plugin-aliyun": "^1.1.1",
"@certd/plugin-all": "^1.1.1",
"@certd/plugin-cert": "^1.1.1",
"@certd/plugin-host": "^1.1.1",
"@certd/plugin-huawei": "^1.1.1",
"@certd/plugin-tencent": "^1.1.1",
"@certd/plugin-util": "^1.1.1",
"@koa/cors": "^3.4.3",
"@midwayjs/bootstrap": "^3.9.1",
"@midwayjs/cache": "^3.9.0",

View File

@@ -71,6 +71,9 @@ const development = {
expire: 7 * 24 * 60, //单位秒
},
},
certd: {
fileRootDir: '/app/data/files',
},
} as MidwayConfig;
mergeConfig(development, 'development');
export default development;

View File

@@ -60,7 +60,8 @@ export class PipelineController extends CrudController<PipelineService> {
@Post('/delete', { summary: Constants.per.authOnly })
async delete(@Query('id') id) {
await this.service.checkUserId(id, this.ctx.user.id);
return super.delete(id);
await this.service.delete(id);
return this.ok({});
}
@Post('/detail', { summary: Constants.per.authOnly })

View File

@@ -1,4 +1,4 @@
import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/decorator';
import { Config, Inject, Provide, Scope, ScopeEnum } from '@midwayjs/decorator';
import { InjectEntityModel } from '@midwayjs/typeorm';
import { Repository } from 'typeorm';
import { BaseService } from '../../../basic/base-service';
@@ -7,6 +7,8 @@ import { PipelineEntity } from '../entity/pipeline';
import { HistoryDetail } from '../entity/vo/history-detail';
import { HistoryLogService } from './history-log-service';
import { FileItem, Pipeline, RunnableCollection } from '@certd/pipeline';
import { FileStore } from '@certd/pipeline';
import { logger } from '../../../utils/logger';
/**
* 证书申请
@@ -18,6 +20,10 @@ export class HistoryService extends BaseService<HistoryEntity> {
repository: Repository<HistoryEntity>;
@Inject()
logService: HistoryLogService;
@Config('certd')
private certdConfig: any;
getRepository() {
return this.repository;
}
@@ -60,6 +66,11 @@ export class HistoryService extends BaseService<HistoryEntity> {
}
let shouldDeleteCount = count - keepCount;
const deleteCountBatch = 100;
const fileStore = new FileStore({
rootDir: this.certdConfig.fileRootDir,
scope: pipelineId + '',
parent: '0',
});
while (shouldDeleteCount > 0) {
const list = await this.repository.find({
select: {
@@ -76,6 +87,15 @@ export class HistoryService extends BaseService<HistoryEntity> {
});
await this.repository.remove(list);
for (const historyEntity of list) {
const id = historyEntity.id;
try {
fileStore.deleteByParent(pipelineId + '', id + '');
} catch (e) {
logger.error('删除文件失败', e);
}
}
shouldDeleteCount -= deleteCountBatch;
}
}

View File

@@ -1,4 +1,4 @@
import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/decorator';
import { Config, Inject, Provide, Scope, ScopeEnum } from '@midwayjs/decorator';
import { InjectEntityModel } from '@midwayjs/typeorm';
import { In, Repository } from 'typeorm';
import { BaseService } from '../../../basic/base-service';
@@ -38,6 +38,9 @@ export class PipelineService extends BaseService<PipelineEntity> {
@Inject()
cron: Cron;
@Config('certd')
private certdConfig: any;
getRepository() {
return this.repository;
}
@@ -136,6 +139,25 @@ export class PipelineService extends BaseService<PipelineEntity> {
logger.info('定时器数量:', this.cron.getListSize());
}
async delete(id: number) {
const pipeline = await this.info(id);
if (!pipeline) {
return;
}
const pipelineObj = JSON.parse(pipeline.content);
if (pipelineObj.triggers) {
for (const trigger of pipelineObj.triggers) {
this.removeCron(id, trigger);
}
}
await super.delete([id]);
}
removeCron(pipelineId, trigger) {
const name = this.buildCronKey(pipelineId, trigger.id);
this.cron.remove(name);
}
registerCron(pipelineId, trigger) {
let cron = trigger.props?.cron;
if (cron == null) {
@@ -194,6 +216,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
accessService: this.accessService,
storage: new DbStorage(userId, this.storageService),
emailService: this.emailService,
fileRootDir: this.certdConfig.fileRootDir,
});
try {
await executor.init();