From 6359d8ba336eb3b37de0a89a786db5633b323f0a Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Fri, 4 Jan 2019 15:47:44 -0700 Subject: [PATCH] Allow ability to hide the number of visitors --- README.md | Bin 6042 -> 6246 bytes server.js | 12 ++++++++---- settings.json | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f63670e78777ebf5db125b55491e7dc0c3fa622d..bd082228b159080917d4b3be59245efc03976c74 100644 GIT binary patch delta 217 zcmZvWF$w}P6hz0$ay`Ol>xH$pu@D3=U}LqoSyot##toJp!p>6&-pST0_!3(gLMHR) z&*V|R=g&|~s{6V4+)SoYy$)*SwB^2VMtKETsRi>+jRsy0UIWtx&2R-p)GG5n&r7Y) z0&qIwus@lmJ^3-s*VqE4E2RT4M4#89PJF3>r&^Dm3V$UXJ4s3LsiuAHX3Oapd&w!? delta 22 ecmaE6FiU?!5&z^8{&$SElLOg>H#-Qbu>$~USqH)Z diff --git a/server.js b/server.js index 03b7eeb..312eb94 100644 --- a/server.js +++ b/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); }); }); diff --git a/settings.json b/settings.json index 913434a..77388d6 100644 --- a/settings.json +++ b/settings.json @@ -8,5 +8,6 @@ "maxFileSize": 0, "maxHistory": 0, "allowedFormats": [".epub", ".mobi", ".pdf"], - "backupPassword": "password" + "backupPassword": "password", + "hideVisitors": false } \ No newline at end of file