This commit is contained in:
Thomas Zarebczan 2020-04-03 17:23:28 -04:00 committed by Sean Yesmunt
parent a5584890fd
commit 9187d0d71d
2 changed files with 3 additions and 4 deletions

View file

@ -24,7 +24,7 @@ module.exports.getClaim = async function getClaim(claimName, claimId, channelNam
let params = [claimName];
let sql =
'SELECT channel_claim.name as channel, claim.claim_id, claim.name, claim.description, claim.language, claim.thumbnail_url, claim.title, claim.source_media_type, claim.frame_width, claim.frame_height ' +
'SELECT channel_claim.name as channel, claim.claim_id, claim.name, claim.description, claim.language, claim.thumbnail_url, claim.title, claim.source_media_type, claim.frame_width, claim.frame_height, claim.fee ' +
'FROM claim ' +
'LEFT JOIN claim channel_claim on claim.publisher_id = channel_claim.claim_id ' +
'WHERE claim.name = ?';

View file

@ -63,11 +63,10 @@ function buildClaimOgMetadata(uri, claim, overrideOptions = {}) {
? escapeHtmlProperty(truncateDescription(claim.description))
: `View ${claimTitle} on lbry.tv`;
const claimLanguage = escapeHtmlProperty(claim.language) || 'en_US';
const isImage = claim && claim.value && claim.value.stream_type === 'image';
const isFree = claim && claim.value && (!claim.value.fee || Number(claim.value.fee.amount) <= 0);
let imageThumbnail;
if (claim && isImage && isFree) {
if (Number(claim.fee) <= 0 && claim.source_media_type.startsWith('image/')) {
imageThumbnail = generateStreamUrl(claimName, claim.claim_id);
}
const claimThumbnail = escapeHtmlProperty(claim.thumbnail_url) || imageThumbnail || `${URL}/v1-og.png`;