mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-18 18:54:52 +00:00
Incognito check
This commit is contained in:
parent
6c88638829
commit
28ea129c10
@ -24,7 +24,7 @@ const sessionMiddleware = session({
|
||||
saveUninitialized: true
|
||||
});
|
||||
|
||||
var rooms = [];
|
||||
let rooms = [];
|
||||
|
||||
io.use(function(socket, next) {
|
||||
sessionMiddleware(socket.request, socket.request.res, next);
|
||||
@ -44,9 +44,7 @@ function generateNewRoom(req, res, id) {
|
||||
console.log('generating new room');
|
||||
|
||||
room.on('empty', function() {
|
||||
console.log('room empty', room._id);
|
||||
rooms = _.without(rooms, _.findWhere(rooms, {_id: room._id}));
|
||||
|
||||
});
|
||||
|
||||
return res.redirect(`/${id}`);
|
||||
@ -64,7 +62,7 @@ app.get('/loaderio-6f94612a3fa71ff98b23eecfcca2de6c.html', (req, res) => {
|
||||
app.get('/:roomId', (req, res) => {
|
||||
const roomId = req.params.roomId || false;
|
||||
|
||||
let roomExists = _.findWhere(rooms, {_id: roomId}) ? true : false;
|
||||
let roomExists = _.findWhere(rooms, {_id: roomId}) || false;
|
||||
|
||||
if (roomExists) {
|
||||
return res.render('index', {username: shortid.generate()});
|
||||
|
@ -1,3 +1,5 @@
|
||||
var fs = window.RequestFileSystem || window.webkitRequestFileSystem;
|
||||
|
||||
$(function() {
|
||||
var FADE_TIME = 150; // ms
|
||||
var TYPING_TIMER_LENGTH = 400; // ms
|
||||
@ -41,6 +43,16 @@ $(function() {
|
||||
// Sets the client's username
|
||||
function setUsername () {
|
||||
username = window.username;
|
||||
// warn not incognitor
|
||||
if (!fs) {
|
||||
console.log('no fs');
|
||||
} else {
|
||||
fs(window.TEMPORARY,
|
||||
100,
|
||||
log.bind(log, "!!WARNING!! : Your browser is not in incognito mode! : !!WARNING!!"),
|
||||
log.bind(log, "Your browser is in incognito mode."));
|
||||
}
|
||||
|
||||
// If the username is valid
|
||||
if (username) {
|
||||
$chatPage.show();
|
||||
|
Loading…
x
Reference in New Issue
Block a user