Ignore folders in 'users/'
This commit is contained in:
parent
42e3311e0f
commit
12152b8104
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "shout",
|
"name": "shout",
|
||||||
"description": "The self-hosted web IRC client",
|
"description": "The self-hosted web IRC client",
|
||||||
"version": "0.45.0",
|
"version": "0.45.1",
|
||||||
"author": "Mattias Erming",
|
"author": "Mattias Erming",
|
||||||
"preferGlobal": true,
|
"preferGlobal": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|
|
@ -56,9 +56,11 @@ ClientManager.prototype.getUsers = function() {
|
||||||
var path = Helper.HOME + "/users";
|
var path = Helper.HOME + "/users";
|
||||||
mkdirp.sync(path);
|
mkdirp.sync(path);
|
||||||
try {
|
try {
|
||||||
users = fs.readdirSync(path);
|
var files = fs.readdirSync(path);
|
||||||
users =_.map(users, function(name) {
|
files.forEach(function(file) {
|
||||||
return name.replace(".json", "");
|
if (file.indexOf(".json") !== -1) {
|
||||||
|
users.push(file.replace(".json", ""));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
@ -114,12 +116,10 @@ ClientManager.prototype.autoload = function(sockets) {
|
||||||
self.clients,
|
self.clients,
|
||||||
"name"
|
"name"
|
||||||
);
|
);
|
||||||
|
|
||||||
var added = _.difference(self.getUsers(), loaded);
|
var added = _.difference(self.getUsers(), loaded);
|
||||||
_.each(added, function(name) {
|
_.each(added, function(name) {
|
||||||
self.loadUser(name);
|
self.loadUser(name);
|
||||||
});
|
});
|
||||||
|
|
||||||
var removed = _.difference(loaded, self.getUsers());
|
var removed = _.difference(loaded, self.getUsers());
|
||||||
_.each(removed, function(name) {
|
_.each(removed, function(name) {
|
||||||
var client = _.find(
|
var client = _.find(
|
||||||
|
|
Loading…
Reference in New Issue