Allow ability to hide the number of visitors

This commit is contained in:
Robbie Antenesse 2019-01-04 15:47:44 -07:00
parent 6d0a37dd70
commit 6359d8ba33
3 changed files with 10 additions and 5 deletions

BIN
README.md

Binary file not shown.

View file

@ -244,8 +244,10 @@ function Server () {
}); });
this.io.on('connection', socket => { this.io.on('connection', socket => {
if (!settings.hideVisitors) {
this.connections++; this.connections++;
this.io.emit('update visitors', this.connections); this.io.emit('update visitors', this.connections);
}
socket.on('take book', bookId => { socket.on('take book', bookId => {
const fileLocation = this.takeBook(bookId, socket.id); const fileLocation = this.takeBook(bookId, socket.id);
@ -258,8 +260,10 @@ function Server () {
}); });
socket.on('disconnect', () => { socket.on('disconnect', () => {
if (!settings.hideVisitors) {
this.connections--; this.connections--;
this.io.emit('update visitors', this.connections); this.io.emit('update visitors', this.connections);
}
this.deleteBooks(socket.id); this.deleteBooks(socket.id);
}); });
}); });

View file

@ -8,5 +8,6 @@
"maxFileSize": 0, "maxFileSize": 0,
"maxHistory": 0, "maxHistory": 0,
"allowedFormats": [".epub", ".mobi", ".pdf"], "allowedFormats": [".epub", ".mobi", ".pdf"],
"backupPassword": "password" "backupPassword": "password",
"hideVisitors": false
} }