Files
certd/packages/plugins/plugin-center/README.md

66 lines
1.6 KiB
Markdown
Raw Normal View History

2024-03-22 00:50:02 +08:00
# 贡献插件
2024-03-22 01:04:45 +08:00
## 1.本地调试运行
2024-03-22 12:00:51 +08:00
安装依赖包:
```shell
2024-04-15 13:53:05 +08:00
# 设置环境变量
npm config set node_sqlite3_binary_host_mirror "https://registry.npmmirror.com/-/binary/sqlite3"
2024-03-22 12:00:51 +08:00
cd certd
2024-04-15 13:53:05 +08:00
# 安装依赖
2024-03-22 12:00:51 +08:00
pnpm install
```
启动 server:
2024-03-22 01:04:45 +08:00
```shell
cd packages/ui/certd-server
npm run dev
```
2024-03-22 12:00:51 +08:00
启动 client:
2024-03-22 01:04:45 +08:00
```shell
cd packages/ui/certd-client
npm run dev
2024-03-22 12:00:51 +08:00
# 会自动打开浏览器,确认正常运行
2024-03-22 01:04:45 +08:00
```
## 开发插件
进入 `packages/plugins/plugin-center/src`
### 1.复制demo目录作为你的插件目录
2024-03-22 00:50:02 +08:00
比如你想做cloudflare的插件那么你可以复制demo目录将其命名成cloudflare。
2024-03-22 01:04:45 +08:00
### 2. access授权
2024-03-22 00:50:02 +08:00
如果这是一个新的平台它应该有授权方式比如accessKey accessSecret之类的
参考`demo/access.ts` 修改为你要做的平台的`access`
这样用户就可以在certd后台中创建这种授权凭证了
2024-03-22 01:04:45 +08:00
### 3. dns-provider
2024-03-22 00:50:02 +08:00
如果域名是这个平台进行解析的那么你需要实现dns-provider
参考`demo/dns-provider.ts` 修改为你要做的平台的`dns-provider`
2024-03-22 01:04:45 +08:00
### 4. deploy-plugin
2024-03-22 00:50:02 +08:00
如果这个平台有需要部署证书的地方
参考`demo/deploy-plugin.ts` 修改为你要做的平台的`deploy-plugin`
2024-03-22 01:04:45 +08:00
### 5. 增加导入
`./src/你的插件目录/index.ts`中增加你的插件import
```ts
export * from './dns-provider'
export * from './plugin-test'
export * from './access'
````
`./src/index.ts`中增加import
```ts
export * from "./你的插件目录"
```
## 重启服务进行调试
2024-03-22 12:00:51 +08:00
刷新浏览器,检查你的插件是否工作正常, 确保能够正常进行证书申请和部署
2024-03-22 01:04:45 +08:00
## 提交PR
2024-04-15 13:53:05 +08:00
我们将尽快审核PR