Compare commits

...

25 Commits

Author SHA1 Message Date
xiaojunnuo
5668a3e222 v1.25.6 2024-09-29 10:10:49 +08:00
xiaojunnuo
47fa419803 chore: 2024-09-29 10:05:22 +08:00
xiaojunnuo
4fcaab5feb chore: 禁止普通用户使用不安全插件,比如复制到本机、自定义js脚本等 2024-09-29 01:14:21 +08:00
xiaojunnuo
5aa06f5b07 chore: 2024-09-29 00:50:32 +08:00
xiaojunnuo
9d9c021819 perf: 增加使用教程 2024-09-29 00:38:17 +08:00
xiaojunnuo
21c09c93b3 docs: 2024-09-28 19:41:54 +08:00
xiaojunnuo
3dc2750d64 docs: 宝塔容器编排部署教程 2024-09-27 17:59:36 +08:00
xiaojunnuo
76e86ea283 fix: 修复中间证书复制错误的bug 2024-09-27 16:25:18 +08:00
xiaojunnuo
a00e96b63b chore: 2024-09-27 14:46:38 +08:00
xiaojunnuo
d047234d98 perf: 部署支持1Panel 2024-09-27 02:15:41 +08:00
xiaojunnuo
3f21a49988 chore: 2024-09-26 15:15:17 +08:00
xiaojunnuo
6a02de35ce chore: 2024-09-26 14:53:00 +08:00
xiaojunnuo
65363b2713 chore: 2024-09-26 14:35:10 +08:00
xiaojunnuo
ec8c06da9b chore: 2024-09-26 14:27:32 +08:00
xiaojunnuo
d0cb0e324e build: trigger build image 2024-09-26 14:27:23 +08:00
xiaojunnuo
be13390b3a v1.25.5 2024-09-26 14:27:04 +08:00
xiaojunnuo
e9fda44bf0 chore: 2024-09-26 14:26:04 +08:00
xiaojunnuo
27f6cf24dd chore: 2024-09-26 14:20:32 +08:00
xiaojunnuo
6ab627ed5a chore: 2024-09-26 13:20:10 +08:00
xiaojunnuo
a350b51cf8 chore: 2024-09-26 10:40:22 +08:00
xiaojunnuo
bbb032344b chore: 2024-09-26 10:24:25 +08:00
xiaojunnuo
3220b87457 chore: 2024-09-25 10:40:57 +08:00
xiaojunnuo
ec1015295e chore: 优化build 2024-09-25 10:35:30 +08:00
xiaojunnuo
a943a41d2e chore: 1 2024-09-25 10:18:43 +08:00
xiaojunnuo
2d86fa254c build: trigger build image 2024-09-25 09:53:14 +08:00
93 changed files with 1178 additions and 352 deletions

View File

@@ -3,6 +3,21 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29)
### Bug Fixes
* 修复中间证书复制错误的bug ([76e86ea](https://github.com/certd/certd/commit/76e86ea283ecbe4ec76cdc92b98457d0fef544ac))
### Performance Improvements
* 部署支持1Panel ([d047234](https://github.com/certd/certd/commit/d047234d98d31504f2e5a472b66e1b75806af26e))
* 增加使用教程 ([9d9c021](https://github.com/certd/certd/commit/9d9c0218195af5b9896cce7109b26a433480571d))
## [1.25.5](https://github.com/certd/certd/compare/v1.25.4...v1.25.5) (2024-09-26)
**Note:** Version bump only for package root
## [1.25.4](https://github.com/certd/certd/compare/v1.25.3...v1.25.4) (2024-09-25)
### Bug Fixes

View File

@@ -62,21 +62,24 @@ https://certd.handsfree.work/
由于证书、授权信息等属于高度敏感数据,请务必私有化部署,保障数据安全
### 4.1 宝塔面板一键部署【推荐】
### 4.1 宝塔面板一键部署
1. 安装宝塔面板,前往 [宝塔面板](https://www.bt.cn/u/CL3JHS) 官网,选择正式版的脚本下载安装
1. 安装宝塔面板,前往 [宝塔面板](https://www.bt.cn/u/CL3JHS) 官网,选择9.2.0以上正式版的脚本下载安装
2. 安装后登录宝塔面板,在菜单栏中点击 Docker首次进入会提示安装Docker服务点击立即安装按提示完成安装
3. 安装完成后在应用商店中找到`certd`,点击安装,配置域名等基本信息即可完成安装
3. 安装完成后在应用商店中找到`certd`(要先点右上角更新应用),点击安装,配置域名等基本信息即可完成安装
### 4.2 Docker部署
### 4.2 宝塔面板容器编排部署
[宝塔面板容器编排部署教程](./doc/deploy/baota/baota.md)
### 4.3 Docker部署
#### 1. 安装docker、docker-compose
1.1 准备一台云服务器
* 【阿里云】云服务器2核2G新老用户同享99元/年,续费同价!【 [立即购买](https://www.aliyun.com/benefit?scm=20140722.M_10244282._.V_1&source=5176.11533457&userCode=qya11txb )】
* 【腾讯云】云服务器2核2G新老用户同享99元/年,续费同价!【 [立即购买](https://cloud.tencent.com/act/cps/redirect?redirect=6094&cps_key=b3ef73330335d7a6efa4a4bbeeb6b2c9&from=console)】
1.2 安装docker
@@ -110,7 +113,7 @@ docker compose up -d
> 如果提示 没有compose命令,请安装docker-compose
> https://docs.docker.com/compose/install/linux/
#### 镜像说明:
#### 3. 镜像说明:
* 国内镜像地址:
* `registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest`
* `registry.cn-shenzhen.aliyuncs.com/handsfree/certd:armv7``[version]-armv7`
@@ -124,13 +127,19 @@ docker compose up -d
![](./doc/images/action-build.jpg)
#### 3. 访问
#### 4. 访问测试
http://your_server_ip:7001
默认账号密码admin/123456
记得修改密码
### 4.4 源码部署
```shell
# 克隆代码
git clone https://github.com/certd/certd
cd certd
./start.sh
```
## 五、 升级
@@ -223,11 +232,13 @@ https://afdian.com/a/greper
## 十一、贡献代码
1. [贡献插件教程](./plugin.md)
1. 本地开发 [贡献插件教程](./doc/dev/development.md)
2. 作为贡献者,代表您同意您贡献的代码如下许可:
1. 可以调整开源协议以使其更严格或更宽松。
2. 可以用于商业用途。
## 十二、 开源许可
* 本项目遵循 GNU Affero General Public LicenseAGPL开源协议。
* 允许个人和公司使用、复制、修改和分发本项目,禁止任何形式的商业用途

View File

@@ -1 +1 @@
03:33
14:27

32
doc/deploy/baota/baota.md Normal file
View File

@@ -0,0 +1,32 @@
# 宝塔部署教程
## 编排模版部署
### 创建docker模版
打开docker-compose.yaml
https://gitee.com/certd/certd/raw/v2/docker/run/docker-compose.yaml
整个内容复制下来
然后到宝塔里面进到docker的编排模版新建模版
![](./images/1.png)
### 启动应用
![img.png](./images/2.png)
等待启动完成
### 打开应用
http://ip:7001
## 二、一键应用部署
需要宝塔9.2.0版本
### 应用商店
进入应用商店,更新应用列表
### 搜索certd
点击安装

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -1,4 +1,5 @@
# 贡献插件
# 本地开发
欢迎贡献插件
## 1.本地调试运行
@@ -11,9 +12,6 @@ git clone https://github.com/certd/certd
#进入项目目录
cd certd
# 切换到最新的版本tagv2分支可能不稳定
checkout tags/vx.x.x # x.x.x为最新的版本号
# 安装依赖
npm install -g pnpm@8.15.7
pnpm install

View File

@@ -1,4 +1,4 @@
#version: '3.3'
version: '3.3' # 兼容旧版docker-compose
services:
certd:
# 镜像 # ↓↓↓↓↓ --- 镜像版本号,建议改成固定版本号

View File

@@ -1,3 +1,4 @@
current_pwd=$(pwd)
echo "开始设置git配置"

View File

@@ -9,5 +9,5 @@
}
},
"npmClient": "pnpm",
"version": "1.25.4"
"version": "1.25.6"
}

View File

@@ -16,7 +16,7 @@
"afterpublishOnly": "time /t >build.trigger && git add ./build.trigger && git commit -m \"build: trigger build image\" && TIMEOUT /T 10 && git push",
"prepublishOnly1": "npm run check && lerna run build ",
"prepublishOnly2": "npm run check && npm run before-build && lerna run build ",
"before-build": "cd ./packages/pro/plus && time /t >build.md && git add ./build.md && git commit -m \"build: prepare to build\"",
"before-build": "cd ./packages/pro/plus-core && time /t >build.md && git add ./build.md && git commit -m \"build: prepare to build\"",
"deploy1": "node --experimental-json-modules deploy.js ",
"check": "node --experimental-json-modules publish-check.js",
"init": "lerna run build"

View File

@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.6](https://github.com/publishlab/node-acme-client/compare/v1.25.5...v1.25.6) (2024-09-29)
### Performance Improvements
* 部署支持1Panel ([d047234](https://github.com/publishlab/node-acme-client/commit/d047234d98d31504f2e5a472b66e1b75806af26e))
## [1.25.5](https://github.com/publishlab/node-acme-client/compare/v1.25.4...v1.25.5) (2024-09-26)
**Note:** Version bump only for package @certd/acme-client
## [1.25.4](https://github.com/publishlab/node-acme-client/compare/v1.25.3...v1.25.4) (2024-09-25)
**Note:** Version bump only for package @certd/acme-client

View File

@@ -3,7 +3,7 @@
"description": "Simple and unopinionated ACME client",
"private": false,
"author": "nmorsman",
"version": "1.25.4",
"version": "1.25.6",
"main": "src/index.js",
"types": "types/index.d.ts",
"license": "MIT",
@@ -34,7 +34,7 @@
"mocha": "^10.6.0",
"nock": "^13.5.4",
"tsd": "^0.31.1",
"typescript": "^4.8.4",
"typescript": "^5.4.2",
"uuid": "^8.3.2"
},
"scripts": {
@@ -59,5 +59,5 @@
"bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues"
},
"gitHead": "c2650d308c7f64af60f1658ea4844b0f2b13351b"
"gitHead": "be13390b3a9177c9d99f1efabfc285d0c377b013"
}

View File

@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29)
### Performance Improvements
* 部署支持1Panel ([d047234](https://github.com/certd/certd/commit/d047234d98d31504f2e5a472b66e1b75806af26e))
## [1.25.5](https://github.com/certd/certd/compare/v1.25.4...v1.25.5) (2024-09-26)
**Note:** Version bump only for package @certd/pipeline
## [1.25.4](https://github.com/certd/certd/compare/v1.25.3...v1.25.4) (2024-09-25)
**Note:** Version bump only for package @certd/pipeline

View File

@@ -1,25 +1,27 @@
{
"name": "@certd/pipeline",
"private": false,
"version": "1.25.4",
"version": "1.25.6",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"dev": "vite",
"build": "tsc --skipLibCheck",
"before-build": "rimraf dist && rimraf tsconfig.tsbuildinfo && rimraf .rollup.cache",
"build": "npm run before-build && tsc --skipLibCheck",
"build3": "rollup -c",
"build2": "vue-tsc --noEmit && vite build",
"preview": "vite preview",
"test": "mocha --loader=ts-node/esm"
},
"dependencies": {
"@certd/plus": "^1.25.1",
"@certd/plus-core": "^1.25.4",
"axios": "^1.7.2",
"fix-path": "^4.0.0",
"http-proxy-agent": "^7.0.2",
"https-proxy-agent": "^7.0.5",
"lodash-es": "^4.17.21",
"lru-cache": "^10.0.0",
"node-forge": "^1.3.1",
"nodemailer": "^6.9.3",
"proxy-agent": "^6.4.0",
@@ -50,15 +52,16 @@
"mocha": "^10.2.0",
"prettier": "^2.8.8",
"reflect-metadata": "^0.1.13",
"rimraf": "^5.0.5",
"rollup": "^3.7.4",
"rollup-plugin-typescript2": "^0.34.1",
"rollup-plugin-visualizer": "^5.8.2",
"ts-node": "^10.9.1",
"tsc-esm-fix": "^3.0.0",
"tslib": "^2.5.2",
"typescript": "^5.0.4",
"typescript": "^5.4.2",
"vite": "^4.3.8",
"vue-tsc": "^1.6.5"
},
"gitHead": "c2650d308c7f64af60f1658ea4844b0f2b13351b"
"gitHead": "be13390b3a9177c9d99f1efabfc285d0c377b013"
}

View File

@@ -1,7 +1,7 @@
import { ConcurrencyStrategy, NotificationWhen, Pipeline, ResultType, Runnable, RunStrategy, Stage, Step, Task } from "../dt/index.js";
import _ from "lodash-es";
import { RunHistory, RunnableCollection } from "./run-history.js";
import { AbstractTaskPlugin, PluginDefine, pluginRegistry, TaskInstanceContext } from "../plugin/index.js";
import { AbstractTaskPlugin, PluginDefine, pluginRegistry, TaskInstanceContext, UserInfo } from "../plugin/index.js";
import { ContextFactory, IContext } from "./context.js";
import { IStorage } from "./storage.js";
import { logger } from "../utils/util.log.js";
@@ -16,13 +16,13 @@ import { hashUtils, utils } from "../utils/index.js";
// import { TimeoutPromise } from "../utils/util.promise.js";
export type ExecutorOptions = {
userId: any;
pipeline: Pipeline;
storage: IStorage;
onChanged: (history: RunHistory) => Promise<void>;
accessService: IAccessService;
emailService: IEmailService;
fileRootDir?: string;
user: UserInfo;
};
export class Executor {
@@ -46,7 +46,7 @@ export class Executor {
this.onChanged = async (history: RunHistory) => {
await options.onChanged(history);
};
this.pipeline.userId = options.userId;
this.pipeline.userId = options.user.id;
this.contextFactory = new ContextFactory(options.storage);
this.logger = logger;
this.pipelineContext = this.contextFactory.getContext("pipeline", this.pipeline.id);
@@ -269,7 +269,7 @@ export class Executor {
accessService: this.options.accessService,
emailService: this.options.emailService,
pipelineContext: this.pipelineContext,
userContext: this.contextFactory.getContext("user", this.options.userId),
userContext: this.contextFactory.getContext("user", this.options.user.id),
fileStore: new FileStore({
scope: this.pipeline.id,
parent: this.runtime.id,
@@ -277,6 +277,7 @@ export class Executor {
}),
signal: this.abort.signal,
utils,
user: this.options.user,
};
instance.setCtx(taskCtx);

View File

@@ -1,21 +1,28 @@
import _ from "lodash-es";
import { HttpClient, ILogger } from "../utils";
import { HttpClient, ILogger, utils } from "../utils";
export type PluginRequest = {
type: "plugin" | "access";
export type PluginRequestHandleReq<T = any> = {
typeName: string;
action: string;
input: any;
input: T;
data: any;
};
export type RequestHandleContext = {
export type AccessRequestHandleReqInput<T = any> = {
id?: number;
title?: string;
access: T;
};
export type AccessRequestHandleReq<T = any> = PluginRequestHandleReq<AccessRequestHandleReqInput<T>>;
export type AccessRequestHandleContext = {
http: HttpClient;
logger: ILogger;
utils: typeof utils;
};
export class RequestHandler {
async onRequest(req: PluginRequest, ctx: RequestHandleContext) {
export class AccessRequestHandler<T = any> {
async onRequest(req: AccessRequestHandleReq<T>, ctx: AccessRequestHandleContext) {
if (!req.action) {
throw new Error("action is required");
}
@@ -31,3 +38,4 @@ export class RequestHandler {
throw new Error(`action ${req.action} not found`);
}
}

View File

@@ -1,7 +1,7 @@
import { logger } from "../utils/index.js";
import { setLogger, isPlus } from "@certd/plus";
import { setLogger, isPlus } from "@certd/plus-core";
setLogger(logger);
export * from "@certd/plus";
export * from "@certd/plus-core";
export function checkPlus() {
if (!isPlus()) {

View File

@@ -4,11 +4,15 @@ import { FileStore } from "../core/file-store.js";
import { Logger } from "log4js";
import { IAccessService } from "../access/index.js";
import { IEmailService } from "../service/index.js";
import { IContext } from "../core/index.js";
import { ILogger, logger } from "../utils/index.js";
import { IContext, PluginRequestHandleReq } from "../core/index.js";
import { ILogger, logger, utils } from "../utils/index.js";
import { HttpClient } from "../utils/util.request";
import { utils } from "../utils/index.js";
import dayjs from "dayjs";
import _ from "lodash-es";
export type UserInfo = {
role: "admin" | "user";
id: any;
};
export enum ContextScope {
global,
pipeline,
@@ -38,18 +42,13 @@ export type PluginDefine = Registrable & {
[key: string]: any;
};
reference?: {
src: string;
dest: string;
type: "computed";
}[];
needPlus?: boolean;
};
export type ITaskPlugin = {
onInstance(): Promise<void>;
execute(): Promise<void>;
onRequest(req: PluginRequestHandleReq<any>): Promise<any>;
[key: string]: any;
};
@@ -85,6 +84,8 @@ export type TaskInstanceContext = {
signal: AbortSignal;
//工具类
utils: typeof utils;
user: UserInfo;
};
export abstract class AbstractTaskPlugin implements ITaskPlugin {
@@ -107,6 +108,17 @@ export abstract class AbstractTaskPlugin implements ITaskPlugin {
this.accessService = ctx.accessService;
}
async getAccess(accessId: string) {
if (accessId == null) {
throw new Error("您还没有配置授权");
}
const res = await this.ctx.accessService.getById(accessId);
if (res == null) {
throw new Error("授权不存在,可能已被删除,请前往任务配置里面重新选择授权");
}
return res;
}
randomFileId() {
return Math.random().toString(36).substring(2, 9);
}
@@ -147,6 +159,26 @@ export abstract class AbstractTaskPlugin implements ITaskPlugin {
}
return name + "_" + dayjs().format("YYYYMMDDHHmmss");
}
async onRequest(req: PluginRequestHandleReq<any>) {
if (!req.action) {
throw new Error("action is required");
}
const methodName = `on${_.upperFirst(req.action)}`;
// @ts-ignore
const method = this[methodName];
if (method) {
// @ts-ignore
return await this[methodName](req.data);
}
throw new Error(`action ${req.action} not found`);
}
isAdmin() {
return this.ctx.user.role === "admin";
}
}
export type OutputVO = {

View File

@@ -22,5 +22,6 @@ export const pluginGroups = {
tencent: new PluginGroup("tencent", "腾讯云", 4),
host: new PluginGroup("host", "主机", 5),
cdn: new PluginGroup("cdn", "CDN", 6),
other: new PluginGroup("other", "其他", 7),
panel: new PluginGroup("panel", "面板", 7),
other: new PluginGroup("other", "其他", 8),
};

View File

@@ -1,25 +0,0 @@
import { ITaskPlugin } from "../api.js";
import { IsTaskPlugin, TaskInput } from "../decorator.js";
@IsTaskPlugin({
name: "EchoPlugin",
title: "测试插件",
desc: "test",
})
export class EchoPlugin implements ITaskPlugin {
@TaskInput({
title: "测试属性",
component: {
name: "text",
},
})
test?: string;
onInstance(): Promise<void> {
throw new Error("Method not implemented.");
}
async execute(): Promise<void> {
return Promise.resolve(undefined);
}
}

View File

@@ -6,11 +6,15 @@ export * from "./util.file.js";
export * from "./util.sp.js";
export * from "./util.promise.js";
export * from "./util.hash.js";
export * from "./util.merge.js";
export * from "./util.cache.js";
import { mergeUtils } from "./util.merge.js";
import { sp } from "./util.sp.js";
import { hashUtils } from "./util.hash.js";
import { promises } from "./util.promise.js";
import { fileUtils } from "./util.file.js";
import _ from "lodash-es";
import { cache } from "./util.cache.js";
export const utils = {
sleep,
http,
@@ -19,4 +23,6 @@ export const utils = {
promises,
file: fileUtils,
_,
mergeUtils,
cache,
};

View File

@@ -0,0 +1,8 @@
// LRUCache
import { LRUCache } from "lru-cache";
export const cache = new LRUCache<string, any>({
max: 1000,
ttl: 1000 * 60 * 10,
});

View File

@@ -0,0 +1,64 @@
import _ from "lodash-es";
function isUnMergeable(srcValue: any) {
return srcValue != null && srcValue instanceof UnMergeable;
}
function isUnCloneable(value: any) {
return isUnMergeable(value) && !value.cloneable;
}
function merge(target: any, ...sources: any) {
/**
* 如果目标为不可合并对象比如array、unMergeable、ref,则直接覆盖不合并
* @param objValue 被合并对象
* @param srcValue 来源对象
*/
function customizer(objValue: any, srcValue: any) {
if (srcValue == null) {
return;
}
// 如果被合并对象为数组,则直接被覆盖对象覆盖,只要覆盖对象不为空
if (_.isArray(objValue)) {
//原对象如果是数组
return srcValue; //来源对象
}
if (isUnMergeable(srcValue)) {
return srcValue;
}
}
let found: any = null;
for (const item of sources) {
if (isUnMergeable(item)) {
found = item;
}
}
if (found) {
return found;
}
return _.mergeWith(target, ...sources, customizer);
}
function cloneDeep(target: any) {
if (isUnCloneable(target)) {
return target;
}
function customizer(value: any) {
if (isUnCloneable(value)) {
return value;
}
}
return _.cloneDeepWith(target, customizer);
}
export class UnMergeable {
cloneable = false;
setCloneable(cloneable: any) {
this.cloneable = cloneable;
}
}
export const mergeUtils = {
merge,
cloneDeep,
};

View File

@@ -1,27 +0,0 @@
import { Autowire, IsTaskPlugin, ITaskPlugin, TaskInput, TaskOutput } from "../src";
@IsTaskPlugin({
name: "EchoPlugin",
title: "测试插件【echo】",
})
export class EchoPlugin implements ITaskPlugin {
@TaskInput({
title: "cert",
component: {
name: "pi-output-selector",
},
helper: "输出选择",
})
cert!: any;
@TaskOutput({
title: "cert info",
})
certInfo!: any;
// eslint-disable-next-line @typescript-eslint/no-empty-function
async onInstance(): Promise<void> {}
async execute(): Promise<void> {
console.log("input :cert", this.cert);
}
}

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29)
**Note:** Version bump only for package @certd/lib-huawei
## [1.25.5](https://github.com/certd/certd/compare/v1.25.4...v1.25.5) (2024-09-26)
**Note:** Version bump only for package @certd/lib-huawei
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
**Note:** Version bump only for package @certd/lib-huawei

View File

@@ -1,20 +1,21 @@
{
"name": "@certd/lib-huawei",
"private": false,
"version": "1.24.3",
"version": "1.25.6",
"main": "./dist/bundle.js",
"module": "./dist/bundle.js",
"types": "./dist/d/index.d.ts",
"scripts": {
"dev": "vite",
"build": "rollup -c ",
"before-build": "rimraf dist && rimraf tsconfig.tsbuildinfo && rimraf .rollup.cache",
"build": "npm run before-build && rollup -c ",
"build2": "vue-tsc --noEmit && vite build",
"preview": "vite preview"
},
"dependencies": {
"@certd/pipeline": "1.21.0",
"axios": "^1.7.2",
"rimraf": "^5.0.5",
"rollup": "^3.7.4"
},
"gitHead": "c49ccbde93dbad7062ac39d4f18eca7d561f573f"
"gitHead": "be13390b3a9177c9d99f1efabfc285d0c377b013"
}

View File

@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29)
### Performance Improvements
* 部署支持1Panel ([d047234](https://github.com/certd/certd/commit/d047234d98d31504f2e5a472b66e1b75806af26e))
## [1.25.5](https://github.com/certd/certd/compare/v1.25.4...v1.25.5) (2024-09-26)
**Note:** Version bump only for package @certd/lib-iframe
## [1.25.4](https://github.com/certd/certd/compare/v1.25.3...v1.25.4) (2024-09-25)
**Note:** Version bump only for package @certd/lib-iframe

View File

@@ -1,13 +1,14 @@
{
"name": "@certd/lib-iframe",
"private": false,
"version": "1.25.4",
"version": "1.25.6",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"dev": "vite",
"build": "tsc --skipLibCheck",
"before-build": "rimraf dist && rimraf tsconfig.tsbuildinfo && rimraf .rollup.cache",
"build": "npm run before-build && tsc --skipLibCheck",
"build3": "rollup -c",
"build2": "vue-tsc --noEmit && vite build",
"preview": "vite preview"
@@ -30,11 +31,12 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.8.8",
"rimraf": "^5.0.5",
"rollup": "^3.7.4",
"rollup-plugin-visualizer": "^5.8.2",
"ts-node": "^10.9.1",
"tslib": "^2.5.2",
"typescript": "^4.8.4"
"typescript": "^5.4.2"
},
"gitHead": "c2650d308c7f64af60f1658ea4844b0f2b13351b"
"gitHead": "be13390b3a9177c9d99f1efabfc285d0c377b013"
}

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.25.5](https://github.com/certd/certd/compare/v1.25.4...v1.25.5) (2024-09-26)
**Note:** Version bump only for package @certd/lib-jdcloud
## [1.25.4](https://github.com/certd/certd/compare/v1.25.3...v1.25.4) (2024-09-25)
**Note:** Version bump only for package @certd/lib-jdcloud

View File

@@ -1,28 +1,31 @@
{
"name": "@certd/lib-jdcloud",
"private": false,
"version": "1.25.4",
"version": "1.25.6",
"main": "./dist/bundle.mjs",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts",
"scripts": {
"dev": "vite",
"build": "rollup -c ",
"before-build": "rimraf dist && rimraf tsconfig.tsbuildinfo && rimraf .rollup.cache",
"build": "npm run before-build && rollup -c ",
"build2": "vue-tsc --noEmit && vite build",
"preview": "vite preview"
},
"dependencies": {
"@certd/pipeline": "1.21.0",
"axios": "^1.7.2",
"babel-register": "^6.26.0",
"buffer": "^5.0.8",
"create-hash": "^1.1.3",
"create-hmac": "^1.1.6",
"debug": "^3.1.0",
"node-fetch": "^2.1.2",
"rollup": "^3.7.4",
"url": "^0.11.0",
"uuid": "^3.1.0"
},
"gitHead": "c2650d308c7f64af60f1658ea4844b0f2b13351b"
"devDependencies": {
"babel-register": "^6.26.0",
"rimraf": "^5.0.5",
"rollup": "^3.7.4"
},
"gitHead": "be13390b3a9177c9d99f1efabfc285d0c377b013"
}

View File

@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29)
### Performance Improvements
* 部署支持1Panel ([d047234](https://github.com/certd/certd/commit/d047234d98d31504f2e5a472b66e1b75806af26e))
## [1.25.5](https://github.com/certd/certd/compare/v1.25.4...v1.25.5) (2024-09-26)
**Note:** Version bump only for package @certd/lib-k8s
## [1.25.4](https://github.com/certd/certd/compare/v1.25.3...v1.25.4) (2024-09-25)
**Note:** Version bump only for package @certd/lib-k8s

View File

@@ -1,13 +1,14 @@
{
"name": "@certd/lib-k8s",
"private": false,
"version": "1.25.4",
"version": "1.25.6",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"dev": "vite",
"build": "tsc --skipLibCheck",
"before-build": "rimraf dist && rimraf tsconfig.tsbuildinfo && rimraf .rollup.cache",
"build": "npm run before-build && tsc --skipLibCheck",
"build3": "rollup -c",
"build2": "vue-tsc --noEmit && vite build",
"preview": "vite preview"
@@ -16,7 +17,7 @@
"@kubernetes/client-node": "0.21.0"
},
"devDependencies": {
"@certd/pipeline": "^1.25.4",
"@certd/pipeline": "^1.25.6",
"@rollup/plugin-commonjs": "^23.0.4",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
@@ -31,11 +32,12 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.8.8",
"rimraf": "^5.0.5",
"rollup": "^3.7.4",
"rollup-plugin-visualizer": "^5.8.2",
"ts-node": "^10.9.1",
"tslib": "^2.5.2",
"typescript": "^4.8.4"
"typescript": "^5.4.2"
},
"gitHead": "c2650d308c7f64af60f1658ea4844b0f2b13351b"
"gitHead": "be13390b3a9177c9d99f1efabfc285d0c377b013"
}

View File

@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29)
### Performance Improvements
* 部署支持1Panel ([d047234](https://github.com/certd/certd/commit/d047234d98d31504f2e5a472b66e1b75806af26e))
## [1.25.5](https://github.com/certd/certd/compare/v1.25.4...v1.25.5) (2024-09-26)
**Note:** Version bump only for package @certd/midway-flyway-js
## [1.25.4](https://github.com/certd/certd/compare/v1.25.3...v1.25.4) (2024-09-25)
**Note:** Version bump only for package @certd/midway-flyway-js

View File

@@ -1,13 +1,14 @@
{
"name": "@certd/midway-flyway-js",
"version": "1.25.4",
"version": "1.25.6",
"description": "midway with flyway, sql upgrade way ",
"private": false,
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsc --skipLibCheck",
"before-build": "rimraf dist && rimraf tsconfig.tsbuildinfo && rimraf .rollup.cache",
"build": "npm run before-build && tsc --skipLibCheck",
"test": "midway-bin test --ts -V",
"test1": "midway-bin test --ts -V -f test/blank.test.ts -t 'hash-check'",
"cov": "midway-bin cov --ts",
@@ -46,12 +47,13 @@
"mwts": "^1.3.0",
"mwtsc": "^1.4.0",
"prettier": "^2.8.8",
"rimraf": "^5.0.5",
"rollup": "^3.7.4",
"rollup-plugin-visualizer": "^5.8.2",
"ts-node": "^10.9.1",
"tslib": "^2.5.2",
"typeorm": "^0.3.11",
"typescript": "~5.1.0"
"typescript": "^5.4.2"
},
"gitHead": "c2650d308c7f64af60f1658ea4844b0f2b13351b"
"gitHead": "be13390b3a9177c9d99f1efabfc285d0c377b013"
}

View File

@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29)
### Performance Improvements
* 部署支持1Panel ([d047234](https://github.com/certd/certd/commit/d047234d98d31504f2e5a472b66e1b75806af26e))
## [1.25.5](https://github.com/certd/certd/compare/v1.25.4...v1.25.5) (2024-09-26)
**Note:** Version bump only for package @certd/plugin-cert
## [1.25.4](https://github.com/certd/certd/compare/v1.25.3...v1.25.4) (2024-09-25)
**Note:** Version bump only for package @certd/plugin-cert

View File

@@ -1,23 +1,25 @@
{
"name": "@certd/plugin-cert",
"private": false,
"version": "1.25.4",
"version": "1.25.6",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"dev": "vite",
"build": "tsc --skipLibCheck",
"before-build": "rimraf dist && rimraf tsconfig.tsbuildinfo && rimraf .rollup.cache",
"build": "npm run before-build &&tsc --skipLibCheck",
"build3": "rollup -c",
"build2": "vue-tsc --noEmit && vite build",
"preview": "vite preview"
},
"dependencies": {
"@certd/acme-client": "^1.25.4",
"@certd/pipeline": "^1.25.4",
"@certd/acme-client": "^1.25.6",
"@certd/pipeline": "^1.25.6",
"jszip": "^3.10.1",
"node-forge": "^0.10.0",
"psl": "^1.9.0"
"psl": "^1.9.0",
"rimraf": "^5.0.5"
},
"devDependencies": {
"@alicloud/cs20151215": "^3.0.3",
@@ -49,9 +51,9 @@
"rollup-plugin-visualizer": "^5.8.2",
"ts-node": "^10.9.1",
"tslib": "^2.5.2",
"typescript": "^4.8.4",
"typescript": "^5.4.2",
"vite": "^3.1.0",
"vue-tsc": "^0.38.9"
},
"gitHead": "c2650d308c7f64af60f1658ea4844b0f2b13351b"
"gitHead": "be13390b3a9177c9d99f1efabfc285d0c377b013"
}

View File

@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29)
### Performance Improvements
* 部署支持1Panel ([d047234](https://github.com/certd/certd/commit/d047234d98d31504f2e5a472b66e1b75806af26e))
* 增加使用教程 ([9d9c021](https://github.com/certd/certd/commit/9d9c0218195af5b9896cce7109b26a433480571d))
## [1.25.5](https://github.com/certd/certd/compare/v1.25.4...v1.25.5) (2024-09-26)
**Note:** Version bump only for package @certd/ui-client
## [1.25.4](https://github.com/certd/certd/compare/v1.25.3...v1.25.4) (2024-09-25)
**Note:** Version bump only for package @certd/ui-client

View File

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

View File

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 124 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 145 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View File

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

@@ -9,6 +9,7 @@ import CronEditor from "./cron-editor/index.vue";
import { CronLight } from "@vue-js-cron/light";
import "@vue-js-cron/light/dist/light.css";
import Plugins from "./plugins/index";
import TutorialButton from "./tutorial/index.vue";
export default {
install(app: any) {
app.component("PiContainer", PiContainer);
@@ -24,6 +25,8 @@ export default {
app.component("InfoCircleOutlined", InfoCircleOutlined);
app.component("UndoOutlined", UndoOutlined);
app.component("TutorialButton", TutorialButton);
app.use(vip);
app.use(Plugins);
}

View File

@@ -0,0 +1,47 @@
<script setup lang="ts">
import { ComponentPropsType, doRequest } from "/@/components/plugins/lib";
import { ref, watch } from "vue";
const props = defineProps<
{
watches: string[];
} & ComponentPropsType
>();
const emit = defineEmits<{
"update:value": any;
}>();
const optionsRef = ref([]);
const getOptions = async () => {
return await doRequest({
type: props.type,
typeName: props.typeName,
action: props.action,
input: props.form
});
};
watch(
() => {
const values = [];
for (const item of props.watches) {
values.push(props.form[item]);
}
return {
form: props.form,
watched: values
};
},
async () => {
optionsRef.value = await getOptions();
},
{ immediate: true }
);
</script>
<template>
<a-select class="remote-select" :options="optionsRef" :value="value" @update:value="emit('update:value', $event)" />
</template>
<style lang="less"></style>

View File

@@ -1,6 +1,8 @@
import PiSynologyIdDeviceGetter from "./synology/device-id-getter.vue";
import SynologyIdDeviceGetter from "./synology/device-id-getter.vue";
import RemoteSelect from "./common/remote-select.vue";
export default {
install(app: any) {
app.component("PiSynologyDeviceIdGetter", PiSynologyIdDeviceGetter);
app.component("SynologyDeviceIdGetter", SynologyIdDeviceGetter);
app.component("RemoteSelect", RemoteSelect);
}
};

View File

@@ -0,0 +1,31 @@
import { request } from "/@/api/service";
export type ComponentPropsType = {
type: string;
typeName: string;
action: string;
form: any;
value?: any;
};
export type RequestHandleReq<T = any> = {
type: strin;
typeName: string;
action: string;
data: any;
input: T;
};
export async function doRequest(req: RequestHandleReq) {
const url = req.type === "access" ? "/pi/handle/access" : "/pi/handle/plugin";
const { typeName, action, data, input } = req;
const res = await request({
url,
method: "post",
data: {
typeName,
action,
data,
input
}
});
return res;
}

View File

@@ -11,15 +11,10 @@
<script lang="tsx" setup>
import { defineProps, ref, useAttrs } from "vue";
import { request } from "/@/api/service";
import { Modal } from "ant-design-vue";
import { ComponentPropsType, doRequest } from "/@/components/plugins/lib";
const props = defineProps<{
type: string;
typeName: string;
form: any;
value?: any;
}>();
const props = defineProps<ComponentPropsType>();
const emit = defineEmits<{
"update:value": any;
@@ -29,24 +24,15 @@ const attrs = useAttrs();
const otpCodeRef = ref("");
async function doRequest(action: string, data: any) {
const res = await request({
url: "/pi/handle",
method: "post",
data: {
type: props.type,
typeName: props.typeName,
action,
data: data,
input: props.form.access
}
});
return res;
}
async function loginWithOTPCode(otpCode: string) {
return await doRequest("LoginWithOPTCode", {
otpCode
return await doRequest({
type: props.type,
typeName: props.typeName,
action: "LoginWithOPTCode",
data: {
otpCode
},
form: props.form
});
}

View File

@@ -0,0 +1,37 @@
<script setup lang="ts">
import { ref } from "vue";
import TutorialSteps from "/@/components/tutorial/tutorial-steps.vue";
const openedRef = ref(false);
function open() {
openedRef.value = true;
}
function close() {
openedRef.value = false;
}
function prev() {
console.log("prev");
}
function next() {
console.log("next");
}
</script>
<template>
<div class="tutorial-button" @click="open">
<fs-icon icon="mingcute:question-line"></fs-icon>
<div class="ml-5">使用教程</div>
<a-modal v-model:open="openedRef" class="tutorial-modal" width="90%">
<template #title> 使用教程 </template>
<tutorial-steps v-if="openedRef" />
<template #footer></template>
</a-modal>
</div>
</template>
<style lang="less">
.tutorial-modal {
.ant-modal-body {
height: 70vh;
}
}
</style>

View File

@@ -0,0 +1,313 @@
<template>
<div class="flex-col h-100 tutorial-steps">
<a-steps v-model:current="current" class="mt-10" :percent="percent" size="small" :items="steps" @change="stepChanged"></a-steps>
<div class="step-item overflow-hidden">
<div class="text">
<h3 class="title">{{ number }} {{ currentStepItem.title }}</h3>
<div class="description mt-5">
<div v-for="desc of currentStepItem.descriptions">{{ desc }}</div>
</div>
</div>
<div class="image-box">
<a-image :src="currentStepItem.image" />
</div>
</div>
<div class="flex-center actions">
<fs-button class="m-10" icon="mingcute:arrow-left-fill" @click="prev()">上一步</fs-button>
<fs-button class="m-10" icon-right="mingcute:arrow-right-fill" @click="next()">下一步</fs-button>
</div>
</div>
</template>
<script setup lang="ts">
type Step = {
title: string;
subTitle?: string;
description?: string;
items: StepItems[];
};
type StepItems = {
image: string;
title: string;
descriptions?: string[];
};
import { computed, nextTick, ref } from "vue";
const steps = ref<Step[]>([
{
title: "创建证书申请流水线",
description: "演示证书申请任务如何配置",
items: [
{
image: "/doc/images/1-add.png",
title: "创建证书流水线",
descriptions: ["点击添加流水线,选择证书申请"]
},
{
image: "/doc/images/2-access-provider.png",
title: "DNS授权",
descriptions: ["证书申请需要给域名添加TXT解析记录来验证域名所有权"]
},
{
image: "/doc/images/3-add-access.png",
title: "第一次使用需要添加DNS授权",
descriptions: ["选择DNS授权确认创建"]
},
// {
// image: "/doc/images/3-add-access.png",
// title: "确定创建流水线",
// descriptions: ["选择DNS授权信息填写无误确认创建"]
// },
{
image: "/doc/images/4-add-success.png",
title: "流水线创建成功",
descriptions: ["此时证书申请任务已经建好,点击手动触发即可测试证书申请", "接下来演示如何添加部署任务"]
}
]
},
{
title: "添加部署证书任务",
description: "演示部署到阿里云CDN和Nginx",
items: [
{
image: "/doc/images/6-1-add-task.png",
title: "添加部署任务",
descriptions: ["演示第一个部署任务部署到阿里云CDN"]
},
{
image: "/doc/images/6-2-add-task.png",
title: "选择任务插件",
descriptions: ["可以搜索插件这里选择阿里云CDN插件"]
},
{
image: "/doc/images/6-3-add-task.png",
title: "配置任务参数",
descriptions: ["填写CDN的域名和证书ID", "任务保存之后阿里云CDN的部署任务就配置好了"]
},
{
image: "/doc/images/7-1-add-host-task.png",
title: "添加主机部署任务",
descriptions: ["接下来演示配置第二个部署任务,部署到主机", "部署到主机分两步: 1. 上传证书到主机 2. 运行主机命令"]
},
{
image: "/doc/images/7-2-add-host-task.png",
title: "配置上传到主机任务",
descriptions: ["填写上传到主机任务参数", "比如证书保存路径"]
},
{
image: "/doc/images/7-3-add-host-task.png",
title: "添加主机ssh登录授权",
descriptions: ["填写主机ip、用户名、密码授权只需添加一次后续其他任务可以复用"]
},
{
image: "/doc/images/8-1-add-host-task.png",
title: "上传到主机任务配置完成",
descriptions: ["接下来配置主机执行脚本,去部署证书"]
},
{
image: "/doc/images/8-2-add-host-task.png",
title: "选择添加主机远程命令任务",
descriptions: ["选择主机远程命令任务"]
},
{
image: "/doc/images/8-4-add-host-task.png",
title: "填写证书部署脚本",
descriptions: ["选择主机授权编写部署脚本这里演示部署到nginx需要重启nginx让证书生效"]
},
{
image: "/doc/images/8-5-add-host-task.png",
title: "上传到主机任务的两个步骤配置完成",
descriptions: ["接下来测试运行"]
}
]
},
{
title: "运行与测试",
description: "演示流水线运行,查看日志,成功后跳过等",
items: [
{
image: "/doc/images/9-start.png",
title: "运行测试一下",
descriptions: ["之前是把证书上传到主机,接下来要运行命令,去部署证书"]
},
{
image: "/doc/images/10-1-log.png",
title: "查看日志",
descriptions: ["点击任务可以查看状态和日志"]
},
{
image: "/doc/images/11-1-error.png",
title: "执行失败如何排查",
descriptions: ["查看错误日志"]
},
{
image: "/doc/images/11-2-error.png",
title: "执行失败如何排查",
descriptions: ["查看错误日志,这里报的是nginx容器不存在修改命令改成正确的nginx容器名称"]
},
{
image: "/doc/images/12-1-log-success.png",
title: "执行成功",
descriptions: ["修改正确后,重新点击手动触发,重新运行一次,执行成功"]
},
{
image: "/doc/images/12-2-skip-log.png",
title: "成功后自动跳过",
descriptions: ["可以看到成功过的将会自动跳过,不会重复执行,只有当参数变更或者证书更新了,才会重新运行"]
},
{
image: "/doc/images/13-1-result.png",
title: "查看证书部署成功",
descriptions: ["访问nginx上的网站可以看到证书已经部署成功"]
},
{
image: "/doc/images/13-2-result.png",
title: "阿里云CDN也部署成功",
descriptions: ["阿里云CDN上已经更新证书证书名称已certd开头"]
},
{
image: "/doc/images/13-3-download.png",
title: "还可以下载证书,手动部署",
descriptions: ["如果还没有好用的部署插件,没办法自动部署,你还可以下载证书,手动部署"]
}
]
},
{
title: "设置定时执行和邮件通知",
description: "自动运行",
items: [
{
image: "/doc/images/14-timer.png",
title: "设置定时执行",
descriptions: [
"流水线测试成功,接下来配置定时触发,以后每天定时执行就不用管了",
"推荐配置每天运行一次在到期前20天才会重新申请新证书并部署没到期前会自动跳过不会重复申请。"
]
},
{
image: "/doc/images/15-1-email.png",
title: "设置邮件通知",
descriptions: ["建议选择监听'错误时'和'错误转成功'两种即可,在意外失败时可以尽快去排查问题,(免费版需要配置邮件服务器)"]
}
]
}
]);
const current = ref(0);
const currentItem = ref(0);
const number = computed(() => {
return `${current.value + 1}-${currentItem.value + 1}. `;
});
const currentStep = computed(() => {
return steps.value[current.value];
});
const currentStepItem = computed(() => {
return currentStep.value.items[currentItem.value];
});
const percent = computed(() => {
return ((currentItem.value + 1) / currentStep.value.items.length) * 100;
});
function stepNext() {
if (current.value < steps.value.length - 1) {
current.value++;
return true;
}
return false;
}
function stepPrev() {
if (current.value > 0) {
current.value--;
return true;
} else {
return false;
}
}
function next() {
if (currentItem.value < currentStep.value.items.length - 1) {
currentItem.value++;
} else {
if (stepNext()) {
currentItem.value = 0;
}
}
}
function prev() {
if (currentItem.value > 0) {
currentItem.value--;
} else {
if (stepPrev()) {
nextTick(() => {
currentItem.value = currentStep.value.items.length - 1;
});
}
}
}
function stepChanged(index: number) {
current.value = index;
currentItem.value = 0;
}
</script>
<style lang="less">
.tutorial-steps {
.step-item {
display: flex !important;
flex-direction: column;
align-items: center;
justify-content: center;
flex: 1;
padding: 20px;
.text {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20px;
}
.image-box {
overflow: hidden;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: #eee;
width: 100%;
height: 100%;
img {
height: 100%;
width: 100%;
object-fit: contain;
}
}
.desc {
margin-top: 10px;
font-size: 16px;
font-weight: bold;
}
}
.actions {
.fs-icon {
margin-left: 5px;
margin-right: 5px;
}
}
.ant-steps .ant-steps-item-description {
font-size: 12px !important;
color: #999 !important;
}
}
</style>

View File

@@ -19,6 +19,7 @@
</div>
<fs-menu class="header-menu" mode="horizontal" :expand-selected="false" :selectable="false" :menus="frameworkMenus" />
<vip-button class="flex-center header-btn" mode="nav" />
<tutorial-button class="flex-center header-btn" />
</div>
<div class="header-right header-buttons">
<!-- <button-->
@@ -84,10 +85,23 @@ import FsThemeSet from "/@/layout/components/theme/index.vue";
import { env } from "../utils/util.env";
import FsThemeModeSet from "./components/theme/mode-set.vue";
import VipButton from "/@/components/vip-button/index.vue";
import TutorialSteps from "/@/components/tutorial/tutorial-steps.vue";
export default {
name: "LayoutFramework",
// eslint-disable-next-line vue/no-unused-components
components: { FsThemeSet, MenuFoldOutlined, MenuUnfoldOutlined, FsMenu, FsLocale, FsSourceLink, FsUserInfo, FsTabs, FsThemeModeSet, VipButton },
components: {
TutorialSteps,
FsThemeSet,
MenuFoldOutlined,
MenuUnfoldOutlined,
FsMenu,
FsLocale,
FsSourceLink,
FsUserInfo,
FsTabs,
FsThemeModeSet,
VipButton
},
setup() {
const resourceStore = useResourceStore();
const frameworkMenus = computed(() => {

View File

@@ -20,6 +20,7 @@ div#app {
h1, h2, h3, h4, h5, h6 {
margin-bottom: 0;
margin-top:0;
}
.fs-desc {
@@ -197,4 +198,4 @@ h1, h2, h3, h4, h5, h6 {
}
.cursor-pointer{
cursor: pointer;
}
}

View File

@@ -1,23 +1,19 @@
import _ from "lodash-es";
import { compute } from "@fast-crud/fast-crud";
import { asyncCompute, compute } from "@fast-crud/fast-crud";
import { computed } from "vue";
export type MergeScriptContext = {
compute: typeof compute;
asyncCompute: typeof asyncCompute;
computed: typeof computed;
};
export function useReference(formItem: any) {
if (formItem.reference) {
for (const reference of formItem.reference) {
_.set(
formItem,
reference.dest,
compute<any>((scope) => {
return _.get(scope, reference.src);
})
);
}
delete formItem.reference;
}
if (formItem.mergeScript) {
const ctx = {
compute
compute,
asyncCompute,
computed
};
const script = formItem.mergeScript;
const func = new Function("ctx", script);

View File

@@ -102,7 +102,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
},
type: ["text"],
form: {
rules: [{ required: true, message: "请填写名称" }]
rules: [{ required: true, message: "请填写名称" }],
helper: "随便填,当多个相同类型的授权时,便于区分"
},
column: {
width: 200

View File

@@ -4,11 +4,19 @@
<div class="title">权限管理</div>
</template>
<fs-crud ref="crudRef" v-bind="crudBinding">
<a-button v-permission="'sys:auth:per:add'" style="margin-left: 20px" @click="addHandle({})">
<a-button v-permission="'1sys:auth:per:add'" style="margin-left: 20px" @click="addHandle({})">
<fs-icon :icon="ui.icons.add"></fs-icon>
添加
</a-button>
<fs-permission-tree class="permission-tree mt-10" :tree="crudBinding.data" :checkable="false" :actions="permission" @add="addHandle" @edit="editHandle" @remove="removeHandle"></fs-permission-tree>
<fs-permission-tree
class="permission-tree mt-10"
:tree="crudBinding.data"
:checkable="false"
:actions="permission"
@add="addHandle"
@edit="editHandle"
@remove="removeHandle"
></fs-permission-tree>
</fs-crud>
</fs-page>
</template>
@@ -49,9 +57,9 @@ export default defineComponent({
const { hasPermissions } = usePermission();
const permission = ref({
add: hasPermissions("sys:auth:per:add"),
edit: hasPermissions("sys:auth:per:edit"),
remove: hasPermissions("sys:auth:per:remove")
add: hasPermissions("1sys:auth:per:add"),
edit: hasPermissions("1sys:auth:per:edit"),
remove: hasPermissions("1sys:auth:per:remove")
});
return {

View File

@@ -3,6 +3,20 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29)
### Bug Fixes
* 修复中间证书复制错误的bug ([76e86ea](https://github.com/certd/certd/commit/76e86ea283ecbe4ec76cdc92b98457d0fef544ac))
### Performance Improvements
* 部署支持1Panel ([d047234](https://github.com/certd/certd/commit/d047234d98d31504f2e5a472b66e1b75806af26e))
## [1.25.5](https://github.com/certd/certd/compare/v1.25.4...v1.25.5) (2024-09-26)
**Note:** Version bump only for package @certd/ui-server
## [1.25.4](https://github.com/certd/certd/compare/v1.25.3...v1.25.4) (2024-09-25)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/ui-server",
"version": "1.25.4",
"version": "1.25.6",
"description": "fast-server base midway",
"private": true,
"type": "module",
@@ -22,14 +22,15 @@
"dependencies": {
"@alicloud/cs20151215": "^3.0.3",
"@alicloud/pop-core": "^1.7.10",
"@certd/acme-client": "^1.25.4",
"@certd/lib-huawei": "^1.24.3",
"@certd/lib-jdcloud": "^1.25.4",
"@certd/lib-k8s": "^1.25.4",
"@certd/midway-flyway-js": "^1.25.4",
"@certd/pipeline": "^1.25.4",
"@certd/plugin-cert": "^1.25.4",
"@certd/plugin-plus": "^1.25.4",
"@certd/acme-client": "^1.25.6",
"@certd/lib-huawei": "^1.25.6",
"@certd/lib-jdcloud": "^1.25.6",
"@certd/lib-k8s": "^1.25.6",
"@certd/midway-flyway-js": "^1.25.6",
"@certd/pipeline": "^1.25.6",
"@certd/plugin-cert": "^1.25.6",
"@certd/plugin-plus": "^1.25.6",
"@certd/plus-core": "^1.25.4",
"@koa/cors": "^5.0.0",
"@midwayjs/bootstrap": "^3.16.2",
"@midwayjs/cache": "^3.14.0",
@@ -59,7 +60,7 @@
"kubernetes-client": "^9.0.0",
"lodash-es": "^4.17.21",
"log4js": "^6.7.1",
"lru-cache": "^10.0.0",
"lru-cache": "^10.2.0",
"md5": "^2.3.0",
"mwtsc": "^1.4.0",
"nanoid": "^4.0.0",
@@ -68,6 +69,7 @@
"qiniu": "^7.12.0",
"querystring": "^0.2.1",
"reflect-metadata": "^0.1.13",
"rimraf": "^5.0.5",
"ssh2": "^1.15.0",
"strip-ansi": "^7.1.0",
"svg-captcha": "^1.4.0",
@@ -93,7 +95,7 @@
"mwts": "^1.3.0",
"prettier": "^2.8.8",
"ts-node": "^10.9.2",
"typescript": "~5.1.0"
"typescript": "^5.4.2"
},
"engines": {
"node": ">=18.0.0"

View File

@@ -1,12 +1,4 @@
import {
ALL,
Body,
Controller,
Inject,
Post,
Provide,
Query,
} from '@midwayjs/core';
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
import { CrudController } from '../../../basic/crud-controller.js';
import { PermissionService } from '../service/permission-service.js';
@@ -49,7 +41,7 @@ export class PermissionController extends CrudController<PermissionService> {
@Post('/delete', { summary: 'sys:auth:per:remove' })
async delete(
@Query('id')
id : number
id: number
) {
return await super.delete(id);
}

View File

@@ -16,4 +16,6 @@ export class UserRoleService extends BaseService<UserRoleEntity> {
getRepository() {
return this.repository;
}
}

View File

@@ -204,4 +204,16 @@ export class UserService extends BaseService<UserEntity> {
}
await super.delete(ids);
}
async isAdmin(userId: any) {
const userRoles = await this.userRoleService.find({
where: {
userId,
},
});
const roleIds = userRoles.map(item => item.roleId);
if (roleIds.includes(1)) {
return true;
}
}
}

View File

@@ -1,36 +1,110 @@
import { ALL, Body, Controller, Post, Provide } from '@midwayjs/core';
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
import { Constants } from '../../../basic/constants.js';
import { accessRegistry, http, logger, PluginRequest, RequestHandleContext } from '@certd/pipeline';
import { merge } from 'lodash-es';
import {
accessRegistry,
AccessRequestHandleContext,
AccessRequestHandleReq,
http,
ITaskPlugin,
logger,
mergeUtils,
pluginRegistry,
PluginRequestHandleReq,
TaskInstanceContext,
utils,
} from '@certd/pipeline';
import { BaseController } from '../../../basic/base-controller.js';
import { AccessService } from '../service/access-service.js';
import { EmailService } from '../../basic/service/email-service.js';
@Provide()
@Controller('/api/pi/handle')
export class HandleController extends BaseController {
@Post('/', { summary: Constants.per.authOnly })
async request(@Body(ALL) body: PluginRequest) {
const type = body.type;
if (type === 'access') {
const accessItem = accessRegistry.get(body.typeName);
const accessCls = accessItem.target;
if (accessCls == null) {
throw new Error(`access ${body.typeName} not found`);
}
//实例化access
//@ts-ignore
const access = new accessCls();
//注入input
merge(access, body.input);
const ctx: RequestHandleContext = {
http: http,
logger: logger,
};
const res = await access.onRequest(body, ctx);
@Inject()
accessService: AccessService;
return this.ok(res);
} else if (type === 'plugin') {
throw new Error(`plugin:${body.typeName} not support`);
} else {
throw new Error(`type:${type} not support`);
@Inject()
emailService: EmailService;
@Post('/access', { summary: Constants.per.authOnly })
async accessRequest(@Body(ALL) body: AccessRequestHandleReq) {
const accessItem = accessRegistry.get(body.typeName);
const accessCls = accessItem.target;
if (accessCls == null) {
throw new Error(`access ${body.typeName} not found`);
}
//实例化access
//@ts-ignore
const access = new accessCls();
let isNew = true;
if (body.input.id > 0) {
const oldEntity = await this.accessService.info(body.input.id);
if (!oldEntity) {
isNew = false;
const param = {
type: body.typeName,
setting: JSON.stringify(body.input.access),
};
this.accessService.encryptSetting(param, oldEntity);
body.input.access = JSON.parse(param.setting);
}
}
if (isNew) {
mergeUtils.merge(access, body.input.access);
}
const ctx: AccessRequestHandleContext = {
http: http,
logger: logger,
utils,
};
const res = await access.onRequest(body, ctx);
return this.ok(res);
}
@Post('/plugin', { summary: Constants.per.authOnly })
async pluginRequest(@Body(ALL) body: PluginRequestHandleReq) {
const pluginDefine = pluginRegistry.get(body.typeName);
const pluginCls = pluginDefine.target;
if (pluginCls == null) {
throw new Error(`plugin ${body.typeName} not found`);
}
//实例化access
//@ts-ignore
const plugin: PluginRequestHandler = new pluginCls();
//@ts-ignore
const instance = plugin as ITaskPlugin;
//@ts-ignore
const taskCtx: TaskInstanceContext = {
pipeline: undefined,
step: undefined,
lastStatus: undefined,
http,
logger: logger,
inputChanged: true,
accessService: this.accessService,
emailService: this.emailService,
pipelineContext: undefined,
userContext: undefined,
fileStore: undefined,
signal: undefined,
// pipelineContext: this.pipelineContext,
// userContext: this.contextFactory.getContext('user', this.options.userId),
// fileStore: new FileStore({
// scope: this.pipeline.id,
// parent: this.runtime.id,
// rootDir: this.options.fileRootDir,
// }),
// signal: this.abort.signal,
utils,
};
instance.setCtx(taskCtx);
mergeUtils.merge(plugin, body.input);
await instance.onInstance();
const res = await plugin.onRequest(body);
return this.ok(res);
}
}

View File

@@ -4,7 +4,7 @@ import { In, Repository } from 'typeorm';
import { BaseService } from '../../../basic/base-service.js';
import { PipelineEntity } from '../entity/pipeline.js';
import { PipelineDetail } from '../entity/vo/pipeline-detail.js';
import { Executor, isPlus, Pipeline, ResultType, RunHistory } from '@certd/pipeline';
import { Executor, isPlus, Pipeline, ResultType, RunHistory, UserInfo } from '@certd/pipeline';
import { AccessService } from './access-service.js';
import { DbStorage } from './db-storage.js';
import { StorageService } from './storage-service.js';
@@ -16,9 +16,11 @@ import { HistoryLogService } from './history-log-service.js';
import { logger } from '../../../utils/logger.js';
import { EmailService } from '../../basic/service/email-service.js';
import { NeedVIPException } from '../../../basic/exception/vip-exception.js';
import { UserService } from '../../authority/service/user-service.js';
const runningTasks: Map<string | number, Executor> = new Map();
const freeCount = 10;
/**
* 证书申请
*/
@@ -38,6 +40,9 @@ export class PipelineService extends BaseService<PipelineEntity> {
@Inject()
historyLogService: HistoryLogService;
@Inject()
userService: UserService;
@Inject()
cron: Cron;
@@ -331,9 +336,13 @@ export class PipelineService extends BaseService<PipelineEntity> {
const userId = entity.userId;
const historyId = await this.historyService.start(entity);
const userIsAdmin = await this.userService.isAdmin(userId);
const user: UserInfo = {
id: userId,
role: userIsAdmin ? 'admin' : 'user',
};
const executor = new Executor({
userId,
user,
pipeline,
onChanged,
accessService: this.accessService,

View File

@@ -8,7 +8,7 @@ import path from 'path';
name: 'CopyToLocal',
title: '复制到本机',
icon: 'solar:copy-bold-duotone',
desc: '实际上是复制证书到docker容器内的某个路径需要做目录映射到宿主机',
desc: '【仅管理员使用】实际上是复制证书到docker容器内的某个路径需要做目录映射到宿主机',
group: pluginGroups.host.key,
default: {
strategy: {
@@ -19,9 +19,9 @@ import path from 'path';
export class CopyCertToLocalPlugin extends AbstractTaskPlugin {
@TaskInput({
title: '证书保存路径',
helper: '路径要包含文件名,文件名不能用*?!等特殊符号' + '\n推荐使用相对路径将写入与数据库同级目录无需映射例如./tmp/cert.pem',
helper: '全链证书,路径要包含文件名,文件名不能用*?!等特殊符号' + '\n推荐使用相对路径将写入与数据库同级目录无需映射例如./tmp/cert.pem',
component: {
placeholder: './tmp/cert.pem',
placeholder: './tmp/full_chain.pem',
},
})
crtPath!: string;
@@ -34,6 +34,15 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin {
})
keyPath!: string;
@TaskInput({
title: '中间证书保存路径',
helper: '一般情况传上面两个文件就行了,极少数情况需要这个中间证书',
component: {
placeholder: '/root/deploy/nginx/intermediate.pem',
},
})
icPath!: string;
@TaskInput({
title: 'PFX证书保存路径',
helper: '用于IIS证书部署路径要包含文件名文件名不能用*?!等特殊符号\n推荐使用相对路径将写入与数据库同级目录无需映射例如./tmp/cert.pfx',
@@ -76,6 +85,12 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin {
})
hostKeyPath!: string;
@TaskOutput({
title: '中间证书保存路径',
type: 'HostKeyPath',
})
hostIcPath!: string;
@TaskOutput({
title: 'PFX保存路径',
type: 'HostPfxPath',
@@ -99,10 +114,14 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin {
fs.copyFileSync(srcFile, destFile);
}
async execute(): Promise<void> {
let { crtPath, keyPath, pfxPath, derPath } = this;
if (!this.isAdmin()) {
throw new Error('只有管理员才能运行此任务');
}
let { crtPath, keyPath, icPath, pfxPath, derPath } = this;
const certReader = new CertReader(this.cert);
const handle = async ({ reader, tmpCrtPath, tmpKeyPath, tmpDerPath, tmpPfxPath }) => {
const handle = async ({ reader, tmpCrtPath, tmpKeyPath, tmpDerPath, tmpPfxPath, tmpIcPath }) => {
this.logger.info('复制到目标路径');
if (crtPath) {
crtPath = crtPath.startsWith('/') ? crtPath : path.join(Constants.dataDir, crtPath);
@@ -114,6 +133,11 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin {
this.copyFile(tmpKeyPath, keyPath);
this.hostKeyPath = keyPath;
}
if (icPath) {
icPath = icPath.startsWith('/') ? icPath : path.join(Constants.dataDir, icPath);
this.copyFile(tmpIcPath, icPath);
this.hostIcPath = icPath;
}
if (pfxPath) {
pfxPath = pfxPath.startsWith('/') ? pfxPath : path.join(Constants.dataDir, pfxPath);
this.copyFile(tmpPfxPath, pfxPath);

View File

@@ -18,10 +18,10 @@ import { SshAccess } from '../../access/index.js';
})
export class UploadCertToHostPlugin extends AbstractTaskPlugin {
@TaskInput({
title: 'PEM证书保存路径',
helper: '需要有写入权限,路径要包含证书文件名,文件名不能用*?!等特殊符号,例如:/tmp/cert.pem',
title: '证书保存路径',
helper: '全链证书,需要有写入权限,路径要包含证书文件名,文件名不能用*?!等特殊符号,例如:/tmp/cert.pem',
component: {
placeholder: '/root/deploy/nginx/cert.pem',
placeholder: '/root/deploy/nginx/full_chain.pem',
},
})
crtPath!: string;
@@ -36,9 +36,9 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
@TaskInput({
title: '中间证书保存路径',
helper: '需要有写入权限,路径要包含私钥文件名,文件名不能用*?!等特殊符号,例如:/tmp/intermediate.crt',
helper: '一般情况传上面两个文件即可,极少数情况需要这个中间证书',
component: {
placeholder: '/root/deploy/nginx/intermediate.crt',
placeholder: '/root/deploy/nginx/intermediate.pem',
},
})
icPath!: string;
@@ -79,7 +79,7 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
name: 'pi-access-selector',
type: 'ssh',
},
rules: [{ required: false, message: '' }],
required: true,
})
accessId!: string;
@@ -106,20 +106,6 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
})
script!: string;
@TaskInput({
title: '仅复制到当前主机',
helper:
'注意:本配置即将废弃\n' +
'开启后将直接复制到当前主机某个目录不上传到主机由于是docker启动实际上是复制到docker容器内的“证书保存路径”\n' +
'你需要事先在docker-compose.yaml中配置主机目录映射 volumes: /your_target_path:/your_target_path',
value: false,
component: {
name: 'a-switch',
vModel: 'checked',
},
})
copyToThisHost!: boolean;
@TaskOutput({
title: '证书保存路径',
})
@@ -161,81 +147,91 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
async execute(): Promise<void> {
const { crtPath, keyPath, cert, accessId } = this;
const certReader = new CertReader(cert);
const connectConf: SshAccess = await this.accessService.getById(accessId);
const sshClient = new SshClient(this.logger);
const handle = async (opts: CertReaderHandleContext) => {
const { tmpCrtPath, tmpKeyPath, tmpDerPath, tmpPfxPath, tmpIcPath } = opts;
if (this.copyToThisHost) {
this.logger.info('复制到目标路径');
this.copyFile(tmpCrtPath, crtPath);
this.copyFile(tmpKeyPath, keyPath);
this.copyFile(tmpIcPath, this.icPath);
this.copyFile(tmpPfxPath, this.pfxPath);
this.copyFile(tmpDerPath, this.derPath);
} else {
if (!accessId) {
throw new Error('主机登录授权配置不能为空');
}
this.logger.info('准备上传文件到服务器');
// if (this.copyToThisHost) {
// this.logger.info('复制到目标路径');
// this.copyFile(tmpCrtPath, crtPath);
// this.copyFile(tmpKeyPath, keyPath);
// this.copyFile(tmpIcPath, this.icPath);
// this.copyFile(tmpPfxPath, this.pfxPath);
// this.copyFile(tmpDerPath, this.derPath);
// this.logger.warn('复制到当前主机功能已迁移到 “复制到本机”插件,请尽快换成复制到本机插件');
// return;
// }
const transports: any = [];
if (crtPath) {
transports.push({
localPath: tmpCrtPath,
remotePath: crtPath,
});
this.logger.info(`上传证书到主机:${crtPath}`);
}
if (keyPath) {
transports.push({
localPath: tmpKeyPath,
remotePath: keyPath,
});
this.logger.info(`上传私钥到主机:${keyPath}`);
}
if (this.icPath) {
transports.push({
localPath: tmpIcPath,
remotePath: this.icPath,
});
this.logger.info(`上传中间证书到主机:${this.icPath}`);
}
if (this.pfxPath) {
transports.push({
localPath: tmpPfxPath,
remotePath: this.pfxPath,
});
this.logger.info(`上传PFX证书到主机${this.pfxPath}`);
}
if (this.derPath) {
transports.push({
localPath: tmpDerPath,
remotePath: this.derPath,
});
this.logger.info(`上传DER证书到主机${this.derPath}`);
}
this.logger.info('开始上传文件到服务器');
await sshClient.uploadFiles({
connectConf,
transports,
mkdirs: this.mkdirs,
});
this.logger.info('上传文件到服务器成功');
//输出
this.hostCrtPath = crtPath;
this.hostKeyPath = keyPath;
this.hostIcPath = this.icPath;
this.hostPfxPath = this.pfxPath;
this.hostDerPath = this.derPath;
if (accessId == null) {
this.logger.error('复制到当前主机功能已迁移到 “复制到本机”插件,请换成复制到本机插件');
return;
}
const connectConf: SshAccess = await this.accessService.getById(accessId);
const sshClient = new SshClient(this.logger);
if (!accessId) {
throw new Error('主机登录授权配置不能为空');
}
this.logger.info('准备上传文件到服务器');
const transports: any = [];
if (crtPath) {
transports.push({
localPath: tmpCrtPath,
remotePath: crtPath,
});
this.logger.info(`上传证书到主机:${crtPath}`);
}
if (keyPath) {
transports.push({
localPath: tmpKeyPath,
remotePath: keyPath,
});
this.logger.info(`上传私钥到主机:${keyPath}`);
}
if (this.icPath) {
transports.push({
localPath: tmpIcPath,
remotePath: this.icPath,
});
this.logger.info(`上传中间证书到主机:${this.icPath}`);
}
if (this.pfxPath) {
transports.push({
localPath: tmpPfxPath,
remotePath: this.pfxPath,
});
this.logger.info(`上传PFX证书到主机${this.pfxPath}`);
}
if (this.derPath) {
transports.push({
localPath: tmpDerPath,
remotePath: this.derPath,
});
this.logger.info(`上传DER证书到主机${this.derPath}`);
}
this.logger.info('开始上传文件到服务器');
await sshClient.uploadFiles({
connectConf,
transports,
mkdirs: this.mkdirs,
});
this.logger.info('上传文件到服务器成功');
//输出
this.hostCrtPath = crtPath;
this.hostKeyPath = keyPath;
this.hostIcPath = this.icPath;
this.hostPfxPath = this.pfxPath;
this.hostDerPath = this.derPath;
};
await certReader.readCertFile({
logger: this.logger,
handle,
});
if (this.script && this.script?.trim()) {
const connectConf: SshAccess = await this.accessService.getById(accessId);
const sshClient = new SshClient(this.logger);
this.logger.info('执行脚本命令');
const scripts = this.script.split('\n');
await sshClient.exec({

View File

@@ -4,7 +4,7 @@ import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput
name: 'RestartCertd',
title: '重启Certd',
icon: 'mdi:restart',
desc: '延迟一定时间后自动杀死自己然后通过Docker来自动重启',
desc: '【仅管理员】延迟一定时间后自动杀死自己然后通过Docker来自动重启',
group: pluginGroups.other.key,
default: {
strategy: {
@@ -25,6 +25,9 @@ export class RestartCertdPlugin extends AbstractTaskPlugin {
delay = 30;
async onInstance() {}
async execute(): Promise<void> {
if (!this.isAdmin()) {
throw new Error('只有管理员才能运行此任务');
}
this.logger.info(`Certd 将在 ${this.delay} 秒后关闭`);
setTimeout(() => {
this.logger.info('重启 Certd');

View File

@@ -9,8 +9,8 @@ export type CustomScriptContext = {
@IsTaskPlugin({
name: 'CustomScript',
title: '自定义js脚本',
icon:"ri:javascript-line",
desc: '测试',
icon: 'ri:javascript-line',
desc: '【仅管理员】运行自定义js脚本执行',
group: pluginGroups.other.key,
default: {
strategy: {
@@ -45,6 +45,9 @@ export class CustomScriptPlugin extends AbstractTaskPlugin {
async onInstance() {}
async execute(): Promise<void> {
if (!this.isAdmin()) {
throw new Error('只有管理员才能运行此任务');
}
this.logger.info('执行自定义脚本:\n', this.script);
const ctx: CustomScriptContext = {
CertReader,

View File

@@ -8,7 +8,7 @@ import { doRequest, uploadCert } from '../lib/sdk.js';
title: '部署证书至七牛CDN',
icon: 'svg:icon-qiniuyun',
group: pluginGroups.cdn.key,
desc: '自动部署域名证书至七牛云CDN',
desc: '自动部署域名证书至七牛云CDN七牛云OSS',
default: {
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed,

View File

@@ -2,8 +2,8 @@
"compileOnSave": true,
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node16",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,

29
start.sh Normal file
View File

@@ -0,0 +1,29 @@
#
echo "即将删除packages下除ui之外的其他目录按y确认"
read -p "y/n: " confirm
if [ $confirm != "y" ]; then
echo "取消操作"
exit 1
fi
find ./packages -mindepth 1 -maxdepth 1 -type d ! -name 'ui' -exec rm -rf {} +
echo "删除成功"
echo "安装pnpm 8.15.7, 前提是已经安装了nodejs"
npm install -g pnpm@8.15.7
echo "安装依赖"
pnpm install
echo "开始构建"
echo "构建certd-client"
cd packages/ui/certd-client
npm run build
cp -r dist/* ../certd-server/public
echo "构建certd-server"
cd ../certd-server
npm run build
echo "构建完成"
echo "启动服务"
npm run start

50
step.md
View File

@@ -19,13 +19,13 @@
![添加域名的DNS解析服务商的授权](./doc/images/2-access-provider.png)
填写accessKey和accessSecret
![](./doc/images/3-add-access.png)
![](./packages/ui/certd-client/public/doc/images/3-add-access.png)
流水线创建成功
![](./doc/images/4-add-success.png)
![](./packages/ui/certd-client/public/doc/images/4-add-success.png)
### 2. 任务详情界面
![](./doc/images/5-view.png)
![](./packages/ui/certd-client/public/doc/images/5-view.png)
到这一步申请证书就已经配置完成了。
点击手动触发,就可以申请证书了。
@@ -34,72 +34,72 @@
### 3. 添加部署到阿里云CDN任务
点击添加任务
![](./doc/images/6-1-add-task.png)
![](./packages/ui/certd-client/public/doc/images/6-1-add-task.png)
选择任务类型
![](./doc/images/6-2-add-task.png)
![](./packages/ui/certd-client/public/doc/images/6-2-add-task.png)
填写任务参数
![](./doc/images/6-3-add-task.png)
![](./packages/ui/certd-client/public/doc/images/6-3-add-task.png)
点击确定部署到CDN任务配置成功
### 4. 添加部署到服务器主机任务
点击新任务,弹出添加任务界面
![](./doc/images/7-1-add-host-task.png)
![](./packages/ui/certd-client/public/doc/images/7-1-add-host-task.png)
先选择上传到主机任务
填写任务参数,比如证书保存路径
![](./doc/images/7-2-add-host-task.png)
![](./packages/ui/certd-client/public/doc/images/7-2-add-host-task.png)
需要添加主机ip、用户名、密码只需添加一次后续其他任务可以复用
![](./doc/images/7-3-add-host-task.png)
![](./packages/ui/certd-client/public/doc/images/7-3-add-host-task.png)
然后添加第二个任务,执行主机命令,部署证书
![](./doc/images/8-1-add-host-task.png)
![](./packages/ui/certd-client/public/doc/images/8-1-add-host-task.png)
选择执行脚本命令任务
![](./doc/images/8-2-add-host-task.png)
![](./packages/ui/certd-client/public/doc/images/8-2-add-host-task.png)
编写脚本,选择之前添加的主机
![](./doc/images/8-4-add-host-task.png)
![](./packages/ui/certd-client/public/doc/images/8-4-add-host-task.png)
点击确定,部署到主机任务配置成功
![](./doc/images/8-5-add-host-task.png)
![](./packages/ui/certd-client/public/doc/images/8-5-add-host-task.png)
### 5. 手动触发执行任务,测试一下
![](./doc/images/9-start.png)
![](./packages/ui/certd-client/public/doc/images/9-start.png)
点击任务可以查看状态和日志
![](./doc/images/10-1-log.png)
![](./packages/ui/certd-client/public/doc/images/10-1-log.png)
这里执行失败,可以查看错误日志
![](./doc/images/11-1-error.png)
![](./doc/images/11-2-error.png)
![](./packages/ui/certd-client/public/doc/images/11-1-error.png)
![](./packages/ui/certd-client/public/doc/images/11-2-error.png)
修改正确后,重新执行
![](./doc/images/12-1-log-success.png)
![](./packages/ui/certd-client/public/doc/images/12-1-log-success.png)
可以看到前面执行过的就会跳过,不会重复执行
![](./doc/images/12-2-skip-log.png)
![](./packages/ui/certd-client/public/doc/images/12-2-skip-log.png)
### 6. 查看证书部署效果
可以看到证书已经部署到CDN成功
![](./doc/images/13-1-result.png)
![](./doc/images/13-2-result.png)
![](./packages/ui/certd-client/public/doc/images/13-1-result.png)
![](./packages/ui/certd-client/public/doc/images/13-2-result.png)
也可以手动下载证书
![](./doc/images/13-3-download.png)
![](./packages/ui/certd-client/public/doc/images/13-3-download.png)
### 7. 定时触发
配置定时触发,以后每天定时执行
cron格式例如 `0 0 3 * * *` 表示每天凌晨3点执行
到期前20天会自动申请新证书并部署没到期前不会重复申请
![](./doc/images/14-timer.png)
![](./packages/ui/certd-client/public/doc/images/14-timer.png)
### 8. 邮件通知
可以接收邮件通知(支持时机:开始、成功、失败、失败转成功)
![](./doc/images/15-1-email.png)
![](./packages/ui/certd-client/public/doc/images/15-1-email.png)
需要配置邮件服务器
![](./doc/images/15-2-email.png)
![](./packages/ui/certd-client/public/doc/images/15-2-email.png)