Merge branch 'master' of github.com:designcreateplay/NodeBB
commit
dc90db74c0
@ -0,0 +1,30 @@
|
|||||||
|
define(function() {
|
||||||
|
var home = {};
|
||||||
|
|
||||||
|
home.init = function() {
|
||||||
|
|
||||||
|
ajaxify.register_events([
|
||||||
|
'user.count',
|
||||||
|
'post.stats',
|
||||||
|
'api:user.active.get'
|
||||||
|
]);
|
||||||
|
|
||||||
|
socket.emit('user.count', {});
|
||||||
|
socket.on('user.count', function(data) {
|
||||||
|
$('#stats_users').html(utils.makeNumberHumanReadable(data.count)).attr('title', data.count);
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.emit('post.stats');
|
||||||
|
socket.on('post.stats', function(data) {
|
||||||
|
$('#stats_topics').html(utils.makeNumberHumanReadable(data.topics)).attr('title', data.topics);
|
||||||
|
$('#stats_posts').html(utils.makeNumberHumanReadable(data.posts)).attr('title', data.posts);
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.emit('api:user.active.get');
|
||||||
|
socket.on('api:user.active.get', function(data) {
|
||||||
|
$('#stats_online').html(data.users);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return home;
|
||||||
|
});
|
@ -0,0 +1,25 @@
|
|||||||
|
var nconf = require('nconf'),
|
||||||
|
path = require('path'),
|
||||||
|
fs = require('fs'),
|
||||||
|
Plugins = require('../plugins'),
|
||||||
|
|
||||||
|
PluginRoutes = function(app) {
|
||||||
|
// Static Assets
|
||||||
|
app.get('/plugins/:id/*', function(req, res) {
|
||||||
|
var relPath = req.url.replace('/plugins/' + req.params.id, '');
|
||||||
|
if (Plugins.staticDirs[req.params.id]) {
|
||||||
|
var fullPath = path.join(Plugins.staticDirs[req.params.id], relPath);
|
||||||
|
fs.exists(fullPath, function(exists) {
|
||||||
|
if (exists) {
|
||||||
|
res.sendfile(fullPath);
|
||||||
|
} else {
|
||||||
|
res.redirect('/404');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
res.redirect('/404');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = PluginRoutes;
|
Loading…
Reference in New Issue