updated serve url

This commit is contained in:
bill bittner 2018-07-30 15:23:26 -07:00
parent abe405c1b5
commit b401919bb4

View file

@ -5,9 +5,7 @@ const getClaimId = require('../../utils/getClaimId');
const getOEmbedDataForAsset = (channelName, channelClaimId, claimName, claimId) => { const getOEmbedDataForAsset = (channelName, channelClaimId, claimName, claimId) => {
let fileData, claimData; let fileData, claimData;
let data = { let data = {
version : 1.0, version : '1.0',
author_name : 'Spee.ch',
author_url : 'https://spee.ch',
provider_name: 'Spee.ch', provider_name: 'Spee.ch',
provider_url : 'https://spee.ch', provider_url : 'https://spee.ch',
cache_age : 86400, // one day in seconds cache_age : 86400, // one day in seconds
@ -38,17 +36,21 @@ const getOEmbedDataForAsset = (channelName, channelClaimId, claimName, claimId)
.then(fileRecord => { .then(fileRecord => {
fileData = fileRecord.dataValues; fileData = fileRecord.dataValues;
logger.debug('file data:', fileData); logger.debug('file data:', fileData);
const serveUrl = `https://dev1.spee.ch/${fileData.claimId}/${fileData.name}.${fileData.fileType.substring(fileData.fileType.indexOf('/') + 1)}`;
// set the resource type // set the resource type
if (fileData.fileType === 'video/mp4') { if (fileData.fileType === 'video/mp4') {
data['type'] = 'video'; data['type'] = 'video';
data['html'] = `<video width="100%" controls poster="${claimData.thumbnail}" src="${serveUrl}"/></video>`;
} else { } else {
data['type'] = 'picture'; data['type'] = 'picture';
data['url'] = serveUrl;
} }
// get the data // get the data
data['title'] = claimData.title; data['title'] = claimData.title;
data['thumbnail_url'] = `https://dev1.spee.ch/${fileData.claimId}/${fileData.name}.${fileData.fileType.substring('/')}`; data['width'] = fileData.width || 600;
data['thumbnail_width'] = fileData.width || 600; data['height'] = fileData.height || 400;
data['thumbnail_height'] = fileData.height || 400; data['author_name'] = 'Spee.ch';
data['author_url'] = 'https://spee.ch';
}) })
.then(() => { .then(() => {
return data; return data;