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:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user