mirror of
https://github.com/certd/certd.git
synced 2026-07-16 02:37:34 +08:00
chore: format
This commit is contained in:
@@ -1,38 +1,38 @@
|
||||
import { BaseNotification, IsNotification, NotificationBody, NotificationInput } from '@certd/pipeline';
|
||||
import { BaseNotification, IsNotification, NotificationBody, NotificationInput } from "@certd/pipeline";
|
||||
|
||||
@IsNotification({
|
||||
name: 'slack',
|
||||
title: 'Slack通知',
|
||||
desc: 'Slack消息推送通知',
|
||||
name: "slack",
|
||||
title: "Slack通知",
|
||||
desc: "Slack消息推送通知",
|
||||
needPlus: true,
|
||||
})
|
||||
export class SlackNotification extends BaseNotification {
|
||||
@NotificationInput({
|
||||
title: 'webhook地址',
|
||||
title: "webhook地址",
|
||||
component: {
|
||||
placeholder: 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX',
|
||||
placeholder: "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
},
|
||||
helper: '[APPS](https://api.slack.com/apps/)->进入APP->incoming-webhooks->Add New Webhook to Workspace',
|
||||
helper: "[APPS](https://api.slack.com/apps/)->进入APP->incoming-webhooks->Add New Webhook to Workspace",
|
||||
required: true,
|
||||
})
|
||||
webhook = '';
|
||||
webhook = "";
|
||||
|
||||
@NotificationInput({
|
||||
title: '代理',
|
||||
title: "代理",
|
||||
component: {
|
||||
placeholder: 'http://xxxxx:xx',
|
||||
placeholder: "http://xxxxx:xx",
|
||||
},
|
||||
helper: '使用https_proxy',
|
||||
helper: "使用https_proxy",
|
||||
required: false,
|
||||
})
|
||||
httpsProxy = '';
|
||||
httpsProxy = "";
|
||||
|
||||
@NotificationInput({
|
||||
title: '忽略证书校验',
|
||||
title: "忽略证书校验",
|
||||
value: false,
|
||||
component: {
|
||||
name: 'a-switch',
|
||||
vModel: 'checked',
|
||||
name: "a-switch",
|
||||
vModel: "checked",
|
||||
},
|
||||
required: false,
|
||||
})
|
||||
@@ -40,12 +40,12 @@ export class SlackNotification extends BaseNotification {
|
||||
|
||||
async send(body: NotificationBody) {
|
||||
if (!this.webhook) {
|
||||
throw new Error('token不能为空');
|
||||
throw new Error("token不能为空");
|
||||
}
|
||||
|
||||
await this.http.request({
|
||||
url: this.webhook,
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
data: {
|
||||
text: `${body.title}\n${body.content}\n\n[查看详情](${body.url})`,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user