This repository has been archived by the owner on Sep 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed 404 on /random, edited the router system a bit for simplicity, …
…hid the error message for security
- Loading branch information
1 parent
168992a
commit e765c6b
Showing
4 changed files
with
41 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
const express = require('express'); | ||
|
||
module.exports = [ | ||
{ | ||
path: "/random/:type", | ||
method: "get", | ||
router: (req, res, data, logger) => { | ||
const type = req.params.type; | ||
if (!type) return res.redirect('/random/neko'); | ||
if (!['neko', 'kitsune', 'lewd', 'hug', 'kiss', 'pat', 'slap'].includes(type)) return res.redirect('/random/neko'); | ||
|
||
module.exports = { | ||
path: "/random/:type", | ||
method: "get", | ||
router: (req, res, data, logger) => { | ||
const type = req.params.type; | ||
if (!type) return res.status(400).json({ message: 'Bad request.' }); | ||
if (!['neko', 'kitsune', 'lewd', 'hug', 'kiss', 'pat', 'slap'].includes(type)) return res.redirect('/random/neko'); | ||
|
||
return res.render('random', { | ||
page: req.url, | ||
type: type | ||
}); | ||
return res.render('random', { | ||
page: req.url, | ||
type: type | ||
}); | ||
} | ||
}, | ||
{ | ||
path: "/random", | ||
method: "get", | ||
router: (req, res) => { | ||
return res.redirect('/random/neko'); | ||
} | ||
} | ||
}; | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters