0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 16:22:44 +00:00

use same theme endpoint for user and static themes

`getThemeBundle()` rework no longer needs two separate endpoints
This commit is contained in:
Trevor Buckner
2024-07-20 11:39:23 -04:00
parent f364f054f8
commit 0a5ff213de
2 changed files with 1 additions and 7 deletions

View File

@@ -175,10 +175,7 @@ const BrewRenderer = (props)=>{
// Loads the theme bundle and parses it out. Called when the iFrame is first mounted, and when a new theme is selected
const loadAllBrewStylesAndSnippets = ()=>{
const rendererPath = isStaticTheme(props.renderer, props.theme) ? `/${props.renderer}/` : '/';
// Load the themeBundle from the endpoint as an object
fetch(`${window.location.protocol}//${window.location.host}/theme${rendererPath}${props.theme}`).then((response)=>response.json()).then((themeBundle)=>{
fetch(`${window.location.protocol}//${window.location.host}/theme/${props.renderer}/${props.theme}`).then((response)=>response.json()).then((themeBundle)=>{
themeBundle.joinedStyles = themeBundle.styles.map(style => `<style>${style}</style>`).join('\n\n'); //DOMPurify.sanitize(joinedStyles, purifyConfig);
setState((prevState)=>({
...prevState,

View File

@@ -78,9 +78,6 @@ app.get('/robots.txt', (req, res)=>{
});
// Theme
// Path for User Themes
app.get('/theme/:id', asyncHandler(getThemeBundle));
// Path for Static Themes
app.get('/theme/:renderer/:id', asyncHandler(getThemeBundle));
//Home page