mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-09 07:12:40 +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 brew = await getBrewFromId(req.params.id, 'share');
|
||||||
|
|
||||||
const replaceStrings = { '&': '&', '<': '<', '>': '>' };
|
const replaceStrings = { '&': '&', '<': '<', '>': '>' };
|
||||||
let text = brew.text;
|
let text = `\`\`\`css\n${brew.style}\n\`\`\`\n\n${brew.text}`;
|
||||||
for (const replaceStr in replaceStrings) {
|
for (const replaceStr in replaceStrings) {
|
||||||
text = text.replaceAll(replaceStr, replaceStrings[replaceStr]);
|
text = text.replaceAll(replaceStr, replaceStrings[replaceStr]);
|
||||||
}
|
}
|
||||||
@@ -132,8 +132,9 @@ app.get('/download/:id', asyncHandler(async (req, res)=>{
|
|||||||
'Cache-Control' : 'no-cache',
|
'Cache-Control' : 'no-cache',
|
||||||
'Content-Type' : 'text/plain',
|
'Content-Type' : 'text/plain',
|
||||||
'Content-Disposition' : `attachment; filename="${fileName}.txt"`
|
'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
|
//User Page
|
||||||
|
|||||||
Reference in New Issue
Block a user