mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-22 05:55:16 -05:00
Fix require-v-for-key
, remove unused declarations and double spaces
This commit is contained in:
parent
78f5d2cd8b
commit
d94894b7e0
@ -3,8 +3,6 @@ const utc = require('dayjs/plugin/utc')
|
|||||||
var timezone = require('dayjs/plugin/timezone')
|
var timezone = require('dayjs/plugin/timezone')
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
dayjs.extend(timezone)
|
dayjs.extend(timezone)
|
||||||
const axios = require("axios");
|
|
||||||
const {R} = require("redbean-node");
|
|
||||||
const {BeanModel} = require("redbean-node/dist/bean-model");
|
const {BeanModel} = require("redbean-node/dist/bean-model");
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class Notification {
|
|||||||
finalData = data;
|
finalData = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
let res = await axios.post(notification.webhookURL, finalData, config)
|
await axios.post(notification.webhookURL, finalData, config)
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
@ -102,7 +102,8 @@ class Notification {
|
|||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
let res = await axios.post(notification.discordWebhookUrl, data)
|
|
||||||
|
await axios.post(notification.discordWebhookUrl, data)
|
||||||
return true;
|
return true;
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
@ -118,7 +119,7 @@ class Notification {
|
|||||||
};
|
};
|
||||||
let config = {};
|
let config = {};
|
||||||
|
|
||||||
let res = await axios.post(notification.signalURL, data, config)
|
await axios.post(notification.signalURL, data, config)
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
@ -129,7 +130,7 @@ class Notification {
|
|||||||
try {
|
try {
|
||||||
if (heartbeatJSON == null) {
|
if (heartbeatJSON == null) {
|
||||||
let data = {'text': "Uptime Kuma Slack testing successful."}
|
let data = {'text': "Uptime Kuma Slack testing successful."}
|
||||||
let res = await axios.post(notification.slackwebhookURL, data)
|
await axios.post(notification.slackwebhookURL, data)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +171,7 @@ class Notification {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
let res = await axios.post(notification.slackwebhookURL, data)
|
await axios.post(notification.slackwebhookURL, data)
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
@ -231,7 +232,7 @@ class Notification {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// send mail with defined transport object
|
// send mail with defined transport object
|
||||||
let info = await transporter.sendMail({
|
await transporter.sendMail({
|
||||||
from: `"Uptime Kuma" <${notification.smtpFrom}>`,
|
from: `"Uptime Kuma" <${notification.smtpFrom}>`,
|
||||||
to: notification.smtpTo,
|
to: notification.smtpTo,
|
||||||
subject: msg,
|
subject: msg,
|
||||||
|
@ -162,10 +162,6 @@ let needSetup = false;
|
|||||||
msg: e.message
|
msg: e.message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Auth Only API
|
// Auth Only API
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import relativeTime from "dayjs/plugin/relativeTime"
|
import relativeTime from "dayjs/plugin/relativeTime"
|
||||||
import utc from 'dayjs/plugin/utc'
|
import utc from 'dayjs/plugin/utc'
|
||||||
import timezone from 'dayjs/plugin/timezone' // dependent on utc plugin
|
import timezone from 'dayjs/plugin/timezone' // dependent on utc plugin
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
dayjs.extend(timezone)
|
dayjs.extend(timezone)
|
||||||
dayjs.extend(relativeTime)
|
dayjs.extend(relativeTime)
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="type" class="form-label">Notification Type</label>
|
<label for="type" class="form-label">Notification Type</label>
|
||||||
<select class="form-select" id="type" v-model="notification.type">
|
<select class="form-select" id="type" v-model="notification.type">
|
||||||
<option value="telegram">Telegram</option>
|
<option value="telegram">Telegram</option>
|
||||||
<option value="webhook">Webhook</option>
|
<option value="webhook">Webhook</option>
|
||||||
<option value="smtp">Email (SMTP)</option>
|
<option value="smtp">Email (SMTP)</option>
|
||||||
@ -67,13 +67,13 @@
|
|||||||
<template v-if="notification.type === 'webhook'">
|
<template v-if="notification.type === 'webhook'">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="webhook-url" class="form-label">Post URL</label>
|
<label for="webhook-url" class="form-label">Post URL</label>
|
||||||
<input type="url" pattern="https?://.+" class="form-control" id="webhook-url" required v-model="notification.webhookURL">
|
<input type="url" pattern="https?://.+" class="form-control" id="webhook-url" required v-model="notification.webhookURL">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="webhook-content-type" class="form-label">Content Type</label>
|
<label for="webhook-content-type" class="form-label">Content Type</label>
|
||||||
<select class="form-select" id="webhook-content-type" v-model="notification.webhookContentType" required>
|
<select class="form-select" id="webhook-content-type" v-model="notification.webhookContentType" required>
|
||||||
<option value="json">application/json</option>
|
<option value="json">application/json</option>
|
||||||
<option value="form-data">multipart/form-data</option>
|
<option value="form-data">multipart/form-data</option>
|
||||||
</select>
|
</select>
|
||||||
@ -98,7 +98,7 @@
|
|||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="checkbox" value="" id="secure" v-model="notification.smtpSecure">
|
<input class="form-check-input" type="checkbox" value="" id="secure" v-model="notification.smtpSecure">
|
||||||
<label class="form-check-label" for="secure">
|
<label class="form-check-label" for="secure">
|
||||||
Secure
|
Secure
|
||||||
</label>
|
</label>
|
||||||
@ -139,7 +139,7 @@
|
|||||||
<template v-if="notification.type === 'signal'">
|
<template v-if="notification.type === 'signal'">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="signal-url" class="form-label">Post URL</label>
|
<label for="signal-url" class="form-label">Post URL</label>
|
||||||
<input type="url" pattern="https?://.+" class="form-control" id="signal-url" required v-model="notification.signalURL">
|
<input type="url" pattern="https?://.+" class="form-control" id="signal-url" required v-model="notification.signalURL">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
No Monitors, please <router-link to="/add">add one</router-link>.
|
No Monitors, please <router-link to="/add">add one</router-link>.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<router-link :to="monitorURL(item.id)" class="item" :class="{ 'disabled': ! item.active }" v-for="item in sortedMonitorList" @click="$root.cancelActiveList">
|
<router-link :to="monitorURL(item.id)" class="item" :class="{ 'disabled': ! item.active }" v-for="(item, index) in sortedMonitorList" @click="$root.cancelActiveList" :key="index">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6 col-md-8 small-padding">
|
<div class="col-6 col-md-8 small-padding">
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<div class="functions">
|
<div class="functions">
|
||||||
<button class="btn btn-light" @click="pauseDialog" v-if="monitor.active">Pause</button>
|
<button class="btn btn-light" @click="pauseDialog" v-if="monitor.active">Pause</button>
|
||||||
<button class="btn btn-primary" @click="resumeMonitor" v-if="! monitor.active">Resume</button>
|
<button class="btn btn-primary" @click="resumeMonitor" v-if="! monitor.active">Resume</button>
|
||||||
<router-link :to=" '/edit/' + monitor.id " class="btn btn-secondary">Edit</router-link>
|
<router-link :to=" '/edit/' + monitor.id " class="btn btn-secondary">Edit</router-link>
|
||||||
<button class="btn btn-danger" @click="deleteDialog">Delete</button>
|
<button class="btn btn-danger" @click="deleteDialog">Delete</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
<h2>Notifications</h2>
|
<h2>Notifications</h2>
|
||||||
<p v-if="$root.notificationList.length === 0">Not available, please setup.</p>
|
<p v-if="$root.notificationList.length === 0">Not available, please setup.</p>
|
||||||
|
|
||||||
<div class="form-check form-switch mb-3" v-for="notification in $root.notificationList">
|
<div class="form-check form-switch mb-3" v-for="(notification, index) in $root.notificationList" :key="index">
|
||||||
<input class="form-check-input" type="checkbox" :id=" 'notification' + notification.id" v-model="monitor.notificationIDList[notification.id]">
|
<input class="form-check-input" type="checkbox" :id=" 'notification' + notification.id" v-model="monitor.notificationIDList[notification.id]">
|
||||||
|
|
||||||
<label class="form-check-label" :for=" 'notification' + notification.id">
|
<label class="form-check-label" :for=" 'notification' + notification.id">
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<label for="timezone" class="form-label">Timezone</label>
|
<label for="timezone" class="form-label">Timezone</label>
|
||||||
<select class="form-select" id="timezone" v-model="$root.userTimezone">
|
<select class="form-select" id="timezone" v-model="$root.userTimezone">
|
||||||
<option value="auto">Auto: {{ guessTimezone }}</option>
|
<option value="auto">Auto: {{ guessTimezone }}</option>
|
||||||
<option v-for="timezone in timezoneList" :value="timezone.value">{{ timezone.name }}</option>
|
<option v-for="(timezone, index) in timezoneList" :value="timezone.value" :key="index">{{ timezone.name }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -59,7 +59,7 @@
|
|||||||
<p v-else>Please assign the notification to monitor(s) to get it works.</p>
|
<p v-else>Please assign the notification to monitor(s) to get it works.</p>
|
||||||
|
|
||||||
<ul class="list-group mb-3" style="border-radius: 1rem;">
|
<ul class="list-group mb-3" style="border-radius: 1rem;">
|
||||||
<li class="list-group-item" v-for="notification in $root.notificationList">
|
<li class="list-group-item" v-for="(notification, index) in $root.notificationList" :key="index">
|
||||||
{{ notification.name }}<br />
|
{{ notification.name }}<br />
|
||||||
<a href="#" @click="$refs.notificationDialog.show(notification.id)">Edit</a>
|
<a href="#" @click="$refs.notificationDialog.show(notification.id)">Edit</a>
|
||||||
</li>
|
</li>
|
||||||
@ -77,8 +77,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import utc from 'dayjs/plugin/utc'
|
import utc from 'dayjs/plugin/utc'
|
||||||
import timezone from 'dayjs/plugin/timezone'
|
import timezone from 'dayjs/plugin/timezone'
|
||||||
import NotificationDialog from "../components/NotificationDialog.vue";
|
import NotificationDialog from "../components/NotificationDialog.vue";
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
dayjs.extend(timezone)
|
dayjs.extend(timezone)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import utc from 'dayjs/plugin/utc'
|
import utc from 'dayjs/plugin/utc'
|
||||||
import timezone from 'dayjs/plugin/timezone'
|
import timezone from 'dayjs/plugin/timezone'
|
||||||
|
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
dayjs.extend(timezone)
|
dayjs.extend(timezone)
|
||||||
@ -29,6 +29,7 @@ function getTimezoneOffset(timeZone) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// From: https://stackoverflow.com/questions/38399465/how-to-get-list-of-all-timezones-in-javascript
|
// From: https://stackoverflow.com/questions/38399465/how-to-get-list-of-all-timezones-in-javascript
|
||||||
|
// TODO: Move to separate file
|
||||||
const aryIannaTimeZones = [
|
const aryIannaTimeZones = [
|
||||||
'Europe/Andorra',
|
'Europe/Andorra',
|
||||||
'Asia/Dubai',
|
'Asia/Dubai',
|
||||||
@ -412,4 +413,3 @@ export function timezoneList() {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user