diff --git a/index.js b/index.js index 297a0a1..8887a8e 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,8 @@ const fs = require("fs"); const https = require("https"); const express = require("express"); const socketio = require("socket.io"); +const basicAuth = require("express-basic-auth"); + const app = express(); const https_options = { @@ -91,6 +93,13 @@ io.on("connection", (client) => { app.use(express.static("src")); +app.get("/clear", basicAuth({users:{"quentin": "BlanquerCaca89"}, challenge: true}), (req, res) => { + messagesHistory = []; + res.send("message history was cleared"); + log("Admin cleared messages history"); + io.sockets.emit("refresh"); +}); + app.listen(80, () => { log("Web server started on port 80") });