misc fixes

handle spider uids properly
This commit is contained in:
Barış Soner Uşaklı
2018-11-12 00:20:44 -05:00
parent afa84023a2
commit 69bb3293ee
30 changed files with 122 additions and 104 deletions

View File

@@ -62,10 +62,10 @@ middleware.pageView = function (req, res, next) {
user.updateOnlineUsers(req.uid, next);
} else {
user.updateOnlineUsers(req.uid);
next();
setImmediate(next);
}
} else {
next();
setImmediate(next);
}
};
@@ -156,11 +156,11 @@ middleware.privateUploads = function (req, res, next) {
};
middleware.busyCheck = function (req, res, next) {
if (global.env === 'production' && (!meta.config.hasOwnProperty('eventLoopCheckEnabled') || meta.config.eventLoopCheckEnabled) && toobusy()) {
if (global.env === 'production' && meta.config.eventLoopCheckEnabled && toobusy()) {
analytics.increment('errors:503');
res.status(503).type('text/html').sendFile(path.join(__dirname, '../../public/503.html'));
} else {
next();
setImmediate(next);
}
};

View File

@@ -8,12 +8,12 @@ var user = require('../user');
module.exports = function (middleware) {
middleware.maintenanceMode = function (req, res, callback) {
if (!meta.config.maintenanceMode) {
return callback();
return setImmediate(callback);
}
var url = req.url.replace(nconf.get('relative_path'), '');
if (url.startsWith('/login') || url.startsWith('/api/login')) {
return callback();
return setImmediate(callback);
}
var data;
async.waterfall([

View File

@@ -226,7 +226,7 @@ module.exports = function (middleware) {
middleware.registrationComplete = function (req, res, next) {
// If the user's session contains registration data, redirect the user to complete registration
if (!req.session.hasOwnProperty('registration')) {
return next();
return setImmediate(next);
}
if (!req.path.endsWith('/register/complete')) {
// Append user data if present
@@ -234,7 +234,7 @@ module.exports = function (middleware) {
controllers.helpers.redirect(res, '/register/complete');
} else {
return next();
return setImmediate(next);
}
};
};