Check for invalid theme values in middleware

This commit is contained in:
regalijan 2023-10-19 16:50:05 -04:00
parent a6254b3e6e
commit 969fab85ba
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -126,7 +126,7 @@ async function setTheme(context: RequestContext) {
); );
const theme = themeCookie?.split("=").at(1); const theme = themeCookie?.split("=").at(1);
if (!theme) context.data.theme = "dark"; if (!theme || !["dark", "light"].includes(theme)) context.data.theme = "dark";
else context.data.theme = theme; else context.data.theme = theme;
return await context.next(); return await context.next();