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