feat(notifications): implement notifications for gotify

This commit is contained in:
depado
2025-01-18 14:23:27 +01:00
parent 1f8a476264
commit e25d0c0c68
12 changed files with 4450 additions and 871 deletions
@@ -6,6 +6,7 @@ import { eq } from "drizzle-orm";
import {
sendDiscordNotification,
sendEmailNotification,
sendGotifyNotification,
sendSlackNotification,
sendTelegramNotification,
} from "./utils";
@@ -20,11 +21,12 @@ export const sendDokployRestartNotifications = async () => {
discord: true,
telegram: true,
slack: true,
gotify: true,
},
});
for (const notification of notificationList) {
const { email, discord, telegram, slack } = notification;
const { email, discord, telegram, slack, gotify } = notification;
if (email) {
const template = await renderAsync(
@@ -64,11 +66,21 @@ export const sendDokployRestartNotifications = async () => {
});
}
if (gotify) {
const decorate = (decoration: string, text: string) =>
`${gotify.decoration ? decoration : ""} ${text}`.trim();
await sendGotifyNotification(
gotify,
decorate("✅", "Dokploy Server Restarted"),
`${decorate("🕒", `Date: ${date.toLocaleString()}`)}`,
);
}
if (telegram) {
await sendTelegramNotification(
telegram,
`
<b>✅ Dokploy Serverd Restarted</b>
<b>✅ Dokploy Server Restarted</b>
<b>Time:</b> ${date.toLocaleString()}
`,
);