perf: 通知选择器优化

This commit is contained in:
xiaojunnuo
2024-12-02 14:06:55 +08:00
parent 68a503796c
commit 2c0cbdd29e
11 changed files with 274 additions and 150 deletions
@@ -7,6 +7,16 @@ import { BaseNotification, IsNotification, NotificationBody, NotificationInput }
needPlus: true,
})
export class TelegramNotification extends BaseNotification {
@NotificationInput({
title: 'URL',
value: 'https://api.telegram.org',
component: {
placeholder: 'https://api.telegram.org',
},
required: true,
})
endpoint = 'https://api.telegram.org';
@NotificationInput({
title: 'Bot Token',
component: {
@@ -27,6 +37,27 @@ export class TelegramNotification extends BaseNotification {
})
chatId = '';
@NotificationInput({
title: '代理',
component: {
placeholder: 'http://xxxxx:xx',
},
helper: '使用https_proxy',
required: false,
})
httpsProxy = '';
@NotificationInput({
title: '忽略证书校验',
value: false,
component: {
name: 'a-switch',
vModel: 'checked',
},
required: false,
})
skipSslVerify: boolean;
async send(body: NotificationBody) {
if (!this.botToken || !this.chatId) {
throw new Error('Bot Token 和聊天ID不能为空');
@@ -47,6 +78,8 @@ export class TelegramNotification extends BaseNotification {
text: messageContent,
parse_mode: 'MarkdownV2', // 或使用 'HTML' 取决于需要的格式
},
httpProxy: this.httpsProxy,
skipSslVerify: this.skipSslVerify,
});
}
}