mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-08 22:21:03 +08:00
Generated documentation :)
This commit is contained in:
@@ -1349,6 +1349,13 @@ exports.entryPage = "dashboard";
|
||||
|
||||
})();
|
||||
|
||||
/**
|
||||
* Adds or removes notifications from a monitor.
|
||||
* @param {number} monitorID The ID of the monitor to add/remove notifications from.
|
||||
* @param {Array.<number>} notificationIDList An array of IDs for the notifications to add/remove.
|
||||
*
|
||||
* Generated by Trelent
|
||||
*/
|
||||
async function updateMonitorNotification(monitorID, notificationIDList) {
|
||||
await R.exec("DELETE FROM monitor_notification WHERE monitor_id = ? ", [
|
||||
monitorID,
|
||||
@@ -1364,6 +1371,13 @@ async function updateMonitorNotification(monitorID, notificationIDList) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks if the user owns a monitor with the given ID.
|
||||
* @param {number} monitorID - The ID of the monitor to check ownership for.
|
||||
* @param {number} userID - The ID of the user who is trying to access this data.
|
||||
*
|
||||
* Generated by Trelent
|
||||
*/
|
||||
async function checkOwner(userID, monitorID) {
|
||||
let row = await R.getRow("SELECT id FROM monitor WHERE id = ? AND user_id = ? ", [
|
||||
monitorID,
|
||||
@@ -1381,6 +1395,13 @@ async function sendMonitorList(socket) {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to send the heartbeat list of a monitor.
|
||||
* @param {Socket} socket - The socket object that will be used to send the data.
|
||||
* @param {String} monitorID - The ID of the monitor that will have its heartbeat list sent.
|
||||
*
|
||||
* Generated by Trelent
|
||||
*/
|
||||
async function afterLogin(socket, user) {
|
||||
socket.userID = user.id;
|
||||
socket.join(user.id);
|
||||
@@ -1403,6 +1424,13 @@ async function afterLogin(socket, user) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of monitors for the given user.
|
||||
* @param {string} userID - The ID of the user to get monitors for.
|
||||
* @returns {Promise<Object>} A promise that resolves to an object with monitor IDs as keys and monitor objects as values.
|
||||
*
|
||||
* Generated by Trelent
|
||||
*/
|
||||
async function getMonitorJSONList(userID) {
|
||||
let result = {};
|
||||
|
||||
@@ -1417,6 +1445,11 @@ async function getMonitorJSONList(userID) {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to the database and patch it if necessary.
|
||||
*
|
||||
* Generated by Trelent
|
||||
*/
|
||||
async function initDatabase() {
|
||||
if (! fs.existsSync(Database.path)) {
|
||||
console.log("Copying Database");
|
||||
@@ -1451,6 +1484,13 @@ async function initDatabase() {
|
||||
jwtSecret = jwtSecretBean.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resume a monitor.
|
||||
* @param {string} userID - The ID of the user who owns the monitor.
|
||||
* @param {string} monitorID - The ID of the monitor to resume.
|
||||
*
|
||||
* Generated by Trelent
|
||||
*/
|
||||
async function startMonitor(userID, monitorID) {
|
||||
await checkOwner(userID, monitorID);
|
||||
|
||||
@@ -1477,6 +1517,13 @@ async function restartMonitor(userID, monitorID) {
|
||||
return await startMonitor(userID, monitorID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pause a monitor.
|
||||
* @param {string} userID - The ID of the user who owns the monitor.
|
||||
* @param {string} monitorID - The ID of the monitor to pause.
|
||||
*
|
||||
* Generated by Trelent
|
||||
*/
|
||||
async function pauseMonitor(userID, monitorID) {
|
||||
await checkOwner(userID, monitorID);
|
||||
|
||||
@@ -1509,6 +1556,12 @@ async function startMonitors() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops all monitors and closes the database connection.
|
||||
* @param {string} signal The signal that triggered this function to be called.
|
||||
*
|
||||
* Generated by Trelent
|
||||
*/
|
||||
async function shutdownFunction(signal) {
|
||||
console.log("Shutdown requested");
|
||||
console.log("Called signal: " + signal);
|
||||
|
Reference in New Issue
Block a user