mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-06-03 03:52:35 +02:00
Merge branch 'master' into smseagle
This commit is contained in:
commit
caac8ff60a
19 changed files with 411 additions and 300 deletions
|
@ -3,6 +3,7 @@ console.log("== Uptime Kuma Reset Password Tool ==");
|
|||
const Database = require("../server/database");
|
||||
const { R } = require("redbean-node");
|
||||
const readline = require("readline");
|
||||
const { passwordStrength } = require("check-password-strength");
|
||||
const { initJWTSecret } = require("../server/util-server");
|
||||
const User = require("../server/model/user");
|
||||
const { io } = require("socket.io-client");
|
||||
|
@ -42,8 +43,15 @@ const main = async () => {
|
|||
console.log("Using password from argument");
|
||||
console.warn("\x1b[31m%s\x1b[0m", "Warning: the password might be stored, in plain text, in your shell's history");
|
||||
password = confirmPassword = args["new-password"] + "";
|
||||
if (passwordStrength(password).value === "Too weak") {
|
||||
throw new Error("Password is too weak, please use a stronger password.");
|
||||
}
|
||||
} else {
|
||||
password = await question("New Password: ");
|
||||
if (passwordStrength(password).value === "Too weak") {
|
||||
console.log("Password is too weak, please try again.");
|
||||
continue;
|
||||
}
|
||||
confirmPassword = await question("Confirm New Password: ");
|
||||
}
|
||||
|
||||
|
|
521
package-lock.json
generated
521
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -72,7 +72,7 @@
|
|||
"@louislam/sqlite3": "15.1.6",
|
||||
"@vvo/tzdb": "^6.125.0",
|
||||
"args-parser": "~1.3.0",
|
||||
"axios": "~0.29.0",
|
||||
"axios": "~0.30.0",
|
||||
"badge-maker": "~3.3.1",
|
||||
"bcryptjs": "~2.4.3",
|
||||
"chardet": "~1.4.0",
|
||||
|
@ -82,6 +82,7 @@
|
|||
"command-exists": "~1.2.9",
|
||||
"compare-versions": "~3.6.0",
|
||||
"compression": "~1.7.4",
|
||||
"country-flag-emoji-polyfill": "^0.1.8",
|
||||
"croner": "~8.1.0",
|
||||
"dayjs": "~1.11.5",
|
||||
"dev-null": "^0.1.1",
|
||||
|
|
|
@ -380,39 +380,6 @@ class Monitor extends BeanModel {
|
|||
if (await Monitor.isUnderMaintenance(this.id)) {
|
||||
bean.msg = "Monitor under maintenance";
|
||||
bean.status = MAINTENANCE;
|
||||
} else if (this.type === "group") {
|
||||
const children = await Monitor.getChildren(this.id);
|
||||
|
||||
if (children.length > 0) {
|
||||
bean.status = UP;
|
||||
bean.msg = "All children up and running";
|
||||
for (const child of children) {
|
||||
if (!child.active) {
|
||||
// Ignore inactive childs
|
||||
continue;
|
||||
}
|
||||
const lastBeat = await Monitor.getPreviousHeartbeat(child.id);
|
||||
|
||||
// Only change state if the monitor is in worse conditions then the ones before
|
||||
// lastBeat.status could be null
|
||||
if (!lastBeat) {
|
||||
bean.status = PENDING;
|
||||
} else if (bean.status === UP && (lastBeat.status === PENDING || lastBeat.status === DOWN)) {
|
||||
bean.status = lastBeat.status;
|
||||
} else if (bean.status === PENDING && lastBeat.status === DOWN) {
|
||||
bean.status = lastBeat.status;
|
||||
}
|
||||
}
|
||||
|
||||
if (bean.status !== UP) {
|
||||
bean.msg = "Child inaccessible";
|
||||
}
|
||||
} else {
|
||||
// Set status pending if group is empty
|
||||
bean.status = PENDING;
|
||||
bean.msg = "Group empty";
|
||||
}
|
||||
|
||||
} else if (this.type === "http" || this.type === "keyword" || this.type === "json-query") {
|
||||
// Do not do any queries/high loading things before the "bean.ping"
|
||||
let startTime = dayjs().valueOf();
|
||||
|
@ -1625,7 +1592,7 @@ class Monitor extends BeanModel {
|
|||
/**
|
||||
* Gets all Children of the monitor
|
||||
* @param {number} monitorID ID of monitor to get
|
||||
* @returns {Promise<LooseObject<any>>} Children
|
||||
* @returns {Promise<LooseObject<any>[]>} Children
|
||||
*/
|
||||
static async getChildren(monitorID) {
|
||||
return await R.getAll(`
|
||||
|
|
|
@ -34,12 +34,16 @@ class DnsMonitorType extends MonitorType {
|
|||
switch (monitor.dns_resolve_type) {
|
||||
case "A":
|
||||
case "AAAA":
|
||||
case "TXT":
|
||||
case "PTR":
|
||||
dnsMessage = `Records: ${dnsRes.join(" | ")}`;
|
||||
conditionsResult = dnsRes.some(record => handleConditions({ record }));
|
||||
break;
|
||||
|
||||
case "TXT":
|
||||
dnsMessage = `Records: ${dnsRes.join(" | ")}`;
|
||||
conditionsResult = dnsRes.flat().some(record => handleConditions({ record }));
|
||||
break;
|
||||
|
||||
case "CNAME":
|
||||
dnsMessage = dnsRes[0];
|
||||
conditionsResult = handleConditions({ record: dnsRes[0] });
|
||||
|
|
49
server/monitor-types/group.js
Normal file
49
server/monitor-types/group.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
const { UP, PENDING, DOWN } = require("../../src/util");
|
||||
const { MonitorType } = require("./monitor-type");
|
||||
const Monitor = require("../model/monitor");
|
||||
|
||||
class GroupMonitorType extends MonitorType {
|
||||
name = "group";
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
async check(monitor, heartbeat, _server) {
|
||||
const children = await Monitor.getChildren(monitor.id);
|
||||
|
||||
if (children.length > 0) {
|
||||
heartbeat.status = UP;
|
||||
heartbeat.msg = "All children up and running";
|
||||
for (const child of children) {
|
||||
if (!child.active) {
|
||||
// Ignore inactive childs
|
||||
continue;
|
||||
}
|
||||
const lastBeat = await Monitor.getPreviousHeartbeat(child.id);
|
||||
|
||||
// Only change state if the monitor is in worse conditions then the ones before
|
||||
// lastBeat.status could be null
|
||||
if (!lastBeat) {
|
||||
heartbeat.status = PENDING;
|
||||
} else if (heartbeat.status === UP && (lastBeat.status === PENDING || lastBeat.status === DOWN)) {
|
||||
heartbeat.status = lastBeat.status;
|
||||
} else if (heartbeat.status === PENDING && lastBeat.status === DOWN) {
|
||||
heartbeat.status = lastBeat.status;
|
||||
}
|
||||
}
|
||||
|
||||
if (heartbeat.status !== UP) {
|
||||
heartbeat.msg = "Child inaccessible";
|
||||
}
|
||||
} else {
|
||||
// Set status pending if group is empty
|
||||
heartbeat.status = PENDING;
|
||||
heartbeat.msg = "Group empty";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
GroupMonitorType,
|
||||
};
|
||||
|
|
@ -79,11 +79,13 @@ class Mattermost extends NotificationProvider {
|
|||
fallback:
|
||||
"Your " +
|
||||
monitorJSON.pathName +
|
||||
monitorJSON.name +
|
||||
" service went " +
|
||||
statusText,
|
||||
color: color,
|
||||
title:
|
||||
monitorJSON.pathName +
|
||||
monitorJSON.name +
|
||||
" service went " +
|
||||
statusText,
|
||||
title_link: monitorJSON.url,
|
||||
|
|
|
@ -113,6 +113,7 @@ class UptimeKumaServer {
|
|||
UptimeKumaServer.monitorTypeList["tailscale-ping"] = new TailscalePing();
|
||||
UptimeKumaServer.monitorTypeList["dns"] = new DnsMonitorType();
|
||||
UptimeKumaServer.monitorTypeList["mqtt"] = new MqttMonitorType();
|
||||
UptimeKumaServer.monitorTypeList["group"] = new GroupMonitorType();
|
||||
UptimeKumaServer.monitorTypeList["snmp"] = new SNMPMonitorType();
|
||||
UptimeKumaServer.monitorTypeList["mongodb"] = new MongodbMonitorType();
|
||||
UptimeKumaServer.monitorTypeList["rabbitmq"] = new RabbitMqMonitorType();
|
||||
|
@ -551,6 +552,7 @@ const { RealBrowserMonitorType } = require("./monitor-types/real-browser-monitor
|
|||
const { TailscalePing } = require("./monitor-types/tailscale-ping");
|
||||
const { DnsMonitorType } = require("./monitor-types/dns");
|
||||
const { MqttMonitorType } = require("./monitor-types/mqtt");
|
||||
const { GroupMonitorType } = require("./monitor-types/group");
|
||||
const { SNMPMonitorType } = require("./monitor-types/snmp");
|
||||
const { MongodbMonitorType } = require("./monitor-types/mongodb");
|
||||
const { RabbitMqMonitorType } = require("./monitor-types/rabbitmq");
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
|
||||
<script>
|
||||
import { setPageLocale } from "./util-frontend";
|
||||
import { polyfillCountryFlagEmojis } from "country-flag-emoji-polyfill";
|
||||
export default {
|
||||
created() {
|
||||
setPageLocale();
|
||||
},
|
||||
};
|
||||
polyfillCountryFlagEmojis();
|
||||
</script>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
@import "node_modules/bootstrap/scss/bootstrap";
|
||||
|
||||
#app {
|
||||
font-family: BlinkMacSystemFont, segoe ui, Roboto, helvetica neue, Arial, noto sans, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol, noto color emoji;
|
||||
font-family: "Twemoji Country Flags", BlinkMacSystemFont, segoe ui, Roboto, helvetica neue, Arial, noto sans, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol, noto color emoji;
|
||||
}
|
||||
|
||||
h1 {
|
||||
|
|
|
@ -42,6 +42,9 @@ export default {
|
|||
mounted() {
|
||||
this.modal = new Modal(this.$refs.modal);
|
||||
},
|
||||
beforeUnmount() {
|
||||
this.cleanupModal();
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* Show the confirm dialog
|
||||
|
@ -58,6 +61,19 @@ export default {
|
|||
this.$emit("added", this.groupName);
|
||||
this.modal.hide();
|
||||
},
|
||||
/**
|
||||
* Clean up modal and restore scroll behavior
|
||||
* @returns {void}
|
||||
*/
|
||||
cleanupModal() {
|
||||
if (this.modal) {
|
||||
try {
|
||||
this.modal.hide();
|
||||
} catch (e) {
|
||||
console.warn("Modal hide failed:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
</span>
|
||||
{{ monitor.name }}
|
||||
</div>
|
||||
<div v-if="monitor.tags.length > 0" class="tags">
|
||||
<div v-if="monitor.tags.length > 0" class="tags gap-1">
|
||||
<Tag v-for="tag in monitor.tags" :key="tag" :item="tag" :size="'sm'" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -235,6 +235,9 @@ export default {
|
|||
mounted() {
|
||||
this.modal = new Modal(this.$refs.modal);
|
||||
},
|
||||
beforeUnmount() {
|
||||
this.cleanupModal();
|
||||
},
|
||||
methods: {
|
||||
|
||||
/**
|
||||
|
@ -339,6 +342,20 @@ export default {
|
|||
});
|
||||
} while (this.$root.notificationList.find(it => it.name === name));
|
||||
return name;
|
||||
},
|
||||
|
||||
/**
|
||||
* Clean up modal and restore scroll behavior
|
||||
* @returns {void}
|
||||
*/
|
||||
cleanupModal() {
|
||||
if (this.modal) {
|
||||
try {
|
||||
this.modal.hide();
|
||||
} catch (e) {
|
||||
console.warn("Modal hide failed:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -125,11 +125,12 @@ export default {
|
|||
}
|
||||
};
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.modal = new Modal(this.$refs.modal);
|
||||
},
|
||||
|
||||
beforeUnmount() {
|
||||
this.cleanupModal();
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* Show dialog to confirm deletion
|
||||
|
@ -209,6 +210,20 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Clean up modal and restore scroll behavior
|
||||
* @returns {void}
|
||||
*/
|
||||
cleanupModal() {
|
||||
if (this.modal) {
|
||||
try {
|
||||
this.modal.hide();
|
||||
} catch (e) {
|
||||
console.warn("Modal hide failed:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
'm-2': size == 'normal',
|
||||
'px-2': size == 'sm',
|
||||
'py-0': size == 'sm',
|
||||
'mx-1': size == 'sm',
|
||||
}"
|
||||
:style="{ backgroundColor: item.color, fontSize: size == 'sm' ? '0.7em' : '1em' }"
|
||||
>
|
||||
|
@ -48,7 +47,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
displayText() {
|
||||
if (this.item.value === "" || this.item.value === undefined) {
|
||||
if (this.item.value === "" || this.item.value === undefined || this.item.value === null) {
|
||||
return this.item.name;
|
||||
} else {
|
||||
return `${this.item.name}: ${this.item.value}`;
|
||||
|
|
|
@ -248,6 +248,9 @@ export default {
|
|||
this.modal = new Modal(this.$refs.modal);
|
||||
this.getExistingTags();
|
||||
},
|
||||
beforeUnmount() {
|
||||
this.cleanupModal();
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* Show the add tag dialog
|
||||
|
@ -459,6 +462,19 @@ export default {
|
|||
this.newTags = [];
|
||||
this.deleteTags = [];
|
||||
this.processing = false;
|
||||
},
|
||||
/**
|
||||
* Clean up modal and restore scroll behavior
|
||||
* @returns {void}
|
||||
*/
|
||||
cleanupModal() {
|
||||
if (this.modal) {
|
||||
try {
|
||||
this.modal.hide();
|
||||
} catch (e) {
|
||||
console.warn("Modal hide failed:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
{{ $t("matrixDesc1") }}
|
||||
</p>
|
||||
<i18n-t tag="p" keypath="matrixDesc2" style="margin-top: 8px;">
|
||||
<code>curl -XPOST -d '{"type": "m.login.password", "identifier": {"user": "botusername", "type": "m.id.user"}, "password": "passwordforuser"}' "https://home.server/_matrix/client/r0/login"</code>.
|
||||
<code>curl -XPOST -d '{"type": "m.login.password", "identifier": {"user": "botusername", "type": "m.id.user"}, "password": "passwordforuser"}' "https://home.server/_matrix/client/v3/login"</code>.
|
||||
</i18n-t>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
<label><input v-model="settings.checkBeta" type="checkbox" :disabled="!settings.checkUpdate" @change="saveSettings()" /> {{ $t("Also check beta release") }}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<p>{{ $t("Font Twemoji by Twitter licensed under") }} <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY 4.0</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -1081,5 +1081,6 @@
|
|||
"YZJ Robot Token": "YZJ Robot token",
|
||||
"Plain Text": "Plain Text",
|
||||
"Message Template": "Message Template",
|
||||
"Template Format": "Template Format"
|
||||
"Template Format": "Template Format",
|
||||
"Font Twemoji by Twitter licensed under": "Font Twemoji by Twitter licensed under"
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue