Slight change to path logic.

This commit is contained in:
00Fjongl 2024-07-08 12:40:18 -05:00
parent 22f404793a
commit e2fd72b8ba

View file

@ -94,9 +94,9 @@ app.use(helmet({
// Query strings like /?j are converted into paths like /views/hidden.html // Query strings like /?j are converted into paths like /views/hidden.html
// back here. Which query string converts to what is defined in routes.mjs. // back here. Which query string converts to what is defined in routes.mjs.
router.get('/', async (req, res) => res.send(paintSource(loadTemplates(tryReadFile( router.get('/', async (req, res) => res.send(paintSource(loadTemplates(tryReadFile(
// Return the index page if the query is not found. // Return the index page if the query is not found, as there is no
// Also sets it as the default page. // undefined page in routes.mjs. Also sets it as the default page.
path.join(__dirname, 'views', pages[Object.keys(req.query)[0] || 'index'] || pages.index) path.join(__dirname, 'views', pages[Object.keys(req.query)[0]] || pages.index)
))))); )))));