2017-07-17 22:16:11 +02:00
|
|
|
const logger = require('winston');
|
|
|
|
|
|
|
|
module.exports = {
|
2017-11-28 00:57:20 +01:00
|
|
|
serveFile ({ filePath, fileType }, claimId, name, res) {
|
2017-12-14 21:32:20 +01:00
|
|
|
logger.verbose(`serving file: ${filePath}`);
|
2017-11-21 21:53:43 +01:00
|
|
|
// set response options
|
2017-11-28 00:57:20 +01:00
|
|
|
const headerContentType = fileType || 'image/jpeg';
|
2017-11-21 21:53:43 +01:00
|
|
|
const options = {
|
2017-07-17 22:16:11 +02:00
|
|
|
headers: {
|
|
|
|
'X-Content-Type-Options': 'nosniff',
|
2017-11-21 21:53:43 +01:00
|
|
|
'Content-Type' : headerContentType,
|
2017-07-17 22:16:11 +02:00
|
|
|
},
|
|
|
|
};
|
|
|
|
// send the file
|
2017-11-28 01:53:32 +01:00
|
|
|
res.status(200).sendFile(filePath, options);
|
2017-07-17 22:16:11 +02:00
|
|
|
},
|
2017-11-27 23:35:29 +01:00
|
|
|
showFile (claimInfo, shortId, res) {
|
2017-12-14 21:32:20 +01:00
|
|
|
logger.verbose(`showing claim: ${claimInfo.name}#${claimInfo.claimId}`);
|
2018-01-30 18:00:02 +01:00
|
|
|
res.status(200).render('index');
|
2017-08-01 02:02:39 +02:00
|
|
|
},
|
2017-11-27 23:35:29 +01:00
|
|
|
showFileLite (claimInfo, shortId, res) {
|
2017-12-14 21:32:20 +01:00
|
|
|
logger.verbose(`showlite claim: ${claimInfo.name}#${claimInfo.claimId}`);
|
2018-01-30 18:00:02 +01:00
|
|
|
res.status(200).render('index');
|
2017-08-01 02:02:39 +02:00
|
|
|
},
|
2017-07-17 22:16:11 +02:00
|
|
|
};
|