mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-15 20:25:23 +02:00
[autofix.ci] apply automated fixes
This commit is contained in:
@@ -41,233 +41,233 @@ export const sendDokployRestartNotifications = async () => {
|
|||||||
|
|
||||||
for (const notification of notificationList) {
|
for (const notification of notificationList) {
|
||||||
const {
|
const {
|
||||||
email,
|
email,
|
||||||
resend,
|
resend,
|
||||||
discord,
|
discord,
|
||||||
telegram,
|
telegram,
|
||||||
slack,
|
slack,
|
||||||
gotify,
|
gotify,
|
||||||
ntfy,
|
ntfy,
|
||||||
custom,
|
custom,
|
||||||
lark,
|
lark,
|
||||||
pushover,
|
pushover,
|
||||||
teams,
|
teams,
|
||||||
} = notification;
|
} = notification;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (email || resend) {
|
if (email || resend) {
|
||||||
const template = await renderAsync(
|
const template = await renderAsync(
|
||||||
DokployRestartEmail({ date: date.toLocaleString() }),
|
DokployRestartEmail({ date: date.toLocaleString() }),
|
||||||
).catch();
|
).catch();
|
||||||
|
|
||||||
if (email) {
|
if (email) {
|
||||||
await sendEmailNotification(
|
await sendEmailNotification(
|
||||||
email,
|
email,
|
||||||
"Dokploy Server Restarted",
|
"Dokploy Server Restarted",
|
||||||
template,
|
template,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resend) {
|
||||||
|
await sendResendNotification(
|
||||||
|
resend,
|
||||||
|
"Dokploy Server Restarted",
|
||||||
|
template,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resend) {
|
if (discord) {
|
||||||
await sendResendNotification(
|
const decorate = (decoration: string, text: string) =>
|
||||||
resend,
|
`${discord.decoration ? decoration : ""} ${text}`.trim();
|
||||||
"Dokploy Server Restarted",
|
|
||||||
template,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (discord) {
|
await sendDiscordNotification(discord, {
|
||||||
const decorate = (decoration: string, text: string) =>
|
title: decorate(">", "`✅` Dokploy Server Restarted"),
|
||||||
`${discord.decoration ? decoration : ""} ${text}`.trim();
|
color: 0x57f287,
|
||||||
|
fields: [
|
||||||
await sendDiscordNotification(discord, {
|
{
|
||||||
title: decorate(">", "`✅` Dokploy Server Restarted"),
|
name: decorate("`📅`", "Date"),
|
||||||
color: 0x57f287,
|
value: `<t:${unixDate}:D>`,
|
||||||
fields: [
|
inline: true,
|
||||||
{
|
},
|
||||||
name: decorate("`📅`", "Date"),
|
{
|
||||||
value: `<t:${unixDate}:D>`,
|
name: decorate("`⌚`", "Time"),
|
||||||
inline: true,
|
value: `<t:${unixDate}:t>`,
|
||||||
},
|
inline: true,
|
||||||
{
|
},
|
||||||
name: decorate("`⌚`", "Time"),
|
{
|
||||||
value: `<t:${unixDate}:t>`,
|
name: decorate("`❓`", "Type"),
|
||||||
inline: true,
|
value: "Successful",
|
||||||
},
|
inline: true,
|
||||||
{
|
},
|
||||||
name: decorate("`❓`", "Type"),
|
],
|
||||||
value: "Successful",
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
timestamp: date.toISOString(),
|
|
||||||
footer: {
|
|
||||||
text: "Dokploy Restart Notification",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gotify) {
|
|
||||||
const decorate = (decoration: string, text: string) =>
|
|
||||||
`${gotify.decoration ? decoration : ""} ${text}\n`;
|
|
||||||
await sendGotifyNotification(
|
|
||||||
gotify,
|
|
||||||
decorate("✅", "Dokploy Server Restarted"),
|
|
||||||
`${decorate("🕒", `Date: ${date.toLocaleString()}`)}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ntfy) {
|
|
||||||
await sendNtfyNotification(
|
|
||||||
ntfy,
|
|
||||||
"Dokploy Server Restarted",
|
|
||||||
"white_check_mark",
|
|
||||||
"",
|
|
||||||
`🕒Date: ${date.toLocaleString()}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (telegram) {
|
|
||||||
await sendTelegramNotification(
|
|
||||||
telegram,
|
|
||||||
`<b>✅ Dokploy Server Restarted</b>\n\n<b>Date:</b> ${format(
|
|
||||||
date,
|
|
||||||
"PP",
|
|
||||||
)}\n<b>Time:</b> ${format(date, "pp")}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (slack) {
|
|
||||||
const { channel } = slack;
|
|
||||||
await sendSlackNotification(slack, {
|
|
||||||
channel: channel,
|
|
||||||
attachments: [
|
|
||||||
{
|
|
||||||
color: "#00FF00",
|
|
||||||
pretext: ":white_check_mark: *Dokploy Server Restarted*",
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
title: "Time",
|
|
||||||
value: date.toLocaleString(),
|
|
||||||
short: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (custom) {
|
|
||||||
try {
|
|
||||||
await sendCustomNotification(custom, {
|
|
||||||
title: "Dokploy Server Restarted",
|
|
||||||
message: "Dokploy server has been restarted successfully",
|
|
||||||
timestamp: date.toISOString(),
|
timestamp: date.toISOString(),
|
||||||
date: date.toLocaleString(),
|
footer: {
|
||||||
status: "success",
|
text: "Dokploy Restart Notification",
|
||||||
type: "dokploy-restart",
|
},
|
||||||
});
|
});
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (lark) {
|
if (gotify) {
|
||||||
await sendLarkNotification(lark, {
|
const decorate = (decoration: string, text: string) =>
|
||||||
msg_type: "interactive",
|
`${gotify.decoration ? decoration : ""} ${text}\n`;
|
||||||
card: {
|
await sendGotifyNotification(
|
||||||
schema: "2.0",
|
gotify,
|
||||||
config: {
|
decorate("✅", "Dokploy Server Restarted"),
|
||||||
update_multi: true,
|
`${decorate("🕒", `Date: ${date.toLocaleString()}`)}`,
|
||||||
style: {
|
);
|
||||||
text_size: {
|
}
|
||||||
normal_v2: {
|
|
||||||
default: "normal",
|
if (ntfy) {
|
||||||
pc: "normal",
|
await sendNtfyNotification(
|
||||||
mobile: "heading",
|
ntfy,
|
||||||
|
"Dokploy Server Restarted",
|
||||||
|
"white_check_mark",
|
||||||
|
"",
|
||||||
|
`🕒Date: ${date.toLocaleString()}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (telegram) {
|
||||||
|
await sendTelegramNotification(
|
||||||
|
telegram,
|
||||||
|
`<b>✅ Dokploy Server Restarted</b>\n\n<b>Date:</b> ${format(
|
||||||
|
date,
|
||||||
|
"PP",
|
||||||
|
)}\n<b>Time:</b> ${format(date, "pp")}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slack) {
|
||||||
|
const { channel } = slack;
|
||||||
|
await sendSlackNotification(slack, {
|
||||||
|
channel: channel,
|
||||||
|
attachments: [
|
||||||
|
{
|
||||||
|
color: "#00FF00",
|
||||||
|
pretext: ":white_check_mark: *Dokploy Server Restarted*",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
title: "Time",
|
||||||
|
value: date.toLocaleString(),
|
||||||
|
short: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (custom) {
|
||||||
|
try {
|
||||||
|
await sendCustomNotification(custom, {
|
||||||
|
title: "Dokploy Server Restarted",
|
||||||
|
message: "Dokploy server has been restarted successfully",
|
||||||
|
timestamp: date.toISOString(),
|
||||||
|
date: date.toLocaleString(),
|
||||||
|
status: "success",
|
||||||
|
type: "dokploy-restart",
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lark) {
|
||||||
|
await sendLarkNotification(lark, {
|
||||||
|
msg_type: "interactive",
|
||||||
|
card: {
|
||||||
|
schema: "2.0",
|
||||||
|
config: {
|
||||||
|
update_multi: true,
|
||||||
|
style: {
|
||||||
|
text_size: {
|
||||||
|
normal_v2: {
|
||||||
|
default: "normal",
|
||||||
|
pc: "normal",
|
||||||
|
mobile: "heading",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
header: {
|
||||||
header: {
|
title: {
|
||||||
title: {
|
tag: "plain_text",
|
||||||
tag: "plain_text",
|
content: "✅ Dokploy Server Restarted",
|
||||||
content: "✅ Dokploy Server Restarted",
|
|
||||||
},
|
|
||||||
subtitle: {
|
|
||||||
tag: "plain_text",
|
|
||||||
content: "",
|
|
||||||
},
|
|
||||||
template: "green",
|
|
||||||
padding: "12px 12px 12px 12px",
|
|
||||||
},
|
|
||||||
body: {
|
|
||||||
direction: "vertical",
|
|
||||||
padding: "12px 12px 12px 12px",
|
|
||||||
elements: [
|
|
||||||
{
|
|
||||||
tag: "column_set",
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
tag: "column",
|
|
||||||
width: "weighted",
|
|
||||||
elements: [
|
|
||||||
{
|
|
||||||
tag: "markdown",
|
|
||||||
content: "**Status:**\nSuccessful",
|
|
||||||
text_align: "left",
|
|
||||||
text_size: "normal_v2",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vertical_align: "top",
|
|
||||||
weight: 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
tag: "column",
|
|
||||||
width: "weighted",
|
|
||||||
elements: [
|
|
||||||
{
|
|
||||||
tag: "markdown",
|
|
||||||
content: `**Restart Time:**\n${format(
|
|
||||||
date,
|
|
||||||
"PP pp",
|
|
||||||
)}`,
|
|
||||||
text_align: "left",
|
|
||||||
text_size: "normal_v2",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vertical_align: "top",
|
|
||||||
weight: 1,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
],
|
subtitle: {
|
||||||
|
tag: "plain_text",
|
||||||
|
content: "",
|
||||||
|
},
|
||||||
|
template: "green",
|
||||||
|
padding: "12px 12px 12px 12px",
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
direction: "vertical",
|
||||||
|
padding: "12px 12px 12px 12px",
|
||||||
|
elements: [
|
||||||
|
{
|
||||||
|
tag: "column_set",
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
tag: "column",
|
||||||
|
width: "weighted",
|
||||||
|
elements: [
|
||||||
|
{
|
||||||
|
tag: "markdown",
|
||||||
|
content: "**Status:**\nSuccessful",
|
||||||
|
text_align: "left",
|
||||||
|
text_size: "normal_v2",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
vertical_align: "top",
|
||||||
|
weight: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tag: "column",
|
||||||
|
width: "weighted",
|
||||||
|
elements: [
|
||||||
|
{
|
||||||
|
tag: "markdown",
|
||||||
|
content: `**Restart Time:**\n${format(
|
||||||
|
date,
|
||||||
|
"PP pp",
|
||||||
|
)}`,
|
||||||
|
text_align: "left",
|
||||||
|
text_size: "normal_v2",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
vertical_align: "top",
|
||||||
|
weight: 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
});
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (pushover) {
|
if (pushover) {
|
||||||
await sendPushoverNotification(
|
await sendPushoverNotification(
|
||||||
pushover,
|
pushover,
|
||||||
"Dokploy Server Restarted",
|
"Dokploy Server Restarted",
|
||||||
`Date: ${date.toLocaleString()}`,
|
`Date: ${date.toLocaleString()}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (teams) {
|
if (teams) {
|
||||||
await sendTeamsNotification(teams, {
|
await sendTeamsNotification(teams, {
|
||||||
title: "✅ Dokploy Server Restarted",
|
title: "✅ Dokploy Server Restarted",
|
||||||
facts: [
|
facts: [
|
||||||
{ name: "Status", value: "Successful" },
|
{ name: "Status", value: "Successful" },
|
||||||
{ name: "Restart Time", value: format(date, "PP pp") },
|
{ name: "Restart Time", value: format(date, "PP pp") },
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("[Dokploy] Restart notifications failed:", error);
|
console.error("[Dokploy] Restart notifications failed:", error);
|
||||||
|
|||||||
Reference in New Issue
Block a user