diff --git a/server/server.js b/server/server.js index 9a5e1028b..602b5a866 100644 --- a/server/server.js +++ b/server/server.js @@ -133,6 +133,7 @@ const { statusPageSocketHandler } = require("./socket-handlers/status-page-socke const databaseSocketHandler = require("./socket-handlers/database-socket-handler"); const TwoFA = require("./2fa"); const StatusPage = require("./model/status_page"); +const { cloudflaredSocketHandler } = require("./socket-handlers/cloudflared-socket-handler"); app.use(express.json()); @@ -1319,6 +1320,7 @@ exports.entryPage = "dashboard"; // Status Page Socket Handler for admin only statusPageSocketHandler(socket); + cloudflaredSocketHandler(socket); databaseSocketHandler(socket); debug("added all socket handlers"); diff --git a/server/socket-handlers/cloudflared-socket-handler.js b/server/socket-handlers/cloudflared-socket-handler.js new file mode 100644 index 000000000..95dd4d80b --- /dev/null +++ b/server/socket-handlers/cloudflared-socket-handler.js @@ -0,0 +1,19 @@ +const { checkLogin } = require("../util-server"); + +const prefix = "cloudflared_"; + +module.exports.cloudflaredSocketHandler = (socket) => { + + socket.on(prefix + "start", async (callback) => { + try { + checkLogin(socket); + + } catch (error) { + callback({ + ok: false, + msg: error.message, + }); + } + }); + +};