re-enabling updateLastOnlineTime - calling that middleware for page loads only instead of every API call

v1.18.x
psychobunny 11 years ago
parent ecd00bb679
commit ab1c231b84

@ -36,8 +36,6 @@ middleware.authenticate = function(req, res, next) {
middleware.ensureLoggedIn = ensureLoggedIn.ensureLoggedIn();
middleware.updateLastOnlineTime = function(req, res, next) {
return next();
if(req.user) {
user.updateLastOnlineTime(req.user.uid);
}

@ -161,7 +161,7 @@ module.exports = function(app, middleware) {
};
pluginRouter.hotswapId = 'plugins';
app.all(relativePath + '/api/?*', middleware.updateLastOnlineTime, middleware.prepareAPI);
app.all(relativePath + '/api/?*', middleware.prepareAPI);
app.all(relativePath + '/api/admin/*', middleware.admin.isAdmin, middleware.prepareAPI);
app.all(relativePath + '/admin/?*', middleware.ensureLoggedIn, middleware.admin.isAdmin);
@ -181,6 +181,7 @@ module.exports = function(app, middleware) {
*
*/
pageRouter.use(middleware.incrementPageViews);
pageRouter.use(middleware.updateLastOnlineTime);
mainRoutes(pageRouter, middleware, controllers);
staticRoutes(pageRouter, middleware, controllers);

Loading…
Cancel
Save