Fix themes not being found in theme selector dropdown

This commit is contained in:
Jérémie Astori 2018-01-12 00:46:55 -05:00
parent 3eb017caf8
commit c49239b4f1
No known key found for this signature in database
GPG key ID: B9A4F245CD67BDE8
2 changed files with 5 additions and 2 deletions

View file

@ -14,7 +14,7 @@ module.exports = {
};
function loadLocalThemes() {
fs.readdir(path.join(__dirname, "..", "..", "public", "themes"), (err, builtInThemes) => {
fs.readdir(path.join(__dirname, "..", "..", "..", "public", "themes"), (err, builtInThemes) => {
if (err) {
return;
}
@ -46,7 +46,6 @@ function makeLocalThemeObject(css) {
const themeName = css.slice(0, -4);
return {
displayName: themeName.charAt(0).toUpperCase() + themeName.slice(1),
filename: path.join(__dirname, "..", "..", "public", "themes", `${themeName}.css`),
name: themeName,
};
}

View file

@ -48,6 +48,10 @@ module.exports = function() {
maxAge: 86400 * 1000,
}));
// This route serves *installed themes only*. Local themes are served directly
// from the `public/themes/` folder as static assets, without entering this
// handler. Remember this is you make changes to this function, serving of
// local themes will not get those changes.
app.get("/themes/:theme.css", (req, res) => {
const themeName = req.params.theme;
const theme = themes.getFilename(themeName);