switched hard coding for configs
This commit is contained in:
parent
995d3f138b
commit
f42cc51d12
1 changed files with 12 additions and 5 deletions
|
@ -2,12 +2,19 @@ const logger = require('winston');
|
|||
const db = require('../../../models');
|
||||
const getClaimId = require('../../utils/getClaimId');
|
||||
|
||||
const {
|
||||
details: {
|
||||
host,
|
||||
title: siteTitle,
|
||||
},
|
||||
} = require('@config/siteConfig');
|
||||
|
||||
const getOEmbedDataForAsset = (channelName, channelClaimId, claimName, claimId) => {
|
||||
let fileData, claimData;
|
||||
let data = {
|
||||
version : '1.0',
|
||||
provider_name: 'Spee.ch',
|
||||
provider_url : 'https://spee.ch',
|
||||
provider_name: siteTitle,
|
||||
provider_url : host,
|
||||
cache_age : 86400, // one day in seconds
|
||||
};
|
||||
|
||||
|
@ -36,7 +43,7 @@ const getOEmbedDataForAsset = (channelName, channelClaimId, claimName, claimId)
|
|||
.then(fileRecord => {
|
||||
fileData = fileRecord.dataValues;
|
||||
logger.debug('file data:', fileData);
|
||||
const serveUrl = `https://dev1.spee.ch/${fileData.claimId}/${fileData.name}.${fileData.fileType.substring(fileData.fileType.indexOf('/') + 1)}`;
|
||||
const serveUrl = `${host}/${fileData.claimId}/${fileData.name}.${fileData.fileType.substring(fileData.fileType.indexOf('/') + 1)}`;
|
||||
// set the resource type
|
||||
if (fileData.fileType === 'video/mp4') {
|
||||
data['type'] = 'video';
|
||||
|
@ -49,8 +56,8 @@ const getOEmbedDataForAsset = (channelName, channelClaimId, claimName, claimId)
|
|||
data['title'] = claimData.title;
|
||||
data['width'] = fileData.width || 600;
|
||||
data['height'] = fileData.height || 400;
|
||||
data['author_name'] = 'Spee.ch';
|
||||
data['author_url'] = 'https://spee.ch';
|
||||
data['author_name'] = siteTitle;
|
||||
data['author_url'] = host;
|
||||
})
|
||||
.then(() => {
|
||||
return data;
|
||||
|
|
Loading…
Add table
Reference in a new issue