Fixed page breaking if cookie is missing.

This commit is contained in:
DebaucheryLibrarian 2024-04-03 23:00:54 +02:00
parent 24f480d384
commit bd8976ecf6
1 changed files with 7 additions and 5 deletions

View File

@ -60,12 +60,14 @@ export default async function initServer() {
router.use('/media', express.static(config.media.path));
router.use((req, res, next) => {
if (req.headers.cookie) {
const cookies = cookie.parse(req.headers.cookie);
/* eslint-disable no-param-reassign */
req.cookies = cookies;
req.tagFilter = cookies.tags ? JSON.parse(cookies.tags) : [];
/* eslint-enable no-param-reassign */
}
next();
});