chore: format

This commit is contained in:
xiaojunnuo
2026-05-31 01:41:33 +08:00
parent acd440106b
commit 4b57a0d729
557 changed files with 12530 additions and 14039 deletions
@@ -1,58 +1,58 @@
import { BaseNotification, IsNotification, NotificationBody, NotificationInput } from '@certd/pipeline';
import { BaseNotification, IsNotification, NotificationBody, NotificationInput } from "@certd/pipeline";
@IsNotification({
name: 'telegram',
title: 'Telegram通知',
desc: 'Telegram Bot推送通知',
name: "telegram",
title: "Telegram通知",
desc: "Telegram Bot推送通知",
needPlus: true,
})
export class TelegramNotification extends BaseNotification {
@NotificationInput({
title: 'URL',
value: 'https://api.telegram.org',
title: "URL",
value: "https://api.telegram.org",
component: {
placeholder: 'https://api.telegram.org',
placeholder: "https://api.telegram.org",
},
required: true,
})
endpoint = 'https://api.telegram.org';
endpoint = "https://api.telegram.org";
@NotificationInput({
title: 'Bot Token',
title: "Bot Token",
component: {
placeholder: '123456789:ABCdefGhijklmnopqrstUVWXyz',
placeholder: "123456789:ABCdefGhijklmnopqrstUVWXyz",
},
helper: '[token获取](https://core.telegram.org/bots/features#botfather)',
helper: "[token获取](https://core.telegram.org/bots/features#botfather)",
required: true,
})
botToken = '';
botToken = "";
@NotificationInput({
title: '聊天ID',
title: "聊天ID",
component: {
placeholder: '聊天ID,例如 123456789 或 @channelusername',
placeholder: "聊天ID,例如 123456789 或 @channelusername",
},
helper: '用户ID(纯数字)或频道名称(@xxxx)',
helper: "用户ID(纯数字)或频道名称(@xxxx)",
required: true,
})
chatId = '';
chatId = "";
@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,
})
@@ -60,13 +60,13 @@ export class TelegramNotification extends BaseNotification {
replaceText(text: string) {
// .*()<> 等都需要用\\进行替换
return text.replace(/[_*[\]()~`>#\+\-=|{}.!]/g, '\\$&');
return text.replace(/[_*[\]()~`>#\+\-=|{}.!]/g, "\\$&");
// .replace(/([\\_*`|!.[\](){}>+#=~-])/gm, '\\$1')
// return text.replace(/[\\.*()<>]/g, '\\$&');
}
async send(body: NotificationBody) {
if (!this.botToken || !this.chatId) {
throw new Error('Bot Token 和聊天ID不能为空');
throw new Error("Bot Token 和聊天ID不能为空");
}
// 构建消息内容
@@ -78,11 +78,11 @@ export class TelegramNotification extends BaseNotification {
// 发送 HTTP 请求
await this.http.request({
url: url,
method: 'POST',
method: "POST",
data: {
chat_id: this.chatId,
text: messageContent,
parse_mode: 'MarkdownV2', // 或使用 'HTML' 取决于需要的格式
parse_mode: "MarkdownV2", // 或使用 'HTML' 取决于需要的格式
},
httpProxy: this.httpsProxy,
skipSslVerify: this.skipSslVerify,