This commit is contained in:
Barış Soner Uşaklı
2017-05-08 13:49:35 -04:00
481 changed files with 1430 additions and 654 deletions

View File

@@ -16,22 +16,30 @@ var info = {};
infoController.get = function (req, res) {
info = {};
pubsub.publish('sync:node:info:start');
var timeoutMS = 1000;
setTimeout(function () {
var data = [];
Object.keys(info).forEach(function (key) {
data.push(info[key]);
});
data.sort(function (a, b) {
if (a.os.hostname < b.os.hostname) {
if (a.id < b.id) {
return -1;
}
if (a.os.hostname > b.os.hostname) {
if (a.id > b.id) {
return 1;
}
return 0;
});
res.render('admin/development/info', { info: data, infoJSON: JSON.stringify(data, null, 4), host: os.hostname(), port: nconf.get('port') });
}, 500);
res.render('admin/development/info', {
info: data,
infoJSON: JSON.stringify(data, null, 4),
host: os.hostname(),
port: nconf.get('port'),
nodeCount: data.length,
timeout: timeoutMS,
});
}, timeoutMS);
};
pubsub.on('sync:node:info:start', function () {
@@ -39,7 +47,8 @@ pubsub.on('sync:node:info:start', function () {
if (err) {
return winston.error(err);
}
pubsub.publish('sync:node:info:end', { data: data, id: os.hostname() + ':' + nconf.get('port') });
data.id = os.hostname() + ':' + nconf.get('port');
pubsub.publish('sync:node:info:end', { data: data, id: data.id });
});
});

View File

@@ -18,6 +18,7 @@ languagesController.get = function (req, res, next) {
res.render('admin/general/languages', {
languages: languages,
autoDetectLang: parseInt(meta.config.autoDetectLang, 10) === 1,
});
});
};

View File

@@ -5,6 +5,7 @@ var path = require('path');
var async = require('async');
var nconf = require('nconf');
var winston = require('winston');
var mime = require('mime');
var meta = require('../../meta');
var file = require('../../file');
@@ -102,6 +103,11 @@ uploadsController.uploadLogo = function (req, res, next) {
uploadsController.uploadSound = function (req, res, next) {
var uploadedFile = req.files.files[0];
var mimeType = mime.lookup(uploadedFile.name);
if (!/^audio\//.test(mimeType)) {
return next(Error('[[error:invalid-data]]'));
}
file.saveFileToLocal(uploadedFile.name, 'sounds', uploadedFile.path, function (err) {
if (err) {
return next(err);