From 4a1cad43c8e6156d57e98dbe9dfb0bb1dcc51346 Mon Sep 17 00:00:00 2001 From: MrFry Date: Sun, 3 Nov 2019 16:40:51 +0100 Subject: [PATCH] Proper 404 handling --- modules/main.js | 7 ++----- modules/qmining.js | 7 ++----- modules/sio.js | 7 ++----- modules/stuff.js | 7 ++----- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/modules/main.js b/modules/main.js index c80b075..73fbcbd 100644 --- a/modules/main.js +++ b/modules/main.js @@ -54,14 +54,11 @@ app.get('/', function (req, res) { }) app.get('*', function (req, res) { - res.render('shared/404') - res.status(404) - // utils.AppendToFile(logger.GetDateString() + ": " + "404 GET", logFile); + res.status(404).render('shared/404') }) app.post('*', function (req, res) { - res.status(404) - // utils.AppendToFile(logger.GetDateString() + ": " + "404 POST", logFile); + res.status(404).render('shared/404') }) exports.app = app diff --git a/modules/qmining.js b/modules/qmining.js index b7d75df..51c2ad3 100644 --- a/modules/qmining.js +++ b/modules/qmining.js @@ -201,14 +201,11 @@ app.route('/badtestsender').post(function (req, res, next) { }) app.get('*', function (req, res) { - res.render('shared/404') - res.status(404) - // utils.AppendToFile(logger.GetDateString() + ": " + "404 GET", logFile); + res.status(404).render('shared/404') }) app.post('*', function (req, res) { - res.status(404) - // utils.AppendToFile(logger.GetDateString() + ": " + "404 POST", logFile); + res.status(404).render('shared/404') }) exports.app = app diff --git a/modules/sio.js b/modules/sio.js index 4006016..e25fcdd 100644 --- a/modules/sio.js +++ b/modules/sio.js @@ -83,14 +83,11 @@ app.route('/fosuploader').post(function (req, res, next) { }) }) app.get('*', function (req, res) { - res.render('shared/404') - res.status(404) - // utils.AppendToFile(logger.GetDateString() + ": " + "404 GET", logFile); + res.status(404).render('shared/404') }) app.post('*', function (req, res) { - res.status(404) - // utils.AppendToFile(logger.GetDateString() + ": " + "404 POST", logFile); + res.status(404).render('shared/404') }) exports.app = app diff --git a/modules/stuff.js b/modules/stuff.js index 4b6dc72..e6ca958 100644 --- a/modules/stuff.js +++ b/modules/stuff.js @@ -155,14 +155,11 @@ app.get('/*', function (req, res) { // ----------------------------------------------------------------------------------------------- app.get('*', function (req, res) { - res.render('shared/404') - res.status(404) - // utils.AppendToFile(logger.GetDateString() + ": " + "404 GET", logFile); + res.status(404).render('shared/404') }) app.post('*', function (req, res) { - res.status(404) - // utils.AppendToFile(logger.GetDateString() + ": " + "404 POST", logFile); + res.status(404).render('shared/404') }) exports.app = app