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

Switch CSS route to call a function

This commit is contained in:
G.Ambatte
2024-08-12 18:48:28 +12:00
parent 190bce519f
commit 7d699e455e

View File

@@ -201,16 +201,20 @@ app.get('/download/:id', asyncHandler(getBrew('share')), (req, res)=>{
});
//Serve brew styling
app.get('/css/:id', asyncHandler(getBrew('share')), (req, res)=>{
app.get('/css/:id', asyncHandler(getBrew('share')), ((req, res)=>{app.getCSS(req, res);}));
app.getCSS = (req, res)=>{
const { brew } = req;
if(!brew) return res.status(404).send();
splitTextStyleAndMetadata(brew);
if(!brew.style) return res.status(404).send();
res.set({
'Cache-Control' : 'no-cache',
'Content-Type' : 'text/css'
});
res.status(200).send(brew.style);
});
return res.status(200).send(brew.style);
};
//User Page
app.get('/user/:username', async (req, res, next)=>{