Allow ability to hide the number of visitors
This commit is contained in:
parent
6d0a37dd70
commit
6359d8ba33
3 changed files with 10 additions and 5 deletions
BIN
README.md
BIN
README.md
Binary file not shown.
12
server.js
12
server.js
|
@ -244,8 +244,10 @@ function Server () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.io.on('connection', socket => {
|
this.io.on('connection', socket => {
|
||||||
this.connections++;
|
if (!settings.hideVisitors) {
|
||||||
this.io.emit('update visitors', this.connections);
|
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', () => {
|
||||||
this.connections--;
|
if (!settings.hideVisitors) {
|
||||||
this.io.emit('update visitors', this.connections);
|
this.connections--;
|
||||||
|
this.io.emit('update visitors', this.connections);
|
||||||
|
}
|
||||||
this.deleteBooks(socket.id);
|
this.deleteBooks(socket.id);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue