mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-08 18:22:40 +00:00
Switch CSS route to call a function
This commit is contained in:
@@ -201,16 +201,20 @@ app.get('/download/:id', asyncHandler(getBrew('share')), (req, res)=>{
|
|||||||
});
|
});
|
||||||
|
|
||||||
//Serve brew styling
|
//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;
|
const { brew } = req;
|
||||||
|
if(!brew) return res.status(404).send();
|
||||||
splitTextStyleAndMetadata(brew);
|
splitTextStyleAndMetadata(brew);
|
||||||
|
if(!brew.style) return res.status(404).send();
|
||||||
|
|
||||||
res.set({
|
res.set({
|
||||||
'Cache-Control' : 'no-cache',
|
'Cache-Control' : 'no-cache',
|
||||||
'Content-Type' : 'text/css'
|
'Content-Type' : 'text/css'
|
||||||
});
|
});
|
||||||
res.status(200).send(brew.style);
|
return res.status(200).send(brew.style);
|
||||||
});
|
};
|
||||||
|
|
||||||
//User Page
|
//User Page
|
||||||
app.get('/user/:username', async (req, res, next)=>{
|
app.get('/user/:username', async (req, res, next)=>{
|
||||||
|
|||||||
Reference in New Issue
Block a user