mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 16:22:44 +00:00
Update server.js
Initial commit of incorporating `brew.style` into /source and /download pages
This commit is contained in:
@@ -113,7 +113,7 @@ app.get('/source/:id', asyncHandler(async (req, res)=>{
|
||||
const brew = await getBrewFromId(req.params.id, 'share');
|
||||
|
||||
const replaceStrings = { '&': '&', '<': '<', '>': '>' };
|
||||
let text = brew.text;
|
||||
let text = `\`\`\`css\n${brew.style}\n\`\`\`\n\n${brew.text}`;
|
||||
for (const replaceStr in replaceStrings) {
|
||||
text = text.replaceAll(replaceStr, replaceStrings[replaceStr]);
|
||||
}
|
||||
@@ -132,8 +132,9 @@ app.get('/download/:id', asyncHandler(async (req, res)=>{
|
||||
'Cache-Control' : 'no-cache',
|
||||
'Content-Type' : 'text/plain',
|
||||
'Content-Disposition' : `attachment; filename="${fileName}.txt"`
|
||||
});
|
||||
res.status(200).send(brew.text);
|
||||
});
|
||||
let text = `\`\`\`css\n${brew.style}\n\`\`\`\n\n${brew.text}`;
|
||||
res.status(200).send(text);
|
||||
}));
|
||||
|
||||
//User Page
|
||||
|
||||
Reference in New Issue
Block a user