Merge branch 'master' into mark-as-draft
This commit is contained in:
commit
8a68dbf940
@ -11,6 +11,11 @@ class Discord extends NotificationProvider {
|
|||||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||||
const okMsg = "Sent Successfully.";
|
const okMsg = "Sent Successfully.";
|
||||||
|
|
||||||
|
// Discord Message Flags
|
||||||
|
// @see https://discord.com/developers/docs/resources/message#message-object-message-flags
|
||||||
|
// This message will not trigger push and desktop notifications
|
||||||
|
const SUPPRESS_NOTIFICATIONS_FLAG = 1 << 12;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let config = this.getAxiosConfigWithProxy({});
|
let config = this.getAxiosConfigWithProxy({});
|
||||||
const discordDisplayName = notification.discordUsername || "Uptime Kuma";
|
const discordDisplayName = notification.discordUsername || "Uptime Kuma";
|
||||||
@ -41,6 +46,9 @@ class Discord extends NotificationProvider {
|
|||||||
if (notification.discordChannelType === "createNewForumPost") {
|
if (notification.discordChannelType === "createNewForumPost") {
|
||||||
discordtestdata.thread_name = notification.postName;
|
discordtestdata.thread_name = notification.postName;
|
||||||
}
|
}
|
||||||
|
if (notification.discordSuppressNotifications) {
|
||||||
|
discordtestdata.flags = SUPPRESS_NOTIFICATIONS_FLAG;
|
||||||
|
}
|
||||||
await axios.post(webhookUrl.toString(), discordtestdata, config);
|
await axios.post(webhookUrl.toString(), discordtestdata, config);
|
||||||
return okMsg;
|
return okMsg;
|
||||||
}
|
}
|
||||||
@ -89,6 +97,9 @@ class Discord extends NotificationProvider {
|
|||||||
if (notification.discordPrefixMessage) {
|
if (notification.discordPrefixMessage) {
|
||||||
discorddowndata.content = notification.discordPrefixMessage;
|
discorddowndata.content = notification.discordPrefixMessage;
|
||||||
}
|
}
|
||||||
|
if (notification.discordSuppressNotifications) {
|
||||||
|
discorddowndata.flags = SUPPRESS_NOTIFICATIONS_FLAG;
|
||||||
|
}
|
||||||
|
|
||||||
await axios.post(webhookUrl.toString(), discorddowndata, config);
|
await axios.post(webhookUrl.toString(), discorddowndata, config);
|
||||||
return okMsg;
|
return okMsg;
|
||||||
@ -140,6 +151,9 @@ class Discord extends NotificationProvider {
|
|||||||
if (notification.discordPrefixMessage) {
|
if (notification.discordPrefixMessage) {
|
||||||
discordupdata.content = notification.discordPrefixMessage;
|
discordupdata.content = notification.discordPrefixMessage;
|
||||||
}
|
}
|
||||||
|
if (notification.discordSuppressNotifications) {
|
||||||
|
discordupdata.flags = SUPPRESS_NOTIFICATIONS_FLAG;
|
||||||
|
}
|
||||||
|
|
||||||
await axios.post(webhookUrl.toString(), discordupdata, config);
|
await axios.post(webhookUrl.toString(), discordupdata, config);
|
||||||
return okMsg;
|
return okMsg;
|
||||||
|
|||||||
@ -102,6 +102,24 @@
|
|||||||
<label class="form-check-label" for="discord-disable-url">{{ $t("Disable URL in Notification") }}</label>
|
<label class="form-check-label" for="discord-disable-url">{{ $t("Disable URL in Notification") }}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input
|
||||||
|
id="discord-suppress-notifications"
|
||||||
|
v-model="$parent.notification.discordSuppressNotifications"
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
role="switch"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="discord-suppress-notifications">
|
||||||
|
{{ $t("Suppress Notifications") }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-text">
|
||||||
|
{{ $t("discordSuppressNotificationsHelptext") }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
@ -112,6 +130,9 @@ export default {
|
|||||||
if (this.$parent.notification.disableUrl === undefined) {
|
if (this.$parent.notification.disableUrl === undefined) {
|
||||||
this.$parent.notification.disableUrl = false;
|
this.$parent.notification.disableUrl = false;
|
||||||
}
|
}
|
||||||
|
if (this.$parent.notification.discordSuppressNotifications === undefined) {
|
||||||
|
this.$parent.notification.discordSuppressNotifications = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1265,6 +1265,8 @@
|
|||||||
"Matomo": "Matomo",
|
"Matomo": "Matomo",
|
||||||
"Umami": "Umami",
|
"Umami": "Umami",
|
||||||
"Disable URL in Notification": "Disable URL in Notification",
|
"Disable URL in Notification": "Disable URL in Notification",
|
||||||
|
"Suppress Notifications": "Suppress Notifications",
|
||||||
|
"discordSuppressNotificationsHelptext": "When enabled, messages will be posted to the channel but won't trigger push or desktop notifications for recipients.",
|
||||||
"Ip Family": "IP Family",
|
"Ip Family": "IP Family",
|
||||||
"ipFamilyDescriptionAutoSelect": "Uses the {happyEyeballs} for determining the IP family.",
|
"ipFamilyDescriptionAutoSelect": "Uses the {happyEyeballs} for determining the IP family.",
|
||||||
"Happy Eyeballs algorithm": "Happy Eyeballs algorithm",
|
"Happy Eyeballs algorithm": "Happy Eyeballs algorithm",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user