fixed maintenance mode assets not being loaded properly

v1.18.x
Julian Lam 10 years ago
parent 1a90de7dd6
commit a28b4bb8b9

@ -474,18 +474,29 @@ middleware.addExpiresHeaders = function(req, res, next) {
middleware.maintenanceMode = function(req, res, next) { middleware.maintenanceMode = function(req, res, next) {
var allowedRoutes = [ var allowedRoutes = [
'/login' '/login',
'/stylesheet.css',
'/nodebb.min.js',
'/vendor/fontawesome/fonts/fontawesome-webfont.woff'
], ],
render = function() { render = function() {
middleware.buildHeader(req, res, function() { middleware.buildHeader(req, res, function() {
res.render('maintenance', { res.status(503).render('maintenance', {
site_title: meta.config.site_title || 'NodeBB', site_title: meta.config.site_title || 'NodeBB',
message: meta.config.maintenanceModeMessage message: meta.config.maintenanceModeMessage
}); });
}); });
},
isAllowed = function(url) {
for(var x=0,numAllowed=allowedRoutes.length,route;x<numAllowed;x++) {
route = new RegExp(allowedRoutes[x]);
if (route.test(url)) {
return true;
}
}
}; };
if (meta.config.maintenanceMode === '1' && allowedRoutes.indexOf(req.url) === -1) { if (meta.config.maintenanceMode === '1' && !isAllowed(req.url)) {
if (!req.user) { if (!req.user) {
return render(); return render();
} else { } else {

Loading…
Cancel
Save