Add disable url option in notification Discord (#5817)

Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
Cyril59310 2025-05-06 01:33:49 +02:00 committed by GitHub
parent 32d92eccfa
commit 76c382f229
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 5 deletions

View file

@ -46,10 +46,10 @@ class Discord extends NotificationProvider {
name: "Service Name", name: "Service Name",
value: monitorJSON["name"], value: monitorJSON["name"],
}, },
{ ...(!notification.disableUrl ? [{
name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL", name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL",
value: this.extractAddress(monitorJSON), value: this.extractAddress(monitorJSON),
}, }] : []),
{ {
name: `Time (${heartbeatJSON["timezone"]})`, name: `Time (${heartbeatJSON["timezone"]})`,
value: heartbeatJSON["localDateTime"], value: heartbeatJSON["localDateTime"],
@ -83,10 +83,10 @@ class Discord extends NotificationProvider {
name: "Service Name", name: "Service Name",
value: monitorJSON["name"], value: monitorJSON["name"],
}, },
{ ...(!notification.disableUrl ? [{
name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL", name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL",
value: this.extractAddress(monitorJSON), value: this.extractAddress(monitorJSON),
}, }] : []),
{ {
name: `Time (${heartbeatJSON["timezone"]})`, name: `Time (${heartbeatJSON["timezone"]})`,
value: heartbeatJSON["localDateTime"], value: heartbeatJSON["localDateTime"],

View file

@ -53,6 +53,13 @@
</div> </div>
</div> </div>
</div> </div>
<div class="mb-3">
<div class="form-check form-switch">
<input id="discord-disable-url" v-model="$parent.notification.disableUrl" class="form-check-input" type="checkbox" role="switch">
<label class="form-check-label" for="discord-disable-url">{{ $t("Disable URL in Notification") }}</label>
</div>
</div>
</template> </template>
<script> <script>
export default { export default {
@ -60,6 +67,9 @@ export default {
if (!this.$parent.notification.discordChannelType) { if (!this.$parent.notification.discordChannelType) {
this.$parent.notification.discordChannelType = "channel"; this.$parent.notification.discordChannelType = "channel";
} }
if (this.$parent.notification.disableUrl === undefined) {
this.$parent.notification.disableUrl = false;
}
} }
}; };
</script> </script>

View file

@ -1093,5 +1093,6 @@
"the smsplanet documentation": "the smsplanet documentation", "the smsplanet documentation": "the smsplanet documentation",
"Phone numbers": "Phone numbers", "Phone numbers": "Phone numbers",
"Sender name": "Sender name", "Sender name": "Sender name",
"smsplanetNeedToApproveName": "Needs to be approved in the client panel" "smsplanetNeedToApproveName": "Needs to be approved in the client panel",
"Disable URL in Notification": "Disable URL in Notification"
} }