0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-04 16:52:38 +00:00

Lint App.js

Just whitespace changes
This commit is contained in:
Trevor Buckner
2024-09-16 01:39:44 -04:00
parent a283438b28
commit 1645a5acf4

View File

@@ -203,22 +203,22 @@ app.get('/download/:id', asyncHandler(getBrew('share')), (req, res)=>{
}); });
//Serve brew metadata //Serve brew metadata
app.get('/metadata/:id', asyncHandler(getBrew('share')), (req, res) => { app.get('/metadata/:id', asyncHandler(getBrew('share')), (req, res)=>{
const { brew } = req; const { brew } = req;
sanitizeBrew(brew, 'share'); sanitizeBrew(brew, 'share');
const fields = [ 'title', 'pageCount', 'description', 'authors', 'lang', const fields = ['title', 'pageCount', 'description', 'authors', 'lang',
'published', 'views', 'shareId', 'createdAt', 'updatedAt', 'published', 'views', 'shareId', 'createdAt', 'updatedAt',
'lastViewed', 'thumbnail', 'tags' 'lastViewed', 'thumbnail', 'tags'
]; ];
const metadata = fields.reduce((acc, field) => { const metadata = fields.reduce((acc, field)=>{
if (brew[field] !== undefined) acc[field] = brew[field]; if(brew[field] !== undefined) acc[field] = brew[field];
return acc; return acc;
}, {}); }, {});
res.status(200).json(metadata); res.status(200).json(metadata);
}); });
//Serve brew styling //Serve brew styling
app.get('/css/:id', asyncHandler(getBrew('share')), (req, res)=>{getCSS(req, res);}); app.get('/css/:id', asyncHandler(getBrew('share')), (req, res)=>{getCSS(req, res);});
@@ -378,7 +378,7 @@ app.get('/share/:id', asyncHandler(getBrew('share')), asyncHandler(async (req, r
app.get('/account', asyncHandler(async (req, res, next)=>{ app.get('/account', asyncHandler(async (req, res, next)=>{
const data = {}; const data = {};
data.title = 'Account Information Page'; data.title = 'Account Information Page';
if(!req.account) { if(!req.account) {
res.set('WWW-Authenticate', 'Bearer realm="Authorization Required"'); res.set('WWW-Authenticate', 'Bearer realm="Authorization Required"');
const error = new Error('No valid account'); const error = new Error('No valid account');
@@ -462,8 +462,8 @@ app.get('/vault', asyncHandler(async(req, res, next)=>{
//Send rendered page //Send rendered page
app.use(asyncHandler(async (req, res, next)=>{ app.use(asyncHandler(async (req, res, next)=>{
if (!req.route) return res.redirect('/'); // Catch-all for invalid routes if(!req.route) return res.redirect('/'); // Catch-all for invalid routes
const page = await renderPage(req, res); const page = await renderPage(req, res);
if(!page) return; if(!page) return;
res.send(page); res.send(page);