diff --git a/server/client.js b/server/client.js index fcfddeb53..4f28a2fa0 100644 --- a/server/client.js +++ b/server/client.js @@ -4,7 +4,6 @@ const { TimeLogger } = require("../src/util"); const { R } = require("redbean-node"); const { io } = require("./server"); -const { userMonitorList } = require("./user-monitor-list"); async function sendNotificationList(socket) { const timeLogger = new TimeLogger(); diff --git a/server/model/monitor.js b/server/model/monitor.js index 57815cdd8..19f21d924 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -11,7 +11,6 @@ const { tcping, ping, dnsResolve, checkCertificate, checkStatusCode, getTotalCli const { R } = require("redbean-node"); const { BeanModel } = require("redbean-node/dist/bean-model"); const { Notification } = require("../notification") -const { userMonitorList } = require("../user-monitor-list"); const version = require("../../package.json").version; /** diff --git a/server/server.js b/server/server.js index 126aa18d9..b8eb79ee5 100644 --- a/server/server.js +++ b/server/server.js @@ -27,7 +27,7 @@ debug("Importing Monitor"); const Monitor = require("./model/monitor"); debug("Importing Settings"); const { getSettings, setSettings, setting, initJWTSecret } = require("./util-server"); -const { userMonitorList } = require("./user-monitor-list"); +const UserMonitorList = require("./user-monitor-list"); debug("Importing Notification"); const { Notification } = require("./notification"); @@ -105,6 +105,11 @@ let totalClient = 0; */ let jwtSecret = null; +/** + * Main monitor list, filled by startMonitors() + */ +let userMonitorList = new UserMonitorList(); + /** * Show Setup Page * @type {boolean} diff --git a/server/user-monitor-list.js b/server/user-monitor-list.js index 053060bde..49c5bbe4b 100644 --- a/server/user-monitor-list.js +++ b/server/user-monitor-list.js @@ -1,7 +1,5 @@ -/** - * Main monitor list - */ class UserMonitorList { + list = {}; add(userID, monitor) { @@ -48,6 +46,4 @@ class UserMonitorList { } -module.exports = { - userMonitorList: new UserMonitorList(), -}; +module.exports = UserMonitorList;