From cd06b55a0cf5e4a7d99c65340c9930ac8e2fc74a Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Tue, 23 Sep 2025 16:46:21 +0000 Subject: [PATCH] [autofix.ci] apply automated fixes --- .../src/utils/notifications/build-error.ts | 63 +++++------ .../src/utils/notifications/build-success.ts | 57 +++++----- .../utils/notifications/database-backup.ts | 104 +++++++++--------- .../src/utils/notifications/docker-cleanup.ts | 37 ++++--- .../utils/notifications/dokploy-restart.ts | 33 +++--- .../utils/notifications/server-threshold.ts | 38 +++---- 6 files changed, 169 insertions(+), 163 deletions(-) diff --git a/packages/server/src/utils/notifications/build-error.ts b/packages/server/src/utils/notifications/build-error.ts index a409c9cf8..67c568b72 100644 --- a/packages/server/src/utils/notifications/build-error.ts +++ b/packages/server/src/utils/notifications/build-error.ts @@ -50,7 +50,8 @@ export const sendBuildErrorNotifications = async ({ }); for (const notification of notificationList) { - const { email, discord, telegram, slack, gotify, ntfy, lark } = notification; + const { email, discord, telegram, slack, gotify, ntfy, lark } = + notification; if (email) { const template = await renderAsync( BuildFailedEmail({ @@ -128,11 +129,11 @@ export const sendBuildErrorNotifications = async ({ 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("⚙️", `Application: ${applicationName}`)}` + + `${decorate("❔", `Type: ${applicationType}`)}` + + `${decorate("🕒", `Date: ${date.toLocaleString()}`)}` + + `${decorate("⚠️", `Error:\n${errorMessage}`)}` + + `${decorate("🔗", `Build details:\n${buildLink}`)}`, ); } @@ -143,10 +144,10 @@ export const sendBuildErrorNotifications = async ({ "warning", `view, Build details, ${buildLink}, clear=true;`, `🛠️Project: ${projectName}\n` + - `⚙️Application: ${applicationName}\n` + - `❔Type: ${applicationType}\n` + - `🕒Date: ${date.toLocaleString()}\n` + - `⚠️Error:\n${errorMessage}`, + `⚙️Application: ${applicationName}\n` + + `❔Type: ${applicationType}\n` + + `🕒Date: ${date.toLocaleString()}\n` + + `⚠️Error:\n${errorMessage}`, ); } @@ -228,10 +229,10 @@ export const sendBuildErrorNotifications = async ({ normal_v2: { default: "normal", pc: "normal", - mobile: "heading" - } - } - } + mobile: "heading", + }, + }, + }, }, header: { title: { @@ -243,7 +244,7 @@ export const sendBuildErrorNotifications = async ({ content: "", }, template: "red", - padding: "12px 12px 12px 12px" + padding: "12px 12px 12px 12px", }, body: { direction: "vertical", @@ -260,23 +261,23 @@ export const sendBuildErrorNotifications = async ({ tag: "markdown", content: `**Project:**\n${projectName}`, text_align: "left", - text_size: "normal_v2" + text_size: "normal_v2", }, { tag: "markdown", content: `**Type:**\n${applicationType}`, text_align: "left", - text_size: "normal_v2" + text_size: "normal_v2", }, { tag: "markdown", content: `**Error Message:**\n\`\`\`\n${truncatedErrorMessage}\n\`\`\``, text_align: "left", - text_size: "normal_v2" - } + text_size: "normal_v2", + }, ], vertical_align: "top", - weight: 1 + weight: 1, }, { tag: "column", @@ -286,19 +287,19 @@ export const sendBuildErrorNotifications = async ({ tag: "markdown", content: `**Application:**\n${applicationName}`, text_align: "left", - text_size: "normal_v2" + text_size: "normal_v2", }, { tag: "markdown", content: `**Date:**\n${format(date, "PP pp")}`, text_align: "left", - text_size: "normal_v2" - } + text_size: "normal_v2", + }, ], vertical_align: "top", - weight: 1 - } - ] + weight: 1, + }, + ], }, { tag: "button", @@ -315,13 +316,13 @@ export const sendBuildErrorNotifications = async ({ default_url: buildLink, pc_url: "", ios_url: "", - android_url: "" - } + android_url: "", + }, ], - margin: "0px 0px 0px 0px" - } + margin: "0px 0px 0px 0px", + }, ], - } + }, }, }); } diff --git a/packages/server/src/utils/notifications/build-success.ts b/packages/server/src/utils/notifications/build-success.ts index 7eaa677fb..a93b3d547 100644 --- a/packages/server/src/utils/notifications/build-success.ts +++ b/packages/server/src/utils/notifications/build-success.ts @@ -51,7 +51,8 @@ export const sendBuildSuccessNotifications = async ({ }); for (const notification of notificationList) { - const { email, discord, telegram, slack, gotify, ntfy, lark } = notification; + const { email, discord, telegram, slack, gotify, ntfy, lark } = + notification; if (email) { const template = await renderAsync( @@ -123,10 +124,10 @@ export const sendBuildSuccessNotifications = async ({ gotify, decorate("✅", "Build Success"), `${decorate("🛠️", `Project: ${projectName}`)}` + - `${decorate("⚙️", `Application: ${applicationName}`)}` + - `${decorate("❔", `Type: ${applicationType}`)}` + - `${decorate("🕒", `Date: ${date.toLocaleString()}`)}` + - `${decorate("🔗", `Build details:\n${buildLink}`)}`, + `${decorate("⚙️", `Application: ${applicationName}`)}` + + `${decorate("❔", `Type: ${applicationType}`)}` + + `${decorate("🕒", `Date: ${date.toLocaleString()}`)}` + + `${decorate("🔗", `Build details:\n${buildLink}`)}`, ); } @@ -137,9 +138,9 @@ export const sendBuildSuccessNotifications = async ({ "white_check_mark", `view, Build details, ${buildLink}, clear=true;`, `🛠Project: ${projectName}\n` + - `⚙️Application: ${applicationName}\n` + - `❔Type: ${applicationType}\n` + - `🕒Date: ${date.toLocaleString()}`, + `⚙️Application: ${applicationName}\n` + + `❔Type: ${applicationType}\n` + + `🕒Date: ${date.toLocaleString()}`, ); } @@ -225,10 +226,10 @@ export const sendBuildSuccessNotifications = async ({ normal_v2: { default: "normal", pc: "normal", - mobile: "heading" - } - } - } + mobile: "heading", + }, + }, + }, }, header: { title: { @@ -240,7 +241,7 @@ export const sendBuildSuccessNotifications = async ({ content: "", }, template: "green", - padding: "12px 12px 12px 12px" + padding: "12px 12px 12px 12px", }, body: { direction: "vertical", @@ -257,17 +258,17 @@ export const sendBuildSuccessNotifications = async ({ tag: "markdown", content: `**Project:**\n${projectName}`, text_align: "left", - text_size: "normal_v2" + text_size: "normal_v2", }, { tag: "markdown", content: `**Type:**\n${applicationType}`, text_align: "left", - text_size: "normal_v2" - } + text_size: "normal_v2", + }, ], vertical_align: "top", - weight: 1 + weight: 1, }, { tag: "column", @@ -277,19 +278,19 @@ export const sendBuildSuccessNotifications = async ({ tag: "markdown", content: `**Application:**\n${applicationName}`, text_align: "left", - text_size: "normal_v2" + text_size: "normal_v2", }, { tag: "markdown", content: `**Date:**\n${format(date, "PP pp")}`, text_align: "left", - text_size: "normal_v2" - } + text_size: "normal_v2", + }, ], vertical_align: "top", - weight: 1 - } - ] + weight: 1, + }, + ], }, { tag: "button", @@ -306,13 +307,13 @@ export const sendBuildSuccessNotifications = async ({ default_url: buildLink, pc_url: "", ios_url: "", - android_url: "" - } + android_url: "", + }, ], - margin: "0px 0px 0px 0px" - } + margin: "0px 0px 0px 0px", + }, ], - } + }, }, }); } diff --git a/packages/server/src/utils/notifications/database-backup.ts b/packages/server/src/utils/notifications/database-backup.ts index 4f1ad9e1a..c5cb68dbc 100644 --- a/packages/server/src/utils/notifications/database-backup.ts +++ b/packages/server/src/utils/notifications/database-backup.ts @@ -50,7 +50,8 @@ export const sendDatabaseBackupNotifications = async ({ }); for (const notification of notificationList) { - const { email, discord, telegram, slack, gotify, ntfy, lark } = notification; + const { email, discord, telegram, slack, gotify, ntfy, lark } = + notification; if (email) { const template = await renderAsync( @@ -120,11 +121,11 @@ export const sendDatabaseBackupNotifications = async ({ }, ...(type === "error" && errorMessage ? [ - { - name: decorate("`⚠️`", "Error Message"), - value: `\`\`\`${errorMessage}\`\`\``, - }, - ] + { + name: decorate("`⚠️`", "Error Message"), + value: `\`\`\`${errorMessage}\`\`\``, + }, + ] : []), ], timestamp: date.toISOString(), @@ -145,11 +146,11 @@ export const sendDatabaseBackupNotifications = async ({ `Database Backup ${type === "success" ? "Successful" : "Failed"}`, ), `${decorate("🛠️", `Project: ${projectName}`)}` + - `${decorate("⚙️", `Application: ${applicationName}`)}` + - `${decorate("❔", `Type: ${databaseType}`)}` + - `${decorate("📂", `Database Name: ${databaseName}`)}` + - `${decorate("🕒", `Date: ${date.toLocaleString()}`)}` + - `${type === "error" && errorMessage ? decorate("❌", `Error:\n${errorMessage}`) : ""}`, + `${decorate("⚙️", `Application: ${applicationName}`)}` + + `${decorate("❔", `Type: ${databaseType}`)}` + + `${decorate("📂", `Database Name: ${databaseName}`)}` + + `${decorate("🕒", `Date: ${date.toLocaleString()}`)}` + + `${type === "error" && errorMessage ? decorate("❌", `Error:\n${errorMessage}`) : ""}`, ); } @@ -160,11 +161,11 @@ export const sendDatabaseBackupNotifications = async ({ `${type === "success" ? "white_check_mark" : "x"}`, "", `🛠Project: ${projectName}\n` + - `⚙️Application: ${applicationName}\n` + - `❔Type: ${databaseType}\n` + - `📂Database Name: ${databaseName}` + - `🕒Date: ${date.toLocaleString()}\n` + - `${type === "error" && errorMessage ? `❌Error:\n${errorMessage}` : ""}`, + `⚙️Application: ${applicationName}\n` + + `❔Type: ${databaseType}\n` + + `📂Database Name: ${databaseName}` + + `🕒Date: ${date.toLocaleString()}\n` + + `${type === "error" && errorMessage ? `❌Error:\n${errorMessage}` : ""}`, ); } @@ -196,12 +197,12 @@ export const sendDatabaseBackupNotifications = async ({ fields: [ ...(type === "error" && errorMessage ? [ - { - title: "Error Message", - value: errorMessage, - short: false, - }, - ] + { + title: "Error Message", + value: errorMessage, + short: false, + }, + ] : []), { title: "Project", @@ -243,9 +244,10 @@ export const sendDatabaseBackupNotifications = async ({ if (lark) { const limitCharacter = 800; - const truncatedErrorMessage = errorMessage && errorMessage.length > limitCharacter - ? errorMessage.substring(0, limitCharacter) - : errorMessage; + const truncatedErrorMessage = + errorMessage && errorMessage.length > limitCharacter + ? errorMessage.substring(0, limitCharacter) + : errorMessage; await sendLarkNotification(lark, { msg_type: "interactive", @@ -258,10 +260,10 @@ export const sendDatabaseBackupNotifications = async ({ normal_v2: { default: "normal", pc: "normal", - mobile: "heading" - } - } - } + mobile: "heading", + }, + }, + }, }, header: { title: { @@ -276,7 +278,7 @@ export const sendDatabaseBackupNotifications = async ({ content: "", }, template: type === "success" ? "green" : "red", - padding: "12px 12px 12px 12px" + padding: "12px 12px 12px 12px", }, body: { direction: "vertical", @@ -293,23 +295,23 @@ export const sendDatabaseBackupNotifications = async ({ tag: "markdown", content: `**Project:**\n${projectName}`, text_align: "left", - text_size: "normal_v2" + text_size: "normal_v2", }, { tag: "markdown", content: `**Database Type:**\n${databaseType}`, text_align: "left", - text_size: "normal_v2" + text_size: "normal_v2", }, { tag: "markdown", content: `**Status:**\n${type === "success" ? "Successful" : "Failed"}`, text_align: "left", - text_size: "normal_v2" - } + text_size: "normal_v2", + }, ], vertical_align: "top", - weight: 1 + weight: 1, }, { tag: "column", @@ -319,38 +321,38 @@ export const sendDatabaseBackupNotifications = async ({ tag: "markdown", content: `**Application:**\n${applicationName}`, text_align: "left", - text_size: "normal_v2" + text_size: "normal_v2", }, { tag: "markdown", content: `**Database Name:**\n${databaseName}`, text_align: "left", - text_size: "normal_v2" + text_size: "normal_v2", }, { tag: "markdown", content: `**Date:**\n${format(date, "PP pp")}`, text_align: "left", - text_size: "normal_v2" - } + text_size: "normal_v2", + }, ], vertical_align: "top", - weight: 1 - } - ] + weight: 1, + }, + ], }, ...(type === "error" && truncatedErrorMessage ? [ - { - tag: "markdown", - content: `**Error Message:**\n\`\`\`\n${truncatedErrorMessage}\n\`\`\``, - text_align: "left", - text_size: "normal_v2" - } - ] - : []) + { + tag: "markdown", + content: `**Error Message:**\n\`\`\`\n${truncatedErrorMessage}\n\`\`\``, + text_align: "left", + text_size: "normal_v2", + }, + ] + : []), ], - } + }, }, }); } diff --git a/packages/server/src/utils/notifications/docker-cleanup.ts b/packages/server/src/utils/notifications/docker-cleanup.ts index 984c78e79..062da9d49 100644 --- a/packages/server/src/utils/notifications/docker-cleanup.ts +++ b/packages/server/src/utils/notifications/docker-cleanup.ts @@ -37,7 +37,8 @@ export const sendDockerCleanupNotifications = async ( }); for (const notification of notificationList) { - const { email, discord, telegram, slack, gotify, ntfy, lark } = notification; + const { email, discord, telegram, slack, gotify, ntfy, lark } = + notification; if (email) { const template = await renderAsync( @@ -93,7 +94,7 @@ export const sendDockerCleanupNotifications = async ( gotify, decorate("✅", "Docker Cleanup"), `${decorate("🕒", `Date: ${date.toLocaleString()}`)}` + - `${decorate("📜", `Message:\n${message}`)}`, + `${decorate("📜", `Message:\n${message}`)}`, ); } @@ -150,10 +151,10 @@ export const sendDockerCleanupNotifications = async ( normal_v2: { default: "normal", pc: "normal", - mobile: "heading" - } - } - } + mobile: "heading", + }, + }, + }, }, header: { title: { @@ -165,7 +166,7 @@ export const sendDockerCleanupNotifications = async ( content: "", }, template: "green", - padding: "12px 12px 12px 12px" + padding: "12px 12px 12px 12px", }, body: { direction: "vertical", @@ -182,17 +183,17 @@ export const sendDockerCleanupNotifications = async ( tag: "markdown", content: `**Status:**\nSuccessful`, text_align: "left", - text_size: "normal_v2" + text_size: "normal_v2", }, { tag: "markdown", content: `**Cleanup Details:**\n${message}`, text_align: "left", - text_size: "normal_v2" - } + text_size: "normal_v2", + }, ], vertical_align: "top", - weight: 1 + weight: 1, }, { tag: "column", @@ -202,16 +203,16 @@ export const sendDockerCleanupNotifications = async ( tag: "markdown", content: `**Date:**\n${format(date, "PP pp")}`, text_align: "left", - text_size: "normal_v2" - } + text_size: "normal_v2", + }, ], vertical_align: "top", - weight: 1 - } - ] - } + weight: 1, + }, + ], + }, ], - } + }, }, }); } diff --git a/packages/server/src/utils/notifications/dokploy-restart.ts b/packages/server/src/utils/notifications/dokploy-restart.ts index e27a032c5..2582c92d1 100644 --- a/packages/server/src/utils/notifications/dokploy-restart.ts +++ b/packages/server/src/utils/notifications/dokploy-restart.ts @@ -31,7 +31,8 @@ export const sendDokployRestartNotifications = async () => { }); for (const notification of notificationList) { - const { email, discord, telegram, slack, gotify, ntfy, lark } = notification; + const { email, discord, telegram, slack, gotify, ntfy, lark } = + notification; if (email) { const template = await renderAsync( @@ -151,10 +152,10 @@ export const sendDokployRestartNotifications = async () => { normal_v2: { default: "normal", pc: "normal", - mobile: "heading" - } - } - } + mobile: "heading", + }, + }, + }, }, header: { title: { @@ -166,7 +167,7 @@ export const sendDokployRestartNotifications = async () => { content: "", }, template: "green", - padding: "12px 12px 12px 12px" + padding: "12px 12px 12px 12px", }, body: { direction: "vertical", @@ -183,11 +184,11 @@ export const sendDokployRestartNotifications = async () => { tag: "markdown", content: `**Status:**\nSuccessful`, text_align: "left", - text_size: "normal_v2" - } + text_size: "normal_v2", + }, ], vertical_align: "top", - weight: 1 + weight: 1, }, { tag: "column", @@ -197,16 +198,16 @@ export const sendDokployRestartNotifications = async () => { tag: "markdown", content: `**Restart Time:**\n${format(date, "PP pp")}`, text_align: "left", - text_size: "normal_v2" - } + text_size: "normal_v2", + }, ], vertical_align: "top", - weight: 1 - } - ] - } + weight: 1, + }, + ], + }, ], - } + }, }, }); } catch (error) { diff --git a/packages/server/src/utils/notifications/server-threshold.ts b/packages/server/src/utils/notifications/server-threshold.ts index bfe779ce5..b8d627425 100644 --- a/packages/server/src/utils/notifications/server-threshold.ts +++ b/packages/server/src/utils/notifications/server-threshold.ts @@ -166,10 +166,10 @@ export const sendServerThresholdNotifications = async ( normal_v2: { default: "normal", pc: "normal", - mobile: "heading" - } - } - } + mobile: "heading", + }, + }, + }, }, header: { title: { @@ -181,7 +181,7 @@ export const sendServerThresholdNotifications = async ( content: "", }, template: "red", - padding: "12px 12px 12px 12px" + padding: "12px 12px 12px 12px", }, body: { direction: "vertical", @@ -198,23 +198,23 @@ export const sendServerThresholdNotifications = async ( tag: "markdown", content: `**Server Name:**\n${payload.ServerName}`, text_align: "left", - text_size: "normal_v2" + text_size: "normal_v2", }, { tag: "markdown", content: `**Current Value:**\n${payload.Value.toFixed(2)}%`, text_align: "left", - text_size: "normal_v2" + text_size: "normal_v2", }, { tag: "markdown", content: `**Alert Message:**\n${payload.Message}`, text_align: "left", - text_size: "normal_v2" - } + text_size: "normal_v2", + }, ], vertical_align: "top", - weight: 1 + weight: 1, }, { tag: "column", @@ -224,28 +224,28 @@ export const sendServerThresholdNotifications = async ( tag: "markdown", content: `**Type:**\n${payload.Type === "CPU" ? "🔲" : "💾"} ${payload.Type}`, text_align: "left", - text_size: "normal_v2" + text_size: "normal_v2", }, { tag: "markdown", content: `**Threshold:**\n${payload.Threshold.toFixed(2)}%`, text_align: "left", - text_size: "normal_v2" + text_size: "normal_v2", }, { tag: "markdown", content: `**Alert Time:**\n${date.toLocaleString()}`, text_align: "left", - text_size: "normal_v2" - } + text_size: "normal_v2", + }, ], vertical_align: "top", - weight: 1 - } - ] - } + weight: 1, + }, + ], + }, ], - } + }, }, }); }