Compare commits

...

48 Commits

Author SHA1 Message Date
xiaojunnuo 1f1d687317 perf: 添加Azure DNS插件支持及文档
添加Azure DNS插件实现,包括DNS记录管理和授权配置
新增Azure使用文档和配置截图
更新依赖添加@azure/arm-dns和@azure/identity包
2026-04-26 03:36:33 +08:00
xiaojunnuo edc7bfc230 perf: 支持google dns插件 2026-04-26 01:56:08 +08:00
xiaojunnuo 7b6b3aa293 chore: skill 优化 2026-04-26 00:51:05 +08:00
xiaojunnuo 2f7514a2e7 perf: 阿里云waf支持云产品接入方式应用的证书部署 2026-04-26 00:12:37 +08:00
xiaojunnuo 575415b93a perf: 模版创建流水线支持随机时间 2026-04-25 19:01:06 +08:00
xiaojunnuo c28dfa8aca chore: 1 2026-04-25 17:39:34 +08:00
xiaojunnuo 91141922ee chore: 优化插件默认设置 2026-04-25 11:43:17 +08:00
xiaojunnuo cc5154e04e perf: 为DNS解析器添加超时配置,避免查询时间过长
在util.js中为dns.Resolver添加超时配置,确保DNS查询在合理时间内完成
2026-04-25 04:45:39 +08:00
xiaojunnuo 77db5ecd12 perf: 优化权威域名服务器查询超时时长 2026-04-25 04:30:48 +08:00
xiaojunnuo 7ac789c9c7 perf: 商业版支持配置证书申请插件参数 2026-04-25 04:12:26 +08:00
xiaojunnuo 24dff05f64 fix: 修复商业版设置了公共eab,创建流水线仍然会显示需要配置eab的bug 2026-04-25 03:32:45 +08:00
xiaojunnuo 64a350364d fix: 修复流水线未编辑模式下也提示未保存的bug 2026-04-25 02:29:25 +08:00
xiaojunnuo 11b7cfe5cb perf: 支持主动修改绑定url地址 2026-04-24 00:11:55 +08:00
xiaojunnuo 71cfcad2a1 fix: 修复列表页面底部滚动条与表格之间有空白间隙的bug 2026-04-24 00:04:42 +08:00
xiaojunnuo ab4373b26e chore: 商业版放开限制,可以切换为企业模式 2026-04-23 23:30:52 +08:00
xiaojunnuo d23ddc96ac chore: 优化安装脚本 2026-04-23 01:24:49 +08:00
xiaojunnuo 147708e779 chore: 1 2026-04-23 01:17:15 +08:00
xiaojunnuo dc969dd7ed perf: 支持一键安装脚本 2026-04-23 01:03:54 +08:00
xiaojunnuo ef7d1d9327 perf: 支持hipm dns mgr 2026-04-22 23:48:12 +08:00
xiaojunnuo 2e6e9ed925 perf: 支持部署到nginx-proxy-manager 2026-04-22 23:47:02 +08:00
HINS 296dcab4c7 perf: 添加HiPMDnsmgr DNS提供商的支持 @WUHINS
* feat: add HiPM DNSMgr DNS provider plugin

- Create plugin-hipmdnsmgr for HiPM DNSMgr integration
- Support API Token authentication (Bearer token)
- Implement createRecord and removeRecord for ACME DNS-01 challenge
- Add getDomainListPage for domain selection
- Register plugin in plugins/index.ts

Features:
- RESTful API integration with DNSMgr
- Automatic domain ID resolution
- Full TypeScript type support

* refactor: reorganize plugin-hipmdnsmgr directory structure

- Move access.ts to access/hipmdnsmgr-access.ts
- Move dns-provider.ts to dns-provider/hipmdnsmgr-dns-provider.ts
- Add index.ts files for proper module exports
- Align with plugin-huawei and plugin-tencent structure

Structure:
  plugin-hipmdnsmgr/
     access/
        hipmdnsmgr-access.ts
        index.ts
     dns-provider/
        hipmdnsmgr-dns-provider.ts
        index.ts
     index.ts
2026-04-22 00:10:13 +08:00
xiaojunnuo f9e1c46c45 chore: 1 2026-04-19 12:26:05 +08:00
xiaojunnuo 94fd5bd7ec chore: 1 2026-04-19 12:25:28 +08:00
xiaojunnuo eb6ca96e85 Merge branch 'v2-dev' of https://github.com/certd/certd into v2-dev 2026-04-19 12:24:06 +08:00
xiaojunnuo a2bbc7e272 fix: 修复站点监控某些情况下获取不到证书的bug 2026-04-19 12:23:41 +08:00
xiaojunnuo f075a991f0 chore: 1 2026-04-17 19:34:01 +08:00
xiaojunnuo edeb817c39 perf(technitium): 添加Technitium DNS Server插件支持
- 新增Technitium DNS Server插件,包含DNS提供商和授权配置
- 实现DNS记录创建、删除和域名列表获取功能
- 添加默认DNS传播等待时间配置
- 优化用户取消操作时的错误处理
- 为图标选择组件添加过滤功能
- 更新DNS提供商开发文档
2026-04-17 19:22:10 +08:00
xiaojunnuo 23b4658672 perf: apisix支持v2 2026-04-17 17:04:29 +08:00
ahe 5f95ee987f fix 站点IP监控提示权限不足 (#714) 2026-04-17 16:46:44 +08:00
xiaojunnuo cc73f156a7 chore: 1 2026-04-17 00:56:21 +08:00
xiaojunnuo ee72d10718 build: release 2026-04-12 00:29:18 +08:00
xiaojunnuo 831871d37f build: publish 2026-04-11 23:48:07 +08:00
xiaojunnuo 6072550ec1 build: trigger build image 2026-04-11 23:47:55 +08:00
xiaojunnuo 112a565bf7 v1.39.10 2026-04-11 23:46:27 +08:00
xiaojunnuo 59e5c76286 build: prepare to build 2026-04-11 23:43:16 +08:00
xiaojunnuo 21620ac6bd perf: 流水线修改编辑之后,增加未保存提示 2026-04-11 23:41:20 +08:00
xiaojunnuo d05129ec67 perf: 部署到1panel面板支持mux模式 2026-04-11 23:20:19 +08:00
xiaojunnuo 0998de4ae6 chore: 首页时间动态刷新 2026-04-11 23:10:51 +08:00
xiaojunnuo 2bdf1832da perf: 增加域名管理 子域名检查提醒 2026-04-11 22:43:42 +08:00
xiaojunnuo a846c4b66e chore: 1 2026-04-11 22:21:02 +08:00
xiaojunnuo ee535895a3 perf: 修复检查全部某些情况下无效的bug,优化公共触发站点证书检查定时逻辑 2026-04-11 21:50:44 +08:00
xiaojunnuo 1e549dfd43 fix: 修复流水线任务编辑页面复制粘贴按钮在夜间模式显示问题 2026-04-11 21:07:23 +08:00
xiaojunnuo 6ee718a252 perf: 站点监控域名气泡增加端口显示 2026-04-11 21:02:31 +08:00
xiaojunnuo 557e98c33f fix: 修复用户管理添加用户无法上传头像的bug 2026-04-11 20:56:51 +08:00
xiaojunnuo 7a9eec88e8 perf: 1panel支持先上传证书再选择证书 2026-04-10 00:08:10 +08:00
xiaojunnuo a7a4f66633 chore: 资源迁移到项目提示优化 2026-04-09 18:55:05 +08:00
xiaojunnuo a88d0a6ae1 fix: 修复创建流水线无法选择通知的bug 2026-04-09 18:43:57 +08:00
xiaojunnuo db87bc770e chore: 1 2026-04-09 18:20:36 +08:00
164 changed files with 14194 additions and 1424 deletions
+265 -188
View File
@@ -1,190 +1,59 @@
---
name: access-plugin-dev
description: 用于开发 Certd 系统中的 Access 插件,存储用户第三方应用授权数据并对接实现第三方 API 接口。当用户需要创建授权插件、实现第三方API接口、添加新的授权方式或修改现有 Access 插件时触发。
version: 1.0.0
---
# Access 插件开发技能 # Access 插件开发技能
## 什么是 Access 插件 ## 角色定义
你是一名 Certd 插件开发专家,擅长创建和实现 Access 类型的插件,熟悉 TypeScript 编程和 Certd 插件开发规范。
Access 插件是 Certd 系统中用于存储用户第三方应用授权数据的插件,例如用户名密码、accessSecret 或 accessToken 等。同时,它还负责对接实现第三方的 API 接口,供其他插件调用使用。 ## 核心指令
请严格按照以下步骤执行任务:
## 开发步骤 1. **导入必要的依赖**
- 导入 `AccessInput`, `BaseAccess`, `IsAccess`, `Pager`, `PageRes`, `PageSearch` 等必要的类型和装饰器
- 导入 `DomainRecord` 等相关类型
### 1. 导入必要的依赖 2. **使用 @IsAccess 注解注册插件**
- 配置插件的唯一标识、标题、图标和描述
- 继承 `BaseAccess`
```typescript 3. **定义授权属性**
import { AccessInput, BaseAccess, IsAccess, Pager, PageRes, PageSearch } from '@certd/pipeline'; - 使用 `@AccessInput` 注解定义授权属性
import { DomainRecord } from '@certd/plugin-lib'; - 配置属性的标题、默认值、组件类型和验证规则
``` - 对于敏感信息,设置 `encrypt: true` 进行加密
### 2. 使用 @IsAccess 注解注册插件 4. **实现测试方法**
- 添加测试按钮配置
- 实现 `onTestRequest` 方法,用于测试接口调用是否正常
```typescript 5. **实现 API 方法**
@IsAccess({ - 实现必要的 API 方法,如 `GetDomainList`
name: 'demo', // 插件唯一标识 - 封装统一的 API 请求方法 `doRequest`,处理错误和日志
title: '授权插件示例', // 插件标题
icon: 'clarity:plugin-line', // 插件图标
desc: '这是一个示例授权插件,用于演示如何实现一个授权插件', // 插件描述
})
export class DemoAccess extends BaseAccess {
// 插件实现...
}
```
### 3. 定义授权属性 6. **遵循开发最佳实践**
- 使用 `this.ctx.logger` 输出日志
- 统一处理错误,抛出明确的错误信息
- 实现代码复用,避免重复逻辑
使用 `@AccessInput` 注解定义授权属性: ## 输出规范
- 必须包含完整的插件实现代码,包括所有必要的导入语句
- 代码必须包含详细的注释说明,解释每个步骤的目的和实现细节
- 提供完整的示例代码,展示插件的使用方法,包括不同类型的授权方式
- 代码块必须使用正确的语法高亮,确保代码可读性
- 包含开发技巧和注意事项,帮助开发者避免常见错误
- 输出内容必须结构清晰,使用适当的标题和列表格式
```typescript ## 示例
@AccessInput({
title: '授权方式',
value: 'apiKey', // 默认值
component: {
name: "a-select", // 基于 antdv 的输入组件
vModel: "value", // v-model 绑定的属性名
options: [ // 组件参数
{ label: "API密钥(推荐)", value: "apiKey" },
{ label: "账号密码", value: "account" },
],
placeholder: 'demoKeyId',
},
required: true,
})
apiType = '';
@AccessInput({ ### 示例 1: 基本 Access 插件
title: '密钥Id',
component: {
name:"a-input",
allowClear: true,
placeholder: 'demoKeyId',
},
required: true,
})
demoKeyId = '';
@AccessInput({ #### 用户输入
title: '密钥',//标题 创建一个 Access 插件,用于存储第三方应用的授权信息并提供 API 接口。
required: true, //text组件可以省略
encrypt: true, //该属性是否需要加密
})
demoKeySecret = '';
#### 你的回答
@AccessInput({
title: '另外一个授权Id',//标题
component: {
name:"access-selector", //access选择组件
vModel:"modelValue",
type: "ssh", // access类型,让用户固定选择这种类型的access
},
required: true, //text组件可以省略
})
otherAccessId;
```
### 4. 实现测试方法
```typescript
@AccessInput({
title: "测试",
component: {
name: "api-test",
action: "TestRequest"
},
helper: "点击测试接口是否正常"
})
testRequest = true;
/**
* 会通过上面的testRequest参数在ui界面上生成测试按钮,供用户测试接口调用是否正常
*/
async onTestRequest() {
await this.GetDomainList({});
return "ok"
}
```
### 5. 实现 API 方法
```typescript
/**
* api接口示例 获取域名列表,
*/
async GetDomainList(req: PageSearch): Promise<PageRes<DomainRecord>> {
//输出日志必须使用ctx.logger
this.ctx.logger.info(`获取域名列表,req:${JSON.stringify(req)}`);
const pager = new Pager(req);
const resp = await this.doRequest({
action: "ListDomains",
data: {
domain: req.searchKey,
offset: pager.getOffset(),
limit: pager.pageSize,
}
});
const total = resp?.TotalCount || 0;
let list = resp?.DomainList?.map((item) => {
item.domain = item.Domain;
item.id = item.DomainId;
return item;
})
return {
total,
list
};
}
/**
* 通用api调用方法, 具体如何构造请求体,需参考对应应用的API文档
*/
async doRequest(req: { action: string, data?: any }) {
/**
this.ctx中包含很多有用的工具类
type AccessContext = {
http: HttpClient;
logger: ILogger;
utils: typeof utils;
accessService: IAccessService;
}
*/
const res = await this.ctx.http.request({
url: "https://api.demo.cn/api/",
method: "POST",
data: {
Action: req.action,
Body: req.data
}
});
if (res.Code !== 0) {
//异常处理
throw new Error(res.Message || "请求失败");
}
return res.Resp;
}
```
--- 开发技巧:实现统一的 API 请求封装
**好处:**
- **代码复用**:避免在每个 API 方法中重复编写相同的 header 设置和错误处理逻辑
- **错误处理一致**:统一捕获和处理各种错误情况,确保错误信息格式统一
- **日志记录完善**:集中记录详细的错误信息,便于调试和问题排查
- **接口调用简化**:调用方只需关注业务逻辑,无需关心底层请求细节
- **易于维护**:统一修改 API 调用方式时,只需修改一处代码
## 注意事项
1. **插件命名**:插件名称应简洁明了,反映其功能。
2. **属性加密**:对于敏感信息(如密钥),应设置 `encrypt: true`
3. **日志输出**:必须使用 `this.ctx.logger` 输出日志,而不是 `console`
4. **错误处理**:API 调用失败时应抛出明确的错误信息。
5. **测试方法**:实现 `onTestRequest` 方法,以便用户可以测试授权是否正常。
6. **统一接口调用方法**:封装统一的 API 请求方法,避免在每个 API 方法调用中重复编写错误处理逻辑。
## 完整示例
### 示例 1: 通用授权插件
```typescript ```typescript
import { AccessInput, BaseAccess, IsAccess, Pager, PageRes, PageSearch } from '@certd/pipeline'; import { AccessInput, BaseAccess, IsAccess, Pager, PageRes, PageSearch } from '@certd/pipeline';
@@ -202,7 +71,7 @@ import { DomainRecord } from '@certd/plugin-lib';
}) })
export class DemoAccess extends BaseAccess { export class DemoAccess extends BaseAccess {
/** /**
* 授权属性配置 * 授权属性配置
*/ */
@AccessInput({ @AccessInput({
@@ -248,7 +117,6 @@ export class DemoAccess extends BaseAccess {
}) })
demoKeySecret = ''; demoKeySecret = '';
@AccessInput({ @AccessInput({
title: "测试", title: "测试",
component: { component: {
@@ -268,7 +136,7 @@ export class DemoAccess extends BaseAccess {
} }
/** /**
* api接口示例 取域名列表 * api接口示例 取域名列表
*/ */
async GetDomainList(req: PageSearch): Promise<PageRes<DomainRecord>> { async GetDomainList(req: PageSearch): Promise<PageRes<DomainRecord>> {
//输出日志必须使用ctx.logger //输出日志必须使用ctx.logger
@@ -294,21 +162,10 @@ export class DemoAccess extends BaseAccess {
}; };
} }
// 还可以继续编写API
/** /**
* 通用api调用方法, 具体如何构造请求体,需参考对应应用的API文档 * 通用api调用方法, 具体如何构造请求体,需参考对应应用的API文档
*/ */
async doRequest(req: { action: string, data?: any }) { async doRequest(req: { action: string, data?: any }) {
/**
this.ctx中包含很多有用的工具类
type AccessContext = {
http: HttpClient;
logger: ILogger;
utils: typeof utils;
accessService: IAccessService;
}
*/
const res = await this.ctx.http.request({ const res = await this.ctx.http.request({
url: "https://api.demo.cn/api/", url: "https://api.demo.cn/api/",
method: "POST", method: "POST",
@@ -325,4 +182,224 @@ export class DemoAccess extends BaseAccess {
return res.Resp; return res.Resp;
} }
} }
```
### 示例 2: 支持 OAuth 授权的 Access 插件
#### 用户输入
创建一个支持 OAuth 授权方式的 Access 插件。
#### 你的回答
```typescript
import { AccessInput, BaseAccess, IsAccess, Pager, PageRes, PageSearch } from '@certd/pipeline';
import { DomainRecord } from '@certd/plugin-lib';
/**
* OAuth 授权插件示例
*/
@IsAccess({
name: 'oauth-demo',
title: 'OAuth授权插件示例',
icon: 'clarity:plugin-line',
desc: '这是一个支持OAuth授权的插件示例',
})
export class OAuthDemoAccess extends BaseAccess {
@AccessInput({
title: '授权方式',
value: 'oauth',
component: {
name: "a-select",
vModel: "value",
options: [
{
label: "OAuth授权",
value: "oauth"
},
{
label: "API密钥",
value: "apiKey"
},
],
},
required: true,
})
authType = '';
@AccessInput({
title: '客户端ID',
component: {
name:"a-input",
placeholder: 'Client ID',
},
required: true,
})
clientId = '';
@AccessInput({
title: '客户端密钥',
required: true,
encrypt: true,
})
clientSecret = '';
@AccessInput({
title: '授权回调地址',
component: {
name:"a-input",
placeholder: 'https://your-domain.com/callback',
},
required: true,
})
redirectUri = '';
@AccessInput({
title: 'AccessToken',
required: true,
encrypt: true,
})
accessToken = '';
@AccessInput({
title: 'RefreshToken',
encrypt: true,
})
refreshToken = '';
@AccessInput({
title: "测试",
component: {
name: "api-test",
action: "TestOAuth"
},
helper: "点击测试OAuth授权是否正常"
})
testOAuth = true;
/**
* 测试OAuth授权
*/
async onTestOAuth() {
try {
// 测试AccessToken是否有效
const result = await this.doOAuthRequest('GET', '/api/user/profile');
this.ctx.logger.info('OAuth测试成功:', result);
return "OAuth授权测试成功";
} catch (error) {
this.ctx.logger.error('OAuth测试失败:', error);
throw new Error('OAuth授权测试失败');
}
}
/**
* OAuth API请求方法
*/
async doOAuthRequest(method: string, endpoint: string, data?: any) {
const res = await this.ctx.http.request({
url: `https://api.oauth-demo.com${endpoint}`,
method,
headers: {
'Authorization': `Bearer ${this.accessToken}`,
'Content-Type': 'application/json'
},
data
});
if (res.status !== 200) {
throw new Error(`API请求失败: ${res.status} ${res.statusText}`);
}
return res.data;
}
/**
* 刷新AccessToken
*/
async refreshAccessToken() {
if (!this.refreshToken) {
throw new Error('没有提供RefreshToken');
}
const res = await this.ctx.http.request({
url: 'https://api.oauth-demo.com/oauth/token',
method: 'POST',
data: {
grant_type: 'refresh_token',
refresh_token: this.refreshToken,
client_id: this.clientId,
client_secret: this.clientSecret
}
});
if (res.status === 200 && res.data.access_token) {
this.accessToken = res.data.access_token;
if (res.data.refresh_token) {
this.refreshToken = res.data.refresh_token;
}
return true;
}
throw new Error('刷新AccessToken失败');
}
/**
* 获取域名列表
*/
async GetDomainList(req: PageSearch): Promise<PageRes<DomainRecord>> {
try {
const res = await this.doOAuthRequest('GET', '/api/domains', {
search: req.searchKey,
page: req.page,
pageSize: req.pageSize
});
return {
total: res.total,
list: res.items.map((item: any) => ({
id: item.id,
domain: item.domain
}))
};
} catch (error) {
// 尝试刷新AccessToken并重试
if (error.message.includes('401')) {
await this.refreshAccessToken();
const res = await this.doOAuthRequest('GET', '/api/domains', {
search: req.searchKey,
page: req.page,
pageSize: req.pageSize
});
return {
total: res.total,
list: res.items.map((item: any) => ({
id: item.id,
domain: item.domain
}))
};
}
throw error;
}
}
}
```
## 注意事项
1. **插件命名**:插件名称应简洁明了,反映其功能。
2. **属性加密**:对于敏感信息(如密钥),应设置 `encrypt: true`
3. **日志输出**:必须使用 `this.ctx.logger` 输出日志,而不是 `console`,参数文本化,不要传对象,否则会输出`[object Object]}`
4. **错误处理**:API 调用失败时应抛出明确的错误信息。
5. **测试方法**:实现 `onTestRequest` 方法,以便用户可以测试授权是否正常。
6. **统一接口调用**:封装统一的 API 请求方法,避免重复编写错误处理逻辑。
## 开发技巧
### 实现统一的 API 请求封装
**好处:**
- **代码复用**:避免在每个 API 方法中重复编写相同的 header 设置和错误处理逻辑
- **错误处理一致**:统一捕获和处理各种错误情况,确保错误信息格式统一
- **日志记录完善**:集中记录详细的错误信息,便于调试和问题排查
- **接口调用简化**:调用方只需关注业务逻辑,无需关心底层请求细节
- **易于维护**:统一修改 API 调用方式时,只需修改一处代码
``` ```
+378 -150
View File
@@ -1,141 +1,82 @@
---
name: dns-provider-dev
description: 用于开发 Certd 系统中的 DNS Provider 插件,在 ACME 申请证书时给域名添加 TXT 解析记录以验证域名所有权。当用户需要创建DNS提供商插件、实现DNS解析、ACME证书验证或修改现有 DNS Provider 插件时触发。
version: 1.0.0
---
# DNS Provider 插件开发技能 # DNS Provider 插件开发技能
## 什么是 DNS Provider 插件 ## 角色定义
你是一名 Certd 插件开发专家,擅长创建和实现 DNS Provider 类型的插件,熟悉 TypeScript 编程和 Certd 插件开发规范。
DNS Provider 插件是 Certd 系统中的 DNS 提供商插件,它用于在 ACME 申请证书时给域名添加 TXT 解析记录,以验证域名所有权。 ## 核心指令
请严格按照以下步骤执行任务:
## 开发步骤 1. **导入必要的依赖**
- 导入 `AbstractDnsProvider`, `CreateRecordOptions`, `IsDnsProvider`, `RemoveRecordOptions` 等必要的类型和装饰器
- 导入对应的 Access 插件类型
### 1. 导入必要的依赖 2. **定义记录数据结构**
- 定义适合对应云平台的记录数据结构
- 至少包含 id 字段,用于后续删除记录
3. **使用 @IsDnsProvider 注解注册插件**
- 配置插件的唯一标识、标题、描述、图标
- 指定对应的云平台的 access 类型名称
- 设置排序值(可选)
- 继承 `AbstractDnsProvider`
4. **实现 onInstance 方法**
- 获取并保存对应的 Access 实例
- 执行初始化操作
5. **实现 createRecord 方法**
- 解析传入的参数(fullRecord, value, type, domain
- 记录操作开始日志
- 调用云平台 API 创建 TXT 类型的 DNS 解析记录
- 处理可能的错误:网络错误、API调用失败、授权失败等
- 记录操作结果日志
- 返回创建的记录信息,用于后续删除操作
6. **实现 removeRecord 方法**
- 解析传入的参数和之前创建的记录信息
- 记录操作开始日志
- 调用云平台 API 删除 TXT 类型的 DNS 解析记录
- 处理可能的错误:网络错误、API调用失败、记录不存在等
- 记录操作结果日志
7. **实现 getDomainListPage 方法**
- 实现获取域名列表的方法
- 支持分页查询
- 处理可能的错误:网络错误、API调用失败、授权失败等
- 返回标准化的域名列表格式
8. **实例化插件**
- 实例化插件,确保插件被注册
## 输出规范
- 必须包含完整的插件实现代码
- 代码必须包含详细的注释说明
- 提供完整的示例代码,展示插件的使用方法
- 包含开发注意事项
## 示例
### 示例 1: 基本 DNS Provider 插件
#### 用户输入
创建一个 DNS Provider 插件,用于在 ACME 申请证书时添加和删除 TXT 解析记录。
#### 你的回答
```typescript ```typescript
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from '@certd/plugin-cert'; import { Pager, PageRes, PageSearch } from "@certd/pipeline";
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions, DomainRecord } from '@certd/plugin-cert';
import { DemoAccess } from './access.js'; import { DemoAccess } from './access.js';
import { isDev } from '../../utils/env.js';
```
### 2. 定义记录数据结构
```typescript
type DemoRecord = {
// 这里定义 Record 记录的数据结构,跟对应云平台接口返回值一样即可,一般是拿到 id 就行,用于删除 txt 解析记录,清理申请痕迹
// id:string
};
```
### 3. 使用 @IsDnsProvider 注解注册插件
```typescript
// 这里通过 IsDnsProvider 注册一个 dnsProvider
@IsDnsProvider({
name: 'demo', // 插件唯一标识
title: 'Dns提供商Demo', // 插件标题
desc: 'dns provider示例', // 插件描述
icon: 'clarity:plugin-line', // 插件图标
// 这里是对应的云平台的 access 类型名称
accessType: 'demo',
order: 99, // 排序
})
export class DemoDnsProvider extends AbstractDnsProvider<DemoRecord> {
access!: DemoAccess;
async onInstance() {
this.access = this.ctx.access as DemoAccess;
// 也可以通过 ctx 成员变量传递 context
this.logger.debug('access', this.access);
// 初始化的操作
// ...
}
// 插件实现...
}
```
### 4. 实现 createRecord 方法
```typescript
/**
* 创建 dns 解析记录,用于验证域名所有权
*/
async createRecord(options: CreateRecordOptions): Promise<any> {
/**
* options 参数说明
* fullRecord: '_acme-challenge.example.com',
* value: 一串 uuid
* type: 'TXT',
* domain: 'example.com'
*/
const { fullRecord, value, type, domain } = options;
this.logger.info('添加域名解析:', fullRecord, value, type, domain);
// 调用创建 dns 解析记录的对应的云端接口,创建 txt 类型的 dns 解析记录
// 请根据实际接口情况调用,例如:
// const createDnsRecordUrl = "xxx"
// const record = this.http.post(createDnsRecordUrl,{
// // 授权参数
// // 创建 dns 解析记录的参数
// })
// // 返回本次创建的 dns 解析记录,这个记录会在删除的时候用到
// return record
}
```
### 5. 实现 removeRecord 方法
```typescript
/**
* 删除 dns 解析记录,清理申请痕迹
* @param options
*/
async removeRecord(options: RemoveRecordOptions<DemoRecord>): Promise<void> {
const { fullRecord, value, domain } = options.recordReq;
const record = options.recordRes;
this.logger.info('删除域名解析:', domain, fullRecord, value, record);
// 这里调用删除 txt dns 解析记录接口
// 请根据实际接口情况调用,例如:
// const deleteDnsRecordUrl = "xxx"
// const res = this.http.delete(deleteDnsRecordUrl,{
// // 授权参数
// // 删除 dns 解析记录的参数
// })
this.logger.info('删除域名解析成功:', fullRecord, value);
}
```
### 6. 实例化插件
```typescript
// 实例化这个 provider,将其自动注册到系统中
if (isDev()) {
// 你的实现 要去掉这个 if,不然生产环境将不会显示
new DemoDnsProvider();
}
```
## 注意事项
1. **插件命名**:插件名称应简洁明了,反映其功能。
2. **accessType**:必须指定对应的云平台的 access 类型名称。
3. **记录结构**:定义适合对应云平台的记录数据结构,至少包含 id 字段用于删除记录。
4. **日志输出**:使用 `this.logger` 输出日志,而不是 `console`
5. **错误处理**:API 调用失败时应抛出明确的错误信息。
6. **实例化**:生产环境中应移除 `if (isDev())` 条件,确保插件在生产环境中也能被注册。
## 完整示例
### 示例:通用 DNS Provider
```typescript
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from '@certd/plugin-cert';
import { DemoAccess } from './access.js';
import { isDev } from '../../utils/env.js';
type DemoRecord = { type DemoRecord = {
// 这里定义 Record 记录的数据结构,跟对应云平台接口返回值一样即可,一般是拿到 id 就行,用于删除 txt 解析记录,清理申请痕迹 // 这里定义 Record 记录的数据结构,跟对应云平台接口返回值一样即可
// id:string id: string;
}; };
// 这里通过 IsDnsProvider 注册一个 dnsProvider // 这里通过 IsDnsProvider 注册一个 dnsProvider
@@ -173,15 +114,23 @@ export class DemoDnsProvider extends AbstractDnsProvider<DemoRecord> {
const { fullRecord, value, type, domain } = options; const { fullRecord, value, type, domain } = options;
this.logger.info('添加域名解析:', fullRecord, value, type, domain); this.logger.info('添加域名解析:', fullRecord, value, type, domain);
// 调用创建 dns 解析记录的对应的云端接口,创建 txt 类型的 dns 解析记录 try {
// 请根据实际接口情况调用,例如: // 调用创建 dns 解析记录的对应的云端接口,创建 txt 类型的 dns 解析记录
// const createDnsRecordUrl = "xxx" // 请根据实际接口情况调用,例如:
// const record = this.http.post(createDnsRecordUrl,{ // const createDnsRecordUrl = "xxx"
// // 授权参数 // const record = this.http.post(createDnsRecordUrl,{
// // 创建 dns 解析记录的参数 // // 授权参数
// }) // // 创建 dns 解析记录的参数
// // 返回本次创建的 dns 解析记录,这个记录会在删除的时候用到 // })
// return record // // 返回本次创建的 dns 解析记录,这个记录会在删除的时候用到
// return record
// 模拟返回
return { id: 'demo-record-id' };
} catch (error) {
this.logger.error('创建DNS记录失败:', error);
throw new Error(`创建DNS记录失败: ${error.message}`);
}
} }
/** /**
@@ -192,23 +141,302 @@ export class DemoDnsProvider extends AbstractDnsProvider<DemoRecord> {
const { fullRecord, value, domain } = options.recordReq; const { fullRecord, value, domain } = options.recordReq;
const record = options.recordRes; const record = options.recordRes;
this.logger.info('删除域名解析:', domain, fullRecord, value, record); this.logger.info('删除域名解析:', domain, fullRecord, value, record);
// 这里调用删除 txt dns 解析记录接口
// 请根据实际接口情况调用,例如: try {
// 这里调用删除 txt dns 解析记录接口
// 请根据实际接口情况调用,例如:
// const deleteDnsRecordUrl = "xxx"
// const res = this.http.delete(deleteDnsRecordUrl,{
// // 授权参数
// // 删除 dns 解析记录的参数
// })
this.logger.info('删除域名解析成功:', fullRecord, value);
} catch (error) {
this.logger.error('删除DNS记录失败:', error);
// 即使删除失败也不抛出异常,避免影响整个证书申请流程
}
}
// const deleteDnsRecordUrl = "xxx" /**
// const res = this.http.delete(deleteDnsRecordUrl,{ * 实现获取域名列表
// // 授权参数 */
// // 删除 dns 解析记录的参数 async getDomainListPage(req: PageSearch): Promise<PageRes<DomainRecord>> {
// }) try {
const pager = new Pager(req);
const res = await this.http.request({
// 请求接口获取域名列表
})
const list = res.Domains?.map(item => ({
id: item.Id,
domain: item.DomainName,
})) || []
return {
this.logger.info('删除域名解析成功:', fullRecord, value); list,
total: res.Total,
};
} catch (error) {
this.logger.error('获取域名列表失败:', error);
return { list: [], total: 0 };
}
} }
} }
// 实例化这个 provider,将其自动注册到系统中 // 实例化这个 provider,将其自动注册到系统中
if (isDev()) { new DemoDnsProvider();
// 你的实现 要去掉这个 if,不然生产环境将不会显示 ```
new DemoDnsProvider();
### 示例 2: 阿里云 DNS Provider 插件
#### 用户输入
创建一个阿里云 DNS Provider 插件,用于在 ACME 申请证书时添加和删除 TXT 解析记录。
#### 你的回答
```typescript
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions, PageSearch, PageRes, DomainRecord } from '@certd/plugin-cert';
import { AliyunAccess } from './aliyun-access.js';
import { Pager } from '@certd/pipeline';
type AliyunRecord = {
RecordId: string;
};
// 阿里云 DNS Provider 插件
@IsDnsProvider({
name: 'aliyun',
title: '阿里云DNS',
desc: '阿里云DNS提供商插件',
icon: 'clarity:plugin-line',
accessType: 'aliyun',
order: 10,
})
export class AliyunDnsProvider extends AbstractDnsProvider<AliyunRecord> {
access!: AliyunAccess;
async onInstance() {
this.access = this.ctx.access as AliyunAccess;
this.logger.debug('阿里云Access实例初始化成功');
}
/**
* 创建 DNS 解析记录
*/
async createRecord(options: CreateRecordOptions): Promise<AliyunRecord> {
const { fullRecord, value, type, domain } = options;
this.logger.info('阿里云DNS: 添加解析记录', { fullRecord, value, type, domain });
try {
// 提取主机记录
const hostRecord = fullRecord.replace(`.${domain}`, '');
// 调用阿里云 API 创建解析记录
const response = await this.access.doRequest({
action: 'AddDomainRecord',
data: {
DomainName: domain,
RR: hostRecord,
Type: type,
Value: value,
TTL: 600, // 10分钟
}
});
this.logger.info('阿里云DNS: 解析记录创建成功', { RecordId: response.RecordId });
return { RecordId: response.RecordId };
} catch (error) {
this.logger.error('阿里云DNS: 创建解析记录失败', error);
throw new Error(`阿里云DNS创建解析记录失败: ${error.message}`);
}
}
/**
* 删除 DNS 解析记录
*/
async removeRecord(options: RemoveRecordOptions<AliyunRecord>): Promise<void> {
const { fullRecord, value, domain } = options.recordReq;
const record = options.recordRes;
this.logger.info('阿里云DNS: 删除解析记录', { fullRecord, value, domain, RecordId: record.RecordId });
try {
// 调用阿里云 API 删除解析记录
await this.access.doRequest({
action: 'DeleteDomainRecord',
data: {
RecordId: record.RecordId,
}
});
this.logger.info('阿里云DNS: 解析记录删除成功', { RecordId: record.RecordId });
} catch (error) {
this.logger.error('阿里云DNS: 删除解析记录失败', error);
// 即使删除失败也不抛出异常,避免影响整个证书申请流程
}
}
/**
* 获取域名列表
*/
async getDomainListPage(req: PageSearch): Promise<PageRes<DomainRecord>> {
try {
const pager = new Pager(req);
const response = await this.access.doRequest({
action: 'DescribeDomains',
data: {
PageNumber: pager.page,
PageSize: pager.pageSize,
KeyWord: req.searchKey,
}
});
const list = response.Domains.Domain.map((domain: any) => ({
id: domain.DomainId,
domain: domain.DomainName,
}));
return {
list,
total: response.TotalCount,
};
} catch (error) {
this.logger.error('阿里云DNS: 获取域名列表失败', error);
return { list: [], total: 0 };
}
}
} }
```
// 实例化插件
new AliyunDnsProvider();
```
### 示例 3: 腾讯云 DNS Provider 插件
#### 用户输入
创建一个腾讯云 DNS Provider 插件,用于在 ACME 申请证书时添加和删除 TXT 解析记录。
#### 你的回答
```typescript
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions, PageSearch, PageRes, DomainRecord } from '@certd/plugin-cert';
import { TencentAccess } from './tencent-access.js';
import { Pager } from '@certd/pipeline';
type TencentRecord = {
RecordId: string;
};
// 腾讯云 DNS Provider 插件
@IsDnsProvider({
name: 'tencent',
title: '腾讯云DNS',
desc: '腾讯云DNS提供商插件',
icon: 'clarity:plugin-line',
accessType: 'tencent',
order: 20,
})
export class TencentDnsProvider extends AbstractDnsProvider<TencentRecord> {
access!: TencentAccess;
async onInstance() {
this.access = this.ctx.access as TencentAccess;
this.logger.debug('腾讯云Access实例初始化成功');
}
/**
* 创建 DNS 解析记录
*/
async createRecord(options: CreateRecordOptions): Promise<TencentRecord> {
const { fullRecord, value, type, domain } = options;
this.logger.info('腾讯云DNS: 添加解析记录', { fullRecord, value, type, domain });
try {
// 提取主机记录
const hostRecord = fullRecord.replace(`.${domain}`, '');
// 调用腾讯云 API 创建解析记录
const response = await this.access.doRequest({
action: 'CreateRecord',
data: {
Domain: domain,
SubDomain: hostRecord,
RecordType: type,
RecordValue: value,
TTL: 600, // 10分钟
}
});
this.logger.info('腾讯云DNS: 解析记录创建成功', { RecordId: response.RecordId });
return { RecordId: response.RecordId };
} catch (error) {
this.logger.error('腾讯云DNS: 创建解析记录失败', error);
throw new Error(`腾讯云DNS创建解析记录失败: ${error.message}`);
}
}
/**
* 删除 DNS 解析记录
*/
async removeRecord(options: RemoveRecordOptions<TencentRecord>): Promise<void> {
const { fullRecord, value, domain } = options.recordReq;
const record = options.recordRes;
this.logger.info('腾讯云DNS: 删除解析记录', { fullRecord, value, domain, RecordId: record.RecordId });
try {
// 调用腾讯云 API 删除解析记录
await this.access.doRequest({
action: 'DeleteRecord',
data: {
RecordId: record.RecordId,
}
});
this.logger.info('腾讯云DNS: 解析记录删除成功', { RecordId: record.RecordId });
} catch (error) {
this.logger.error('腾讯云DNS: 删除解析记录失败', error);
// 即使删除失败也不抛出异常,避免影响整个证书申请流程
}
}
/**
* 获取域名列表
*/
async getDomainListPage(req: PageSearch): Promise<PageRes<DomainRecord>> {
try {
const pager = new Pager(req);
const response = await this.access.doRequest({
action: 'DescribeDomains',
data: {
Offset: (pager.page - 1) * pager.pageSize,
Limit: pager.pageSize,
Keyword: req.searchKey,
}
});
const list = response.Domains.map((domain: any) => ({
id: domain.DomainId,
domain: domain.DomainName,
}));
return {
list,
total: response.TotalCount,
};
} catch (error) {
this.logger.error('腾讯云DNS: 获取域名列表失败', error);
return { list: [], total: 0 };
}
}
}
// 实例化插件
new TencentDnsProvider();
```
## 注意事项
1. **插件命名**:插件名称应简洁明了,反映其功能。
2. **accessType**:必须指定对应的云平台的 access 类型名称。
3. **记录结构**:定义适合对应云平台的记录数据结构,至少包含 id 字段用于删除记录。
4. **日志输出**:使用 `this.logger` 输出日志,而不是 `console`,参数文本化,不要传对象,否则会输出`[object Object]}`
5. **错误处理**:API 调用失败时应抛出明确的错误信息。
+192 -117
View File
@@ -1,126 +1,90 @@
---
name: plugin-converter
description: 用于将 Certd 插件转换为 YAML 配置文件的命令行工具,支持分析单个插件文件、识别插件类型并生成对应的 YAML 配置。当用户需要生成插件配置、转换插件格式、批量处理插件或修改现有插件配置时触发。
version: 1.0.0
---
# 插件转换工具技能 # 插件转换工具技能
## 什么是插件转换工具 ## 角色定义
你是一名 Certd 插件开发专家,擅长使用插件转换工具将 Certd 插件转换为 YAML 配置文件,熟悉命令行工具的使用和 Certd 插件开发规范。
插件转换工具是一个用于将 Certd 插件转换为 YAML 配置文件的命令行工具。它可以分析单个插件文件,识别插件类型,并生成对应的 YAML 配置,可以让插件分发和在线注册。 ## 核心指令
请严格按照以下步骤执行任务:
## 工具位置 1. **定位工具位置**
- 工具位于 `trae/skills/convert-plugin-to-yaml.js`
`trae/skills/convert-plugin-to-yaml.js` 2. **了解功能特性**
- 单个插件转换:支持指定单个插件文件进行转换
- 批量插件转换:支持指定目录批量转换多个插件
- 自动类型识别:自动识别插件类型(Access、Task、DNS Provider、Notification、Addon
- 详细日志输出:提供详细的转换过程日志
- YAML 配置生成:生成标准的 YAML 配置文件
- 配置文件保存:自动将生成的配置保存到 `./metadata` 目录
- 自定义输出目录:支持指定自定义输出目录
- 格式化输出:支持格式化 YAML 输出
- 可复用函数:导出了可复用的函数,便于其他模块调用
## 功能特性 3. **使用工具**
- 基本用法:`node trae/skills/convert-plugin-to-yaml.js <插件文件路径>`
- 批量转换:`node trae/skills/convert-plugin-to-yaml.js <目录路径>`
- 自定义输出目录:`node trae/skills/convert-plugin-to-yaml.js <插件文件路径> --output <输出目录>`
- 格式化输出:`node trae/skills/convert-plugin-to-yaml.js <插件文件路径> --format`
- 示例:
- 转换 Access 插件:`node trae/skills/convert-plugin-to-yaml.js packages/ui/certd-server/src/plugins/plugin-demo/access.js`
- 转换 Task 插件:`node trae/skills/convert-plugin-to-yaml.js packages/ui/certd-server/src/plugins/plugin-demo/plugins/plugin-test.js`
- 转换 DNS Provider 插件:`node trae/skills/convert-plugin-to-yaml.js packages/ui/certd-server/src/plugins/plugin-demo/dns-provider.js`
- 批量转换插件:`node trae/skills/convert-plugin-to-yaml.js packages/ui/certd-server/src/plugins/`
- 自定义输出目录:`node trae/skills/convert-plugin-to-yaml.js packages/ui/certd-server/src/plugins/plugin-demo/access.js --output ./configs`
- **单个插件转换**:支持指定单个插件文件进行转换,而不是扫描整个目录 4. **理解转换过程**
- **自动类型识别**:自动识别插件类型(Access、Task、DNS Provider、Notification、Addon - 加载插件模块:使用 `import()` 动态加载指定的插件文件
- **详细日志输出**:提供详细的转换过程日志,便于调试 - 分析插件定义:检查模块导出的对象,寻找带有 `define` 属性的插件
- **YAML 配置生成**:生成标准的 YAML 配置文件 - 识别插件类型:根据插件的继承关系或属性识别插件类型
- **配置文件保存**:自动将生成的配置保存到 `./metadata` 目录 - 生成 YAML 配置:基于插件定义生成标准的 YAML 配置
- **可复用函数**:导出了可复用的函数,便于其他模块调用 - 保存配置文件:将生成的配置保存到 `./metadata` 目录
## 使用方法 5. **了解输出说明**
- 命令行输出:插件加载状态、插件导出的对象列表、插件类型识别结果、生成的 YAML 配置内容、配置文件保存路径
- 配置文件命名规则:`<插件类型>[_<子类型>]_<插件名称>.yaml`
### 基本用法 6. **理解插件类型识别逻辑**
- DNS Provider:如果插件定义中包含 `accessType` 属性
- Task:如果插件继承自 `AbstractTaskPlugin`
- Notification:如果插件继承自 `BaseNotification`
- Access:如果插件继承自 `BaseAccess`
- Addon:如果插件继承自 `BaseAddon`
```bash 7. **遵循注意事项**
node trae/skills/convert-plugin-to-yaml.js <插件文件路径> - 文件路径:插件文件路径可以是相对路径或绝对路径
``` - 文件格式:仅支持 `.js` 文件,不支持 `.ts` 文件(需要先编译)
- 依赖安装:执行前确保已安装所有必要的依赖
- 配置目录:如果 `./metadata` 目录不存在,工具会自动创建
- 错误处理:如果插件加载失败或识别失败,工具会输出错误信息但不会终止执行
### 示例 ## 输出规范
- 必须包含工具的使用方法和示例
- 必须包含转换过程的详细说明
- 必须包含输出说明和配置文件命名规则
- 必须包含插件类型识别逻辑
- 必须包含注意事项和故障排除建议
## 示例
### 示例 1: 转换单个 Access 插件
#### 用户输入
将 Access 插件转换为 YAML 配置文件。
#### 你的回答
```bash ```bash
# 转换 Access 插件 # 转换 Access 插件
node trae/skills/convert-plugin-to-yaml.js packages/ui/certd-server/src/plugins/plugin-demo/access.js node trae/skills/convert-plugin-to-yaml.js packages/ui/certd-server/src/plugins/plugin-demo/access.js
# 转换 Task 插件
node trae/skills/convert-plugin-to-yaml.js packages/ui/certd-server/src/plugins/plugin-demo/plugins/plugin-test.js
# 转换 DNS Provider 插件
node trae/skills/convert-plugin-to-yaml.js packages/ui/certd-server/src/plugins/plugin-demo/dns-provider.js
``` ```
## 转换过程 #### 输出
1. **加载插件模块**:使用 `import()` 动态加载指定的插件文件
2. **分析插件定义**:检查模块导出的对象,寻找带有 `define` 属性的插件
3. **识别插件类型**:根据插件的继承关系或属性识别插件类型
4. **生成 YAML 配置**:基于插件定义生成标准的 YAML 配置
5. **保存配置文件**:将生成的配置保存到 `./metadata` 目录
## 输出说明
### 命令行输出
执行转换命令后,工具会输出以下信息:
- 插件加载状态
- 插件导出的对象列表
- 插件类型识别结果
- 生成的 YAML 配置内容
- 配置文件保存路径
### 配置文件命名规则
生成的配置文件命名规则为:
```
<插件类型>[_<子类型>]_<插件名称>.yaml
```
例如:
- `access_demo.yaml`Access 插件)
- `deploy_DemoTest.yaml`Task 插件)
- `dnsProvider_demo.yaml`DNS Provider 插件)
## 插件类型识别逻辑
工具通过以下逻辑识别插件类型:
1. **DNS Provider**:如果插件定义中包含 `accessType` 属性
2. **Task**:如果插件继承自 `AbstractTaskPlugin`
3. **Notification**:如果插件继承自 `BaseNotification`
4. **Access**:如果插件继承自 `BaseAccess`
5. **Addon**:如果插件继承自 `BaseAddon`
## 注意事项
1. **文件路径**:插件文件路径可以是相对路径或绝对路径
2. **文件格式**:仅支持 `.js` 文件,不支持 `.ts` 文件(需要先编译)
3. **依赖安装**:执行前确保已安装所有必要的依赖
4. **配置目录**:如果 `./metadata` 目录不存在,工具会自动创建
5. **错误处理**:如果插件加载失败或识别失败,工具会输出错误信息但不会终止执行
## 代码结构
### 主要函数
1. **isPrototypeOf(value, cls)**:检查对象是否是指定类的原型
2. **loadSingleModule(filePath)**:加载单个插件模块
3. **convertSinglePlugin(pluginPath)**:分析单个插件并生成 YAML 配置
4. **main()**:主函数,处理命令行参数并执行转换
### 导出函数
工具导出了以下函数,便于其他模块调用:
```javascript
export {
convertSinglePlugin, // 转换单个插件
loadSingleModule, // 加载单个模块
isPrototypeOf // 检查原型关系
};
```
## 应用场景
1. **插件开发**:在开发新插件时,快速生成配置文件
2. **插件调试**:查看插件的内部定义和配置
3. **插件管理**:批量转换现有插件为标准配置格式
4. **自动化构建**:集成到构建流程中,自动生成插件配置
## 示例输出
### 转换 Access 插件示例
```bash ```bash
$ node trae/skills/convert-plugin-to-yaml.js packages/ui/certd-server/src/plugins/plugin-demo/access.js $ node trae/skills/convert-plugin-to-yaml.js packages/ui/certd-server/src/plugins/plugin-demo/access.js
开始转换插件: packages/ui/certd-server/src/plugins/plugin-demo/access.js 开始转换插件: packages/ui/certd-server/src/plugins/plugin-demo/access.js
@@ -142,30 +106,117 @@ YAML 配置已保存到: ./metadata/access_demo.yaml
插件转换完成! 插件转换完成!
``` ```
### 转换 Task 插件示例 ### 示例 2: 批量转换插件
#### 用户输入
批量转换目录中的所有插件为 YAML 配置文件。
#### 你的回答
```bash ```bash
$ node trae/skills/convert-plugin-to-yaml.js packages/ui/certd-server/src/plugins/plugin-demo/plugins/plugin-test.js # 批量转换插件
node trae/skills/convert-plugin-to-yaml.js packages/ui/certd-server/src/plugins/
```
#### 输出
```bash
$ node trae/skills/convert-plugin-to-yaml.js packages/ui/certd-server/src/plugins/
开始转换目录: packages/ui/certd-server/src/plugins/
正在处理文件: packages/ui/certd-server/src/plugins/plugin-demo/access.js
开始转换插件: packages/ui/certd-server/src/plugins/plugin-demo/access.js
插件模块导出了 1 个对象: DemoAccess
处理插件: DemoAccess
插件类型: access
脚本路径: packages/ui/certd-server/src/plugins/plugin-demo/access.js
生成的 YAML 配置:
name: demo
title: 授权插件示例
desc: 这是一个示例授权插件,用于演示如何实现一个授权插件
icon: clarity:plugin-line
pluginType: access
type: builtIn
scriptFilePath: packages/ui/certd-server/src/plugins/plugin-demo/access.js
YAML 配置已保存到: ./metadata/access_demo.yaml
插件转换完成!
正在处理文件: packages/ui/certd-server/src/plugins/plugin-demo/plugins/plugin-test.js
开始转换插件: packages/ui/certd-server/src/plugins/plugin-demo/plugins/plugin-test.js 开始转换插件: packages/ui/certd-server/src/plugins/plugin-demo/plugins/plugin-test.js
插件模块导出了 1 个对象: DemoTest 插件模块导出了 1 个对象: DemoTest
处理插件: DemoTest 处理插件: DemoTest
插件类型: deploy 插件类型: task
脚本路径: packages/ui/certd-server/src/plugins/plugin-demo/plugins/plugin-test.js 脚本路径: packages/ui/certd-server/src/plugins/plugin-demo/plugins/plugin-test.js
生成的 YAML 配置: 生成的 YAML 配置:
name: DemoTest name: DemoTest
title: Demo-测试插件 title: Demo-测试插件
desc: "" desc: 这是一个示例任务插件,用于演示如何实现一个任务插件
icon: clarity:plugin-line icon: clarity:plugin-line
pluginType: task
group: other group: other
default:
strategy:
runStrategy: SkipWhenSucceed
pluginType: deploy
type: builtIn type: builtIn
scriptFilePath: packages/ui/certd-server/src/plugins/plugin-demo/plugins/plugin-test.js scriptFilePath: packages/ui/certd-server/src/plugins/plugin-demo/plugins/plugin-test.js
YAML 配置已保存到: ./metadata/deploy_DemoTest.yaml YAML 配置已保存到: ./metadata/task_DemoTest.yaml
插件转换完成!
正在处理文件: packages/ui/certd-server/src/plugins/plugin-demo/dns-provider.js
开始转换插件: packages/ui/certd-server/src/plugins/plugin-demo/dns-provider.js
插件模块导出了 1 个对象: DemoDnsProvider
处理插件: DemoDnsProvider
插件类型: dns-provider
脚本路径: packages/ui/certd-server/src/plugins/plugin-demo/dns-provider.js
生成的 YAML 配置:
name: demo
title: Dns提供商Demo
desc: dns provider示例
icon: clarity:plugin-line
pluginType: dns-provider
accessType: demo
order: 99
type: builtIn
scriptFilePath: packages/ui/certd-server/src/plugins/plugin-demo/dns-provider.js
YAML 配置已保存到: ./metadata/dns-provider_demo.yaml
插件转换完成!
批量转换完成,共处理 3 个插件文件
```
### 示例 3: 自定义输出目录
#### 用户输入
将插件转换为 YAML 配置文件,并保存到自定义目录。
#### 你的回答
```bash
# 自定义输出目录
node trae/skills/convert-plugin-to-yaml.js packages/ui/certd-server/src/plugins/plugin-demo/access.js --output ./configs
```
#### 输出
```bash
$ node trae/skills/convert-plugin-to-yaml.js packages/ui/certd-server/src/plugins/plugin-demo/access.js --output ./configs
开始转换插件: packages/ui/certd-server/src/plugins/plugin-demo/access.js
插件模块导出了 1 个对象: DemoAccess
处理插件: DemoAccess
插件类型: access
脚本路径: packages/ui/certd-server/src/plugins/plugin-demo/access.js
生成的 YAML 配置:
name: demo
title: 授权插件示例
desc: 这是一个示例授权插件,用于演示如何实现一个授权插件
icon: clarity:plugin-line
pluginType: access
type: builtIn
scriptFilePath: packages/ui/certd-server/src/plugins/plugin-demo/access.js
YAML 配置已保存到: ./configs/access_demo.yaml
插件转换完成! 插件转换完成!
``` ```
@@ -196,6 +247,30 @@ YAML 配置已保存到: ./metadata/deploy_DemoTest.yaml
- **尝试简化插件**:如果转换失败,尝试创建一个最小化的插件示例进行测试 - **尝试简化插件**:如果转换失败,尝试创建一个最小化的插件示例进行测试
- **检查依赖版本**:确保使用的依赖版本与 Certd 兼容 - **检查依赖版本**:确保使用的依赖版本与 Certd 兼容
## 总结 ## 代码结构
插件转换工具是一个方便实用的工具,它可以帮助开发者快速生成插件的 YAML 配置文件,简化插件的注册和管理过程。通过命令行参数指定单个插件文件,工具会自动完成类型识别、配置生成和保存等操作,大大提高了插件开发和管理的效率。 ### 主要函数
1. **isPrototypeOf(value, cls)**:检查对象是否是指定类的原型
2. **loadSingleModule(filePath)**:加载单个插件模块
3. **convertSinglePlugin(pluginPath)**:分析单个插件并生成 YAML 配置
4. **main()**:主函数,处理命令行参数并执行转换
### 导出函数
工具导出了以下函数,便于其他模块调用:
```javascript
export {
convertSinglePlugin, // 转换单个插件
loadSingleModule, // 加载单个模块
isPrototypeOf // 检查原型关系
};
```
## 应用场景
1. **插件开发**:在开发新插件时,快速生成配置文件
2. **插件调试**:查看插件的内部定义和配置
3. **插件管理**:批量转换现有插件为标准配置格式
4. **自动化构建**:集成到构建流程中,自动生成插件配置
+436 -227
View File
@@ -1,12 +1,73 @@
---
name: task-plugin-dev
description: 用于开发 Certd 系统中的 Task 插件,继承自 AbstractTaskPlugin 类,被流水线调用 execute 方法将证书部署到对应的应用上。当用户需要创建任务插件、部署证书、自动化任务或修改现有 Task 插件时触发。
version: 1.0.0
---
# Task 插件开发技能 # Task 插件开发技能
## 什么是 Task 插件 ## 角色定义
你是一名 Certd 插件开发专家,擅长创建和实现 Task 类型的插件,熟悉 TypeScript 编程和 Certd 插件开发规范。
Task 插件是 Certd 系统中的部署任务插件,它继承自 `AbstractTaskPlugin` 类,被流水线调用 `execute` 方法,将证书部署到对应的应用上。 ## 核心指令
请严格按照以下步骤执行任务:
## 开发步骤 1. **导入必要的依赖**
- 导入 `AbstractTaskPlugin`, `IsTaskPlugin`, `PageSearch`, `pluginGroups`, `RunStrategy`, `TaskInput` 等必要的类型和装饰器
- 导入 `CertInfo`, `CertReader` 等证书相关类型
- 导入 `createCertDomainGetterInputDefine`, `createRemoteSelectInputDefine` 等工具函数
- 导入 `optionsUtils` 等辅助工具
- 导入 `CertApplyPluginNames` 等常量
### 1. 导入必要的依赖 2. **使用 @IsTaskPlugin 注解注册插件**
- 配置插件的唯一标识、标题、图标
- 设置插件分组
- 配置默认策略(如 `SkipWhenSucceed`
- 确保类名与插件名称一致
3. **定义任务输入参数**
- 使用 `@TaskInput` 注解定义各种输入参数
- 必须包含证书选择参数,用于获取前置任务输出的域名证书
- 可以添加授权选择框、文本输入、选择框等参数
- 使用 `createCertDomainGetterInputDefine` 获取证书域名列表
4. **实现动态显隐配置**
- 使用 `mergeScript` 实现根据其他输入值动态控制输入项的显隐状态
- 利用 `ctx.compute` 函数访问表单中的其他字段值
5. **实现插件方法**
- **onInstance 方法**:插件实例化时执行的初始化操作
- **execute 方法**:插件的核心执行逻辑
- 获取授权信息
- 读取证书信息
- 执行具体的部署逻辑
- 处理错误并记录日志
- 实现幂等性:确保重复执行不会导致问题
- 实现超时处理:设置合理的超时时间
- 实现回滚机制:在部署失败时能够回滚到之前的状态
- **后端获取选项方法**:用于前端从后端获取选项的方法
6. **遵循开发最佳实践**
- 插件命名:遵循命名规范,大写字母开头,驼峰命名
- 类名规范:类名应与插件名称一致
- 日志输出:使用 `this.logger` 输出日志
- 错误处理:捕获并记录执行过程中的错误
- 授权获取:使用 `this.getAccess(accessId)` 获取授权信息
## 输出规范
- 必须包含完整的插件实现代码
- 代码必须包含详细的注释说明
- 提供完整的示例代码,展示插件的使用方法
- 包含开发注意事项和最佳实践
## 示例
### 示例 1: 基本 Task 插件
#### 用户输入
创建一个 Task 插件,用于将证书部署到对应的应用上。
#### 你的回答
```typescript ```typescript
import { AbstractTaskPlugin, IsTaskPlugin, PageSearch, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline'; import { AbstractTaskPlugin, IsTaskPlugin, PageSearch, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
@@ -14,230 +75,9 @@ import { CertInfo, CertReader } from '@certd/plugin-cert';
import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from '@certd/plugin-lib'; import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from '@certd/plugin-lib';
import { optionsUtils } from '@certd/basic'; import { optionsUtils } from '@certd/basic';
import { CertApplyPluginNames} from '@certd/plugin-cert'; import { CertApplyPluginNames} from '@certd/plugin-cert';
```
### 2. 使用 @IsTaskPlugin 注解注册插件
```typescript
@IsTaskPlugin({ @IsTaskPlugin({
// 命名规范,插件类型+功能,大写字母开头,驼峰命名 //命名规范,插件类型+功能,大写字母开头,驼峰命名
name: 'DemoTest',
title: 'Demo-测试插件', // 插件标题
icon: 'clarity:plugin-line', // 插件图标
// 插件分组
group: pluginGroups.other.key,
default: {
// 默认值配置照抄即可
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed,
},
},
})
// 类名规范,跟上面插件名称(name)一致
export class DemoTest extends AbstractTaskPlugin {
// 插件实现...
}
```
### 3. 定义任务输入参数
使用 `@TaskInput` 注解定义任务输入参数:
```typescript
// 测试参数
@TaskInput({
title: '属性示例',
value: '默认值',
component: {
// 前端组件配置,具体配置见组件文档 https://www.antdv.com/components/input-cn
name: 'a-input',
vModel: 'value', // 双向绑定组件的 props 名称
},
helper: '帮助说明,[链接](https://certd.docmirror.cn)',
required: false, // 是否必填
})
text!: string;
// 证书选择,此项必须要有
@TaskInput({
title: '域名证书',
helper: '请选择前置任务输出的域名证书',
component: {
name: 'output-selector',
from: [...CertApplyPluginNames],
},
// required: true, // 必填
})
cert!: CertInfo;
@TaskInput(createCertDomainGetterInputDefine({ props: { required: false } }))
// 前端可以展示,当前申请的证书域名列表
certDomains!: string[];
// 授权选择框
@TaskInput({
title: 'demo授权',
helper: 'demoAccess授权',
component: {
name: 'access-selector',
vModel:"modelValue",
type: "demo", // access类型,让用户固定选择这种类型的access
},
// rules: [{ required: true, message: '此项必填' }],
// required: true, // 必填
})
accessId!: string;
```
### 4. 动态显隐配置(mergeScript
使用 `mergeScript` 可以实现根据其他输入值动态控制当前输入项的显隐状态。
```typescript
@TaskInput({
title: '匹配模式',
component: {
name: 'select',
options: [
{ label: '手动选择', value: 'manual' },
{ label: '根据证书匹配', value: 'auto' },
],
},
default: 'manual',
})
domainMatchMode!: 'manual' | 'auto';
@TaskInput(
createRemoteSelectInputDefine({
title: 'DCDN加速域名',
helper: '你在阿里云上配置的DCDN加速域名',
action: DeployCertToAliyunDCDN.prototype.onGetDomainList.name,
watches: ['certDomains', 'accessId'],
required: true,
mergeScript: `
return {
show: ctx.compute(({form})=>{
return domainMatchMode === "manual"
})
}
`,
})
)
domainName!: string | string[];
```
`mergeScript` 中的 `ctx.compute` 函数接收一个回调函数,通过 `form` 参数可以访问表单中的其他字段值。
### 5. 实现插件方法
#### 5.1 插件实例化时执行的方法
```typescript
// 插件实例化时执行的方法
async onInstance() {}
```
#### 5.2 插件执行方法
```typescript
// 插件执行方法
async execute(): Promise<void> {
const { select, text, cert, accessId } = this;
try {
const access = await this.getAccess(accessId);
this.logger.debug('access', access);
} catch (e) {
this.logger.error('获取授权失败', e);
}
try {
const certReader = new CertReader(cert);
this.logger.debug('certReader', certReader);
} catch (e) {
this.logger.error('读取crt失败', e);
}
this.logger.info('DemoTestPlugin execute');
this.logger.info('text:', text);
this.logger.info('select:', select);
this.logger.info('switch:', this.switch);
this.logger.info('授权id:', accessId);
// 具体的部署逻辑
// ...
}
```
#### 5.3 后端获取选项方法
使用 `createRemoteSelectInputDefine` 创建远程选择输入项,`action` 指向的方法接收 `PageSearch` 参数并返回 `{ list, total }` 格式。
```typescript
@TaskInput(
createRemoteSelectInputDefine({
title: '从后端获取选项',
helper: '选择时可以从后端获取选项',
action: DemoTest.prototype.onGetSiteList.name,
// 当以下参数变化时,触发获取选项
watches: ['certDomains', 'accessId'],
required: true,
})
)
siteName!: string | string[];
// 从后端获取选项的方法,接收PageSearch参数
async onGetSiteList(data: PageSearch) {
if (!this.accessId) {
throw new Error('请选择Access授权');
}
// @ts-ignore
const access = await this.getAccess(this.accessId);
// const siteRes = await access.GetDomainList(data);
// 以下是模拟数据
const siteRes = [
{ id: 1, siteName: 'site1.com' },
{ id: 2, siteName: 'site2.com' },
{ id: 3, siteName: 'site2.com' },
];
// 转换为前端所需要的格式
const options = siteRes.map((item: any) => {
return {
value: item.siteName,
label: item.siteName,
domain: item.siteName,
};
});
// 返回{list, total}格式
return {
list: optionsUtils.buildGroupOptions(options, this.certDomains),
total: siteRes.length,
};
}
```
## 注意事项
1. **插件命名**:插件名称应遵循命名规范,大写字母开头,驼峰命名。
2. **类名规范**:类名应与插件名称(name)一致。
3. **证书选择**:必须包含证书选择参数,用于获取前置任务输出的域名证书。
4. **日志输出**:使用 `this.logger` 输出日志,而不是 `console`
5. **错误处理**:执行过程中的错误应被捕获并记录。
6. **授权获取**:使用 `this.getAccess(accessId)` 获取授权信息。
## 完整示例
```typescript
import { AbstractTaskPlugin, IsTaskPlugin, PageSearch, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
import { CertInfo, CertReader } from '@certd/plugin-cert';
import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from '@certd/plugin-lib';
import { optionsUtils } from '@certd/basic';
import { CertApplyPluginNames} from '@certd/plugin-cert';
@IsTaskPlugin({
//命名规范,插件类型+功能(就是目录plugin-demo中的demo),大写字母开头,驼峰命名
name: 'DemoTest', name: 'DemoTest',
title: 'Demo-测试插件', title: 'Demo-测试插件',
icon: 'clarity:plugin-line', icon: 'clarity:plugin-line',
@@ -286,7 +126,7 @@ export class DemoTest extends AbstractTaskPlugin {
title: '动态显隐', title: '动态显隐',
helper: '我会根据选择框的值进行显隐', helper: '我会根据选择框的值进行显隐',
show: true, //动态计算的值会覆盖它 show: true, //动态计算的值会覆盖它
//动态计算脚本, mergeScript返回的对象会合并当前配置,此处演示 show的值会被动态计算结果覆盖,show的值根据用户选择的select的值决定 //动态计算脚本, mergeScript返回的对象会合并当前配置
mergeScript: ` mergeScript: `
return { return {
show: ctx.compute(({form})=>{ show: ctx.compute(({form})=>{
@@ -324,6 +164,7 @@ export class DemoTest extends AbstractTaskPlugin {
}, },
}) })
switch!: boolean; switch!: boolean;
//证书选择,此项必须要有 //证书选择,此项必须要有
@TaskInput({ @TaskInput({
title: '域名证书', title: '域名证书',
@@ -392,6 +233,7 @@ export class DemoTest extends AbstractTaskPlugin {
this.logger.info('switch:', this.switch); this.logger.info('switch:', this.switch);
this.logger.info('授权id:', accessId); this.logger.info('授权id:', accessId);
// 具体的部署逻辑
// const res = await this.http.request({ // const res = await this.http.request({
// url: 'https://api.demo.com', // url: 'https://api.demo.com',
// method: 'GET', // method: 'GET',
@@ -434,4 +276,371 @@ export class DemoTest extends AbstractTaskPlugin {
}; };
} }
} }
```
### 示例 2: Nginx 部署 Task 插件
#### 用户输入
创建一个 Task 插件,用于将证书部署到 Nginx 服务器上。
#### 你的回答
```typescript
import { AbstractTaskPlugin, CertInfo, IsTaskPlugin, TaskInput, pluginGroups, RunStrategy } from '@certd/pipeline';
import { CertReader } from '@certd/plugin-lib';
/**
* Nginx 证书部署插件
*/
@IsTaskPlugin({
name: 'NginxDeploy',
title: 'Nginx 部署',
desc: '将证书部署到 Nginx 服务器上',
icon: 'clarity:server-line',
group: pluginGroups.deploy.key,
default: {
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed,
},
},
})
export class NginxDeploy extends AbstractTaskPlugin {
/**
* 服务器授权
*/
@TaskInput({
title: '服务器授权',
component: {
name: 'access-selector',
vModel: 'accessId',
accessTypes: ['ssh'],
placeholder: '请选择服务器授权',
},
required: true,
})
accessId = '';
/**
* 域名证书
*/
@TaskInput({
title: '域名证书',
component: {
name: 'output-selector',
from: ['CertApply', 'CertApplyCloudflare'],
field: 'cert',
},
required: true,
})
cert!: CertInfo;
/**
* 证书路径
*/
@TaskInput({
title: '证书路径',
value: '/etc/nginx/ssl',
component: {
name: 'a-input',
placeholder: '请输入证书存储路径',
},
required: true,
})
certPath = '';
/**
* Nginx 配置文件路径
*/
@TaskInput({
title: 'Nginx 配置文件',
value: '/etc/nginx/conf.d',
component: {
name: 'a-input',
placeholder: '请输入 Nginx 配置文件路径',
},
required: true,
})
nginxConfPath = '';
/**
* 服务名称
*/
@TaskInput({
title: '服务名称',
component: {
name: 'a-input',
placeholder: '请输入服务名称(用于生成配置文件)',
},
required: true,
})
serviceName = '';
/**
* 执行部署
*/
async execute(): Promise<void> {
this.logger.info('开始部署证书到 Nginx');
try {
// 1. 获取服务器授权
const sshAccess = await this.getAccess(this.accessId);
this.logger.info('获取服务器授权成功');
// 2. 读取证书信息
const certReader = new CertReader(this.cert);
const cert = certReader.getCert();
const key = certReader.getKey();
const fullchain = certReader.getFullChain();
this.logger.info('读取证书信息成功');
// 3. 准备部署路径
const certFile = `${this.certPath}/${this.serviceName}.pem`;
const keyFile = `${this.certPath}/${this.serviceName}.key`;
const confFile = `${this.nginxConfPath}/${this.serviceName}.conf`;
// 4. 创建证书目录
await sshAccess.exec(`mkdir -p ${this.certPath}`);
this.logger.info('创建证书目录成功');
// 5. 上传证书文件
await sshAccess.uploadContent(cert, certFile);
await sshAccess.uploadContent(key, keyFile);
await sshAccess.uploadContent(fullchain, `${this.certPath}/${this.serviceName}-fullchain.pem`);
this.logger.info('上传证书文件成功');
// 6. 生成 Nginx 配置
const nginxConf = `server {
listen 443 ssl;
server_name ${this.cert.domains.join(' ')};
ssl_certificate ${certFile};
ssl_certificate_key ${keyFile};
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://localhost:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
`;
// 7. 上传 Nginx 配置
await sshAccess.uploadContent(nginxConf, confFile);
this.logger.info('上传 Nginx 配置成功');
// 8. 测试 Nginx 配置
const testResult = await sshAccess.exec('nginx -t');
if (testResult.includes('test is successful')) {
this.logger.info('Nginx 配置测试成功');
} else {
throw new Error(`Nginx 配置测试失败: ${testResult}`);
}
// 9. 重启 Nginx 服务
await sshAccess.exec('systemctl reload nginx');
this.logger.info('重启 Nginx 服务成功');
this.logger.info('证书部署到 Nginx 成功');
} catch (error) {
this.logger.error('部署失败:', error);
throw new Error(`部署到 Nginx 失败: ${error.message}`);
}
}
}
// 实例化插件
new NginxDeploy();
```
### 示例 3: 阿里云 OSS 部署 Task 插件
#### 用户输入
创建一个 Task 插件,用于将证书部署到阿里云 OSS 上。
#### 你的回答
```typescript
import { AbstractTaskPlugin, CertInfo, IsTaskPlugin, TaskInput, pluginGroups, RunStrategy } from '@certd/pipeline';
import { CertReader } from '@certd/plugin-lib';
/**
* 阿里云 OSS 证书部署插件
*/
@IsTaskPlugin({
name: 'AliyunOSSDeploy',
title: '阿里云 OSS 部署',
desc: '将证书部署到阿里云 OSS 存储上',
icon: 'clarity:cloud-line',
group: pluginGroups.deploy.key,
default: {
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed,
},
},
})
export class AliyunOSSDeploy extends AbstractTaskPlugin {
/**
* 阿里云授权
*/
@TaskInput({
title: '阿里云授权',
component: {
name: 'access-selector',
vModel: 'accessId',
accessTypes: ['aliyun'],
placeholder: '请选择阿里云授权',
},
required: true,
})
accessId = '';
/**
* 域名证书
*/
@TaskInput({
title: '域名证书',
component: {
name: 'output-selector',
from: ['CertApply', 'CertApplyCloudflare'],
field: 'cert',
},
required: true,
})
cert!: CertInfo;
/**
* OSS 存储桶
*/
@TaskInput({
title: 'OSS 存储桶',
component: {
name: 'a-input',
placeholder: '请输入 OSS 存储桶名称',
},
required: true,
})
bucketName = '';
/**
* 存储路径
*/
@TaskInput({
title: '存储路径',
value: 'ssl/',
component: {
name: 'a-input',
placeholder: '请输入证书存储路径',
},
})
storagePath = '';
/**
* 执行部署
*/
async execute(): Promise<void> {
this.logger.info('开始部署证书到阿里云 OSS');
try {
// 1. 获取阿里云授权
const aliyunAccess = await this.getAccess(this.accessId);
this.logger.info('获取阿里云授权成功');
// 2. 读取证书信息
const certReader = new CertReader(this.cert);
const cert = certReader.getCert();
const key = certReader.getKey();
const fullchain = certReader.getFullChain();
this.logger.info('读取证书信息成功');
// 3. 准备存储路径
const basePath = this.storagePath.endsWith('/') ? this.storagePath : `${this.storagePath}/`;
const certFileName = `${basePath}${this.cert.domains[0]}.pem`;
const keyFileName = `${basePath}${this.cert.domains[0]}.key`;
const fullchainFileName = `${basePath}${this.cert.domains[0]}-fullchain.pem`;
// 4. 上传证书到 OSS
await aliyunAccess.uploadToOSS({
bucket: this.bucketName,
key: certFileName,
content: cert,
});
this.logger.info('上传证书文件成功');
await aliyunAccess.uploadToOSS({
bucket: this.bucketName,
key: keyFileName,
content: key,
});
this.logger.info('上传私钥文件成功');
await aliyunAccess.uploadToOSS({
bucket: this.bucketName,
key: fullchainFileName,
content: fullchain,
});
this.logger.info('上传完整证书链成功');
// 5. 设置文件访问权限(可选)
await aliyunAccess.setOSSObjectAcl({
bucket: this.bucketName,
key: certFileName,
acl: 'private',
});
await aliyunAccess.setOSSObjectAcl({
bucket: this.bucketName,
key: keyFileName,
acl: 'private',
});
await aliyunAccess.setOSSObjectAcl({
bucket: this.bucketName,
key: fullchainFileName,
acl: 'private',
});
this.logger.info('设置文件访问权限成功');
this.logger.info('证书部署到阿里云 OSS 成功');
} catch (error) {
this.logger.error('部署失败:', error);
throw new Error(`部署到阿里云 OSS 失败: ${error.message}`);
}
}
}
// 实例化插件
new AliyunOSSDeploy();
```
## 注意事项
1. **插件命名**:插件名称应遵循命名规范,大写字母开头,驼峰命名。
2. **类名规范**:类名应与插件名称(name)一致。
3. **证书选择**:必须包含证书选择参数,用于获取前置任务输出的域名证书。
4. **日志输出**:使用 `this.logger` 输出日志,而不是 `console`,参数文本化,不要传对象,否则会输出`[object Object]}`
5. **错误处理**:执行过程中的错误应被捕获并记录。
6. **授权获取**:使用 `this.getAccess(accessId)` 获取授权信息。
## 部署逻辑注意事项
1. **部署接口逻辑**
- 研究应用的部署接口逻辑,一般有两种:
a. 用户选择网站ID,给网站部署新证书
b. 用户选择证书ID,只需要更新证书即可
- 保证多次执行都能针对同一个对象部署证书
- 确保出错后重新运行能够回归到正常状态
2. **前置证书选择**
- 前置证书可以是原始的 `certInfo` 类型,也可能是上传到平台之后返回的证书id
- 根据接口要求选择合适的证书类型:
a. 如果接口需要上传后的证书id,那么部署时要先将证书上传,再部署
b. 如果接口需要原始的 `certInfo` 类型,那么直接使用 `certInfo` 部署证书
c. 当两者都支持时,判断用户选择的证书类型,再考虑优先上传再部署
3. **证书清理**
- 如果是先上传再部署的,那么在部署完成后,可能需要考虑清理证书
``` ```
+19
View File
@@ -3,6 +3,25 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.39.10](https://github.com/certd/certd/compare/v1.39.9...v1.39.10) (2026-04-11)
### Bug Fixes
* 修复创建流水线无法选择通知的bug ([a88d0a6](https://github.com/certd/certd/commit/a88d0a6ae15cb6170d0b36e21daf89f0dbd5f681))
* 修复流水线任务编辑页面复制粘贴按钮在夜间模式显示问题 ([1e549df](https://github.com/certd/certd/commit/1e549dfd431ed74e2bcdfce63e5f640c51603af3))
* 修复用户管理添加用户无法上传头像的bug ([557e98c](https://github.com/certd/certd/commit/557e98c33f5462167d8f6289f70dad68bb114a97))
* 修复自定义插件删除后没有反注册的bug ([df98463](https://github.com/certd/certd/commit/df9846332596d2afaba53e66d2897aa1c598f9c4))
* 修复spaceship创建record报错的bug ([70b46d4](https://github.com/certd/certd/commit/70b46d4a8f89cf8eded21ebb237e8c8ce6c40d30))
### Performance Improvements
* 1panel支持先上传证书再选择证书 ([7a9eec8](https://github.com/certd/certd/commit/7a9eec88e8eddf40dba055c072b5b2b0f67c1407))
* 部署到1panel面板支持mux模式 ([d05129e](https://github.com/certd/certd/commit/d05129ec67893b0b639003a4bca6878d128f56ad))
* 流水线修改编辑之后,增加未保存提示 ([21620ac](https://github.com/certd/certd/commit/21620ac6bdeb57e43509156a77037fc07c44282a))
* 修复检查全部某些情况下无效的bug,优化公共触发站点证书检查定时逻辑 ([ee53589](https://github.com/certd/certd/commit/ee535895a3166c6f9046963e28fa8f22f018b574))
* 增加域名管理 子域名检查提醒 ([2bdf183](https://github.com/certd/certd/commit/2bdf1832da73a3728f3ac415837bc26e70531cd6))
* 站点监控域名气泡增加端口显示 ([6ee718a](https://github.com/certd/certd/commit/6ee718a25265a9db2115343af9a1a01958f34b81))
## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05) ## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05)
### Bug Fixes ### Bug Fixes
+9 -1
View File
@@ -95,7 +95,15 @@ https://certd.handfree.work/
3. 【推荐】[1Panel面板方式部署](https://certd.docmirror.cn/guide/install/1panel/) 3. 【推荐】[1Panel面板方式部署](https://certd.docmirror.cn/guide/install/1panel/)
4. 【推荐】[雨云一键部署](https://app.rainyun.com/apps/rca/store/6646/?ref=NzExMDQ2) : 首充翻倍,每月仅需2.2元 4. 【推荐】[雨云一键部署](https://app.rainyun.com/apps/rca/store/6646/?ref=NzExMDQ2) : 首充翻倍,每月仅需2.2元
[<img src="https://rainyun-apps.cn-nb1.rains3.com/materials/deploy-on-rainyun-cn.svg">](https://app.rainyun.com/apps/rca/store/6646/?ref=NzExMDQ2) [<img src="https://rainyun-apps.cn-nb1.rains3.com/materials/deploy-on-rainyun-cn.svg">](https://app.rainyun.com/apps/rca/store/6646/?ref=NzExMDQ2)
5. 【不推荐】[源码方式部署 ](https://certd.docmirror.cn/guide/install/source/)
5. 【推荐】[一键安装脚本](https://certd.docmirror.cn/guide/install/docker/)(自动安装 DockerCertd):
```bash
curl -fsSL https://gitee.com/certd/certd/raw/v2/docker/run/install.sh | bash
```
6. 【不推荐】[源码方式部署 ](https://certd.docmirror.cn/guide/install/source/)
#### Docker镜像说明: #### Docker镜像说明:
* 国内镜像地址: * 国内镜像地址:
+340
View File
@@ -0,0 +1,340 @@
#!/bin/bash
set -e
CERTD_VERSION="${CERTD_VERSION:-latest}"
INSTALL_DIR="${INSTALL_DIR:-/opt/certd}"
COMPOSE_FILE_URL="https://gitee.com/certd/certd/raw/v2/docker/run/docker-compose.yaml"
COMPOSE_FILE="$INSTALL_DIR/docker-compose.yaml"
DOCKER_MIRROR="https://mirrors.aliyun.com"
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
log_info() {
echo -e "${GREEN}[INFO]${NC} $1"
}
log_warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
log_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
check_command() {
command -v "$1" >/dev/null 2>&1
}
get_local_ip() {
LOCAL_IP=$(ip route get 1.1.1.1 2>/dev/null | grep -oP 'src \K[^ ]+' | head -1)
if [ -z "$LOCAL_IP" ]; then
LOCAL_IP=$(hostname -I 2>/dev/null | awk '{print $1}')
fi
if [ -z "$LOCAL_IP" ]; then
LOCAL_IP="127.0.0.1"
fi
echo "$LOCAL_IP"
}
get_public_ip() {
PUBLIC_IP=$(curl -s --max-time 5 https://api.ipify.org 2>/dev/null)
if [ -z "$PUBLIC_IP" ]; then
PUBLIC_IP=$(curl -s --max-time 5 https://checkip.amazonaws.com 2>/dev/null)
fi
if [ -z "$PUBLIC_IP" ]; then
PUBLIC_IP=""
fi
echo "$PUBLIC_IP"
}
show_access_urls() {
LOCAL_IP=$(get_local_ip)
PUBLIC_IP=$(get_public_ip)
echo ""
echo "=========================================="
log_info "安装完成!"
echo "=========================================="
echo ""
echo "访问地址:"
if [ -n "$PUBLIC_IP" ]; then
echo -e " ${GREEN}外网访问:${NC} http://$PUBLIC_IP:7001"
fi
echo -e " ${GREEN}局域网:${NC} http://$LOCAL_IP:7001"
echo ""
echo "配置文件: $COMPOSE_FILE"
echo ""
echo "常用命令:"
echo " cd $INSTALL_DIR"
echo " docker compose logs -f # 查看日志"
echo " docker compose restart # 重启服务"
echo " docker compose down # 停止服务"
echo ""
}
detect_os() {
if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$ID
VER=$VERSION_ID
elif [ -f /etc/centos-release ]; then
OS="centos"
elif [ -f /etc/redhat-release ]; then
OS="rhel"
else
OS="unknown"
fi
}
check_docker() {
if check_command docker; then
DOCKER_VERSION=$(docker --version 2>/dev/null | awk '{print $3}' | tr -d ',')
log_info "Docker 已安装: $DOCKER_VERSION"
return 0
else
log_warn "Docker 未安装"
return 1
fi
}
check_docker_compose() {
if check_command docker-compose; then
COMPOSE_VERSION=$(docker-compose --version 2>/dev/null | awk '{print $3}' | tr -d ',')
log_info "Docker Compose 已安装: $COMPOSE_VERSION"
return 0
elif docker compose version >/dev/null 2>&1; then
log_info "Docker Compose (插件版) 已安装"
return 0
else
log_warn "Docker Compose 未安装"
return 1
fi
}
install_docker_ubuntu() {
log_info "正在安装 Docker (Ubuntu/Debian)..."
apt-get update
apt-get install -y ca-certificates curl gnupg lsb-release
mkdir -p /etc/apt/keyrings
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/${OS}/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg 2>/dev/null || \
curl -fsSL https://download.docker.com/linux/${OS}/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.aliyun.com/docker-ce/linux/${OS} $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
systemctl enable docker
systemctl start docker
log_info "Docker 安装完成"
}
install_docker_centos() {
log_info "正在安装 Docker (CentOS/RHEL)..."
yum install -y yum-utils
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
systemctl enable docker
systemctl start docker
log_info "Docker 安装完成"
}
install_dockerrocky() {
log_info "正在安装 Docker (Rocky Linux/AlmaLinux)..."
dnf install -y yum-utils
dnf config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
dnf install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
systemctl enable docker
systemctl start docker
log_info "Docker 安装完成"
}
install_docker_debian() {
log_info "正在安装 Docker (Debian)..."
apt-get update
apt-get install -y ca-certificates curl gnupg2
mkdir -p /etc/apt/keyrings
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/debian/gpg | gpg --armor -o /etc/apt/keyrings/docker.gpg 2>/dev/null || \
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --armor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.aliyun.com/docker-ce/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
systemctl enable docker
systemctl start docker
log_info "Docker 安装完成"
}
install_docker() {
detect_os
log_info "检测到操作系统: $OS"
case $OS in
ubuntu)
install_docker_ubuntu
;;
debian)
install_docker_debian
;;
centos)
install_docker_centos
;;
rhel|rocky|almalinux)
install_dockerrocky
;;
*)
log_error "不支持的操作系统: $OS"
log_info "请手动安装 Docker"
exit 1
;;
esac
}
install_docker_compose_standalone() {
log_info "正在安装 Docker Compose (独立版本)..."
COMPOSE_URLS=(
"https://get.daocloud.io/docker/compose/releases/download/v2.12.2/docker-compose-$(uname -s)-$(uname -m)"
"https://mirror.sjtu.edu.cn/github/docker/compose/releases/download/v2.12.2/docker-compose-$(uname -s)-$(uname -m)"
"https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-$(uname -s)-$(uname -m)"
)
for url in "${COMPOSE_URLS[@]}"; do
log_info "尝试从: $url"
if curl -L "$url" -o /usr/local/bin/docker-compose 2>/dev/null; then
chmod +x /usr/local/bin/docker-compose
log_info "Docker Compose 安装完成"
return 0
fi
log_warn "下载失败,尝试下一个源..."
done
log_error "Docker Compose 安装失败"
return 1
}
install_docker_compose() {
if check_command docker && docker compose version >/dev/null 2>&1; then
log_info "Docker Compose 插件已可用"
return 0
fi
if check_command docker-compose; then
log_info "Docker Compose 独立版本已安装"
return 0
fi
install_docker_compose_standalone
}
download_compose_file() {
log_info "正在下载 docker-compose.yaml..."
mkdir -p "$INSTALL_DIR"
if curl -fsSL "$COMPOSE_FILE_URL" -o "$COMPOSE_FILE.tmp"; then
mv "$COMPOSE_FILE.tmp" "$COMPOSE_FILE"
log_info "docker-compose.yaml 已下载到 $COMPOSE_FILE"
if [ "$CERTD_VERSION" != "latest" ]; then
sed -i "s|certd:latest|certd:$CERTD_VERSION|g" "$COMPOSE_FILE"
log_info "已修改镜像版本为: $CERTD_VERSION"
fi
else
log_error "下载失败,请检查网络连接"
exit 1
fi
}
start_certd() {
log_info "正在启动 Certd 容器..."
cd "$INSTALL_DIR"
if docker compose -f "$COMPOSE_FILE" up -d 2>/dev/null; then
log_info "Certd 启动成功!"
elif docker-compose -f "$COMPOSE_FILE" up -d; then
log_info "Certd 启动成功!"
fi
sleep 2
docker ps --filter "name=certd" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
}
show_usage() {
echo "用法: $0 [选项]"
echo ""
echo "选项:"
echo " -v, --version VERSION 指定 Certd 版本 (默认: latest)"
echo " -p, --path PATH 指定安装路径 (默认: /opt/certd)"
echo " -h, --help 显示帮助信息"
echo ""
echo "示例:"
echo " $0 # 使用默认配置安装"
echo " $0 -v 1.29.0 # 安装指定版本"
echo " $0 -p /data/certd # 安装到指定目录"
}
main() {
echo "=========================================="
echo " Certd 一键安装脚本"
echo "=========================================="
echo ""
while [[ $# -gt 0 ]]; do
case $1 in
-v|--version)
CERTD_VERSION="$2"
shift 2
;;
-p|--path)
INSTALL_DIR="$2"
COMPOSE_FILE="$INSTALL_DIR/docker-compose.yaml"
shift 2
;;
-h|--help)
show_usage
exit 0
;;
*)
log_error "未知选项: $1"
show_usage
exit 1
;;
esac
done
log_info "Certd 版本: $CERTD_VERSION"
log_info "安装路径: $INSTALL_DIR"
echo ""
DOCKER_INSTALLED=true
COMPOSE_INSTALLED=true
if ! check_docker; then
echo ""
log_info "正在安装 Docker..."
install_docker
fi
if ! check_docker_compose; then
echo ""
log_info "正在安装 Docker Compose..."
install_docker_compose
fi
download_compose_file
start_certd
show_access_urls
}
main "$@"
+1
View File
@@ -114,6 +114,7 @@ export default defineConfig({
{text: "连接windows主机", link: "/guide/use/host/windows.md"}, {text: "连接windows主机", link: "/guide/use/host/windows.md"},
{text: "Google EAB获取", link: "/guide/use/google/"}, {text: "Google EAB获取", link: "/guide/use/google/"},
{text: "阿里云相关", link: "/guide/use/aliyun/"}, {text: "阿里云相关", link: "/guide/use/aliyun/"},
{text: "Azure相关", link: "/guide/use/azure/dns.md"},
{text: "数据备份", link: "/guide/use/backup/"}, {text: "数据备份", link: "/guide/use/backup/"},
{text: "Certd本身的证书更新", link: "/guide/use/https/index.md"}, {text: "Certd本身的证书更新", link: "/guide/use/https/index.md"},
{text: "js脚本插件使用", link: "/guide/use/custom-script/index.md"}, {text: "js脚本插件使用", link: "/guide/use/custom-script/index.md"},
+19
View File
@@ -3,6 +3,25 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.39.10](https://github.com/certd/certd/compare/v1.39.9...v1.39.10) (2026-04-11)
### Bug Fixes
* 修复创建流水线无法选择通知的bug ([a88d0a6](https://github.com/certd/certd/commit/a88d0a6ae15cb6170d0b36e21daf89f0dbd5f681))
* 修复流水线任务编辑页面复制粘贴按钮在夜间模式显示问题 ([1e549df](https://github.com/certd/certd/commit/1e549dfd431ed74e2bcdfce63e5f640c51603af3))
* 修复用户管理添加用户无法上传头像的bug ([557e98c](https://github.com/certd/certd/commit/557e98c33f5462167d8f6289f70dad68bb114a97))
* 修复自定义插件删除后没有反注册的bug ([df98463](https://github.com/certd/certd/commit/df9846332596d2afaba53e66d2897aa1c598f9c4))
* 修复spaceship创建record报错的bug ([70b46d4](https://github.com/certd/certd/commit/70b46d4a8f89cf8eded21ebb237e8c8ce6c40d30))
### Performance Improvements
* 1panel支持先上传证书再选择证书 ([7a9eec8](https://github.com/certd/certd/commit/7a9eec88e8eddf40dba055c072b5b2b0f67c1407))
* 部署到1panel面板支持mux模式 ([d05129e](https://github.com/certd/certd/commit/d05129ec67893b0b639003a4bca6878d128f56ad))
* 流水线修改编辑之后,增加未保存提示 ([21620ac](https://github.com/certd/certd/commit/21620ac6bdeb57e43509156a77037fc07c44282a))
* 修复检查全部某些情况下无效的bug,优化公共触发站点证书检查定时逻辑 ([ee53589](https://github.com/certd/certd/commit/ee535895a3166c6f9046963e28fa8f22f018b574))
* 增加域名管理 子域名检查提醒 ([2bdf183](https://github.com/certd/certd/commit/2bdf1832da73a3728f3ac415837bc26e70531cd6))
* 站点监控域名气泡增加端口显示 ([6ee718a](https://github.com/certd/certd/commit/6ee718a25265a9db2115343af9a1a01958f34b81))
## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05) ## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05)
### Bug Fixes ### Bug Fixes
+22 -5
View File
@@ -2,7 +2,23 @@
## 一、安装 ## 一、安装
### 1. 环境准备 ### 一键脚本安装(推荐)
如果您的服务器未安装 Docker,该脚本会自动为您安装 Docker 和 Docker Compose,并启动 Certd 容器。
```bash
curl -fsSL https://gitee.com/certd/certd/raw/v2/docker/run/install.sh | bash
```
> 支持 Ubuntu、Debian、CentOS、Rocky Linux、AlmaLinux 等主流发行版。
> docker-compose文件目录:`/opt/certd` ,升级时需要先进入此目录
> 运行时数据默认保存路径:`/data/certd` ,可使用参数指定:`-p /data/certd`
### 手动安装
#### 1. 环境准备
1.1 准备一台云服务器 1.1 准备一台云服务器
@@ -19,9 +35,9 @@ https://docs.docker.com/engine/install/
```bash ```bash
# 随便创建一个目录 # 随便创建一个目录
mkdir certd mkdir /opt/certd
# 进入目录 # 进入目录
cd certd cd /opt/certd
# 下载docker-compose.yaml文件,或者手动下载放到certd目录下 # 下载docker-compose.yaml文件,或者手动下载放到certd目录下
wget https://gitee.com/certd/certd/raw/v2/docker/run/docker-compose.yaml wget https://gitee.com/certd/certd/raw/v2/docker/run/docker-compose.yaml
@@ -54,12 +70,12 @@ https://your_server_ip:7002
记得修改密码 记得修改密码
## 二、升级 ## 二、升级Certd
::: warning ::: warning
如果您是第一次升级certd版本,切记切记先备份一下数据 如果您是第一次升级certd版本,切记切记先备份一下数据
``` ```
# docker-compose.yaml配置 # 查看/opt/certd/docker-compose.yaml配置
- /data/certd:/app/data # 请务必确保 /app/data 这个路径没有改动,固定写死 - /data/certd:/app/data # 请务必确保 /app/data 这个路径没有改动,固定写死
``` ```
::: :::
@@ -71,6 +87,7 @@ https://your_server_ip:7002
### 如果使用`latest`版本 ### 如果使用`latest`版本
```shell ```shell
cd /opt/certd
#重新拉取镜像 #重新拉取镜像
docker pull registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest docker pull registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest
# 重新启动容器 # 重新启动容器
+42 -39
View File
@@ -36,45 +36,48 @@
| 32.| **Gcore** | Gcore | | 32.| **Gcore** | Gcore |
| 33.| **Github授权** | | | 33.| **Github授权** | |
| 34.| **godaddy授权** | | | 34.| **godaddy授权** | |
| 35.| **金山云授权** | | | 35.| **HiPM DNSMgr** | HiPM DNSMgr API Token 授权 |
| 36.| **FTP授权** | | | 36.| **金山云授权** | |
| 37.| **七牛OSS授权** | | | 37.| **FTP授权** | |
| 38.| **腾讯云COS授权** | 腾讯云对象存储授权,包含地域和存储桶 | | 38.| **七牛OSS授权** | |
| 39.| **s3/minio授权** | S3/minio oss授权 | | 39.| **腾讯云COS授权** | 腾讯云对象存储授权,包含地域和存储桶 |
| 40.| **namesilo授权** | | | 40.| **s3/minio授权** | S3/minio oss授权 |
| 41.| **Next Terminal 授权** | 用于访问 Next Terminal API 的授权配置 | | 41.| **namesilo授权** | |
| 42.| **1panel授权** | 账号和密码 | | 42.| **Next Terminal 授权** | 用于访问 Next Terminal API 的授权配置 |
| 43.| **支付宝** | | | 43.| **Nginx Proxy Manager 授权** | 用于登录 Nginx Proxy Manager,并为代理主机证书部署提供授权。 |
| 44.| **白山云授权** | | | 44.| **1panel授权** | 账号和密码 |
| 45.| **宝塔云WAF授权** | 用于连接和管理宝塔云WAF服务的授权配置 | | 45.| **支付宝** | |
| 46.| **cdnfly授权** | | | 46.| **白山云授权** | |
| 47.| **k8s授权** | | | 47.| **宝塔云WAF授权** | 用于连接和管理宝塔云WAF服务的授权配置 |
| 48.| **括彩云cdn授权** | 括彩云CDN,每月免费30G[注册即领](https://kuocaicdn.com/register?code=8mn536rrzfbf8) | | 48.| **cdnfly授权** | |
| 49.| **LeCDN授权** | | | 49.| **k8s授权** | |
| 50.| **lucky** | | | 50.| **括彩云cdn授权** | 括彩云CDN,每月免费30G[注册即领](https://kuocaicdn.com/register?code=8mn536rrzfbf8) |
| 51.| **猫云授权** | | | 51.| **LeCDN授权** | |
| 52.| **plesk授权** | | | 52.| **lucky** | |
| 53.| **长亭雷池授权** | | | 53.| **猫云授权** | |
| 54.| **群晖登录授权** | | | 54.| **plesk授权** | |
| 55.| **uniCloud** | unicloud授权 | | 55.| **长亭雷池授权** | |
| 56.| **微信支付** | | | 56.| **群晖登录授权** | |
| 57.| **易盾rcdn授权** | 易盾CDN,每月免费30G[注册即领](https://rhcdn.yiduncdn.com/register?code=8mn536rrzfbf8) | | 57.| **uniCloud** | unicloud授权 |
| 58.| **易发云短信** | sms.yfyidc.cn/ | | 58.| **微信支付** | |
| 59.| **易盾DCDN授权** | https://user.yiduncdn.com | | 59.| **易盾rcdn授权** | 易盾CDN,每月免费30G[注册即领](https://rhcdn.yiduncdn.com/register?code=8mn536rrzfbf8) |
| 60.| **易支付** | | | 60.| **易发云短信** | sms.yfyidc.cn/ |
| 61.| **proxmox** | | | 61.| **易盾DCDN授权** | https://user.yiduncdn.com |
| 62.| **Spaceship.com 授权** | Spaceship.com API 授权插件 | | 62.| **易支付** | |
| 63.| **UCloud授权** | 优刻得授权 | | 63.| **proxmox** | |
| 64.| **又拍云** | | | 64.| **Spaceship.com 授权** | Spaceship.com API 授权插件 |
| 65.| **网宿授权** | | | 65.| **Technitium DNS Server** | Technitium DNS Server 自建DNS服务器授权 |
| 66.| **西部数码授权** | | | 66.| **UCloud授权** | 优刻得授权 |
| 67.| **我爱云授权** | 我爱云CDN | | 67.| **又拍云** | |
| 68.| **新网授权(代理方式)** | | | 68.| **网宿授权** | |
| 69.| **新网授权** | | | 69.| **西部数码授权** | |
| 70.| **新网互联授权** | 仅支持代理账号,ip需要加入白名单 | | 70.| **我爱云授权** | 我爱云CDN |
| 71.| **Zenlayer授权** | Zenlayer授权 | | 71.| **新网授权(代理方式)** | |
| 72.| **GoEdge授权** | | | 72.| **新网授权** | |
| 73.| **雨云授权** | https://app.rainyun.com/ | | 73.| **新网互联授权** | 仅支持代理账号,ip需要加入白名单 |
| 74.| **Zenlayer授权** | Zenlayer授权 |
| 75.| **GoEdge授权** | |
| 76.| **雨云授权** | https://app.rainyun.com/ |
<style module> <style module>
table th:first-of-type { table th:first-of-type {
+21 -20
View File
@@ -1,5 +1,5 @@
# 任务插件 # 任务插件
`129` 款任务插件 `130` 款任务插件
## 1. 证书申请 ## 1. 证书申请
| 序号 | 名称 | 说明 | | 序号 | 名称 | 说明 |
@@ -58,25 +58,26 @@
| 3.| **Dokploy-部署server证书** | 自动更新Dokploy server证书 | | 3.| **Dokploy-部署server证书** | 自动更新Dokploy server证书 |
| 4.| **飞牛NAS-部署证书** | | | 4.| **飞牛NAS-部署证书** | |
| 5.| **NextTerminal-更新证书** | 更新 Next Terminal 证书 | | 5.| **NextTerminal-更新证书** | 更新 Next Terminal 证书 |
| 6.| **1Panel-部署面板证书** | 更新1Panel的面板证书 | | 6.| **Nginx Proxy Manager-部署到主机** | 上传自定义证书到 Nginx Proxy Manager,并绑定到所选主机。 |
| 7.| **1Panel-更新站点证书** | 更新1Panel的站点证书 | | 7.| **1Panel-部署面板证书** | 更新1Panel的面板证书 |
| 8.| **宝塔-删除过期证书** | 删除证书夹中过期证书 | | 8.| **1Panel-更新站点证书** | 更新1Panel的站点证书 |
| 9.| **宝塔-WAF证书部署** | 部署宝塔云WAF/aaWAF | | 9.| **宝塔-删除过期证书** | 删除证书夹中过期证书 |
| 10.| **宝塔-面板证书部署** | 部署宝塔面板本身的ssl证书 | | 10.| **宝塔-WAF证书部署** | 部署宝塔云WAF/aaWAF |
| 11.| **宝塔win-网站证书部署** | 部署到Windows版宝塔管理的站点的ssl证书 | | 11.| **宝塔-面板证书部署** | 部署宝塔面板本身的ssl证书 |
| 12.| **宝塔-网站证书部署** | 部署宝塔管理的站点的ssl证书,目前支持宝塔网站站点、docker站点等。本插件也支持aaPanel。 | | 12.| **宝塔win-网站证书部署** | 部署到Windows版宝塔管理的站点的ssl证书 |
| 13.| **K8S-Apply自定义yaml** | apply自定义yaml到k8s | | 13.| **宝塔-网站证书部署** | 部署宝塔管理的站点的ssl证书,目前支持宝塔网站站点、docker站点等。本插件也支持aaPanel。 |
| 14.| **K8S-Ingress 证书部署** | 部署证书到k8s的Ingress | | 14.| **K8S-Apply自定义yaml** | apply自定义yaml到k8s |
| 15.| **K8S-部署证书到Secret** | 部署证书到k8s的secret | | 15.| **K8S-Ingress 证书部署** | 部署证书到k8s的Ingress |
| 16.| **lucky-更新Lucky证书** | | | 16.| **K8S-部署证书到Secret** | 部署证书到k8s的secret |
| 17.| **Plesk-部署Plesk网站证书** | | | 17.| **lucky-更新Lucky证书** | |
| 18.| **Plesk-更新证书** | 不会创建新证书记录,直接更新旧的证书 | | 18.| **Plesk-部署Plesk网站证书** | |
| 19.| **雷池-更新证书(支持控制台和防护应用)** | 更新长亭雷池WAF的证书,支持更新控制台和防护应用的证书 | | 19.| **Plesk-更新证书** | 不会创建新证书记录,直接更新旧的证书 |
| 20.| **群晖-部署证书到群晖面板** | Synology,支持6.x以上版本 | | 20.| **雷池-更新证书(支持控制台和防护应用)** | 更新长亭雷池WAF的证书,支持更新控制台和防护应用的证书。 |
| 21.| **群晖-刷新OTP登录有效期** | 群晖登录状态可能30天失效,需要在失效之前登录一次,刷新有效期,您可以将其放在“部署到群晖面板”任务之后 | | 21.| **群晖-部署证书到群晖面板** | Synology,支持6.x以上版本 |
| 22.| **uniCloud-部署到服务空间** | 部署到服务空间 | | 22.| **群晖-刷新OTP登录有效期** | 群晖登录状态可能30天失效,需要在失效之前登录一次,刷新有效期,您可以将其放在“部署到群晖面板”任务之后 |
| 23.| **Proxmox-上传证书到Proxmox** | | | 23.| **uniCloud-部署到服务空间** | 部署到服务空间 |
| 24.| **威联通-部署证书到威联通** | 部署证书到qnap | | 24.| **Proxmox-上传证书到Proxmox** | |
| 25.| **威联通-部署证书到威联通** | 部署证书到qnap |
## 5. 阿里云 ## 5. 阿里云
| 序号 | 名称 | 说明 | | 序号 | 名称 | 说明 |
+13 -11
View File
@@ -13,17 +13,19 @@
| 9.| **cloudflare** | cloudflare dns provider | | 9.| **cloudflare** | cloudflare dns provider |
| 10.| **dns.la** | dns.la | | 10.| **dns.la** | dns.la |
| 11.| **godaddy** | GoDaddy | | 11.| **godaddy** | GoDaddy |
| 12.| **华为云** | 华为云DNS解析提供商 | | 12.| **HiPM DNSMgr** | HiPM DNSMgr DNS 解析提供商 |
| 13.| **namesilo** | namesilo dns provider | | 13.| **华为云** | 华为云DNS解析提供商 |
| 14.| **雨云** | 雨云DNS解析提供商 | | 14.| **namesilo** | namesilo dns provider |
| 15.| **腾讯** | 腾讯云域名DNS解析提供 | | 15.| **** | 雨云DNS解析提供 |
| 16.| **腾讯云EO DNS** | 腾讯云EO DNS解析提供者 | | 16.| **Technitium DNS Server** | Technitium DNS Server 自建DNS服务器 |
| 17.| **西部数码** | west dns provider | | 17.| **腾讯云** | 腾讯云域名DNS解析提供者 |
| 18.| **Dns提供商Demo** | dns provider示例 | | 18.| **腾讯云EO DNS** | 腾讯云EO DNS解析提供者 |
| 19.| **彩虹DNS** | 彩虹DNS管理系统 | | 19.| **西部数码** | west dns provider |
| 20.| **Spaceship** | Spaceship 域名解析 | | 20.| **Dns提供商Demo** | dns provider示例 |
| 21.| **51dns** | 51DNS | | 21.| **彩虹DNS** | 彩虹DNS管理系统 |
| 22.| **新网互联** | 新网互联 | | 22.| **Spaceship** | Spaceship 域名解析 |
| 23.| **51dns** | 51DNS |
| 24.| **新网互联** | 新网互联 |
<style module> <style module>
table th:first-of-type { table th:first-of-type {
+28
View File
@@ -0,0 +1,28 @@
# Azure 配置
## Access授权配置
1. 登录 Azure 并创建一个资源组 【可选,如果已经有了可以不用创建】
2. 创建一个应用程序
Microsoft Entra ID - 》 应用注册 - 》 新注册
![](./images/access-1.png)
![](./images/access-2.png)
3. 配置授权
![](./images/access-3.png)
4. 点击测试
## Azure DNS 配置
1. 创建一个 DNS 区域(就是一个域名)
![](./images/dns-1.png)
![](./images/dns-2.png)
2. 为这个域名和上面创建的授权应用分配角色
![](./images/dns-3.png)
![](./images/dns-4.png)
![](./images/dns-5.png)
3. 然后就可以给dns区域去申请证书了
Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

+8 -6
View File
@@ -26,16 +26,20 @@ Created an external account key
[b64MacKey: xxxxxxxxxxxxxxxx [b64MacKey: xxxxxxxxxxxxxxxx
keyId: xxxxxxxxxxxxx] keyId: xxxxxxxxxxxxx]
``` ```
![](./images/google-eab.png)
3. 到Certd中,创建一条EAB授权记录,填写keyId(=kid) 和 b64MacKey 信息 3. 到Certd中,创建一条EAB授权记录,填写keyId(=kid) 和 b64MacKey 信息
注意:keyId没有`]`结尾,不要把`]`也复制了 注意:keyId没有`]`结尾,不要把`]`也复制了
注意:EAB授权使用过一次之后,会绑定邮箱,后续再次使用时,要使用相同的邮箱 注意:EAB授权使用过一次之后,会绑定邮箱,后续再次使用时,要使用相同的邮箱,所以邮箱切记不要修改
否则会报错 `Unknown external account binding (EAB) key. This may be due to the EAB key expiring which occurs 7 days after creation` 否则会报错 `Unknown external account binding (EAB) key. This may be due to the EAB key expiring which occurs 7 days after creation`
### 2.2 通过服务账号获取EAB 4. 创建证书流水线,选择证书提供商为google,选择EAB授权,运行流水线申请证书
此方式可以自动EAB,需要配置代理
### 2.2 通过google服务账号接口获取授权
此方式可以自动获取EAB,需要服务端配置代理
1. 创建服务账号 1. 创建服务账号
https://console.cloud.google.com/projectselector2/iam-admin/serviceaccounts/create?walkthrough_id=iam--create-service-account&hl=zh-cn#step_index=1 https://console.cloud.google.com/projectselector2/iam-admin/serviceaccounts/create?walkthrough_id=iam--create-service-account&hl=zh-cn#step_index=1
@@ -48,9 +52,7 @@ https://console.cloud.google.com/projectselector2/iam-admin/serviceaccounts/crea
7. 点击`添加密钥`->`创建新密钥`->`JSON`,下载密钥文件 7. 点击`添加密钥`->`创建新密钥`->`JSON`,下载密钥文件
8. 将json文件内容粘贴到 certd中 Google服务授权输入框中 8. 将json文件内容粘贴到 certd中 Google服务授权输入框中
9. 创建证书流水线,选择证书提供商为google, 选择服务账号授权,运行流水线申请证书
## 3、 创建证书流水线
选择证书提供商为google, 选择EAB授权 或 服务账号授权
## 4、 其他就跟正常申请证书一样了
+1 -1
View File
@@ -9,5 +9,5 @@
} }
}, },
"npmClient": "pnpm", "npmClient": "pnpm",
"version": "1.39.9" "version": "1.39.10"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.39.10](https://github.com/publishlab/node-acme-client/compare/v1.39.9...v1.39.10) (2026-04-11)
**Note:** Version bump only for package @certd/acme-client
## [1.39.9](https://github.com/publishlab/node-acme-client/compare/v1.39.8...v1.39.9) (2026-04-05) ## [1.39.9](https://github.com/publishlab/node-acme-client/compare/v1.39.8...v1.39.9) (2026-04-05)
**Note:** Version bump only for package @certd/acme-client **Note:** Version bump only for package @certd/acme-client
+3 -3
View File
@@ -3,7 +3,7 @@
"description": "Simple and unopinionated ACME client", "description": "Simple and unopinionated ACME client",
"private": false, "private": false,
"author": "nmorsman", "author": "nmorsman",
"version": "1.39.9", "version": "1.39.10",
"type": "module", "type": "module",
"module": "scr/index.js", "module": "scr/index.js",
"main": "src/index.js", "main": "src/index.js",
@@ -18,7 +18,7 @@
"types" "types"
], ],
"dependencies": { "dependencies": {
"@certd/basic": "^1.39.9", "@certd/basic": "^1.39.10",
"@peculiar/x509": "^1.11.0", "@peculiar/x509": "^1.11.0",
"asn1js": "^3.0.5", "asn1js": "^3.0.5",
"axios": "^1.9.0", "axios": "^1.9.0",
@@ -70,5 +70,5 @@
"bugs": { "bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues" "url": "https://github.com/publishlab/node-acme-client/issues"
}, },
"gitHead": "1c634a702af9298d25542acc270d68f71d9b1049" "gitHead": "112a565bf74c50e16c27a2c0a716588f84f39789"
} }
+2 -1
View File
@@ -21,7 +21,8 @@ const defaultOpts = {
}, },
challengeRemoveFn: async () => { challengeRemoveFn: async () => {
throw new Error("Missing challengeRemoveFn()"); throw new Error("Missing challengeRemoveFn()");
} },
waitDnsDiffuseTime: 30,
}; };
/** /**
+1 -1
View File
@@ -577,7 +577,7 @@ class AcmeClient {
const verifyFn = async (abort) => { const verifyFn = async (abort) => {
if (this.opts.signal && this.opts.signal.aborted) { if (this.opts.signal && this.opts.signal.aborted) {
abort(); abort(true);
throw new CancelError('用户取消'); throw new CancelError('用户取消');
} }
+6 -3
View File
@@ -50,15 +50,18 @@ class Backoff {
async function retryPromise(fn, attempts, backoff, logger = log) { async function retryPromise(fn, attempts, backoff, logger = log) {
let aborted = false; let aborted = false;
let abortedFromUser = false;
try { try {
const setAbort = () => { aborted = true; } const setAbort = (fromUser = false) => { aborted = true; abortedFromUser = fromUser; }
const data = await fn(setAbort); const data = await fn(setAbort);
return data; return data;
} }
catch (e) { catch (e) {
if (aborted){ if (aborted){
logger(`用户取消重试`); if (abortedFromUser){
logger(`用户取消重试`);
}
throw e; throw e;
} }
if ( ((backoff.attempts + 1) >= attempts)) { if ( ((backoff.attempts + 1) >= attempts)) {
@@ -249,7 +252,7 @@ async function resolveDomainBySoaRecord(recordName, logger = log) {
async function getAuthoritativeDnsResolver(recordName, logger = log) { async function getAuthoritativeDnsResolver(recordName, logger = log) {
logger(`获取域名${recordName}的权威NS服务器: `); logger(`获取域名${recordName}的权威NS服务器: `);
const resolver = new dns.Resolver(); const resolver = new dns.Resolver({ timeout: 10000,maxTimeout: 60000 });
try { try {
/* Resolve root domain by SOA */ /* Resolve root domain by SOA */
-1
View File
@@ -92,7 +92,6 @@ async function walkDnsChallengeRecord(recordName, resolver = dns,deep = 0) {
try { try {
log(`检查域名 ${recordName} 的TXT记录`); log(`检查域名 ${recordName} 的TXT记录`);
const txtRecords = await resolver.resolveTxt(recordName); const txtRecords = await resolver.resolveTxt(recordName);
if (txtRecords && txtRecords.length) { if (txtRecords && txtRecords.length) {
log(`找到 ${txtRecords.length} 条 TXT记录( ${recordName}`); log(`找到 ${txtRecords.length} 条 TXT记录( ${recordName}`);
log(`TXT records: ${JSON.stringify(txtRecords)}`); log(`TXT records: ${JSON.stringify(txtRecords)}`);
+1
View File
@@ -68,6 +68,7 @@ export interface ClientAutoOptions {
preferredChain?: string; preferredChain?: string;
signal?: AbortSignal; signal?: AbortSignal;
profile?:string; profile?:string;
waitDnsDiffuseTime?: number;
} }
export class Client { export class Client {
+6
View File
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.39.10](https://github.com/certd/certd/compare/v1.39.9...v1.39.10) (2026-04-11)
### Performance Improvements
* 流水线修改编辑之后,增加未保存提示 ([21620ac](https://github.com/certd/certd/commit/21620ac6bdeb57e43509156a77037fc07c44282a))
## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05) ## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05)
### Performance Improvements ### Performance Improvements
+1 -1
View File
@@ -1 +1 @@
01:21 23:43
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/basic", "name": "@certd/basic",
"private": false, "private": false,
"version": "1.39.9", "version": "1.39.10",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js", "module": "./dist/index.js",
@@ -47,5 +47,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "1c634a702af9298d25542acc270d68f71d9b1049" "gitHead": "112a565bf74c50e16c27a2c0a716588f84f39789"
} }
@@ -126,7 +126,7 @@ export function createAxiosService({ logger }: { logger: ILogger }) {
if (config.skipSslVerify || config.httpProxy) { if (config.skipSslVerify || config.httpProxy) {
let rejectUnauthorized = true; let rejectUnauthorized = true;
if (config.skipSslVerify) { if (config.skipSslVerify) {
logger.info("跳过SSL验"); logger.info("忽略接口请求的SSL验");
rejectUnauthorized = false; rejectUnauthorized = false;
} }
const proxy: any = {}; const proxy: any = {};
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.39.10](https://github.com/certd/certd/compare/v1.39.9...v1.39.10) (2026-04-11)
**Note:** Version bump only for package @certd/pipeline
## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05) ## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05)
### Performance Improvements ### Performance Improvements
+4 -4
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/pipeline", "name": "@certd/pipeline",
"private": false, "private": false,
"version": "1.39.9", "version": "1.39.10",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js", "module": "./dist/index.js",
@@ -18,8 +18,8 @@
"compile": "tsc --skipLibCheck --watch" "compile": "tsc --skipLibCheck --watch"
}, },
"dependencies": { "dependencies": {
"@certd/basic": "^1.39.9", "@certd/basic": "^1.39.10",
"@certd/plus-core": "^1.39.9", "@certd/plus-core": "^1.39.10",
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"reflect-metadata": "^0.1.13" "reflect-metadata": "^0.1.13"
@@ -45,5 +45,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "1c634a702af9298d25542acc270d68f71d9b1049" "gitHead": "112a565bf74c50e16c27a2c0a716588f84f39789"
} }
+4
View File
@@ -65,4 +65,8 @@ export abstract class BaseAccess implements IAccess {
} }
throw new Error(`action ${req.action} not found`); throw new Error(`action ${req.action} not found`);
} }
normalizeEndpoint(endpoint: string) {
return endpoint.replace(/\/$/, "");
}
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.39.10](https://github.com/certd/certd/compare/v1.39.9...v1.39.10) (2026-04-11)
**Note:** Version bump only for package @certd/lib-huawei
## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05) ## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05)
**Note:** Version bump only for package @certd/lib-huawei **Note:** Version bump only for package @certd/lib-huawei
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/lib-huawei", "name": "@certd/lib-huawei",
"private": false, "private": false,
"version": "1.39.9", "version": "1.39.10",
"main": "./dist/bundle.js", "main": "./dist/bundle.js",
"module": "./dist/bundle.js", "module": "./dist/bundle.js",
"types": "./dist/d/index.d.ts", "types": "./dist/d/index.d.ts",
@@ -24,5 +24,5 @@
"prettier": "^2.8.8", "prettier": "^2.8.8",
"tslib": "^2.8.1" "tslib": "^2.8.1"
}, },
"gitHead": "1c634a702af9298d25542acc270d68f71d9b1049" "gitHead": "112a565bf74c50e16c27a2c0a716588f84f39789"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.39.10](https://github.com/certd/certd/compare/v1.39.9...v1.39.10) (2026-04-11)
**Note:** Version bump only for package @certd/lib-iframe
## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05) ## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05)
**Note:** Version bump only for package @certd/lib-iframe **Note:** Version bump only for package @certd/lib-iframe
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/lib-iframe", "name": "@certd/lib-iframe",
"private": false, "private": false,
"version": "1.39.9", "version": "1.39.10",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js", "module": "./dist/index.js",
@@ -31,5 +31,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "1c634a702af9298d25542acc270d68f71d9b1049" "gitHead": "112a565bf74c50e16c27a2c0a716588f84f39789"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.39.10](https://github.com/certd/certd/compare/v1.39.9...v1.39.10) (2026-04-11)
**Note:** Version bump only for package @certd/jdcloud
## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05) ## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05)
**Note:** Version bump only for package @certd/jdcloud **Note:** Version bump only for package @certd/jdcloud
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@certd/jdcloud", "name": "@certd/jdcloud",
"version": "1.39.9", "version": "1.39.10",
"description": "jdcloud openApi sdk", "description": "jdcloud openApi sdk",
"main": "./dist/bundle.js", "main": "./dist/bundle.js",
"module": "./dist/bundle.js", "module": "./dist/bundle.js",
@@ -56,5 +56,5 @@
"fetch" "fetch"
] ]
}, },
"gitHead": "1c634a702af9298d25542acc270d68f71d9b1049" "gitHead": "112a565bf74c50e16c27a2c0a716588f84f39789"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.39.10](https://github.com/certd/certd/compare/v1.39.9...v1.39.10) (2026-04-11)
**Note:** Version bump only for package @certd/lib-k8s
## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05) ## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05)
**Note:** Version bump only for package @certd/lib-k8s **Note:** Version bump only for package @certd/lib-k8s
+3 -3
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/lib-k8s", "name": "@certd/lib-k8s",
"private": false, "private": false,
"version": "1.39.9", "version": "1.39.10",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js", "module": "./dist/index.js",
@@ -18,7 +18,7 @@
"compile": "tsc --skipLibCheck --watch" "compile": "tsc --skipLibCheck --watch"
}, },
"dependencies": { "dependencies": {
"@certd/basic": "^1.39.9", "@certd/basic": "^1.39.10",
"@kubernetes/client-node": "0.21.0" "@kubernetes/client-node": "0.21.0"
}, },
"devDependencies": { "devDependencies": {
@@ -33,5 +33,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "1c634a702af9298d25542acc270d68f71d9b1049" "gitHead": "112a565bf74c50e16c27a2c0a716588f84f39789"
} }
+6
View File
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.39.10](https://github.com/certd/certd/compare/v1.39.9...v1.39.10) (2026-04-11)
### Bug Fixes
* 修复自定义插件删除后没有反注册的bug ([df98463](https://github.com/certd/certd/commit/df9846332596d2afaba53e66d2897aa1c598f9c4))
## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05) ## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05)
**Note:** Version bump only for package @certd/lib-server **Note:** Version bump only for package @certd/lib-server
+7 -7
View File
@@ -1,6 +1,6 @@
{ {
"name": "@certd/lib-server", "name": "@certd/lib-server",
"version": "1.39.9", "version": "1.39.10",
"description": "midway with flyway, sql upgrade way ", "description": "midway with flyway, sql upgrade way ",
"private": false, "private": false,
"type": "module", "type": "module",
@@ -28,11 +28,11 @@
], ],
"license": "AGPL", "license": "AGPL",
"dependencies": { "dependencies": {
"@certd/acme-client": "^1.39.9", "@certd/acme-client": "^1.39.10",
"@certd/basic": "^1.39.9", "@certd/basic": "^1.39.10",
"@certd/pipeline": "^1.39.9", "@certd/pipeline": "^1.39.10",
"@certd/plugin-lib": "^1.39.9", "@certd/plugin-lib": "^1.39.10",
"@certd/plus-core": "^1.39.9", "@certd/plus-core": "^1.39.10",
"@midwayjs/cache": "3.14.0", "@midwayjs/cache": "3.14.0",
"@midwayjs/core": "3.20.11", "@midwayjs/core": "3.20.11",
"@midwayjs/i18n": "3.20.13", "@midwayjs/i18n": "3.20.13",
@@ -64,5 +64,5 @@
"typeorm": "^0.3.11", "typeorm": "^0.3.11",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "1c634a702af9298d25542acc270d68f71d9b1049" "gitHead": "112a565bf74c50e16c27a2c0a716588f84f39789"
} }
@@ -6,10 +6,10 @@ import { BaseSettings, SysInstallInfo, SysPrivateSettings, SysPublicSettings, Sy
import { getAllSslProviderDomains, setSslProviderReverseProxies } from '@certd/acme-client'; import { getAllSslProviderDomains, setSslProviderReverseProxies } from '@certd/acme-client';
import { cache, logger, mergeUtils, setGlobalProxy } from '@certd/basic'; import { cache, logger, mergeUtils, setGlobalProxy } from '@certd/basic';
import { isPlus } from '@certd/plus-core';
import * as dns from 'node:dns'; import * as dns from 'node:dns';
import { BaseService, setAdminMode } from '../../../basic/index.js'; import { BaseService, setAdminMode } from '../../../basic/index.js';
import { executorQueue } from '../../basic/service/executor-queue.js'; import { executorQueue } from '../../basic/service/executor-queue.js';
import { isComm, isPlus } from '@certd/plus-core';
const { merge } = mergeUtils; const { merge } = mergeUtils;
let lastSaveEnvVars = {}; let lastSaveEnvVars = {};
@@ -119,11 +119,11 @@ export class SysSettingsService extends BaseService<SysSettingsEntity> {
} }
async savePublicSettings(bean: SysPublicSettings) { async savePublicSettings(bean: SysPublicSettings) {
if (isComm()) { // if (isComm()) {
if (bean.adminMode === 'enterprise') { // if (bean.adminMode === 'enterprise') {
throw new Error("商业版不支持使用企业管理模式") // throw new Error("商业版不支持使用企业管理模式")
} // }
} // }
await this.saveSetting(bean); await this.saveSetting(bean);
//让设置生效 //让设置生效
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.39.10](https://github.com/certd/certd/compare/v1.39.9...v1.39.10) (2026-04-11)
**Note:** Version bump only for package @certd/midway-flyway-js
## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05) ## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05)
**Note:** Version bump only for package @certd/midway-flyway-js **Note:** Version bump only for package @certd/midway-flyway-js
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@certd/midway-flyway-js", "name": "@certd/midway-flyway-js",
"version": "1.39.9", "version": "1.39.10",
"description": "midway with flyway, sql upgrade way ", "description": "midway with flyway, sql upgrade way ",
"private": false, "private": false,
"type": "module", "type": "module",
@@ -46,5 +46,5 @@
"typeorm": "^0.3.11", "typeorm": "^0.3.11",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "1c634a702af9298d25542acc270d68f71d9b1049" "gitHead": "112a565bf74c50e16c27a2c0a716588f84f39789"
} }
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.39.10](https://github.com/certd/certd/compare/v1.39.9...v1.39.10) (2026-04-11)
**Note:** Version bump only for package @certd/plugin-cert
## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05) ## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05)
**Note:** Version bump only for package @certd/plugin-cert **Note:** Version bump only for package @certd/plugin-cert
+6 -6
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/plugin-cert", "name": "@certd/plugin-cert",
"private": false, "private": false,
"version": "1.39.9", "version": "1.39.10",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
@@ -17,10 +17,10 @@
"compile": "tsc --skipLibCheck --watch" "compile": "tsc --skipLibCheck --watch"
}, },
"dependencies": { "dependencies": {
"@certd/acme-client": "^1.39.9", "@certd/acme-client": "^1.39.10",
"@certd/basic": "^1.39.9", "@certd/basic": "^1.39.10",
"@certd/pipeline": "^1.39.9", "@certd/pipeline": "^1.39.10",
"@certd/plugin-lib": "^1.39.9", "@certd/plugin-lib": "^1.39.10",
"psl": "^1.9.0", "psl": "^1.9.0",
"punycode.js": "^2.3.1" "punycode.js": "^2.3.1"
}, },
@@ -38,5 +38,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "1c634a702af9298d25542acc270d68f71d9b1049" "gitHead": "112a565bf74c50e16c27a2c0a716588f84f39789"
} }
+6
View File
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.39.10](https://github.com/certd/certd/compare/v1.39.9...v1.39.10) (2026-04-11)
### Performance Improvements
* 1panel支持先上传证书再选择证书 ([7a9eec8](https://github.com/certd/certd/commit/7a9eec88e8eddf40dba055c072b5b2b0f67c1407))
## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05) ## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05)
**Note:** Version bump only for package @certd/plugin-lib **Note:** Version bump only for package @certd/plugin-lib
+6 -6
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/plugin-lib", "name": "@certd/plugin-lib",
"private": false, "private": false,
"version": "1.39.9", "version": "1.39.10",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
@@ -22,10 +22,10 @@
"@alicloud/pop-core": "^1.7.10", "@alicloud/pop-core": "^1.7.10",
"@alicloud/tea-util": "^1.4.11", "@alicloud/tea-util": "^1.4.11",
"@aws-sdk/client-s3": "^3.964.0", "@aws-sdk/client-s3": "^3.964.0",
"@certd/acme-client": "^1.39.9", "@certd/acme-client": "^1.39.10",
"@certd/basic": "^1.39.9", "@certd/basic": "^1.39.10",
"@certd/pipeline": "^1.39.9", "@certd/pipeline": "^1.39.10",
"@certd/plus-core": "^1.39.9", "@certd/plus-core": "^1.39.10",
"@kubernetes/client-node": "0.21.0", "@kubernetes/client-node": "0.21.0",
"ali-oss": "^6.22.0", "ali-oss": "^6.22.0",
"basic-ftp": "^5.0.5", "basic-ftp": "^5.0.5",
@@ -57,5 +57,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "1c634a702af9298d25542acc270d68f71d9b1049" "gitHead": "112a565bf74c50e16c27a2c0a716588f84f39789"
} }
@@ -7,6 +7,9 @@ import { ILogger } from "@certd/basic";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { uniq } from "lodash-es"; import { uniq } from "lodash-es";
export interface ICertInfoGetter {
getByPipelineId: (pipelineId: number) => Promise<CertInfo>;
}
export type CertInfo = { export type CertInfo = {
crt: string; //fullchain证书 crt: string; //fullchain证书
key: string; //私钥 key: string; //私钥
@@ -132,7 +135,12 @@ export class CertReader {
} }
static readCertDetail(crt: string) { static readCertDetail(crt: string) {
const detail = crypto.readCertificateInfo(crt.toString()); let detail: CertificateInfo;
try {
detail = crypto.readCertificateInfo(crt.toString());
} catch (e) {
throw new Error("证书解析失败:" + e.message + "(请确定证书格式,是否与私钥搞反?)");
}
const effective = detail.notBefore; const effective = detail.notBefore;
const expires = detail.notAfter; const expires = detail.notAfter;
const fingerprints = CertReader.getFingerprintX509(crt); const fingerprints = CertReader.getFingerprintX509(crt);
@@ -1,2 +1,2 @@
export const CertApplyPluginNames = [":cert:"]; export const CertApplyPluginNames = [":cert:"];
export const EVENT_CERT_APPLY_SUCCESS = "CertApply.success"; export const EVENT_CERT_APPLY_SUCCESS = "CertApply.success";
@@ -1,4 +1,4 @@
export * from "./convert.js"; export * from "./convert.js";
export * from "./cert-reader.js"; export * from "./cert-reader.js";
export * from "./consts.js"; export * from "./consts.js";
export * from "./dns-provider/index.js"; export * from "./dns-provider/index.js";
@@ -44,6 +44,10 @@ export function createRemoteSelectInputDefine(opts?: {
component?: any; component?: any;
value?: any; value?: any;
pageSize?: number; pageSize?: number;
uploadCert?: {
title?: string;
columns?: Record<string, any>;
};
}) { }) {
const title = opts?.title || "请选择"; const title = opts?.title || "请选择";
const certDomainsInputKey = opts?.certDomainsInputKey || "certDomains"; const certDomainsInputKey = opts?.certDomainsInputKey || "certDomains";
@@ -74,6 +78,7 @@ export function createRemoteSelectInputDefine(opts?: {
multi, multi,
pageSize: opts?.pageSize, pageSize: opts?.pageSize,
watches: [certDomainsInputKey, accessIdInputKey, ...watches], watches: [certDomainsInputKey, accessIdInputKey, ...watches],
uploadCert: opts?.uploadCert,
...opts.component, ...opts.component,
}, },
value: opts.value, value: opts.value,
+17
View File
@@ -3,6 +3,23 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.39.10](https://github.com/certd/certd/compare/v1.39.9...v1.39.10) (2026-04-11)
### Bug Fixes
* 修复创建流水线无法选择通知的bug ([a88d0a6](https://github.com/certd/certd/commit/a88d0a6ae15cb6170d0b36e21daf89f0dbd5f681))
* 修复流水线任务编辑页面复制粘贴按钮在夜间模式显示问题 ([1e549df](https://github.com/certd/certd/commit/1e549dfd431ed74e2bcdfce63e5f640c51603af3))
* 修复用户管理添加用户无法上传头像的bug ([557e98c](https://github.com/certd/certd/commit/557e98c33f5462167d8f6289f70dad68bb114a97))
* 修复自定义插件删除后没有反注册的bug ([df98463](https://github.com/certd/certd/commit/df9846332596d2afaba53e66d2897aa1c598f9c4))
### Performance Improvements
* 1panel支持先上传证书再选择证书 ([7a9eec8](https://github.com/certd/certd/commit/7a9eec88e8eddf40dba055c072b5b2b0f67c1407))
* 流水线修改编辑之后,增加未保存提示 ([21620ac](https://github.com/certd/certd/commit/21620ac6bdeb57e43509156a77037fc07c44282a))
* 修复检查全部某些情况下无效的bug,优化公共触发站点证书检查定时逻辑 ([ee53589](https://github.com/certd/certd/commit/ee535895a3166c6f9046963e28fa8f22f018b574))
* 增加域名管理 子域名检查提醒 ([2bdf183](https://github.com/certd/certd/commit/2bdf1832da73a3728f3ac415837bc26e70531cd6))
* 站点监控域名气泡增加端口显示 ([6ee718a](https://github.com/certd/certd/commit/6ee718a25265a9db2115343af9a1a01958f34b81))
## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05) ## [1.39.9](https://github.com/certd/certd/compare/v1.39.8...v1.39.9) (2026-04-05)
### Bug Fixes ### Bug Fixes
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@certd/ui-client", "name": "@certd/ui-client",
"version": "1.39.9", "version": "1.39.10",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite --open", "dev": "vite --open",
@@ -106,8 +106,8 @@
"zod-defaults": "^0.1.3" "zod-defaults": "^0.1.3"
}, },
"devDependencies": { "devDependencies": {
"@certd/lib-iframe": "^1.39.9", "@certd/lib-iframe": "^1.39.10",
"@certd/pipeline": "^1.39.9", "@certd/pipeline": "^1.39.10",
"@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.12", "@types/chai": "^4.3.12",
@@ -13,13 +13,11 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import parser from "cron-parser";
import { computed, ref } from "vue"; import { computed, ref } from "vue";
import dayjs from "dayjs";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { getCronNextTimes } from "/@/components/cron-editor/utils";
const { t } = useI18n(); const { t } = useI18n();
import { getCronNextTimes } from "/@/components/cron-editor/utils";
defineOptions({ defineOptions({
name: "CronEditor", name: "CronEditor",
}); });
@@ -1,5 +1,5 @@
<template> <template>
<a-select :value="value" @update:value="onChange"> <a-select :value="value" :filter-option="true" @update:value="onChange">
<a-select-option v-for="item of options" :key="item.value" :value="item.value" :label="item.label"> <a-select-option v-for="item of options" :key="item.value" :value="item.value" :label="item.label">
<span class="flex-o"> <span class="flex-o">
<fs-icon :icon="item.icon" class="fs-16 color-blue mr-5" /> <fs-icon :icon="item.icon" class="fs-16 color-blue mr-5" />
@@ -1,5 +1,5 @@
<template> <template>
<icon-select class="dns-provider-selector" :value="modelValue" :options="options" @update:value="atChange"> </icon-select> <icon-select class="dns-provider-selector" :value="modelValue" :options="options" :filter-option="true" @update:value="atChange"> </icon-select>
</template> </template>
<script lang="ts"> <script lang="ts">
@@ -2,7 +2,7 @@
<div class="domains-verify-plan-editor" :class="{ fullscreen }"> <div class="domains-verify-plan-editor" :class="{ fullscreen }">
<div class="fullscreen-modal" @click="fullscreenExit"></div> <div class="fullscreen-modal" @click="fullscreenExit"></div>
<div class="plan-wrapper"> <div class="plan-wrapper">
<div class="plan-box"> <div class="plan-box bg-white dark:bg-neutral-700">
<div class="fullscreen-button pointer flex-center" @click="fullscreen = !fullscreen"> <div class="fullscreen-button pointer flex-center" @click="fullscreen = !fullscreen">
<span v-if="!fullscreen" style="font-size: 10px" class="flex-center"> <span v-if="!fullscreen" style="font-size: 10px" class="flex-center">
这里可以放大 这里可以放大
@@ -273,7 +273,7 @@ watch(
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
background-color: rgba(74, 74, 74, 0.78); // background-color: rgba(74, 74, 74, 0.78);
z-index: 1000; z-index: 1000;
margin: auto; margin: auto;
display: flex; display: flex;
@@ -287,7 +287,6 @@ watch(
.plan-box { .plan-box {
position: relative; position: relative;
margin: auto; margin: auto;
background-color: #fff;
} }
} }
@@ -315,7 +314,7 @@ watch(
height: 100%; height: 100%;
//table-layout: fixed; //table-layout: fixed;
th { th {
background-color: #f5f5f5; // background-color: #f5f5f5;
border-top: 1px solid #e8e8e8; border-top: 1px solid #e8e8e8;
border-left: 1px solid #e8e8e8; border-left: 1px solid #e8e8e8;
border-bottom: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8;
@@ -33,7 +33,7 @@ export default {
async function onCreate() { async function onCreate() {
await pluginStore.init(); await pluginStore.init();
options.value = pluginStore.group.getPreStepOutputOptions({ options.value = pluginStore.group.getPreStepOutputOptions({
pipeline: pipeline.value, pipeline: pipeline?.value,
currentStageIndex: currentStageIndex.value, currentStageIndex: currentStageIndex.value,
currentTaskIndex: currentTaskIndex.value, currentTaskIndex: currentTaskIndex.value,
currentStepIndex: currentStepIndex.value, currentStepIndex: currentStepIndex.value,
@@ -25,8 +25,9 @@
</div> </div>
</template> </template>
</a-select> </a-select>
<div class="ml-5"> <div class="ml-5 flex flex-row no-wrap">
<fs-button :loading="loading" title="刷新选项" icon="ion:refresh-outline" @click="refreshOptions"></fs-button> <fs-button :loading="loading" title="刷新选项" icon="ion:refresh-outline" @click="refreshOptions"></fs-button>
<UploadCert v-if="uploadCert" class="ml-5" v-bind="uploadCert" @submit="refreshOptions"></UploadCert>
</div> </div>
</div> </div>
<div class="helper" :class="{ error: hasError }"> <div class="helper" :class="{ error: hasError }">
@@ -39,6 +40,8 @@ import { ComponentPropsType, doRequest } from "/@/components/plugins/lib";
import { defineComponent, inject, ref, useAttrs, watch, Ref } from "vue"; import { defineComponent, inject, ref, useAttrs, watch, Ref } from "vue";
import { PluginDefine } from "@certd/pipeline"; import { PluginDefine } from "@certd/pipeline";
import { getInputFromForm } from "./utils"; import { getInputFromForm } from "./utils";
import UploadCert from "./upload-cert.vue";
import { UploadCertProps } from "./types";
defineOptions({ defineOptions({
name: "RemoteSelect", name: "RemoteSelect",
@@ -65,9 +68,10 @@ const props = defineProps<
pager?: boolean; pager?: boolean;
multi?: boolean; multi?: boolean;
pageSize?: number; pageSize?: number;
uploadCert?: UploadCertProps;
} & ComponentPropsType } & ComponentPropsType
>(); >();
debugger;
const emit = defineEmits<{ const emit = defineEmits<{
"update:value": any; "update:value": any;
}>(); }>();
@@ -0,0 +1,5 @@
export interface UploadCertProps {
title?: string;
columns?: Record<string, any>;
button?: any;
}
@@ -0,0 +1,101 @@
<template>
<div class="upload-cert">
<fs-button v-model:loading="loading" type="primary" text="上传" v-bind="props.button" @click="openUploadCertDialog"></fs-button>
</div>
</template>
<script lang="ts" setup>
import { message } from "ant-design-vue";
import { useFormDialog } from "../../../use/use-dialog";
import { computed, inject, ref } from "vue";
import { doRequest } from "../lib";
import { getInputFromForm } from "./utils";
import { UploadCertProps } from "./types";
import { merge } from "lodash-es";
const props = defineProps<UploadCertProps>();
const loading = ref(false);
const emit = defineEmits(["submit"]);
const { openFormDialog } = useFormDialog();
const pipeline = inject("pipeline", null);
const getCurrentPluginDefine: any = inject("getCurrentPluginDefine", () => {
return {};
});
const getScope: any = inject("get:scope", () => {
return {};
});
const getPluginType: any = inject("get:plugin:type", () => {
return "plugin";
});
const title = computed(() => props.title || "上传证书");
function openUploadCertDialog() {
const columns = merge(
{
certName: {
title: "证书名称",
form: {
component: {
name: "a-input",
vModel: "value",
},
helper: "上传后证书显示名称",
},
},
},
props.columns
);
openFormDialog({
title: title.value,
columns: {
certName: {
title: "证书名称",
form: {
component: {
name: "a-input",
vModel: "value",
},
},
},
...props.columns,
},
onSubmit: async (form: any) => {
const pluginType = getPluginType();
const scope = getScope();
const { input, record } = getInputFromForm(scope.form, pluginType);
loading.value = true;
try {
const res = await doRequest(
{
type: pluginType,
typeName: scope.form.type,
action: "onUploadCert",
input,
record,
data: {
pipelineId: pipeline?.value?.id,
...form,
},
},
{
// onError(err: any) {
// message.error(err.message);
// },
showErrorNotify: true,
}
);
message.success("上传成功");
emit("submit");
} finally {
loading.value = false;
}
},
});
}
</script>
<style lang="less">
.upload-cert {
display: flex;
align-items: center;
}
</style>
@@ -4,7 +4,7 @@
<div class="step-item overflow-hidden"> <div class="step-item overflow-hidden">
<div class="text"> <div class="text">
<h3 class="title">{{ number }} {{ currentStepItem.title }}</h3> <h3 class="title font-bold">{{ number }} {{ currentStepItem.title }}</h3>
<div class="description mt-5"> <div class="description mt-5">
<div v-for="(desc, index) of currentStepItem.descriptions" :key="index">{{ desc }}</div> <div v-for="(desc, index) of currentStepItem.descriptions" :key="index">{{ desc }}</div>
</div> </div>
@@ -247,6 +247,7 @@ function previewMask() {
<style lang="less"> <style lang="less">
.tutorial-steps { .tutorial-steps {
display: flex;
.step-item { .step-item {
display: flex !important; display: flex !important;
flex-direction: row; flex-direction: row;
@@ -251,7 +251,7 @@ function openUpgrade() {
class: "vip-modal", class: "vip-modal",
maskClosable: true, maskClosable: true,
okText: t("vip.close"), okText: t("vip.close"),
width: 1100, width: 1180,
content: () => { content: () => {
return <VipModalContent placeholder={placeholder} isPlus={isPlus} productInfo={productInfo} goBuyPlusPage={goBuyPlusPage} goBuyCommPage={goBuyCommPage} openStarModal={openStarModal} modalRef={modalRef} />; return <VipModalContent placeholder={placeholder} isPlus={isPlus} productInfo={productInfo} goBuyPlusPage={goBuyPlusPage} goBuyCommPage={goBuyCommPage} openStarModal={openStarModal} modalRef={modalRef} />;
}, },
@@ -65,6 +65,11 @@
</div> </div>
<div class="get-show"> <div class="get-show">
<template v-if="item.type === 'plus'"> <template v-if="item.type === 'plus'">
<span v-if="todayOrderCount.showVipTotal" class="mr-5">
已有
<span class="color-red"> {{ todayOrderCount.vipTotal }}</span>
位伙伴支持
</span>
<a-tooltip :title="t('vip.afdian_support_vip')"> <a-tooltip :title="t('vip.afdian_support_vip')">
<a-button size="small" type="primary" @click="goBuyPlusPage"> <a-button size="small" type="primary" @click="goBuyPlusPage">
{{ t("vip.get_after_support") }} {{ t("vip.get_after_support") }}
@@ -260,12 +265,16 @@ const todayOrderCount = computed(() => {
const lastStage = countInfo?.stages?.[countInfo?.stages?.length - 1] || {}; const lastStage = countInfo?.stages?.[countInfo?.stages?.length - 1] || {};
lastStage.orderCount = orderCount; lastStage.orderCount = orderCount;
const vipTotal = countInfo?.vipTotal || 0;
const showVipTotal = countInfo?.showVipTotal || false;
const userTotal = countInfo?.userTotal || 0;
const stages: any = []; const stages: any = [];
stages.push({ stages.push({
title: countInfo.title, title: countInfo.title,
vipTotal: countInfo?.vipTotal || 0, vipTotal: countInfo?.vipTotal || 0,
orderCount: orderCount, orderCount: orderCount,
bg: lastStage.bg, bg: lastStage.bg,
showVipTotal: showVipTotal,
}); });
if (lastStage.orderCount > 0) { if (lastStage.orderCount > 0) {
stages.push(lastStage); stages.push(lastStage);
@@ -273,6 +282,9 @@ const todayOrderCount = computed(() => {
return { return {
enabled: enabled, enabled: enabled,
stages: stages, stages: stages,
showVipTotal: showVipTotal,
vipTotal: vipTotal,
userTotal: userTotal,
}; };
}); });
@@ -65,7 +65,7 @@ export default {
click_to_get_7_day_trial: "Click to get 7-day trial", click_to_get_7_day_trial: "Click to get 7-day trial",
years: "years", years: "years",
afdian_support_vip: "Obtain the permanent professional version coupon", afdian_support_vip: "Obtain the permanent professional version coupon",
get_after_support: "Get after sponsoring", get_after_support: "sponsoring",
business_edition: "Business Edition", business_edition: "Business Edition",
commercial_license: "Commercial license, allowed for external operation", commercial_license: "Commercial license, allowed for external operation",
@@ -33,7 +33,7 @@ export default {
activateCertDesc2: "让证书生效", activateCertDesc2: "让证书生效",
taskSuccessTitle: "部署任务添加成功", taskSuccessTitle: "部署任务添加成功",
taskSuccessDesc: "现在可以运行", taskSuccessDesc: "现在可以运行",
pluginsTitle: "本系统提供茫茫多的部署插件", pluginsTitle: "本系统提供海量的部署插件",
pluginsDesc: "您可以根据自身需求将证书部署到各种应用和平台", pluginsDesc: "您可以根据自身需求将证书部署到各种应用和平台",
}, },
}, },
@@ -289,7 +289,7 @@ export const useSettingStore = defineStore({
} }
}, },
openBindUrlModal() { openBindUrlModal(opts: { closable?: boolean } = { closable: false }) {
const event: any = { ModalRef: null }; const event: any = { ModalRef: null };
mitter.emit("getModal", event); mitter.emit("getModal", event);
const Modal = event.ModalRef; const Modal = event.ModalRef;
@@ -302,10 +302,12 @@ export const useSettingStore = defineStore({
modalRef.destroy(); modalRef.destroy();
} }
}; };
const { closable = false } = opts;
const modalRef: any = Modal.warning({ const modalRef: any = Modal.warning({
title: "URL地址未绑定,是否绑定此地址?", title: "URL地址未绑定,是否绑定此地址?",
width: 500, width: 500,
keyboard: false, keyboard: false,
closable,
content: () => { content: () => {
return ( return (
<div class="p-4"> <div class="p-4">
@@ -338,10 +340,10 @@ export const useSettingStore = defineStore({
danger: true, danger: true,
}, },
okText: "不,回到原来的地址", okText: "不,回到原来的地址",
cancelText: "不,回到原来的地址", // cancelText: "不,回到原来的地址",
onCancel: () => { // onOk: () => {
window.location.href = bindUrl; // window.location.href = bindUrl;
}, // },
}); });
}, },
async loadProductInfo() { async loadProductInfo() {
+19 -8
View File
@@ -73,13 +73,11 @@
margin: 20px; margin: 20px;
} }
.fs-crud-table { // .fs-crud-table {
.ant-table-body { // .ant-table-body {
height: 60vh; // height:60vh;
table { // }
} // }
}
}
body a { body a {
color: #1890ff; color: #1890ff;
@@ -130,4 +128,17 @@ button.ant-btn.ant-btn-default.isPlus{
background-color: rgba(50, 54, 57, 0.04); background-color: rgba(50, 54, 57, 0.04);
box-shadow: none; box-shadow: none;
} }
} }
.dark{
button.ant-btn.ant-btn-default.isPlus{
color: #c5913f;
border: 1px solid #c5913f;
&:disabled {
border-color: hsl(0, 0%, 31%);
color: rgba(233, 233, 233, 0.25);
}
}
}
@@ -131,7 +131,7 @@ const userStore = useUserStore();
const projectStore = useProjectStore(); const projectStore = useProjectStore();
async function emitValue(value: any) { async function emitValue(value: any) {
// target.value = optionsDictRef.dataMap[value]; // target.value = optionsDictRef.dataMap[value];
if (pipeline.value) { if (pipeline?.value) {
const userId = userStore.userInfo.id; const userId = userStore.userInfo.id;
const isEnterprice = projectStore.isEnterprise; const isEnterprice = projectStore.isEnterprise;
if (isEnterprice) { if (isEnterprice) {
@@ -99,3 +99,11 @@ export async function SyncExpirationStatus() {
method: "post", method: "post",
}); });
} }
export async function IsSubdomain(body: any) {
return await request({
url: apiPrefix + "/isSubdomain",
method: "post",
data: body,
});
}
@@ -52,6 +52,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}); });
const openDomainImportManageDialog = useDomainImportManage(); const openDomainImportManageDialog = useDomainImportManage();
const subdomainConfirmed = ref(false);
return { return {
crudOptions: { crudOptions: {
settings: { settings: {
@@ -85,10 +87,29 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
fixed: "right", fixed: "right",
}, },
form: { form: {
beforeSubmit({ form }) { async beforeSubmit({ form }) {
if (form.challengeType === "cname") { if (form.challengeType === "cname") {
throw new Error("CNAME方式请前往CNAME记录页面进行管理"); throw new Error("CNAME方式请前往CNAME记录页面进行管理");
} }
if (form.challengeType === "dns") {
const isSubdomain = await api.IsSubdomain({ domain: form.domain });
if (isSubdomain && !subdomainConfirmed.value) {
Modal.confirm({
title: "子域名确认",
content: `检测到${form.domain}为子域名,只有托管子域名和免费二级子域名才需要在此处维护,否则会导致申请证书失败,请确认是否继续?`,
okText: "确认",
okType: "danger",
onOk: () => {
subdomainConfirmed.value = true;
crudExpose.getFormWrapperRef().submit();
},
});
return false;
}
}
},
afterSubmit({ form }) {
subdomainConfirmed.value = false;
}, },
}, },
actionbar: { actionbar: {
@@ -163,6 +184,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
form: { form: {
required: true, required: true,
helper: "注意:DNS校验方式下,子域名不需要在此处维护,否则会影响证书申请(子域名托管或免费二级域名除外)",
}, },
editForm: { editForm: {
component: { component: {
@@ -346,12 +346,13 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
width: 230, width: 230,
sorter: true, sorter: true,
cellRender({ value, row }) { cellRender({ value, row }) {
const url = `https://${value}:${row.httpsPort}`; const domainPort = value + ":" + row.httpsPort;
const url = `https://${domainPort}`;
return ( return (
<a-tooltip title={value} placement="left"> <a-tooltip title={domainPort} placement="left">
<fs-copyable modelValue={value}> <fs-copyable modelValue={domainPort} title={domainPort}>
<a target="_blank" href={url}> <a target="_blank" href={url}>
{value}:{row.httpsPort} {domainPort}
</a> </a>
</fs-copyable> </fs-copyable>
</a-tooltip> </a-tooltip>
@@ -8,7 +8,6 @@
import { onActivated, onMounted, ref, Ref } from "vue"; import { onActivated, onMounted, ref, Ref } from "vue";
import { useFs } from "@fast-crud/fast-crud"; import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud"; import createCrudOptions from "./crud";
import { siteIpApi } from "./api";
defineOptions({ defineOptions({
name: "SiteIpCertMonitor", name: "SiteIpCertMonitor",
@@ -23,11 +22,6 @@ const { crudBinding, crudRef, crudExpose } = useFs({
}, },
}); });
const siteInfoRef: Ref<any> = ref({});
onMounted(async () => {
siteInfoRef.value = await siteIpApi.GetObj(props.siteId);
});
// //
onMounted(() => { onMounted(() => {
crudExpose.doRefresh(); crudExpose.doRefresh();
@@ -134,18 +134,21 @@ async function emitValue(value: any) {
const userId = userStore.userInfo.id; const userId = userStore.userInfo.id;
const isEnterprice = projectStore.isEnterprise; const isEnterprice = projectStore.isEnterprise;
if (isEnterprice) { if (pipeline?.value) {
const projectId = projectStore.currentProjectId; if (isEnterprice) {
if (pipeline?.value?.projectId !== projectId) { const projectId = projectStore.currentProjectId;
message.error("对不起,您不能修改其他项目流水线的通知"); if (pipeline?.value?.projectId !== projectId) {
return; message.error("对不起,您不能修改其他项目流水线的通知");
} return;
} else { }
if (pipeline?.value?.userId !== userId) { } else {
message.error("对不起,您不能修改他人流水线的通知"); if (pipeline?.value?.userId !== userId) {
return; message.error("对不起,您不能修改他人流水线的通知");
return;
}
} }
} }
emit("change", value); emit("change", value);
emit("update:modelValue", value); emit("update:modelValue", value);
} }
@@ -13,10 +13,27 @@ import { createNotificationApi } from "/@/views/certd/notification/api";
import GroupSelector from "../group/group-selector.vue"; import GroupSelector from "../group/group-selector.vue";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { useSettingStore } from "/@/store/settings"; import { useSettingStore } from "/@/store/settings";
import dayjs from "dayjs";
export function fillPipelineByDefaultForm(pipeline: any, form: any) { export function fillPipelineByDefaultForm(pipeline: any, form: any) {
const triggers = []; const triggers = [];
if (form.triggerCron) {
//根据随机时间设置触发时间
if (form.random === true) {
// 随机时间
const randomRange = form.randomRange;
const start = dayjs().format("YYYY-MM-DD") + " " + randomRange[0];
let end = dayjs().format("YYYY-MM-DD") + " " + randomRange[1];
if (randomRange[1] < randomRange[0]) {
//跨天
end = dayjs().add(1, "day").format("YYYY-MM-DD") + " " + randomRange[1];
}
const startTime = dayjs(start).valueOf();
const endTime = dayjs(end).valueOf();
const randomTime = Math.floor(Math.random() * (endTime - startTime)) + startTime;
const time = dayjs(randomTime).format(" ss:mm:HH").replaceAll(":", " ").replaceAll(" 0", " ").trim();
triggers.push({ title: "定时触发", type: "timer", props: { cron: `${time} * * *` } });
} else if (form.triggerCron) {
triggers.push({ title: "定时触发", type: "timer", props: { cron: form.triggerCron } }); triggers.push({ title: "定时触发", type: "timer", props: { cron: form.triggerCron } });
} }
if (form.webhookEnabled) { if (form.webhookEnabled) {
@@ -85,7 +102,7 @@ export function useCertPipelineCreator() {
const settingStore = useSettingStore(); const settingStore = useSettingStore();
const router = useRouter(); const router = useRouter();
function createCrudOptions(req: { certPlugin: any; doSubmit: any; title?: string }): CreateCrudOptionsRet { function createCrudOptions(req: { certPlugin: any; doSubmit: any; title?: string; initialForm?: any }): CreateCrudOptionsRet {
const inputs: any = {}; const inputs: any = {};
const moreParams = []; const moreParams = [];
const doSubmit = req.doSubmit; const doSubmit = req.doSubmit;
@@ -124,9 +141,11 @@ export function useCertPipelineCreator() {
}, },
}, },
}); });
return { return {
crudOptions: { crudOptions: {
form: { form: {
initialForm: req.initialForm || {},
doSubmit, doSubmit,
wrapper: { wrapper: {
wrapClassName: "cert_pipeline_create_form", wrapClassName: "cert_pipeline_create_form",
@@ -326,6 +345,15 @@ export function useCertPipelineCreator() {
//检查是否流水线数量超出限制 //检查是否流水线数量超出限制
await checkPipelineLimit(); await checkPipelineLimit();
//设置系统初始值
const initialForm: any = {};
const pluginSysConfig = await pluginStore.getPluginConfig({ name: req.pluginName, type: "builtIn" });
if (pluginSysConfig.sysSetting?.input) {
for (const key in pluginSysConfig.sysSetting?.input) {
initialForm[key] = pluginSysConfig.sysSetting?.input[key];
}
}
async function doSubmit({ form }: any) { async function doSubmit({ form }: any) {
// const certDetail = readCertDetail(form.cert.crt); // const certDetail = readCertDetail(form.cert.crt);
// 添加certd pipeline // 添加certd pipeline
@@ -399,6 +427,7 @@ export function useCertPipelineCreator() {
certPlugin, certPlugin,
doSubmit, doSubmit,
title: req.title, title: req.title,
initialForm,
}); });
//@ts-ignore //@ts-ignore
crudOptions.columns.groupId.form.value = req.defaultGroupId || undefined; crudOptions.columns.groupId.form.value = req.defaultGroupId || undefined;
@@ -67,8 +67,8 @@ async function openFormDialog() {
return form.clear !== true; return form.clear !== true;
}), }),
component: { component: {
name: "fs-dict-switch", name: "fs-dict-radio",
vModel: "checked", vModel: "value",
dict: dict({ dict: dict({
data: [ data: [
{ {
@@ -24,6 +24,9 @@
</a-tabs> </a-tabs>
<template #footer> <template #footer>
<fs-button v-if="settingsStore.sysPublic.aiChatEnabled !== false" key="aiChat" :tooltip="{ title: 'AI分析异常' }" type="primary" icon="ion:color-wand-outline" @click="taskModal.onAiChat">AI分析</fs-button> <fs-button v-if="settingsStore.sysPublic.aiChatEnabled !== false" key="aiChat" :tooltip="{ title: 'AI分析异常' }" type="primary" icon="ion:color-wand-outline" @click="taskModal.onAiChat">AI分析</fs-button>
<!-- <fs-button v-if="!settingsStore.isComm && currentStatus === 'error'" key="1v1" :tooltip="{ title: '升级专业版,获得一对一分析服务,为您排忧解难' }" class="isPlus" icon="imingcute:vip-1-line" @click="callService">
呼叫专家
</fs-button> -->
<fs-button key="rerun" type="primary" :tooltip="{ title: '强制重新执行此步骤' }" text="重新运行" icon="icon-park-outline:replay-music" @click="triggerRun(activeKey)"></fs-button> <fs-button key="rerun" type="primary" :tooltip="{ title: '强制重新执行此步骤' }" text="重新运行" icon="icon-park-outline:replay-music" @click="triggerRun(activeKey)"></fs-button>
<fs-button key="downloadLogs" type="primary" :tooltip="{ title: '当前任务日志下载' }" icon="ion:arrow-down-circle-outline" @click="taskModal.onDownloadLogs">下载日志</fs-button> <fs-button key="downloadLogs" type="primary" :tooltip="{ title: '当前任务日志下载' }" icon="ion:arrow-down-circle-outline" @click="taskModal.onDownloadLogs">下载日志</fs-button>
<fs-button key="cancel" :tooltip="{ title: '关闭窗口' }" icon="ion:close-circle-outline" @click="taskModal.onOk">关闭</fs-button> <fs-button key="cancel" :tooltip="{ title: '关闭窗口' }" icon="ion:close-circle-outline" @click="taskModal.onOk">关闭</fs-button>
@@ -39,6 +42,7 @@ import PiStatusShow from "/@/views/certd/pipeline/pipeline/component/status-show
import { usePreferences } from "/@/vben/preferences"; import { usePreferences } from "/@/vben/preferences";
import { useSettingStore } from "/@/store/settings/index"; import { useSettingStore } from "/@/store/settings/index";
import { notification } from "ant-design-vue"; import { notification } from "ant-design-vue";
import { mitter } from "/@/utils/util.mitt";
export default { export default {
name: "PiTaskView", name: "PiTaskView",
components: { PiStatusShow }, components: { PiStatusShow },
@@ -196,6 +200,19 @@ export default {
taskModal.value.open = false; taskModal.value.open = false;
} }
const currentNode = computed(() => {
return detail.value?.nodes?.find(item => item.node.id === activeKey.value);
});
const currentStatus = computed(() => {
return currentNode.value?.node?.status?.result || "";
});
function callService() {
if (!settingsStore.isPlus) {
mitter.emit("openVipModal");
}
}
const settingsStore = useSettingStore(); const settingsStore = useSettingStore();
return { return {
detail, detail,
@@ -206,6 +223,9 @@ export default {
tabPosition, tabPosition,
triggerRun, triggerRun,
settingsStore, settingsStore,
currentNode,
currentStatus,
callService,
}; };
}, },
}; };
@@ -334,7 +334,7 @@ import { useCertViewer } from "/@/views/certd/pipeline/use";
import { useI18n } from "/@/locales"; import { useI18n } from "/@/locales";
import TriggerIcon from "./component/trigger-icon.vue"; import TriggerIcon from "./component/trigger-icon.vue";
import { useCrudPermission } from "/@/plugin/permission"; import { useCrudPermission } from "/@/plugin/permission";
import { onBeforeRouteLeave } from "vue-router";
export default defineComponent({ export default defineComponent({
name: "PipelineEdit", name: "PipelineEdit",
// eslint-disable-next-line vue/no-unused-components // eslint-disable-next-line vue/no-unused-components
@@ -372,10 +372,22 @@ export default defineComponent({
}, },
emits: ["update:modelValue", "update:editMode"], emits: ["update:modelValue", "update:editMode"],
setup(props, ctx) { setup(props, ctx) {
onBeforeRouteLeave((to, from) => {
const newPipelineStr = JSON.stringify(pipeline.value || {});
if (props.editMode && pipelineOriginStr.value && pipelineOriginStr.value !== newPipelineStr) {
const answer = window.confirm("流水线还未保存,确定要离开吗?");
if (!answer) {
return false; // false
}
return true;
}
});
const { t } = useI18n(); const { t } = useI18n();
//pipeline //pipeline
const currentPipeline: Ref<any> = ref({}); const currentPipeline: Ref<any> = ref({});
const pipeline: Ref<any> = ref({}); const pipeline: Ref<any> = ref({});
const pipelineOriginStr = ref("");
const pipelineDetail: Ref<any> = ref({}); const pipelineDetail: Ref<any> = ref({});
const histories: Ref<RunHistory[]> = ref([]); const histories: Ref<RunHistory[]> = ref([]);
@@ -423,6 +435,7 @@ export default defineComponent({
await loadCurrentHistoryDetail(); await loadCurrentHistoryDetail();
pipeline.value = currentHistory.value.pipeline; pipeline.value = currentHistory.value.pipeline;
currentPipeline.value = currentHistory.value.pipeline; currentPipeline.value = currentHistory.value.pipeline;
pipelineOriginStr.value = JSON.stringify(pipeline.value);
}; };
async function loadHistoryList(reload = false, historyId: number = null) { async function loadHistoryList(reload = false, historyId: number = null) {
@@ -880,6 +893,7 @@ export default defineComponent({
pipeline.value.version = version; pipeline.value.version = version;
currentPipeline.value.version = version; currentPipeline.value.version = version;
} }
pipelineOriginStr.value = JSON.stringify(pipeline.value);
} }
if (offEdit) { if (offEdit) {
toggleEditMode(false); toggleEditMode(false);
@@ -182,6 +182,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
showSelect: false, showSelect: false,
createCrudOptions: createCrudOptionsPipeline, createCrudOptions: createCrudOptionsPipeline,
height: "60vh",
crudOptionsOverride: { crudOptionsOverride: {
actionbar: { actionbar: {
show: false, show: false,
@@ -1,4 +1,4 @@
import { dict, useFormWrapper } from "@fast-crud/fast-crud"; import { compute, dict, useFormWrapper } from "@fast-crud/fast-crud";
import { checkPipelineLimit, eachSteps } from "/@/views/certd/pipeline/utils"; import { checkPipelineLimit, eachSteps } from "/@/views/certd/pipeline/utils";
import { templateApi } from "/@/views/certd/pipeline/template/api"; import { templateApi } from "/@/views/certd/pipeline/template/api";
import TemplateForm from "./form.vue"; import TemplateForm from "./form.vue";
@@ -7,6 +7,7 @@ import GroupSelector from "/@/views/certd/pipeline/group/group-selector.vue";
import { ref } from "vue"; import { ref } from "vue";
import { fillPipelineByDefaultForm } from "/@/views/certd/pipeline/certd-form/use"; import { fillPipelineByDefaultForm } from "/@/views/certd/pipeline/certd-form/use";
import { cloneDeep } from "lodash-es"; import { cloneDeep } from "lodash-es";
import { $t } from "/@/locales";
export function createExtraColumns() { export function createExtraColumns() {
const groupDictRef = dict({ const groupDictRef = dict({
@@ -14,23 +15,93 @@ export function createExtraColumns() {
value: "id", value: "id",
label: "name", label: "name",
}); });
const t = $t;
const randomHour = Math.floor(Math.random() * 6); const randomHour = Math.floor(Math.random() * 6);
const randomMin = Math.floor(Math.random() * 60); const randomMin = Math.floor(Math.random() * 60);
return { return {
triggerCron: { // triggerCron: {
title: "定时触发", // title: "定时触发",
type: "text", // type: "text",
// form: {
// value: `0 ${randomMin} ${randomHour} * * *`,
// component: {
// name: "cron-editor",
// vModel: "modelValue",
// placeholder: "0 0 4 * * *",
// },
// col: {
// span: 24,
// },
// helper: "点击上面的按钮,选择每天几点定时执行。\n建议设置为每天触发一次,证书未到期之前任务会跳过,不会重复执行",
// order: 100,
// },
// },
random: {
title: "定时类型",
form: { form: {
value: `0 ${randomMin} ${randomHour} * * *`, order: 100,
component: { value: true,
name: "cron-editor", helper: "是否给流水线随机设置一个时间",
vModel: "modelValue", show: compute(({ form }) => {
placeholder: "0 0 4 * * *", return form.clear !== true;
}, }),
col: { col: {
span: 24, span: 24,
}, },
helper: "点击上面的按钮,选择每天几点定时执行。\n建议设置为每天触发一次,证书未到期之前任务会跳过,不会重复执行", component: {
name: "fs-dict-radio",
vModel: "value",
dict: dict({
data: [
{
label: "随机时间",
value: true,
},
{
label: "固定时间",
value: false,
},
],
}),
},
},
},
randomRange: {
title: "随机时间范围",
form: {
order: 100,
value: ["00:00:00", "08:00:00"],
helper: "随机时间范围,单位秒",
component: {
// <a-time-range-picker :bordered="false" />
name: "a-time-range-picker",
vModel: "value",
valueFormat: "HH:mm:ss",
},
show: compute(({ form }) => {
return form.clear !== true && form.random === true;
}),
rules: [{ required: true, message: "请选择随机时间范围" }],
},
},
triggerCron: {
title: t("certd.schedule"),
form: {
order: 100,
component: {
name: "cron-editor",
vModel: "modelValue",
},
show: compute(({ form }) => {
return form.clear !== true && form?.random !== true;
}),
rules: [{ required: true, message: t("certd.selectCron") }],
},
},
blank2: {
form: {
blank: true,
order: 100, order: 100,
}, },
}, },
@@ -118,6 +118,10 @@ export function useTransfer() {
<div class="text-2xl font-bold"> </div> <div class="text-2xl font-bold"> </div>
<div>"{projectStore.currentProject?.name}"</div> <div>"{projectStore.currentProject?.name}"</div>
</div> </div>
<div class="text-center m-4">
<p class="text-red-500"></p>
</div>
<div class="flex flex-row items-center justify-center w-full"> <div class="flex flex-row items-center justify-center w-full">
<a-button type="primary" onClick={doTransfer}> <a-button type="primary" onClick={doTransfer}>
@@ -238,10 +238,14 @@ const avatar = computed(() => {
} }
return `/api/basic/file/download?key=${avt}`; return `/api/basic/file/download?key=${avt}`;
}); });
const dateNow = ref(Date.now());
const now = computed(() => { const now = computed(() => {
const serverTime = Date.now() - settingStore.app.deltaTime; const serverTime = dateNow.value - settingStore.app.deltaTime;
return dayjs(serverTime).format("YYYY-MM-DD HH:mm:ss"); return dayjs(serverTime).format("YYYY-MM-DD HH:mm:ss");
}); });
setInterval(() => {
dateNow.value = Date.now();
}, 5000);
const deltaTimeWarning = computed(() => { const deltaTimeWarning = computed(() => {
return Math.abs(settingStore.app.deltaTime) > 1000 * 60 * 4; return Math.abs(settingStore.app.deltaTime) > 1000 * 60 * 4;
@@ -172,7 +172,7 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
width: "auto", width: "auto",
}, },
buildUrl(key: string) { buildUrl(key: string) {
return `api/basic/file/download?&key=` + key; return `api/basic/file/download?token=${userStore.getToken}&key=` + key;
}, },
}, },
}, },
@@ -188,7 +188,7 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
onReady: null, onReady: null,
uploader: { uploader: {
type: "form", type: "form",
action: "/basic/file/upload", action: "/basic/file/upload?token=" + userStore.getToken,
name: "file", name: "file",
headers: { headers: {
Authorization: "Bearer " + userStore.getToken, Authorization: "Bearer " + userStore.getToken,
@@ -135,3 +135,11 @@ export async function DoTest(req: { id: number; input: any }): Promise<void> {
data: req, data: req,
}); });
} }
export async function GetPluginByName(name: string): Promise<PluginConfigBean> {
return await request({
url: apiPrefix + "/getPluginByName",
method: "post",
data: { name },
});
}
@@ -36,6 +36,13 @@
</div> </div>
</a-form-item> </a-form-item>
<a-form-item label="其他配置">
<a-button type="primary" @click="doPluginConfig">证书申请插件默认值设置</a-button>
<div class="helper">
<div>自定义证书申请插件参数</div>
</div>
</a-form-item>
<a-form-item :wrapper-col="{ offset: 8, span: 16 }"> <a-form-item :wrapper-col="{ offset: 8, span: 16 }">
<a-button :loading="saveLoading" type="primary" html-type="submit">保存</a-button> <a-button :loading="saveLoading" type="primary" html-type="submit">保存</a-button>
</a-form-item> </a-form-item>
@@ -47,10 +54,10 @@
<script lang="ts" setup> <script lang="ts" setup>
import AccessSelector from "/@/views/certd/access/access-selector/index.vue"; import AccessSelector from "/@/views/certd/access/access-selector/index.vue";
import { reactive, ref } from "vue"; import { reactive, ref } from "vue";
import { CommPluginConfig, GetCommPluginConfigs, SaveCommPluginConfigs } from "/@/views/sys/plugin/api"; import { CommPluginConfig, GetCommPluginConfigs, SaveCommPluginConfigs, GetPluginByName } from "/@/views/sys/plugin/api";
import { merge } from "lodash-es"; import { merge } from "lodash-es";
import { notification } from "ant-design-vue"; import { notification } from "ant-design-vue";
import { usePluginConfig } from "./use-config";
defineOptions({ defineOptions({
name: "SysPluginConfig", name: "SysPluginConfig",
}); });
@@ -87,5 +94,12 @@ const onFinish = async (form: any) => {
const onFinishFailed = (errorInfo: any) => { const onFinishFailed = (errorInfo: any) => {
console.log("Failed:", errorInfo); console.log("Failed:", errorInfo);
}; };
const { openConfigDialog } = usePluginConfig();
async function doPluginConfig() {
const certApplyInfo = await GetPluginByName("CertApply");
await openConfigDialog({ row: certApplyInfo, crudExpose: null });
}
</script> </script>
<style lang="less"></style> <style lang="less"></style>
@@ -3,7 +3,7 @@
<div class="origin-metadata w-100%"> <div class="origin-metadata w-100%">
<div class="block-title"> <div class="block-title">
自定义插件参数配置 自定义插件参数配置
<div class="helper">可以设置插件选项的配置设置配置默认值修改帮助说明设置是否显示该字段等</div> <div class="helper">可以设置插件选项的配置设置配置默认值修改帮助说明设置是否显示该字段等在用户申请证书对话框里面使用你自定义设置的展示效果</div>
</div> </div>
<div class="p-10"> <div class="p-10">
<div ref="formRef" class="config-form w-full" :label-col="labelCol" :wrapper-col="wrapperCol"> <div ref="formRef" class="config-form w-full" :label-col="labelCol" :wrapper-col="wrapperCol">
@@ -43,13 +43,12 @@
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import { computed, nextTick, onMounted, reactive, ref, Ref, unref } from "vue"; import { dict, FsRender } from "@fast-crud/fast-crud";
import { cloneDeep, merge, unset } from "lodash-es";
import { computed, onMounted, reactive, ref } from "vue";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import * as api from "./api";
import { usePluginStore } from "/@/store/plugin";
import { cloneDeep, get, merge, set, unset } from "lodash-es";
import Rollbackable from "./rollbackable.vue"; import Rollbackable from "./rollbackable.vue";
import { FsRender } from "@fast-crud/fast-crud"; import { usePluginStore } from "/@/store/plugin";
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const pluginStore = usePluginStore(); const pluginStore = usePluginStore();
@@ -68,6 +67,18 @@ const labelCol = ref({
const wrapperCol = ref({ span: 16 }); const wrapperCol = ref({ span: 16 });
const configForm: any = reactive({}); const configForm: any = reactive({});
const showDict = dict({
data: [
{
value: true,
label: "显示",
},
{
value: false,
label: "不显示",
},
],
});
function getScope() { function getScope() {
return { return {
form: configForm, form: configForm,
@@ -105,12 +116,25 @@ const editableKeys = ref([
defaultRender(item: any) { defaultRender(item: any) {
return () => { return () => {
const value = item["show"]; const value = item["show"];
return value === false ? "不显示" : "显示"; let showType = "";
let color = "";
if (item.mergeScript?.indexOf("show:") >= -1) {
showType = "条件显示";
color = "orange";
} else {
showType = value === false ? "不显示" : "显示";
color = value === false ? "red" : "green";
}
return (
<a-tag color={color} size="small">
{showType}
</a-tag>
);
}; };
}, },
editRender(item: any) { editRender(item: any) {
return () => { return () => {
return <a-switch vModel:checked={configForm[item.key]["show"]} />; return <fs-dict-switch vModel:checked={configForm[item.key]["show"]} dict={showDict} />;
}; };
}, },
}, },
@@ -178,6 +178,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
type: "dict-select", type: "dict-select",
search: { search: {
show: true, show: true,
component: {
disabled: false,
},
}, },
form: { form: {
order: 0, order: 0,
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { defineProps } from "vue"; import { dict } from "@fast-crud/fast-crud";
const props = defineProps<{ value: any }>(); const props = defineProps<{ value: any }>();
@@ -10,20 +10,42 @@ function setValue() {
function clearValue() { function clearValue() {
emits("clear"); emits("clear");
} }
const switchDict = dict({
data: [
{
value: true,
label: "自定义",
},
{
value: false,
label: "原始值",
},
],
});
function onSwitchChange(value: boolean) {
if (value) {
setValue();
} else {
clearValue();
}
}
</script> </script>
<template> <template>
<div class="rollbackable"> <div class="rollbackable">
<div class="flex"> <div class="flex">
<div style="width: 100px"> <div style="width: 100px">
<a-tag v-if="value === undefined" color="green" size="small" class="pointer flex-inline items-center" @click.stop="setValue"> <!-- <a-tag v-if="value === undefined" color="green" size="small" class="pointer flex-inline items-center" @click.stop="setValue">
<fs-icon icon="material-symbols:edit" class="mr-5"></fs-icon> <fs-icon icon="material-symbols:edit" class="mr-5"></fs-icon>
自定义 自定义
</a-tag> </a-tag>
<a-tag v-else color="red" size="small" class="pointer flex-inline items-center" @click.stop="clearValue"> <a-tag v-else color="red" size="small" class="pointer flex-inline items-center" @click.stop="clearValue">
<fs-icon icon="material-symbols:undo" class="mr-5"></fs-icon> <fs-icon icon="material-symbols:undo" class="mr-5"></fs-icon>
还原 还原
</a-tag> </a-tag> -->
<fs-dict-switch :checked="value !== undefined" :dict="switchDict" @change="onSwitchChange" />
</div> </div>
<div class="flex-1 overflow-hidden value-render"> <div class="flex-1 overflow-hidden value-render">
<slot v-if="value === undefined" name="default"></slot> <slot v-if="value === undefined" name="default"></slot>
@@ -35,7 +35,9 @@ export function usePluginConfig() {
}, },
afterSubmit() { afterSubmit() {
notification.success({ message: t("certd.operationSuccess") }); notification.success({ message: t("certd.operationSuccess") });
crudExpose.doRefresh(); if (crudExpose) {
crudExpose.doRefresh();
}
}, },
async doSubmit({}: any) { async doSubmit({}: any) {
const form = configEditorRef.value.getForm(); const form = configEditorRef.value.getForm();
@@ -25,6 +25,10 @@
<div class="helper" v-html="t('certd.sys.setting.noticeHelper')"></div> <div class="helper" v-html="t('certd.sys.setting.noticeHelper')"></div>
</a-form-item> </a-form-item>
<a-form-item :label="t('certd.sys.setting.bindUrl')">
<a-button class="ml-2" type="primary" @click="settingsStore.openBindUrlModal({ closable: true })">{{ t("certd.sys.setting.bindUrl") }}</a-button>
</a-form-item>
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 8 }"> <a-form-item label=" " :colon="false" :wrapper-col="{ span: 8 }">
<a-button :loading="saveLoading" type="primary" html-type="submit">{{ t("certd.saveButton") }}</a-button> <a-button :loading="saveLoading" type="primary" html-type="submit">{{ t("certd.saveButton") }}</a-button>
</a-form-item> </a-form-item>
@@ -29,7 +29,7 @@ import { SysSettings } from "/@/views/sys/settings/api";
import * as api from "/@/views/sys/settings/api"; import * as api from "/@/views/sys/settings/api";
import { merge } from "lodash-es"; import { merge } from "lodash-es";
import { useSettingStore } from "/@/store/settings"; import { useSettingStore } from "/@/store/settings";
import { notification } from "ant-design-vue"; import { Modal, notification } from "ant-design-vue";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { dict } from "@fast-crud/fast-crud"; import { dict } from "@fast-crud/fast-crud";
import { useProjectStore } from "/@/store/project"; import { useProjectStore } from "/@/store/project";
@@ -80,6 +80,24 @@ const onFinish = async (form: any) => {
notification.success({ notification.success({
message: t("certd.saveSuccess"), message: t("certd.saveSuccess"),
}); });
if (formState.public.adminMode === "enterprise") {
Modal.confirm({
title: "数据迁移",
okText: "去迁移",
content: () => {
return (
<div>
<div>设置为企业模式之后之前创建的个人数据不会显示</div>
<div>是否前往迁移数据到项目? </div>
</div>
);
},
onOk: () => {
goCurrentProject();
},
});
}
} finally { } finally {
saveLoading.value = false; saveLoading.value = false;
} }

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