0
0
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:
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 //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)=>{