From 2dfb5637c6d1b7447f26b3505568c24f901cd6ff Mon Sep 17 00:00:00 2001 From: 5jiji Date: Wed, 10 Jul 2024 20:33:54 +0200 Subject: [PATCH] Fix frontend --- src/server/middleware/middleware.js | 2 +- src/server/middleware/send404.js | 2 +- src/server/routes/root.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/middleware/middleware.js b/src/server/middleware/middleware.js index e72174e86..1d016b1ca 100644 --- a/src/server/middleware/middleware.js +++ b/src/server/middleware/middleware.js @@ -67,7 +67,7 @@ function configureMiddleware(app) { app.use(cookieParser()); // Serve public assets. (e.g. css, scripts, images, audio. EXCLUDING htmls) - app.use(express.static(path.join(__dirname, '..', 'public'))); // Serve public assets + app.use(express.static(path.join(__dirname, '..', '..', '..', 'dist'))); // Serve public assets /** * Sets the req.user and req.role properties if they have an authorization diff --git a/src/server/middleware/send404.js b/src/server/middleware/send404.js index 4b7d5f3e5..a5befad25 100644 --- a/src/server/middleware/send404.js +++ b/src/server/middleware/send404.js @@ -3,7 +3,7 @@ const path = require('path'); function send404(req, res) { res.status(404); if (req.accepts('html')) { - res.sendFile(path.join(__dirname, '..', 'views', 'errors', '404.html')); + res.sendFile(path.join(__dirname, '..', '..', '..', 'dist', 'views', 'errors', '404.html')); } else if (req.accepts('json')) { res.json({ error: "404 Not Found" }); } else { diff --git a/src/server/routes/root.js b/src/server/routes/root.js index 75f5f6dd1..61a0490cb 100644 --- a/src/server/routes/root.js +++ b/src/server/routes/root.js @@ -11,7 +11,7 @@ const { verifyAccount } = require('../controllers/verifyAccountController'); const { ensureOwner, ensurePatron } = require('../middleware/verifyRoles'); const { getCachedHTML, sendCachedHTML } = require('../utility/HTMLScriptInjector'); -const htmlDirectory = path.join(__dirname, '..', 'dist', 'views'); +const htmlDirectory = path.join(__dirname, '..', '..', '..', 'dist', 'views'); // router.get('/skeleton(.html)?', (req, res) => { // If it starts & ends with '/', OR it's '/index.html' OR '/index' // res.sendFile(path.join(__dirname, '../views', 'skeleton.html'));