mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-18 18:54:52 +00:00
noop
This commit is contained in:
parent
b90acce4cc
commit
b5efac6867
13
src/app.js
13
src/app.js
@ -38,22 +38,22 @@ app.use(express.static(__dirname + '/public'));
|
|||||||
|
|
||||||
// Routes
|
// Routes
|
||||||
|
|
||||||
function generateNewRoom(id) {
|
function generateNewRoom(req, res, id) {
|
||||||
const room = new Room(io, id);
|
const room = new Room(io, id);
|
||||||
rooms.push(room);
|
rooms.push(room);
|
||||||
console.log('generating new room');
|
console.log('generating new room');
|
||||||
|
|
||||||
room.on('empty', function() {
|
room.on('empty', function() {
|
||||||
console.log('room empty');
|
console.log('room empty');
|
||||||
rooms = _.without(rooms, _.findWhere(rooms, {_id: this._id}));
|
rooms = _.without(rooms, _.findWhere(rooms, {id: room.id}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return res.redirect(`/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
app.get('/', (req, res) => {
|
app.get('/', (req, res) => {
|
||||||
const id = shortid.generate();
|
const id = shortid.generate();
|
||||||
generateNewRoom(id);
|
generateNewRoom(req, res, id);
|
||||||
res.redirect(`/${id}`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/:roomId', (req, res) => {
|
app.get('/:roomId', (req, res) => {
|
||||||
@ -68,11 +68,10 @@ app.get('/:roomId', (req, res) => {
|
|||||||
|
|
||||||
if (roomExists) {
|
if (roomExists) {
|
||||||
return res.render('index', {username: shortid.generate()});
|
return res.render('index', {username: shortid.generate()});
|
||||||
} else {
|
|
||||||
return res.sendStatus(404);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
generateNewRoom(req, res, roomId);
|
// generateNewRoom(req, res, roomId);
|
||||||
|
return res.render('noop', {});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
10
src/views/noop.mustache
Normal file
10
src/views/noop.mustache
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Nope</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
Room does not exist.
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user