|
|
@ -4,6 +4,8 @@
|
|
|
|
const { TimeLogger } = require("../src/util");
|
|
|
|
const { TimeLogger } = require("../src/util");
|
|
|
|
const { R } = require("redbean-node");
|
|
|
|
const { R } = require("redbean-node");
|
|
|
|
const { io } = require("./server");
|
|
|
|
const { io } = require("./server");
|
|
|
|
|
|
|
|
const { setting } = require("./util-server");
|
|
|
|
|
|
|
|
const checkVersion = require("./check-version");
|
|
|
|
|
|
|
|
|
|
|
|
async function sendNotificationList(socket) {
|
|
|
|
async function sendNotificationList(socket) {
|
|
|
|
const timeLogger = new TimeLogger();
|
|
|
|
const timeLogger = new TimeLogger();
|
|
|
@ -14,10 +16,10 @@ async function sendNotificationList(socket) {
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
for (let bean of list) {
|
|
|
|
for (let bean of list) {
|
|
|
|
result.push(bean.export())
|
|
|
|
result.push(bean.export());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
io.to(socket.userID).emit("notificationList", result)
|
|
|
|
io.to(socket.userID).emit("notificationList", result);
|
|
|
|
|
|
|
|
|
|
|
|
timeLogger.print("Send Notification List");
|
|
|
|
timeLogger.print("Send Notification List");
|
|
|
|
|
|
|
|
|
|
|
@ -39,7 +41,7 @@ async function sendHeartbeatList(socket, monitorID, toUser = false, overwrite =
|
|
|
|
LIMIT 100
|
|
|
|
LIMIT 100
|
|
|
|
`, [
|
|
|
|
`, [
|
|
|
|
monitorID,
|
|
|
|
monitorID,
|
|
|
|
])
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
let result = list.reverse();
|
|
|
|
let result = list.reverse();
|
|
|
|
|
|
|
|
|
|
|
@ -69,7 +71,7 @@ async function sendImportantHeartbeatList(socket, monitorID, toUser = false, ove
|
|
|
|
LIMIT 500
|
|
|
|
LIMIT 500
|
|
|
|
`, [
|
|
|
|
`, [
|
|
|
|
monitorID,
|
|
|
|
monitorID,
|
|
|
|
])
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
timeLogger.print(`[Monitor: ${monitorID}] sendImportantHeartbeatList`);
|
|
|
|
timeLogger.print(`[Monitor: ${monitorID}] sendImportantHeartbeatList`);
|
|
|
|
|
|
|
|
|
|
|
@ -81,8 +83,18 @@ async function sendImportantHeartbeatList(socket, monitorID, toUser = false, ove
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function sendInfo(socket) {
|
|
|
|
|
|
|
|
socket.emit("info", {
|
|
|
|
|
|
|
|
version: checkVersion.version,
|
|
|
|
|
|
|
|
latestVersion: checkVersion.latestVersion,
|
|
|
|
|
|
|
|
primaryBaseURL: await setting("primaryBaseURL")
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
module.exports = {
|
|
|
|
sendNotificationList,
|
|
|
|
sendNotificationList,
|
|
|
|
sendImportantHeartbeatList,
|
|
|
|
sendImportantHeartbeatList,
|
|
|
|
sendHeartbeatList,
|
|
|
|
sendHeartbeatList,
|
|
|
|
}
|
|
|
|
sendInfo
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|