From 1515f4e1215dc690cf2cc5600a6fd3a9a72974c6 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 16 Oct 2023 16:24:47 +0200 Subject: [PATCH] chore:Webhook custom documentation (#3636) * improved the documentation * fixed the `customBodyPlaceholder` not being translated * fixed required not being set where necessary * changed the docs that `monitorJSON` is also avalibale for cert-expiry --- src/components/notifications/Webhook.vue | 76 ++++++++++-------------- src/lang/en.json | 7 ++- 2 files changed, 37 insertions(+), 46 deletions(-) diff --git a/src/components/notifications/Webhook.vue b/src/components/notifications/Webhook.vue index 4262ad067..8c67a2745 100644 --- a/src/components/notifications/Webhook.vue +++ b/src/components/notifications/Webhook.vue @@ -12,9 +12,7 @@
- + -
-
-

{{ $t("webhookJsonDesc", ['"application/json"']) }}

-
-
- - - - -
-
- - - - - -
-
+
{{ $t("webhookJsonDesc", ['"application/json"']) }}
+ + + + +
@@ -67,15 +54,14 @@
-
- -
+
{{ $t("webhookAdditionalHeadersDesc") }}
@@ -90,18 +76,18 @@ export default { computed: { headersPlaceholder() { return this.$t("Example:", [ - ` -{ +`{ "Authorization": "Authorization Token" }`, ]); }, customBodyPlaceholder() { - return `Example: -{ - "Title": "Uptime Kuma Alert - {{ monitorJSON['name'] }}", + return this.$t("Example:", [ +`{ + "Title": "Uptime Kuma Alert{% if monitorJSON %} - {{ monitorJSON['name'] }}{% endif %}", "Body": "{{ msg }}" -}`; +}` + ]); } }, }; diff --git a/src/lang/en.json b/src/lang/en.json index e1b390fa8..90d6de278 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -213,7 +213,12 @@ "Content Type": "Content Type", "webhookJsonDesc": "{0} is good for any modern HTTP servers such as Express.js", "webhookFormDataDesc": "{multipart} is good for PHP. The JSON will need to be parsed with {decodeFunction}", - "webhookCustomBodyDesc": "Define a custom HTTP Body for the request. Template variables {msg}, {heartbeat}, {monitor} are accepted.", + "liquidIntroduction": "Templatability is achieved via the Liquid templating language. Please refer to the {0} for usage instructions. These are the available variables:", + "templateMsg": "message of the notification", + "templateHeartbeatJSON": "object describing the heartbeat", + "templateMonitorJSON": "object describing the monitor", + "templateLimitedToUpDownCertNotifications": "only available for UP/DOWN/Certificate expiry notifications", + "templateLimitedToUpDownNotifications": "only available for UP/DOWN notifications", "webhookAdditionalHeadersTitle": "Additional Headers", "webhookAdditionalHeadersDesc": "Sets additional headers sent with the webhook. Each header should be defined as a JSON key/value.", "webhookBodyPresetOption": "Preset - {0}",