mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-08 03:12:40 +00:00
Fixes from Linter
This commit is contained in:
10
server.js
10
server.js
@@ -99,8 +99,8 @@ const shareFunction = function(req, res, type) {
|
|||||||
|
|
||||||
const setSourceHeaders = function (res, title, type) {
|
const setSourceHeaders = function (res, title, type) {
|
||||||
res.status(200);
|
res.status(200);
|
||||||
if (type == 'download') {
|
if(type == 'download') {
|
||||||
let fileName = sanitizeFilename(title).replaceAll(' ', '-');
|
const fileName = sanitizeFilename(title).replaceAll(' ', '-');
|
||||||
|
|
||||||
res.set({
|
res.set({
|
||||||
'Cache-Control' : 'no-cache',
|
'Cache-Control' : 'no-cache',
|
||||||
@@ -108,18 +108,18 @@ const setSourceHeaders = function (res, title, type) {
|
|||||||
'Content-Disposition' : `attachment; filename="HomeBrewery-${fileName}.txt"`
|
'Content-Disposition' : `attachment; filename="HomeBrewery-${fileName}.txt"`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const getSourceText = function (brewText, type) {
|
const getSourceText = function (brewText, type) {
|
||||||
if(type == 'source') {
|
if(type == 'source') {
|
||||||
return `<code><pre style="white-space: pre-wrap;">${brewText.replaceAll('&', '&').replaceAll('<','<').replaceAll('>', '>')}</pre></code>`;
|
return `<code><pre style="white-space: pre-wrap;">${brewText.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>')}</pre></code>`;
|
||||||
} else if(type == 'download') {
|
} else if(type == 'download') {
|
||||||
return brewText;
|
return brewText;
|
||||||
} else {
|
} else {
|
||||||
console.log('Unhandled source share type');
|
console.log('Unhandled source share type');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//Source page
|
//Source page
|
||||||
app.get('/source/:id', (req, res)=>{
|
app.get('/source/:id', (req, res)=>{
|
||||||
|
|||||||
Reference in New Issue
Block a user