commit
1e2a8453c6
@ -1,22 +0,0 @@
|
|||||||
name: 'Automatically close stale issues and PRs'
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 0 * * *'
|
|
||||||
#Run once a day at midnight
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
stale:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/stale@v4
|
|
||||||
with:
|
|
||||||
stale-issue-message: 'We are clearing up our old issues and your ticket has been open for 6 months with no activity. Remove stale label or comment or this will be closed in 7 days.'
|
|
||||||
stale-pr-message: 'We are clearing up our old Pull Requests and yours has been open for 6 months with no activity. Remove stale label or comment or this will be closed in 7 days.'
|
|
||||||
close-issue-message: 'This issue was closed because it has been stalled for 7 days with no activity.'
|
|
||||||
close-pr-message: 'This PR was closed because it has been stalled for 7 days with no activity.'
|
|
||||||
days-before-stale: 180
|
|
||||||
days-before-close: 0
|
|
||||||
exempt-issue-labels: 'News,Medium,High,discussion,bug,doc,'
|
|
||||||
exempt-pr-labels: 'awaiting-approval,work-in-progress,enhancement,feature-request'
|
|
||||||
exempt-issue-assignees: 'louislam'
|
|
||||||
exempt-pr-assignees: 'louislam'
|
|
@ -0,0 +1,67 @@
|
|||||||
|
const NotificationProvider = require("./notification-provider");
|
||||||
|
const { DOWN, UP } = require("../../src/util");
|
||||||
|
const axios = require("axios");
|
||||||
|
|
||||||
|
class Alerta extends NotificationProvider {
|
||||||
|
|
||||||
|
name = "alerta";
|
||||||
|
|
||||||
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||||
|
let okMsg = "Sent Successfully.";
|
||||||
|
|
||||||
|
try {
|
||||||
|
let alertaUrl = `${notification.alertaApiEndpoint}`;
|
||||||
|
let config = {
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json;charset=UTF-8",
|
||||||
|
"Authorization": "Key " + notification.alertaapiKey,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let data = {
|
||||||
|
environment: notification.alertaEnvironment,
|
||||||
|
severity: "critical",
|
||||||
|
correlate: [],
|
||||||
|
service: [ "UptimeKuma" ],
|
||||||
|
value: "Timeout",
|
||||||
|
tags: [ "uptimekuma" ],
|
||||||
|
attributes: {},
|
||||||
|
origin: "uptimekuma",
|
||||||
|
type: "exceptionAlert",
|
||||||
|
};
|
||||||
|
|
||||||
|
if (heartbeatJSON == null) {
|
||||||
|
let postData = Object.assign({
|
||||||
|
event: "msg",
|
||||||
|
text: msg,
|
||||||
|
group: "uptimekuma-msg",
|
||||||
|
resource: "Message",
|
||||||
|
}, data);
|
||||||
|
|
||||||
|
await axios.post(alertaUrl, postData, config);
|
||||||
|
} else {
|
||||||
|
let datadup = Object.assign( {
|
||||||
|
correlate: ["service_up", "service_down"],
|
||||||
|
event: monitorJSON["type"],
|
||||||
|
group: "uptimekuma-" + monitorJSON["type"],
|
||||||
|
resource: monitorJSON["name"],
|
||||||
|
}, data );
|
||||||
|
|
||||||
|
if (heartbeatJSON["status"] == DOWN) {
|
||||||
|
datadup.severity = notification.alertaAlertState; // critical
|
||||||
|
datadup.text = "Service " + monitorJSON["type"] + " is down.";
|
||||||
|
await axios.post(alertaUrl, datadup, config);
|
||||||
|
} else if (heartbeatJSON["status"] == UP) {
|
||||||
|
datadup.severity = notification.alertaRecoverState; // cleaned
|
||||||
|
datadup.text = "Service " + monitorJSON["type"] + " is up.";
|
||||||
|
await axios.post(alertaUrl, datadup, config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return okMsg;
|
||||||
|
} catch (error) {
|
||||||
|
this.throwGeneralAxiosError(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Alerta;
|
@ -0,0 +1,42 @@
|
|||||||
|
const NotificationProvider = require("./notification-provider");
|
||||||
|
const axios = require("axios");
|
||||||
|
|
||||||
|
class Gorush extends NotificationProvider {
|
||||||
|
|
||||||
|
name = "gorush";
|
||||||
|
|
||||||
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||||
|
let okMsg = "Sent Successfully.";
|
||||||
|
|
||||||
|
let platformMapping = {
|
||||||
|
"ios": 1,
|
||||||
|
"android": 2,
|
||||||
|
"huawei": 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
let data = {
|
||||||
|
"notifications": [
|
||||||
|
{
|
||||||
|
"tokens": [notification.gorushDeviceToken],
|
||||||
|
"platform": platformMapping[notification.gorushPlatform],
|
||||||
|
"message": msg,
|
||||||
|
// Optional
|
||||||
|
"title": notification.gorushTitle,
|
||||||
|
"priority": notification.gorushPriority,
|
||||||
|
"retry": parseInt(notification.gorushRetry) || 0,
|
||||||
|
"topic": notification.gorushTopic,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
let config = {};
|
||||||
|
|
||||||
|
await axios.post(`${notification.gorushServerURL}/api/push`, data, config);
|
||||||
|
return okMsg;
|
||||||
|
} catch (error) {
|
||||||
|
this.throwGeneralAxiosError(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Gorush;
|
@ -0,0 +1,23 @@
|
|||||||
|
const NotificationProvider = require("./notification-provider");
|
||||||
|
const axios = require("axios");
|
||||||
|
|
||||||
|
class TechulusPush extends NotificationProvider {
|
||||||
|
|
||||||
|
name = "PushByTechulus";
|
||||||
|
|
||||||
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||||
|
let okMsg = "Sent Successfully.";
|
||||||
|
|
||||||
|
try {
|
||||||
|
await axios.post(`https://push.techulus.com/api/v1/notify/${notification.pushAPIKey}`, {
|
||||||
|
"title": "Uptime-Kuma",
|
||||||
|
"body": msg,
|
||||||
|
})
|
||||||
|
return okMsg;
|
||||||
|
} catch (error) {
|
||||||
|
this.throwGeneralAxiosError(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = TechulusPush;
|
@ -0,0 +1,14 @@
|
|||||||
|
<template>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="alerta-api-endpoint" class="form-label">{{ $t("alertaApiEndpoint") }}</label>
|
||||||
|
<input id="alerta-api-endpoint" v-model="$parent.notification.alertaApiEndpoint" type="text" class="form-control" required>
|
||||||
|
<label for="alerta-environment" class="form-label">{{ $t("alertaEnvironment") }}</label>
|
||||||
|
<input id="alerta-environment" v-model="$parent.notification.alertaEnvironment" type="text" class="form-control" required>
|
||||||
|
<label for="alerta-api-key" class="form-label">{{ $t("alertaApiKey") }}</label>
|
||||||
|
<input id="alerta-api-key" v-model="$parent.notification.alertaApiKey" type="text" class="form-control" required>
|
||||||
|
<label for="alerta-alert-state" class="form-label">{{ $t("alertaAlertState") }}</label>
|
||||||
|
<input id="alerta-alert-state" v-model="$parent.notification.alertaAlertState" type="text" class="form-control" placeholder="critical" required>
|
||||||
|
<label for="alerta-recover-state" class="form-label">{{ $t("alertaRecoverState") }}</label>
|
||||||
|
<input id="alerta-recover-state" v-model="$parent.notification.alertaRecoverState" type="text" class="form-control" placeholder="cleared" required>
|
||||||
|
</div>
|
||||||
|
</template>
|
@ -0,0 +1,51 @@
|
|||||||
|
<template>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="gorush-device-token" class="form-label">{{ $t("Device Token") }}</label><span style="color: red;"><sup>*</sup></span>
|
||||||
|
<div class="input-group mb-3">
|
||||||
|
<input id="gorush-device-token" v-model="$parent.notification.gorushDeviceToken" type="text" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="gorush-server-url" class="form-label">{{ $t("Server URL") }}</label><span style="color: red;"><sup>*</sup></span>
|
||||||
|
<div class="input-group mb-3">
|
||||||
|
<input id="gorush-server-url" v-model="$parent.notification.gorushServerURL" type="text" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="gorush-platform" class="form-label">{{ $t("Platform") }}</label><span style="color: red;"><sup>*</sup></span>
|
||||||
|
<select id="gorush-platform" v-model="$parent.notification.gorushPlatform" class="form-select">
|
||||||
|
<option value="ios">{{ $t("iOS") }}</option>
|
||||||
|
<option value="android">{{ $t("Android") }}</option>
|
||||||
|
<option value="huawei">{{ $t("Huawei") }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="gorush-title" class="form-label">{{ $t("Title") }}</label>
|
||||||
|
<input id="gorush-title" v-model="$parent.notification.gorushTitle" type="text" class="form-control">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="gorush-priority" class="form-label">{{ $t("Priority") }}</label>
|
||||||
|
<select id="gorush-priority" v-model="$parent.notification.gorushPriority" class="form-select">
|
||||||
|
<option value="normal">{{ $t("Normal") }}</option>
|
||||||
|
<option value="high">{{ $t("High") }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="gorush-retry" class="form-label">{{ $t("Retry") }}</label>
|
||||||
|
<input id="gorush-retry" v-model="$parent.notification.gorushRetry" type="number" class="form-control">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="gorush-topic" class="form-label">{{ $t("Topic") }}</label>
|
||||||
|
<input id="gorush-topic" v-model="$parent.notification.gorushTopic" type="text" class="form-control">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-text">
|
||||||
|
<span style="color: red;"><sup>*</sup></span>{{ $t("Required") }}
|
||||||
|
</div>
|
||||||
|
</template>
|
@ -0,0 +1,20 @@
|
|||||||
|
<template>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="push-api-key" class="form-label">API_KEY</label>
|
||||||
|
<HiddenInput id="push-api-key" v-model="$parent.notification.pushAPIKey" :required="true" autocomplete="one-time-code"></HiddenInput>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<i18n-t tag="p" keypath="More info on:" style="margin-top: 8px;">
|
||||||
|
<a href="https://docs.push.techulus.com" target="_blank">https://docs.push.techulus.com</a>
|
||||||
|
</i18n-t>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import HiddenInput from "../HiddenInput.vue";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
HiddenInput,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
Reference in new issue