feat(notifications): fix gotify style

This commit is contained in:
depado 2025-01-18 13:59:39 +01:00
parent e25d0c0c68
commit 9806a5d607
5 changed files with 23 additions and 23 deletions

View File

@ -116,16 +116,16 @@ export const sendBuildErrorNotifications = async ({
if (gotify) {
const decorate = (decoration: string, text: string) =>
`${gotify.decoration ? decoration : ""} ${text}`.trim();
`${gotify.decoration ? decoration : ""} ${text}\n`;
await sendGotifyNotification(
gotify,
decorate("⚠️", "Build Failed"),
`${decorate("🛠️", `Project: ${projectName}`)}
${decorate("⚙️", `Application: ${applicationName}`)}
${decorate("❔", `Type: ${applicationType}`)}
${decorate("🕒", `Date: ${date.toLocaleString()}`)}
${decorate("⚠️", `Error:\n${errorMessage}`)}
${decorate("🔗", `Build details:\n${buildLink}`)}`,
`${decorate("🛠️", `Project: ${projectName}`)}` +
`${decorate("⚙️", `Application: ${applicationName}`)}` +
`${decorate("❔", `Type: ${applicationType}`)}` +
`${decorate("🕒", `Date: ${date.toLocaleString()}`)}` +
`${decorate("⚠️", `Error:\n${errorMessage}`)}` +
`${decorate("🔗", `Build details:\n${buildLink}`)}`,
);
}

View File

@ -110,15 +110,15 @@ export const sendBuildSuccessNotifications = async ({
if (gotify) {
const decorate = (decoration: string, text: string) =>
`${gotify.decoration ? decoration : ""} ${text}`.trim();
`${gotify.decoration ? decoration : ""} ${text}\n`;
await sendGotifyNotification(
gotify,
decorate("✅", "Build Success"),
`${decorate("🛠️", `Project: ${projectName}`)}
${decorate("⚙️", `Application: ${applicationName}`)}
${decorate("❔", `Type: ${applicationType}`)}
${decorate("🕒", `Date: ${date.toLocaleString()}`)}
${decorate("🔗", `Build details:\n${buildLink}`)}`,
`${decorate("🛠️", `Project: ${projectName}`)}` +
`${decorate("⚙️", `Application: ${applicationName}`)}` +
`${decorate("❔", `Type: ${applicationType}`)}` +
`${decorate("🕒", `Date: ${date.toLocaleString()}`)}` +
`${decorate("🔗", `Build details:\n${buildLink}`)}`,
);
}

View File

@ -125,7 +125,7 @@ export const sendDatabaseBackupNotifications = async ({
if (gotify) {
const decorate = (decoration: string, text: string) =>
`${gotify.decoration ? decoration : ""} ${text}`.trim();
`${gotify.decoration ? decoration : ""} ${text}\n`;
await sendGotifyNotification(
gotify,
@ -133,11 +133,11 @@ export const sendDatabaseBackupNotifications = async ({
type === "success" ? "✅" : "❌",
`Database Backup ${type === "success" ? "Successful" : "Failed"}`,
),
`${decorate("🛠️", `Project: ${projectName}`)}
${decorate("⚙️", `Application: ${applicationName}`)}
${decorate("❔", `Type: ${databaseType}`)}
${decorate("🕒", `Date: ${date.toLocaleString()}`)}
${type === "error" && errorMessage ? decorate("❌", `Error:\n${errorMessage}`) : ""}`,
`${decorate("🛠️", `Project: ${projectName}`)}` +
`${decorate("⚙️", `Application: ${applicationName}`)}` +
`${decorate("❔", `Type: ${databaseType}`)}` +
`${decorate("🕒", `Date: ${date.toLocaleString()}`)}` +
`${type === "error" && errorMessage ? decorate("❌", `Error:\n${errorMessage}`) : ""}`,
);
}

View File

@ -83,12 +83,12 @@ export const sendDockerCleanupNotifications = async (
if (gotify) {
const decorate = (decoration: string, text: string) =>
`${gotify.decoration ? decoration : ""} ${text}`.trim();
`${gotify.decoration ? decoration : ""} ${text}\n`;
await sendGotifyNotification(
gotify,
decorate("✅", "Docker Cleanup"),
`${decorate("🕒", `Date: ${date.toLocaleString()}`)}
${decorate("📜", `Message:\n${message}`)}`,
`${decorate("🕒", `Date: ${date.toLocaleString()}`)}` +
`${decorate("📜", `Message:\n${message}`)}`,
);
}

View File

@ -68,7 +68,7 @@ export const sendDokployRestartNotifications = async () => {
if (gotify) {
const decorate = (decoration: string, text: string) =>
`${gotify.decoration ? decoration : ""} ${text}`.trim();
`${gotify.decoration ? decoration : ""} ${text}\n`;
await sendGotifyNotification(
gotify,
decorate("✅", "Dokploy Server Restarted"),