0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 20:42:43 +00:00

Report Theme title with CSS

This adds a comment/field ( depending on endpoint ) that reports the
name of the Brew being used as a theming source.
This commit is contained in:
David Bolack
2024-02-20 16:44:17 -06:00
parent 8e48df5de1
commit e2ef9b8122

View File

@@ -220,8 +220,9 @@ const api = {
req.brew.text = req.brew.text.slice(index + 5);
}
return res.status(200).send({
parent : req.brew.theme,
theme : req.brew.style
parent : req.brew.theme,
theme : req.brew.style,
themeName : req.brew.title
});
},
getBrewThemeAsCSS : async (req, res)=>{
@@ -241,7 +242,7 @@ const api = {
if(res.hasOwnProperty('set')) {
res.set('Content-Type', 'text/css');
}
return res.status(200).send(req.brew.style);
return res.status(200).send(`// From Theme: ${req.brew.title}\n\n${req.brew.style}`);
},
getBrewThemeWithCSS : async (req, res)=>{
req.brew.text = req.brew.text.replaceAll('\r\n', '\n');
@@ -260,7 +261,7 @@ const api = {
if(res.hasOwnProperty('set')) {
res.set('Content-Type', 'text/css');
}
const parentThemeImport = `@import /themes/${req.brew.renderer}/${req.brew.theme}/styles.css\n\n`;
const parentThemeImport = `// From Theme: ${req.brew.title}\n\n@import /themes/${req.brew.renderer}/${req.brew.theme}/styles.css\n\n`;
return res.status(200).send(`${req.brew.renderer == 'legacy' ? '' : parentThemeImport}${req.brew.style}`);
},
updateBrew : async (req, res)=>{