2024-03-21 16:50:02 +00:00
|
|
|
|
# 贡献插件
|
|
|
|
|
|
2024-03-21 17:04:45 +00:00
|
|
|
|
## 1.本地调试运行
|
2024-03-22 04:00:51 +00:00
|
|
|
|
|
|
|
|
|
安装依赖包:
|
|
|
|
|
```shell
|
2024-04-15 05:53:05 +00:00
|
|
|
|
|
2024-07-14 18:05:26 +00:00
|
|
|
|
# 克隆代码
|
|
|
|
|
git clone https://github.com/certd/certd
|
|
|
|
|
|
|
|
|
|
#进入项目目录
|
2024-03-22 04:00:51 +00:00
|
|
|
|
cd certd
|
2024-07-14 18:05:26 +00:00
|
|
|
|
|
2024-09-05 08:19:00 +00:00
|
|
|
|
# 切换到最新的版本tag,v2分支可能不稳定
|
2024-09-05 08:18:42 +00:00
|
|
|
|
checkout tags/vx.x.x # x.x.x为最新的版本号
|
|
|
|
|
|
2024-04-15 05:53:05 +00:00
|
|
|
|
# 安装依赖
|
2024-07-20 10:18:34 +00:00
|
|
|
|
npm install -g pnpm@8.15.7
|
2024-03-22 04:00:51 +00:00
|
|
|
|
pnpm install
|
2024-07-14 18:05:26 +00:00
|
|
|
|
|
|
|
|
|
# 初始化构建
|
2024-09-05 08:11:03 +00:00
|
|
|
|
npm run init
|
2024-03-22 04:00:51 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
启动 server:
|
2024-03-21 17:04:45 +00:00
|
|
|
|
```shell
|
|
|
|
|
cd packages/ui/certd-server
|
|
|
|
|
npm run dev
|
|
|
|
|
```
|
|
|
|
|
|
2024-03-22 04:00:51 +00:00
|
|
|
|
启动 client:
|
2024-03-21 17:04:45 +00:00
|
|
|
|
```shell
|
|
|
|
|
cd packages/ui/certd-client
|
|
|
|
|
npm run dev
|
|
|
|
|
|
2024-03-22 04:00:51 +00:00
|
|
|
|
# 会自动打开浏览器,确认正常运行
|
|
|
|
|
|
2024-03-21 17:04:45 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 开发插件
|
2024-05-27 10:38:41 +00:00
|
|
|
|
进入 `packages/ui/certd-server/src/plugins`
|
2024-03-21 17:04:45 +00:00
|
|
|
|
|
2024-05-27 10:38:41 +00:00
|
|
|
|
### 1.复制`plugin-demo`目录作为你的插件目录
|
|
|
|
|
比如你想做`cloudflare`的插件,那么你可以复制`plugin-demo`目录,将其命名成`plugin-cloudflare`。
|
|
|
|
|
以下均以`plugin-cloudflare`为例进行说明,你需要将其替换成你的插件名称
|
2024-03-21 16:50:02 +00:00
|
|
|
|
|
2024-03-21 17:04:45 +00:00
|
|
|
|
### 2. access授权
|
2024-03-21 16:50:02 +00:00
|
|
|
|
如果这是一个新的平台,它应该有授权方式,比如accessKey accessSecret之类的
|
2024-05-27 10:38:41 +00:00
|
|
|
|
参考`plugin-cloudflare/access.ts` 修改为你要做的平台的`access`
|
|
|
|
|
这样用户就可以在`certd`后台中创建这种授权凭证了
|
2024-03-21 16:50:02 +00:00
|
|
|
|
|
2024-03-21 17:04:45 +00:00
|
|
|
|
### 3. dns-provider
|
2024-03-21 16:50:02 +00:00
|
|
|
|
如果域名是这个平台进行解析的,那么你需要实现dns-provider
|
2024-05-27 10:38:41 +00:00
|
|
|
|
参考`plugin-cloudflare/dns-provider.ts` 修改为你要做的平台的`dns-provider`
|
2024-03-21 16:50:02 +00:00
|
|
|
|
|
2024-05-27 10:38:41 +00:00
|
|
|
|
### 4. plugin-deploy
|
2024-03-21 16:50:02 +00:00
|
|
|
|
如果这个平台有需要部署证书的地方
|
2024-05-27 10:38:41 +00:00
|
|
|
|
参考`plugin-cloudflare/plugins/plugin-deploy-to-xx.ts` 修改为你要做的平台的`plugin-deploy-to-xx`
|
2024-03-21 16:50:02 +00:00
|
|
|
|
|
2024-03-21 17:04:45 +00:00
|
|
|
|
### 5. 增加导入
|
2024-05-27 10:38:41 +00:00
|
|
|
|
在`plugin-cloudflare/index.ts`中增加你的插件的`import`
|
2024-03-21 17:04:45 +00:00
|
|
|
|
```ts
|
|
|
|
|
export * from './dns-provider'
|
|
|
|
|
export * from './access'
|
2024-05-27 10:38:41 +00:00
|
|
|
|
export * from './plugins/plugin-deploy-to-xx'
|
2024-03-21 17:04:45 +00:00
|
|
|
|
````
|
2024-05-27 10:38:41 +00:00
|
|
|
|
|
|
|
|
|
在`./src/plugins/index.ts`中增加`import`
|
|
|
|
|
|
2024-03-21 17:04:45 +00:00
|
|
|
|
```ts
|
2024-05-27 10:38:41 +00:00
|
|
|
|
export * from "./plugin-cloudflare"
|
2024-03-21 17:04:45 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 重启服务进行调试
|
2024-03-22 04:00:51 +00:00
|
|
|
|
刷新浏览器,检查你的插件是否工作正常, 确保能够正常进行证书申请和部署
|
2024-03-21 17:04:45 +00:00
|
|
|
|
|
|
|
|
|
## 提交PR
|
2024-04-15 05:53:05 +00:00
|
|
|
|
我们将尽快审核PR
|