mirror of
https://github.com/koichixD/uptime-kuma.git
synced 2026-09-03 17:00:44 +00:00
feat(ntfy): add custom title and message templates for notifications (#6804)
Co-authored-by: epifeny <epifeny@users.noreply.github.com> Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
co-authored by
epifeny
Frank Elsinga
parent
bad679ee47
commit
f5578da027
@@ -102,14 +102,59 @@
|
||||
{{ $t("ntfyCallHelptext") }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-switch">
|
||||
<input
|
||||
id="ntfy-use-template"
|
||||
v-model="$parent.notification.ntfyUseTemplate"
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
/>
|
||||
<label class="form-check-label" for="ntfy-use-template">
|
||||
{{ $t("ntfyUseTemplate") }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-text">
|
||||
{{ $t("ntfyUseTemplateDescription") }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-show="$parent.notification.ntfyUseTemplate">
|
||||
<div class="mb-3">
|
||||
<label for="ntfy-title" class="form-label">{{ $t("ntfyCustomTitle") }}</label>
|
||||
<TemplatedInput
|
||||
id="ntfy-title"
|
||||
v-model="$parent.notification.ntfyCustomTitle"
|
||||
:required="false"
|
||||
placeholder=""
|
||||
></TemplatedInput>
|
||||
<div class="form-text">{{ $t("ntfyNotificationTemplateFallback") }}</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="ntfy-message" class="form-label">{{ $t("ntfyCustomMessage") }}</label>
|
||||
<TemplatedTextarea
|
||||
id="ntfy-message"
|
||||
v-model="$parent.notification.ntfyCustomMessage"
|
||||
:required="false"
|
||||
placeholder=""
|
||||
></TemplatedTextarea>
|
||||
<div class="form-text">{{ $t("ntfyNotificationTemplateFallback") }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HiddenInput from "../HiddenInput.vue";
|
||||
import TemplatedInput from "../TemplatedInput.vue";
|
||||
import TemplatedTextarea from "../TemplatedTextarea.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
HiddenInput,
|
||||
TemplatedInput,
|
||||
TemplatedTextarea,
|
||||
},
|
||||
computed: {
|
||||
authenticationMethods() {
|
||||
@@ -139,6 +184,13 @@ export default {
|
||||
this.$parent.notification.ntfyAuthenticationMethod = "usernamePassword";
|
||||
}
|
||||
}
|
||||
|
||||
// Auto-enable template checkbox if either field has content
|
||||
if (typeof this.$parent.notification.ntfyUseTemplate === "undefined") {
|
||||
const hasTitle = !!this.$parent.notification.ntfyCustomTitle?.trim();
|
||||
const hasMessage = !!this.$parent.notification.ntfyCustomMessage?.trim();
|
||||
this.$parent.notification.ntfyUseTemplate = hasTitle || hasMessage;
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user