From cf5aeace6b61e2a4d0686d278c36758ecd86b7b3 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Thu, 9 May 2019 14:49:38 -0400 Subject: [PATCH] feat: closes #7583 --- install/data/defaults.json | 1 + public/language/en-GB/admin/settings/advanced.json | 1 + src/middleware/maintenance.js | 2 +- src/views/admin/settings/advanced.tpl | 4 ++++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/install/data/defaults.json b/install/data/defaults.json index c99c67b42d..b2bcbec5af 100644 --- a/install/data/defaults.json +++ b/install/data/defaults.json @@ -95,6 +95,7 @@ "feeds:disableSitemap": 0, "sitemapTopics": 500, "maintenanceMode": 0, + "maintenanceModeStatus": 503, "votesArePublic": 0, "maximumInvites": 0, "username:disableEdit": 0, diff --git a/public/language/en-GB/admin/settings/advanced.json b/public/language/en-GB/admin/settings/advanced.json index f989898d05..4bd6b2aa60 100644 --- a/public/language/en-GB/admin/settings/advanced.json +++ b/public/language/en-GB/admin/settings/advanced.json @@ -1,6 +1,7 @@ { "maintenance-mode": "Maintenance Mode", "maintenance-mode.help": "When the forum is in maintenance mode, all requests will be redirected to a static holding page. Administrators are exempt from this redirection, and are able to access the site normally.", + "maintenance-mode.status": "Maintenance Mode Status Code", "maintenance-mode.message": "Maintenance Message", "headers": "Headers", "headers.allow-from": "Set ALLOW-FROM to Place NodeBB in an iFrame", diff --git a/src/middleware/maintenance.js b/src/middleware/maintenance.js index 4297c88494..e98a75b9ef 100644 --- a/src/middleware/maintenance.js +++ b/src/middleware/maintenance.js @@ -24,7 +24,7 @@ module.exports = function (middleware) { if (isAdmin) { return callback(); } - res.status(503); + res.status(meta.config.maintenanceModeStatus); data = { site_title: meta.config.title || 'NodeBB', message: meta.config.maintenanceModeMessage, diff --git a/src/views/admin/settings/advanced.tpl b/src/views/admin/settings/advanced.tpl index 4aec0e51fa..79af8dde7f 100644 --- a/src/views/admin/settings/advanced.tpl +++ b/src/views/admin/settings/advanced.tpl @@ -13,6 +13,10 @@

[[admin/settings/advanced:maintenance-mode.help]]

+
+ + +