mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-27 14:39:51 -08:00
commit
21ad715e6a
|
@ -10,6 +10,7 @@ const { UptimeKumaServer } = require("../uptime-kuma-server");
|
||||||
const { UptimeCacheList } = require("../uptime-cache-list");
|
const { UptimeCacheList } = require("../uptime-cache-list");
|
||||||
const { makeBadge } = require("badge-maker");
|
const { makeBadge } = require("badge-maker");
|
||||||
const { badgeConstants } = require("../config");
|
const { badgeConstants } = require("../config");
|
||||||
|
const { Prometheus } = require("../prometheus");
|
||||||
|
|
||||||
let router = express.Router();
|
let router = express.Router();
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ router.get("/api/push/:pushToken", async (request, response) => {
|
||||||
|
|
||||||
let pushToken = request.params.pushToken;
|
let pushToken = request.params.pushToken;
|
||||||
let msg = request.query.msg || "OK";
|
let msg = request.query.msg || "OK";
|
||||||
let ping = request.query.ping || null;
|
let ping = parseInt(request.query.ping) || null;
|
||||||
let statusString = request.query.status || "up";
|
let statusString = request.query.status || "up";
|
||||||
let status = (statusString === "up") ? UP : DOWN;
|
let status = (statusString === "up") ? UP : DOWN;
|
||||||
|
|
||||||
|
@ -89,6 +90,7 @@ router.get("/api/push/:pushToken", async (request, response) => {
|
||||||
io.to(monitor.user_id).emit("heartbeat", bean.toJSON());
|
io.to(monitor.user_id).emit("heartbeat", bean.toJSON());
|
||||||
UptimeCacheList.clearCache(monitor.id);
|
UptimeCacheList.clearCache(monitor.id);
|
||||||
Monitor.sendStats(io, monitor.id, monitor.user_id);
|
Monitor.sendStats(io, monitor.id, monitor.user_id);
|
||||||
|
new Prometheus(monitor).update(bean, undefined);
|
||||||
|
|
||||||
response.json({
|
response.json({
|
||||||
ok: true,
|
ok: true,
|
||||||
|
|
|
@ -276,7 +276,7 @@ module.exports.statusPageSocketHandler = (socket) => {
|
||||||
let statusPage = R.dispense("status_page");
|
let statusPage = R.dispense("status_page");
|
||||||
statusPage.slug = slug;
|
statusPage.slug = slug;
|
||||||
statusPage.title = title;
|
statusPage.title = title;
|
||||||
statusPage.theme = "light";
|
statusPage.theme = "auto";
|
||||||
statusPage.icon = "";
|
statusPage.icon = "";
|
||||||
await R.store(statusPage);
|
await R.store(statusPage);
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,9 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.path.startsWith("/status-page") || this.path.startsWith("/status")) {
|
if (this.path.startsWith("/status-page") || this.path.startsWith("/status")) {
|
||||||
|
if (this.statusPageTheme === "auto") {
|
||||||
|
return this.system;
|
||||||
|
}
|
||||||
return this.statusPageTheme;
|
return this.statusPageTheme;
|
||||||
} else {
|
} else {
|
||||||
if (this.userTheme === "auto") {
|
if (this.userTheme === "auto") {
|
||||||
|
|
|
@ -283,13 +283,13 @@
|
||||||
<label for="sqlConnectionString" class="form-label">{{ $t("Connection String") }}</label>
|
<label for="sqlConnectionString" class="form-label">{{ $t("Connection String") }}</label>
|
||||||
|
|
||||||
<template v-if="monitor.type === 'sqlserver'">
|
<template v-if="monitor.type === 'sqlserver'">
|
||||||
<input id="sqlConnectionString" v-model="monitor.databaseConnectionString" type="text" class="form-control" placeholder="Server=<hostname>,<port>;Database=<your database>;User Id=<your user id>;Password=<your password>;Encrypt=<true/false>;TrustServerCertificate=<Yes/No>;Connection Timeout=<int>">
|
<input id="sqlConnectionString" v-model="monitor.databaseConnectionString" type="text" class="form-control">
|
||||||
</template>
|
</template>
|
||||||
<template v-if="monitor.type === 'postgres'">
|
<template v-if="monitor.type === 'postgres'">
|
||||||
<input id="sqlConnectionString" v-model="monitor.databaseConnectionString" type="text" class="form-control" placeholder="postgres://username:password@host:port/database">
|
<input id="sqlConnectionString" v-model="monitor.databaseConnectionString" type="text" class="form-control">
|
||||||
</template>
|
</template>
|
||||||
<template v-if="monitor.type === 'mysql'">
|
<template v-if="monitor.type === 'mysql'">
|
||||||
<input id="sqlConnectionString" v-model="monitor.databaseConnectionString" type="text" class="form-control" placeholder="mysql://username:password@host:port/database">
|
<input id="sqlConnectionString" v-model="monitor.databaseConnectionString" type="text" class="form-control">
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div class="my-3">
|
<div class="my-3">
|
||||||
|
@ -301,7 +301,7 @@
|
||||||
<template v-if="monitor.type === 'redis'">
|
<template v-if="monitor.type === 'redis'">
|
||||||
<div class="my-3">
|
<div class="my-3">
|
||||||
<label for="redisConnectionString" class="form-label">{{ $t("Connection String") }}</label>
|
<label for="redisConnectionString" class="form-label">{{ $t("Connection String") }}</label>
|
||||||
<input id="redisConnectionString" v-model="monitor.databaseConnectionString" type="text" class="form-control" placeholder="redis://user:password@host:port">
|
<input id="redisConnectionString" v-model="monitor.databaseConnectionString" type="text" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@
|
||||||
<label for="sqlConnectionString" class="form-label">{{ $t("Connection String") }}</label>
|
<label for="sqlConnectionString" class="form-label">{{ $t("Connection String") }}</label>
|
||||||
|
|
||||||
<template v-if="monitor.type === 'mongodb'">
|
<template v-if="monitor.type === 'mongodb'">
|
||||||
<input id="sqlConnectionString" v-model="monitor.databaseConnectionString" type="text" class="form-control" placeholder="mongodb://username:password@host:port/database">
|
<input id="sqlConnectionString" v-model="monitor.databaseConnectionString" type="text" class="form-control">
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -692,6 +692,13 @@ export default {
|
||||||
ipOrHostnameRegexPattern: hostNameRegexPattern(),
|
ipOrHostnameRegexPattern: hostNameRegexPattern(),
|
||||||
mqttIpOrHostnameRegexPattern: hostNameRegexPattern(true),
|
mqttIpOrHostnameRegexPattern: hostNameRegexPattern(true),
|
||||||
gameList: null,
|
gameList: null,
|
||||||
|
connectionStringTemplates: {
|
||||||
|
"sqlserver": "Server=<hostname>,<port>;Database=<your database>;User Id=<your user id>;Password=<your password>;Encrypt=<true/false>;TrustServerCertificate=<Yes/No>;Connection Timeout=<int>",
|
||||||
|
"postgres": "postgres://username:password@host:port/database",
|
||||||
|
"mysql": "mysql://username:password@host:port/database",
|
||||||
|
"redis": "redis://user:password@host:port",
|
||||||
|
"mongodb": "mongodb://username:password@host:port/database",
|
||||||
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -853,6 +860,24 @@ message HealthCheckResponse {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set default database connection string if empty or it is a template from another database monitor type
|
||||||
|
for (let monitorType in this.connectionStringTemplates) {
|
||||||
|
if (this.monitor.type === monitorType) {
|
||||||
|
let isTemplate = false;
|
||||||
|
for (let key in this.connectionStringTemplates) {
|
||||||
|
if (this.monitor.databaseConnectionString === this.connectionStringTemplates[key]) {
|
||||||
|
isTemplate = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!this.monitor.databaseConnectionString || isTemplate) {
|
||||||
|
this.monitor.databaseConnectionString = this.connectionStringTemplates[monitorType];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
currentGameObject(newGameObject, previousGameObject) {
|
currentGameObject(newGameObject, previousGameObject) {
|
||||||
|
@ -860,8 +885,7 @@ message HealthCheckResponse {
|
||||||
this.monitor.port = newGameObject.options.port;
|
this.monitor.port = newGameObject.options.port;
|
||||||
}
|
}
|
||||||
this.monitor.game = newGameObject.keys[0];
|
this.monitor.game = newGameObject.keys[0];
|
||||||
}
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init();
|
this.init();
|
||||||
|
|
|
@ -34,9 +34,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="my-3 form-check form-switch">
|
<div class="my-3">
|
||||||
<input id="switch-theme" v-model="config.theme" class="form-check-input" type="checkbox" true-value="dark" false-value="light">
|
<label for="switch-theme" class="form-label">{{ $t("Theme") }}</label>
|
||||||
<label class="form-check-label" for="switch-theme">{{ $t("Switch to Dark Theme") }}</label>
|
<select id="switch-theme" v-model="config.theme" class="form-select">
|
||||||
|
<option value="auto">{{ $t("Auto") }}</option>
|
||||||
|
<option value="light">{{ $t("Light") }}</option>
|
||||||
|
<option value="dark">{{ $t("Dark") }}</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="my-3 form-check form-switch">
|
<div class="my-3 form-check form-switch">
|
||||||
|
|
Loading…
Reference in a new issue