diff --git a/lbrytv/src/html.js b/lbrytv/src/html.js index febd9c5ef..76987d19d 100644 --- a/lbrytv/src/html.js +++ b/lbrytv/src/html.js @@ -1,5 +1,5 @@ const { URL } = require('../../config.js'); -const { generateEmbedUrl } = require('../../ui/util/lbrytv'); +const { generateEmbedUrl, generateStreamUrl } = require('../../ui/util/lbrytv'); const PAGES = require('../../ui/constants/pages'); const { getClaim } = require('./chainquery'); const { parseURI } = require('lbry-redux'); @@ -61,9 +61,16 @@ function buildClaimOgMetadata(uri, claim, overrideOptions = {}) { const claimDescription = claim.description && claim.description.length > 0 ? escapeHtmlProperty(truncateDescription(claim.description)) - : `Watch ${claimTitle} on LBRY.tv`; + : `View ${claimTitle} on lbry.tv`; const claimLanguage = escapeHtmlProperty(claim.language) || 'en_US'; - const claimThumbnail = escapeHtmlProperty(claim.thumbnail_url) || `${URL}/v1-og.png`; + 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) { + imageThumbnail = generateStreamUrl(claimName, claim.claim_id); + } + const claimThumbnail = escapeHtmlProperty(claim.thumbnail_url) || imageThumbnail || `${URL}/v1-og.png`; // Allow for ovverriding default claim based og metadata const title = overrideOptions.title || claimTitle; @@ -82,7 +89,7 @@ function buildClaimOgMetadata(uri, claim, overrideOptions = {}) { head += ``; head += ``; head += ``; - head += ``; + head += ``; head += ``; head += ``; // below should be canonical_url, but not provided by chainquery yet