mirror of
https://github.com/certd/certd.git
synced 2026-10-13 15:49:25 +08:00
perf: 在线插件支持通知类型
This commit is contained in:
@@ -190,3 +190,39 @@ return class DemoDnsProvider extends AbstractDnsProvider {
|
||||
content: script,
|
||||
};
|
||||
}
|
||||
|
||||
export function getDefaultNotificationPlugin() {
|
||||
const metadata = `
|
||||
input: # 通知插件的输入参数
|
||||
title:
|
||||
title: 通知标题
|
||||
component:
|
||||
name: a-input
|
||||
required: false
|
||||
content:
|
||||
title: 通知内容
|
||||
component:
|
||||
name: a-textarea
|
||||
required: true
|
||||
`;
|
||||
|
||||
const script = `
|
||||
// 必须使用 await import 来引入模块
|
||||
const { BaseNotification } = await import("@certd/pipeline")
|
||||
// 需要返回一个继承BaseNotification的类
|
||||
return class DemoNotification extends BaseNotification {
|
||||
// 通知输入参数,对应左边 input 配置
|
||||
// async send(body){
|
||||
// // body.title: 通知标题
|
||||
// // body.content: 通知内容
|
||||
// // this.logger.info("title:", body.title)
|
||||
// // 调用第三方 API 发送通知
|
||||
// }
|
||||
}
|
||||
`;
|
||||
|
||||
return {
|
||||
metadata: metadata,
|
||||
content: script,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user