Development #287

Merged
bones7242 merged 58 commits from development into master 2017-12-11 20:53:02 +01:00
3 changed files with 15 additions and 14 deletions
Showing only changes of commit 6e20f89317 - Show all commits

View file

@ -16,11 +16,9 @@ module.exports = {
res.status(200).sendFile(filePath, options);
},
showFile (claimInfo, shortId, res) {
const openGraphInfo = module.exports.createOpenGraphInfo(claimInfo);
res.status(200).render('show', { layout: 'show', claimInfo, shortId, openGraphInfo });
res.status(200).render('show', { layout: 'show', claimInfo, shortId });
},
showFileLite (claimInfo, shortId, res) {
const openGraphInfo = module.exports.createOpenGraphInfo(claimInfo);
res.status(200).render('showLite', { layout: 'showlite', claimInfo, shortId, openGraphInfo });
res.status(200).render('showLite', { layout: 'showlite', claimInfo, shortId });
},
};

View file

@ -1,8 +1,8 @@
const logger = require('winston');
const { returnShortId } = require('../helpers/sequelizeHelpers.js');
const DEFAULT_THUMBNAIL = 'https://spee.ch/assets/img/video_thumb_default.png';
const DEFAULT_TITLE = '';
const DEFAULT_DESCRIPTION = '';
const DEFAULT_TITLE = 'Spee<ch';
const DEFAULT_DESCRIPTION = 'Decentralized video and content hosting.';
function determineFileExtensionFromContentType (contentType) {
switch (contentType) {
@ -72,13 +72,15 @@ function addOpengraphDataToClaim (claim) {
claim['ogTitle'] = determineOgTitle(claim.title, DEFAULT_TITLE);
claim['ogDescription'] = determineOgDescription(claim.description, DEFAULT_DESCRIPTION);
claim['ogThumbnailContentType'] = determineOgThumbnailContentType(claim.thumbnail);
return claim;
};
function prepareClaimData (claimData) {
claimData['thumbnail'] = determineThumbnail(claimData.thumbnail, DEFAULT_THUMBNAIL);
claimData['fileExt'] = determineFileExtensionFromContentType(claimData.contentType);
claimData = addOpengraphDataToClaim(claimData);
return claimData;
function prepareClaimData (claim) {
// logger.debug('preparing claim data based on resolved data:', claim);
claim['thumbnail'] = determineThumbnail(claim.thumbnail, DEFAULT_THUMBNAIL);
claim['fileExt'] = determineFileExtensionFromContentType(claim.contentType);
claim = addOpengraphDataToClaim(claim);
return claim;
};
module.exports = (sequelize, { STRING, BOOLEAN, INTEGER, TEXT, DECIMAL }) => {
@ -393,6 +395,7 @@ module.exports = (sequelize, { STRING, BOOLEAN, INTEGER, TEXT, DECIMAL }) => {
where: { name, claimId },
})
.then(claimArray => {
logger.debug('claims found on resolve:', claimArray.length);
switch (claimArray.length) {
case 0:
return resolve(null);

View file

@ -184,9 +184,9 @@ function showAssetToClient (claimId, name, res) {
});
}
function showPlainAssetToClient (claimId, name, res) {
function showLiteAssetToClient (claimId, name, res) {
return Promise
.all([db.Claim.resolveClaim(claimId, name), db.Claim.getShortClaimIdFromLongClaimId(claimId, name)])
.all([db.Claim.resolveClaim(name, claimId), db.Claim.getShortClaimIdFromLongClaimId(claimId, name)])
.then(([claimInfo, shortClaimId]) => {
logger.debug('claimInfo:', claimInfo);
logger.debug('shortClaimId:', shortClaimId);
@ -217,7 +217,7 @@ function showOrServeAsset (responseType, claimId, claimName, res) {
case SHOW:
return showAssetToClient(claimId, claimName, res);
case SHOWLITE:
return showPlainAssetToClient(claimId, claimName, res);
return showLiteAssetToClient(claimId, claimName, res);
case SERVE:
return serveAssetToClient(claimId, claimName, res);
default: