[fix] notification:kind

This commit is contained in:
Christian Fraß 2023-07-27 18:17:54 +02:00
parent 18327a8db2
commit 2b2f04332b

View file

@ -85,11 +85,9 @@ namespace _heimdall.notification_kinds.email
info : any
) : Promise<void>
{
const nm_nodemailer = require("nodemailer");
// datetime = _datetime.datetime.utcnow()
const now : Date = new Date(Date.now());
const nm_nodemailer = require("nodemailer");
const now : Date = new Date(Date.now());
const transporter = nm_nodemailer.createTransport(
{
"host": parameters.access.host,
@ -111,7 +109,7 @@ namespace _heimdall.notification_kinds.email
"tags": (
parameters.tags
.concat([_heimdall.condition_show(state.condition)])
.map(tag => lib_plankton.string.coin("[{{tag}}]", tag.toUpperCase()))
.map(tag => lib_plankton.string.coin("[{{tag}}]", {"tag": tag.toUpperCase()}))
.join(" ")
),
"title": check.name,
@ -119,23 +117,11 @@ namespace _heimdall.notification_kinds.email
),
"text": JSON.stringify(info, undefined, "\t"),
"headers": {
"Date": lib_plankton.string.coin(
"{{day_of_week}}, {{day_of_month}} {{month}} {{year}} {{hour}}:{{minute}}:{{second}} {{time_offset}}",
{
"day_of_week": now.getDay().toFixed(0),
"day_of_month": now.getDate().toFixed(0),
"month": (now.getMonth() + 1).toFixed(0),
"year": now.getFullYear().toFixed(0),
"hour": now.getHours().toFixed(0),
"minute": now.getMinutes().toFixed(0),
"second": now.getSeconds().toFixed(0),
// "time_offset": (now.getTimezoneOffset() / 60).toFixed(0),
"time_offset": "+0000",
}
),
"Date": now.toUTCString(),
}
}
);
return Promise.resolve<void>(undefined);
}