|
|
|
@ -13,7 +13,7 @@
|
|
|
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label for="webhook-content-type" class="form-label">{{
|
|
|
|
|
$t("Content Type")
|
|
|
|
|
$t("Request Body")
|
|
|
|
|
}}</label>
|
|
|
|
|
<select
|
|
|
|
|
id="webhook-content-type"
|
|
|
|
@ -21,52 +21,88 @@
|
|
|
|
|
class="form-select"
|
|
|
|
|
required
|
|
|
|
|
>
|
|
|
|
|
<option value="json">application/json</option>
|
|
|
|
|
<option value="form-data">multipart/form-data</option>
|
|
|
|
|
<option value="json">Preset - application/json</option>
|
|
|
|
|
<option value="form-data">Preset - multipart/form-data</option>
|
|
|
|
|
<option value="custom">Custom Body</option>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<div class="form-text">
|
|
|
|
|
<p>{{ $t("webhookJsonDesc", ['"application/json"']) }}</p>
|
|
|
|
|
<i18n-t tag="p" keypath="webhookFormDataDesc">
|
|
|
|
|
<template #multipart>"multipart/form-data"</template>
|
|
|
|
|
<template #decodeFunction>
|
|
|
|
|
<strong>json_decode($_POST['data'])</strong>
|
|
|
|
|
</template>
|
|
|
|
|
</i18n-t>
|
|
|
|
|
<div v-if="$parent.notification.webhookContentType == 'json'">
|
|
|
|
|
<p>{{ $t("webhookJsonDesc", ['"application/json"']) }}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="$parent.notification.webhookContentType == 'form-data'">
|
|
|
|
|
<i18n-t tag="p" keypath="webhookFormDataDesc">
|
|
|
|
|
<template #multipart>multipart/form-data"</template>
|
|
|
|
|
<template #decodeFunction>
|
|
|
|
|
<strong>json_decode($_POST['data'])</strong>
|
|
|
|
|
</template>
|
|
|
|
|
</i18n-t>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="$parent.notification.webhookContentType == 'custom'">
|
|
|
|
|
<i18n-t tag="p" keypath="webhookCustomBodyDesc">
|
|
|
|
|
<template #msg>
|
|
|
|
|
<code>msg</code>
|
|
|
|
|
</template>
|
|
|
|
|
<template #heartbeat>
|
|
|
|
|
<code>heartbeatJSON</code>
|
|
|
|
|
</template>
|
|
|
|
|
<template #monitor>
|
|
|
|
|
<code>monitorJSON</code>
|
|
|
|
|
</template>
|
|
|
|
|
</i18n-t>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<textarea
|
|
|
|
|
v-if="$parent.notification.webhookContentType == 'custom'"
|
|
|
|
|
id="customBody"
|
|
|
|
|
v-model="$parent.notification.webhookCustomBody"
|
|
|
|
|
class="form-control"
|
|
|
|
|
:placeholder="customBodyPlaceholder"
|
|
|
|
|
></textarea>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<i18n-t
|
|
|
|
|
tag="label"
|
|
|
|
|
class="form-label"
|
|
|
|
|
for="additionalHeaders"
|
|
|
|
|
keypath="webhookAdditionalHeadersTitle"
|
|
|
|
|
>
|
|
|
|
|
</i18n-t>
|
|
|
|
|
<div class="form-check form-switch">
|
|
|
|
|
<input v-model="showAdditionalHeadersField" class="form-check-input" type="checkbox">
|
|
|
|
|
<label class="form-check-label">{{ $t("webhookAdditionalHeadersTitle") }}</label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-text">
|
|
|
|
|
<i18n-t tag="p" keypath="webhookAdditionalHeadersDesc"> </i18n-t>
|
|
|
|
|
</div>
|
|
|
|
|
<textarea
|
|
|
|
|
v-if="showAdditionalHeadersField"
|
|
|
|
|
id="additionalHeaders"
|
|
|
|
|
v-model="$parent.notification.webhookAdditionalHeaders"
|
|
|
|
|
class="form-control"
|
|
|
|
|
:placeholder="headersPlaceholder"
|
|
|
|
|
></textarea>
|
|
|
|
|
<div class="form-text">
|
|
|
|
|
<i18n-t tag="p" keypath="webhookAdditionalHeadersDesc"> </i18n-t>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
showAdditionalHeadersField: this.$parent.notification.webhookAdditionalHeaders != null,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
headersPlaceholder() {
|
|
|
|
|
return this.$t("Example:", [
|
|
|
|
|
`
|
|
|
|
|
{
|
|
|
|
|
"HeaderName": "HeaderValue"
|
|
|
|
|
"Authorization": "Authorization Token"
|
|
|
|
|
}`,
|
|
|
|
|
]);
|
|
|
|
|
},
|
|
|
|
|
customBodyPlaceholder() {
|
|
|
|
|
return `Example:
|
|
|
|
|
{
|
|
|
|
|
"Title": "Uptime Kuma Alert - {{ monitorJSON['name'] }}",
|
|
|
|
|
"Body": "{{ msg }}"
|
|
|
|
|
}`;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|