mirror of
https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git
synced 2025-05-15 12:50:01 -04:00
Reverting to the old logic to implement a 404 page in place of where it would crash.
This commit is contained in:
parent
e2fd72b8ba
commit
a5cdc305aa
1 changed files with 7 additions and 4 deletions
|
@ -94,10 +94,13 @@ app.use(helmet({
|
|||
// 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.
|
||||
router.get('/', async (req, res) => res.send(paintSource(loadTemplates(tryReadFile(
|
||||
// Return the index page if the query is not found, as there is no
|
||||
// undefined page in routes.mjs. Also sets it as the default page.
|
||||
path.join(__dirname, 'views', pages[Object.keys(req.query)[0]] || pages.index)
|
||||
)))));
|
||||
path.join(__dirname,
|
||||
'views',
|
||||
// Return the error page if the query is not found, as there is no
|
||||
// undefined page in routes.mjs. Also set index as the default page.
|
||||
'/?'.indexOf(req.url) ? pages[Object.keys(req.query)[0]] || text404 : pages.index
|
||||
)
|
||||
)))));
|
||||
|
||||
|
||||
app.use(router);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue