Ignore folders in 'users/'

This commit is contained in:
Mattias Erming 2014-10-15 00:24:15 +02:00
parent 42e3311e0f
commit 12152b8104
2 changed files with 6 additions and 6 deletions

View File

@ -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": {

View File

@ -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(