mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 02:41:50 +03:00
e2eef2a6d3
refs: TryGhost#13380 - The i18n package is deprecated. It is being replaced with the tpl package.
26 lines
799 B
JavaScript
26 lines
799 B
JavaScript
const errors = require('@tryghost/errors');
|
|
const config = require('../../../../shared/config');
|
|
const tpl = require('@tryghost/tpl');
|
|
const urlService = require('../../../../frontend/services/url');
|
|
|
|
const messages = {
|
|
maintenance: 'Site is currently undergoing maintenance, please wait a moment then retry.',
|
|
maintenanceUrlService: 'Site is starting up, please wait a moment then retry.'
|
|
};
|
|
|
|
module.exports = function maintenance(req, res, next) {
|
|
if (config.get('maintenance').enabled) {
|
|
return next(new errors.MaintenanceError({
|
|
message: tpl(messages.maintenance)
|
|
}));
|
|
}
|
|
|
|
if (!urlService.hasFinished()) {
|
|
return next(new errors.MaintenanceError({
|
|
message: tpl(messages.maintenanceUrlService)
|
|
}));
|
|
}
|
|
|
|
next();
|
|
};
|