From 12152b81048759260ae2612bafde31801c5d8f14 Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Wed, 15 Oct 2014 00:24:15 +0200 Subject: [PATCH] Ignore folders in 'users/' --- package.json | 2 +- src/clientManager.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 67a9b1f..176faac 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "shout", "description": "The self-hosted web IRC client", - "version": "0.45.0", + "version": "0.45.1", "author": "Mattias Erming", "preferGlobal": true, "bin": { diff --git a/src/clientManager.js b/src/clientManager.js index ad2406d..df4f08a 100644 --- a/src/clientManager.js +++ b/src/clientManager.js @@ -56,9 +56,11 @@ ClientManager.prototype.getUsers = function() { var path = Helper.HOME + "/users"; mkdirp.sync(path); try { - users = fs.readdirSync(path); - users =_.map(users, function(name) { - return name.replace(".json", ""); + var files = fs.readdirSync(path); + files.forEach(function(file) { + if (file.indexOf(".json") !== -1) { + users.push(file.replace(".json", "")); + } }); } catch(e) { console.log(e); @@ -114,12 +116,10 @@ ClientManager.prototype.autoload = function(sockets) { self.clients, "name" ); - var added = _.difference(self.getUsers(), loaded); _.each(added, function(name) { self.loadUser(name); }); - var removed = _.difference(loaded, self.getUsers()); _.each(removed, function(name) { var client = _.find(