Merge branch 'main' into double-search

This commit is contained in:
Alec Armbruster 2023-06-25 13:18:55 -04:00 committed by GitHub
commit 9f6b48c665
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,22 +11,21 @@ export default async (req: Request, res: Response) => {
const theme = req.params.name; const theme = req.params.name;
if (!theme.endsWith(".css")) { if (!theme.endsWith(".css")) {
res.statusCode = 400; return res.status(400).send("Theme must be a css file");
res.send("Theme must be a css file");
} }
const customTheme = path.resolve(extraThemesFolder, theme); const customTheme = path.resolve(extraThemesFolder, theme);
if (existsSync(customTheme)) { if (existsSync(customTheme)) {
res.sendFile(customTheme); return res.sendFile(customTheme);
} else { } else {
const internalTheme = path.resolve(`./dist/assets/css/themes/${theme}`); const internalTheme = path.resolve(`./dist/assets/css/themes/${theme}`);
// If the theme doesn't exist, just send litely // If the theme doesn't exist, just send litely
if (existsSync(internalTheme)) { if (existsSync(internalTheme)) {
res.sendFile(internalTheme); return res.sendFile(internalTheme);
} else { } else {
res.sendFile(path.resolve("./dist/assets/css/themes/litely.css")); return res.sendFile(path.resolve("./dist/assets/css/themes/litely.css"));
} }
} }
}; };