added open graph meta tags
This commit is contained in:
parent
4f5ceb1bf9
commit
b17e013584
6 changed files with 39 additions and 9 deletions
helpers
|
@ -60,6 +60,14 @@ function checkLocalDbForClaims (name, shortUrl) {
|
|||
});
|
||||
}
|
||||
|
||||
function createOpenGraphInfo ({ fileType, claimId, name, fileExt }) {
|
||||
return {
|
||||
type : fileType.substring(0, fileType.indexOf('/')),
|
||||
showUrl: `https://spee.ch/${claimId}/${name}`,
|
||||
source : `https://spee.ch/${claimId}/${name}${fileExt}`,
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
serveFile ({ fileName, fileType, filePath }, res) {
|
||||
logger.info(`serving file ${fileName}`);
|
||||
|
@ -86,11 +94,12 @@ module.exports = {
|
|||
res.status(200).sendFile(filePath, options);
|
||||
},
|
||||
showFile (fileInfo, res) {
|
||||
res.status(200).render('show', { layout: 'show', fileInfo });
|
||||
const openGraphInfo = createOpenGraphInfo(fileInfo);
|
||||
res.status(200).render('show', { layout: 'show', fileInfo, openGraphInfo });
|
||||
},
|
||||
showFileLite (fileInfo, res) {
|
||||
logger.debug('showing file lite');
|
||||
res.status(200).render('showLite', { layout: 'show', fileInfo });
|
||||
const openGraphInfo = createOpenGraphInfo(fileInfo);
|
||||
res.status(200).render('showLite', { layout: 'show', fileInfo, openGraphInfo });
|
||||
},
|
||||
getClaimIdFromShortUrl (shortUrl, name) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue