Allow ability to hide the number of visitors
This commit is contained in:
parent
6d0a37dd70
commit
6359d8ba33
12
server.js
12
server.js
|
@ -244,8 +244,10 @@ function Server () {
|
|||
});
|
||||
|
||||
this.io.on('connection', socket => {
|
||||
this.connections++;
|
||||
this.io.emit('update visitors', this.connections);
|
||||
if (!settings.hideVisitors) {
|
||||
this.connections++;
|
||||
this.io.emit('update visitors', this.connections);
|
||||
}
|
||||
|
||||
socket.on('take book', bookId => {
|
||||
const fileLocation = this.takeBook(bookId, socket.id);
|
||||
|
@ -258,8 +260,10 @@ function Server () {
|
|||
});
|
||||
|
||||
socket.on('disconnect', () => {
|
||||
this.connections--;
|
||||
this.io.emit('update visitors', this.connections);
|
||||
if (!settings.hideVisitors) {
|
||||
this.connections--;
|
||||
this.io.emit('update visitors', this.connections);
|
||||
}
|
||||
this.deleteBooks(socket.id);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,5 +8,6 @@
|
|||
"maxFileSize": 0,
|
||||
"maxHistory": 0,
|
||||
"allowedFormats": [".epub", ".mobi", ".pdf"],
|
||||
"backupPassword": "password"
|
||||
"backupPassword": "password",
|
||||
"hideVisitors": false
|
||||
}
|
Loading…
Reference in New Issue