mirror of
https://github.com/thelounge/thelounge
synced 2024-11-15 00:37:13 +00:00
Merge pull request #1970 from thelounge/astorije/fix-themes
Fix local themes not being found in theme selector dropdown, and serve local themes using the themes route instead of the public folder
This commit is contained in:
commit
1aaa9391db
2 changed files with 5 additions and 2 deletions
|
@ -14,7 +14,7 @@ module.exports = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function loadLocalThemes() {
|
function loadLocalThemes() {
|
||||||
fs.readdir(path.join(__dirname, "..", "..", "public", "themes"), (err, builtInThemes) => {
|
fs.readdir(path.join(__dirname, "..", "..", "..", "public", "themes"), (err, builtInThemes) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,6 @@ function makeLocalThemeObject(css) {
|
||||||
const themeName = css.slice(0, -4);
|
const themeName = css.slice(0, -4);
|
||||||
return {
|
return {
|
||||||
displayName: themeName.charAt(0).toUpperCase() + themeName.slice(1),
|
displayName: themeName.charAt(0).toUpperCase() + themeName.slice(1),
|
||||||
filename: path.join(__dirname, "..", "..", "public", "themes", `${themeName}.css`),
|
|
||||||
name: themeName,
|
name: themeName,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,10 @@ module.exports = function() {
|
||||||
maxAge: 86400 * 1000,
|
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) => {
|
app.get("/themes/:theme.css", (req, res) => {
|
||||||
const themeName = req.params.theme;
|
const themeName = req.params.theme;
|
||||||
const theme = themes.getFilename(themeName);
|
const theme = themes.getFilename(themeName);
|
||||||
|
|
Loading…
Reference in a new issue