From 9806a5d60743241c07b5f90348ea0b0bde2857b9 Mon Sep 17 00:00:00 2001 From: depado Date: Sat, 18 Jan 2025 13:59:39 +0100 Subject: [PATCH] feat(notifications): fix gotify style --- .../server/src/utils/notifications/build-error.ts | 14 +++++++------- .../src/utils/notifications/build-success.ts | 12 ++++++------ .../src/utils/notifications/database-backup.ts | 12 ++++++------ .../src/utils/notifications/docker-cleanup.ts | 6 +++--- .../src/utils/notifications/dokploy-restart.ts | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/server/src/utils/notifications/build-error.ts b/packages/server/src/utils/notifications/build-error.ts index 90bfd77f6..086effb09 100644 --- a/packages/server/src/utils/notifications/build-error.ts +++ b/packages/server/src/utils/notifications/build-error.ts @@ -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}`)}`, ); } diff --git a/packages/server/src/utils/notifications/build-success.ts b/packages/server/src/utils/notifications/build-success.ts index 253762f5d..76d3ee12c 100644 --- a/packages/server/src/utils/notifications/build-success.ts +++ b/packages/server/src/utils/notifications/build-success.ts @@ -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}`)}`, ); } diff --git a/packages/server/src/utils/notifications/database-backup.ts b/packages/server/src/utils/notifications/database-backup.ts index 21e061955..43b967cc2 100644 --- a/packages/server/src/utils/notifications/database-backup.ts +++ b/packages/server/src/utils/notifications/database-backup.ts @@ -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}`) : ""}`, ); } diff --git a/packages/server/src/utils/notifications/docker-cleanup.ts b/packages/server/src/utils/notifications/docker-cleanup.ts index bb167b914..d4aaa5c88 100644 --- a/packages/server/src/utils/notifications/docker-cleanup.ts +++ b/packages/server/src/utils/notifications/docker-cleanup.ts @@ -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}`)}`, ); } diff --git a/packages/server/src/utils/notifications/dokploy-restart.ts b/packages/server/src/utils/notifications/dokploy-restart.ts index ec4a9407d..30f2ad659 100644 --- a/packages/server/src/utils/notifications/dokploy-restart.ts +++ b/packages/server/src/utils/notifications/dokploy-restart.ts @@ -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"),