0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-05-07 18:48:39 +00:00

Add /embed endpoint

This duplicates the share endpoint. It uses the Share Page template
with a boolean for share vs embed to toggle displaying the navbar
and toolbar.

Added a showToolbar property to brewRender to toggle... showing
the toolbar.
This commit is contained in:
David Bolack
2026-02-06 18:01:53 -06:00
parent fabd280efa
commit f16c8b7663
4 changed files with 55 additions and 36 deletions
+13 -2
View File
@@ -454,8 +454,8 @@ app.get('/new', asyncHandler(async(req, res, next)=>{
return next();
}));
//Share Page
app.get('/share/:id', dbCheck, asyncHandler(getBrew('share')), asyncHandler(async (req, res, next)=>{
const shareEmbedCommon = async (req)=>{
const { brew } = req;
req.ogMeta = { ...defaultMetaTags,
title : `${req.brew.title || 'Untitled Brew'} - ${req.brew.authors[0] || 'No author.'}`,
@@ -478,6 +478,17 @@ app.get('/share/:id', dbCheck, asyncHandler(getBrew('share')), asyncHandler(asyn
brew.authors.includes(req.account?.username) ? sanitizeBrew(req.brew, 'shareAuthor') : sanitizeBrew(req.brew, 'share');
splitTextStyleAndMetadata(req.brew);
};
//Share Page
app.get('/share/:id', dbCheck, asyncHandler(getBrew('share')), asyncHandler(async (req, res, next)=>{
shareEmbedCommon(req);
return next();
}));
//Embed Page
app.get('/embed/:id', dbCheck, asyncHandler(getBrew('share')), asyncHandler(async (req, res, next)=>{
shareEmbedCommon(req);
return next();
}));