From 1abced20d673c86aac1ba84725a9392ceeaefafd Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 31 Jul 2024 16:53:34 -0400 Subject: [PATCH 1/2] Do not fetch user themes if there is no user. --- server/homebrew.api.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index c7484da92..569d35202 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -46,6 +46,9 @@ const api = { }, //Get array of any of this user's brews tagged with `meta:theme` getUsersBrewThemes : async (username)=>{ + if(!username) + return {}; + const fields = [ 'title', 'tags', @@ -251,16 +254,12 @@ const api = { res.status(200).send(saved); }, getThemeBundle : async(req, res)=>{ - /* - getThemeBundle: Collects the theme and all parent themes - returns an object containing an array of css, in render order, and an array - of snippets ( currently empty ) - Important parameter members: - req.params.id: This is the shareId ( User theme ) or name ( static theme ) - loaded first. - req.params.renderer: This is the Markdown+ version for the static theme. If a - User theme the value will come from the User Theme metadata. - */ + /* getThemeBundle: Collects the theme and all parent themes + returns an object containing an array of css, and an array of snippets, in render order + + req.params.id : The shareId ( User theme ) or name ( static theme ) + req.params.renderer : The Markdown renderer used for this theme */ + req.params.renderer = _.upperFirst(req.params.renderer); let currentTheme; const completeStyles = []; From 27a4831ea0cf92bac593ca9c7804efee0414f14d Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 31 Jul 2024 16:53:54 -0400 Subject: [PATCH 2/2] Add a theme to our reference pages (changelog, FAQ, migrate) --- server/app.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/app.js b/server/app.js index 6863bc7cb..b419c5cea 100644 --- a/server/app.js +++ b/server/app.js @@ -115,7 +115,8 @@ app.get('/legacy', (req, res, next)=>{ app.get('/migrate', (req, res, next)=>{ req.brew = { text : migrateText, - renderer : 'V3' + renderer : 'V3', + theme : '5ePHB' }, req.ogMeta = { ...defaultMetaTags, @@ -132,7 +133,8 @@ app.get('/changelog', async (req, res, next)=>{ req.brew = { title : 'Changelog', text : changelogText, - renderer : 'V3' + renderer : 'V3', + theme : '5ePHB' }, req.ogMeta = { ...defaultMetaTags, @@ -149,7 +151,8 @@ app.get('/faq', async (req, res, next)=>{ req.brew = { title : 'FAQ', text : faqText, - renderer : 'V3' + renderer : 'V3', + theme : '5ePHB' }, req.ogMeta = { ...defaultMetaTags,