mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-21 01:47:29 +08:00
feat: rework notification templating and add support for telegram (#5637)
This commit is contained in:
committed by
GitHub
parent
fce824f5a8
commit
9857770cc7
@@ -1,7 +1,6 @@
|
||||
const NotificationProvider = require("./notification-provider");
|
||||
const axios = require("axios");
|
||||
const FormData = require("form-data");
|
||||
const { Liquid } = require("liquidjs");
|
||||
|
||||
class Webhook extends NotificationProvider {
|
||||
name = "webhook";
|
||||
@@ -28,17 +27,7 @@ class Webhook extends NotificationProvider {
|
||||
config.headers = formData.getHeaders();
|
||||
data = formData;
|
||||
} else if (notification.webhookContentType === "custom") {
|
||||
// Initialize LiquidJS and parse the custom Body Template
|
||||
const engine = new Liquid();
|
||||
const tpl = engine.parse(notification.webhookCustomBody);
|
||||
|
||||
// Insert templated values into Body
|
||||
data = await engine.render(tpl,
|
||||
{
|
||||
msg,
|
||||
heartbeatJSON,
|
||||
monitorJSON
|
||||
});
|
||||
data = await this.renderTemplate(notification.webhookCustomBody, msg, monitorJSON, heartbeatJSON);
|
||||
}
|
||||
|
||||
if (notification.webhookAdditionalHeaders) {
|
||||
|
Reference in New Issue
Block a user