Add clear page
This commit is contained in:
		
							
								
								
									
										9
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								index.js
									
									
									
									
									
								
							@@ -2,6 +2,8 @@ const fs = require("fs");
 | 
				
			|||||||
const https = require("https");
 | 
					const https = require("https");
 | 
				
			||||||
const express = require("express");
 | 
					const express = require("express");
 | 
				
			||||||
const socketio = require("socket.io");
 | 
					const socketio = require("socket.io");
 | 
				
			||||||
 | 
					const basicAuth = require("express-basic-auth");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const app = express();
 | 
					const app = express();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const https_options = {
 | 
					const https_options = {
 | 
				
			||||||
@@ -91,6 +93,13 @@ io.on("connection", (client) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
app.use(express.static("src"));
 | 
					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, () => {
 | 
					app.listen(80, () => {
 | 
				
			||||||
    log("Web server started on port 80")
 | 
					    log("Web server started on port 80")
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user