From e2ef9b812245a8d4528089ecc0387153ac2e59ce Mon Sep 17 00:00:00 2001 From: David Bolack Date: Tue, 20 Feb 2024 16:44:17 -0600 Subject: [PATCH] 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. --- server/homebrew.api.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index 49ab43893..e99b1b1d9 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -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)=>{