mirror of
https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git
synced 2025-05-15 21:00:00 -04:00
fix rammerhead crashing
This commit is contained in:
parent
8c27b43a63
commit
846aa1d392
1 changed files with 10 additions and 7 deletions
|
@ -93,13 +93,16 @@ app.use(helmet({
|
|||
// This takes one of those files and displays it for a site visitor.
|
||||
// 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(
|
||||
path.join(__dirname,
|
||||
'views',
|
||||
// This returns the file path, and has the index page set as the home page.
|
||||
'/?'.indexOf(req.url) ? pages[Object.keys(req.query)[0]] : pages.index
|
||||
)
|
||||
)))));
|
||||
router.get('/', async (req, res) => {
|
||||
const paramKey = Object.keys(req.query)[0];
|
||||
const filePath = paramKey ? pages[paramKey] : pages.index;
|
||||
|
||||
const validPath = filePath || pages.index;
|
||||
|
||||
res.send(paintSource(loadTemplates(tryReadFile(
|
||||
path.join(__dirname, 'views', validPath)
|
||||
))));
|
||||
});
|
||||
|
||||
|
||||
app.use(router);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue