diff --git a/client/homebrew/pages/homePage/homePage.jsx b/client/homebrew/pages/homePage/homePage.jsx index bcfd237b4..490b22596 100644 --- a/client/homebrew/pages/homePage/homePage.jsx +++ b/client/homebrew/pages/homePage/homePage.jsx @@ -95,6 +95,7 @@ const HomePage = createClass({ onTextChange={this.handleTextChange} renderer={this.state.brew.renderer} showEditButtons={false} + snippetBundle={this.state.themeBundle.snippets} /> =6.9.0" @@ -5484,9 +5484,9 @@ } }, "node_modules/dompurify": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.5.tgz", - "integrity": "sha512-lwG+n5h8QNpxtyrJW/gJWckL+1/DQiYMX8f7t8Z2AZTPw1esVrqjI63i7Zc2Gz0aKzLVMYC1V1PL/ky+aY/NgA==" + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.6.tgz", + "integrity": "sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ==" }, "node_modules/duplexer2": { "version": "0.1.4", diff --git a/package.json b/package.json index 57b6bb4f9..dc5c68e10 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ ] }, "dependencies": { - "@babel/core": "^7.24.7", + "@babel/core": "^7.25.2", "@babel/plugin-transform-runtime": "^7.24.7", "@babel/preset-env": "^7.25.2", "@babel/preset-react": "^7.24.7", @@ -94,7 +94,7 @@ "cookie-parser": "^1.4.6", "create-react-class": "^15.7.0", "dedent-tabs": "^0.10.3", - "dompurify": "^3.1.5", + "dompurify": "^3.1.6", "expr-eval": "^2.0.2", "express": "^4.19.2", "express-async-handler": "^1.2.0", 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, diff --git a/server/homebrew.api.js b/server/homebrew.api.js index c7484da92..c314454e2 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', @@ -183,7 +186,7 @@ const api = { return modified; }, excludeStubProps : (brew)=>{ - const propsToExclude = ['text', 'textBin', 'renderer', 'pageCount']; + const propsToExclude = ['text', 'textBin']; for (const prop of propsToExclude) { brew[prop] = undefined; } @@ -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 = [];