Added serverside check

This commit is contained in:
Henry Hiles 2022-02-28 16:51:56 -05:00
parent 1fefb44b51
commit cacea24aa6

View file

@ -31,7 +31,11 @@ app.get("/", (_, res) => {
})
app.post("/", (req, res) => {
if (!req.body.room.trim() || rooms[req.body.room]) {
if (
!req.body.room.trim() ||
!/^[-a-z0-9]+$/i.test(req.body.room) ||
rooms[req.body.room]
) {
return res.redirect("/")
}
rooms[req.body.room] = { users: {} }