mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 16:54:04 +00:00
Merge pull request #61 from NiNiyas/slack-enhancements
Slack Enhancements and aligns footer to center
This commit is contained in:
commit
6f3ea21864
3 changed files with 39 additions and 18 deletions
|
@ -128,13 +128,17 @@ class Notification {
|
||||||
} else if (notification.type === "slack") {
|
} else if (notification.type === "slack") {
|
||||||
try {
|
try {
|
||||||
if (heartbeatJSON == null) {
|
if (heartbeatJSON == null) {
|
||||||
let data = {'text': "Uptime Kuma Slack testing successful."}
|
let data = {'text': "Uptime Kuma Slack testing successful.", 'channel': notification.slackchannel, 'username': notification.slackusername, 'icon_emoji': notification.slackiconemo}
|
||||||
let res = await axios.post(notification.slackwebhookURL, data)
|
let res = await axios.post(notification.slackwebhookURL, data)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const time = heartbeatJSON["time"];
|
const time = heartbeatJSON["time"];
|
||||||
let data = {
|
let data = {
|
||||||
|
"text": "Uptime Kuma Alert",
|
||||||
|
"channel":notification.slackchannel,
|
||||||
|
"username": notification.slackusername,
|
||||||
|
"icon_emoji": notification.slackiconemo,
|
||||||
"blocks": [{
|
"blocks": [{
|
||||||
"type": "header",
|
"type": "header",
|
||||||
"text": {
|
"text": {
|
||||||
|
@ -155,17 +159,17 @@ class Notification {
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "actions",
|
"type": "actions",
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
||||||
"type": "button",
|
"type": "button",
|
||||||
"text": {
|
"text": {
|
||||||
"type": "plain_text",
|
"type": "plain_text",
|
||||||
"text": "Visit Uptime Kuma",
|
"text": "Visit Uptime Kuma",
|
||||||
},
|
},
|
||||||
"value": "Uptime-Kuma",
|
"value": "Uptime-Kuma",
|
||||||
"url": notification.slackbutton
|
"url": notification.slackbutton || "https://github.com/louislam/uptime-kuma"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -192,15 +192,31 @@
|
||||||
|
|
||||||
<template v-if="notification.type === 'slack'">
|
<template v-if="notification.type === 'slack'">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="slack-webhook-url" class="form-label">Slack Webhook URL</label>
|
<label for="slack-webhook-url" class="form-label">Webhook URL<span style="color:red;"><sup>*</sup></span></label>
|
||||||
<input type="text" class="form-control" id="slack-webhook-url" required v-model="notification.slackwebhookURL" autocomplete="false">
|
<input type="text" class="form-control" id="slack-webhook-url" required v-model="notification.slackwebhookURL">
|
||||||
<label for="gotify-server-url" class="form-label">Uptime Kuma URL</label>
|
<label for="slack-username" class="form-label">Username</label>
|
||||||
<div class="input-group mb-3">
|
<input type="text" class="form-control" id="slack-username" v-model="notification.slackusername">
|
||||||
<input type="text" class="form-control" id="slack-button" required v-model="notification.slackbutton" autocomplete="false">
|
<label for="slack-iconemo" class="form-label">Icon Emoji</label>
|
||||||
</div>
|
<input type="text" class="form-control" id="slack-iconemo" v-model="notification.slackiconemo">
|
||||||
<p style="margin-top: 8px;">
|
<label for="slack-channel" class="form-label">Channel Name</label>
|
||||||
More info on: <a href="https://api.slack.com/messaging/webhooks" target="_blank">https://api.slack.com/messaging/webhooks</a>
|
<input type="text" class="form-control" id="slack-channel-name" v-model="notification.slackchannel">
|
||||||
</p>
|
<label for="slack-button-url" class="form-label">Uptime Kuma URL</label>
|
||||||
|
<input type="text" class="form-control" id="slack-button" v-model="notification.slackbutton">
|
||||||
|
<div class="form-text">
|
||||||
|
<span style="color:red;"><sup>*</sup></span>Required
|
||||||
|
<p style="margin-top: 8px;">
|
||||||
|
More info about webhooks on: <a href="https://api.slack.com/messaging/webhooks" target="_blank">https://api.slack.com/messaging/webhooks</a>
|
||||||
|
</p>
|
||||||
|
<p style="margin-top: 8px;">
|
||||||
|
Enter the channel name on Slack Channel Name field if you want to bypass the webhook channel. Ex: #other-channel
|
||||||
|
</p>
|
||||||
|
<p style="margin-top: 8px;">
|
||||||
|
If you leave the Uptime Kuma URL field blank, it will default to the Project Github page.
|
||||||
|
</p>
|
||||||
|
<p style="margin-top: 8px;">
|
||||||
|
Emoji cheat sheet: <a href="https://www.webfx.com/tools/emoji-cheat-sheet/" target="_blank">https://www.webfx.com/tools/emoji-cheat-sheet/</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,7 @@ footer {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue