Add clear page

This commit is contained in:
Quentin ANIERE 2022-04-14 15:57:54 +02:00
parent 5fdbde912b
commit 0197ccef76

View File

@ -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")
});