|
|
@ -1,7 +1,7 @@
|
|
|
|
const NotificationProvider = require("./notification-provider");
|
|
|
|
const NotificationProvider = require("./notification-provider");
|
|
|
|
const axios = require("axios");
|
|
|
|
const axios = require("axios");
|
|
|
|
const { setSettings, setting } = require("../util-server");
|
|
|
|
const { setSettings, setting } = require("../util-server");
|
|
|
|
const { getMonitorRelativeURL, UP } = require("../../src/util");
|
|
|
|
const { getMonitorRelativeURL, UP, log } = require("../../src/util");
|
|
|
|
|
|
|
|
|
|
|
|
class Slack extends NotificationProvider {
|
|
|
|
class Slack extends NotificationProvider {
|
|
|
|
name = "slack";
|
|
|
|
name = "slack";
|
|
|
@ -50,6 +50,7 @@ class Slack extends NotificationProvider {
|
|
|
|
|
|
|
|
|
|
|
|
const address = this.extractAddress(monitorJSON);
|
|
|
|
const address = this.extractAddress(monitorJSON);
|
|
|
|
if (address) {
|
|
|
|
if (address) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
actions.push({
|
|
|
|
actions.push({
|
|
|
|
"type": "button",
|
|
|
|
"type": "button",
|
|
|
|
"text": {
|
|
|
|
"text": {
|
|
|
@ -57,8 +58,12 @@ class Slack extends NotificationProvider {
|
|
|
|
"text": "Visit site",
|
|
|
|
"text": "Visit site",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"value": "Site",
|
|
|
|
"value": "Site",
|
|
|
|
"url": address,
|
|
|
|
"url": new URL(address),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
log.debug("slack", `Failed to parse address ${address} as URL`);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return actions;
|
|
|
|
return actions;
|
|
|
|