mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
telegram notification
This commit is contained in:
@@ -5,6 +5,7 @@ import { buildDiscordShoutrrrUrl } from "./discord";
|
||||
import { buildGotifyShoutrrrUrl } from "./gotify";
|
||||
import { buildNtfyShoutrrrUrl } from "./ntfy";
|
||||
import { buildPushoverShoutrrrUrl } from "./pushover";
|
||||
import { buildTelegramShoutrrrUrl } from "./telegram";
|
||||
import { buildCustomShoutrrrUrl } from "./custom";
|
||||
|
||||
export function buildShoutrrrUrl(config: NotificationConfig): string {
|
||||
@@ -21,6 +22,8 @@ export function buildShoutrrrUrl(config: NotificationConfig): string {
|
||||
return buildNtfyShoutrrrUrl(config);
|
||||
case "pushover":
|
||||
return buildPushoverShoutrrrUrl(config);
|
||||
case "telegram":
|
||||
return buildTelegramShoutrrrUrl(config);
|
||||
case "custom":
|
||||
return buildCustomShoutrrrUrl(config);
|
||||
default: {
|
||||
|
||||
8
app/server/modules/notifications/builders/telegram.ts
Normal file
8
app/server/modules/notifications/builders/telegram.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { NotificationConfig } from "~/schemas/notifications";
|
||||
|
||||
export function buildTelegramShoutrrrUrl(config: Extract<NotificationConfig, { type: "telegram" }>): string {
|
||||
// Shoutrrr format: telegram://bottoken@telegram?channels=chatid1,chatid2
|
||||
// config: { type: 'telegram', botToken: string, chatId: string }
|
||||
// Do NOT encode botToken or chatId; Shoutrrr expects raw values (colon, dash, etc.)
|
||||
return `telegram://${config.botToken}@telegram?channels=${config.chatId}`;
|
||||
}
|
||||
@@ -65,6 +65,11 @@ async function encryptSensitiveFields(config: NotificationConfig): Promise<Notif
|
||||
...config,
|
||||
apiToken: await cryptoUtils.encrypt(config.apiToken),
|
||||
};
|
||||
case "telegram":
|
||||
return {
|
||||
...config,
|
||||
botToken: await cryptoUtils.encrypt(config.botToken),
|
||||
};
|
||||
case "custom":
|
||||
return {
|
||||
...config,
|
||||
@@ -107,6 +112,11 @@ async function decryptSensitiveFields(config: NotificationConfig): Promise<Notif
|
||||
...config,
|
||||
apiToken: await cryptoUtils.decrypt(config.apiToken),
|
||||
};
|
||||
case "telegram":
|
||||
return {
|
||||
...config,
|
||||
botToken: await cryptoUtils.decrypt(config.botToken),
|
||||
};
|
||||
case "custom":
|
||||
return {
|
||||
...config,
|
||||
|
||||
Reference in New Issue
Block a user