initial fix for #3723
This commit is contained in:
parent
74c4762cd4
commit
d94610acb1
3 changed files with 6 additions and 7 deletions
|
@ -24,7 +24,7 @@ module.exports.getClaim = async function getClaim(claimName, claimId, channelNam
|
||||||
let params = [claimName];
|
let params = [claimName];
|
||||||
|
|
||||||
let sql =
|
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 ' +
|
'FROM claim ' +
|
||||||
'LEFT JOIN claim channel_claim on claim.publisher_id = channel_claim.claim_id ' +
|
'LEFT JOIN claim channel_claim on claim.publisher_id = channel_claim.claim_id ' +
|
||||||
'WHERE claim.name = ?';
|
'WHERE claim.name = ?';
|
||||||
|
|
|
@ -63,12 +63,11 @@ function buildClaimOgMetadata(uri, claim, overrideOptions = {}) {
|
||||||
? escapeHtmlProperty(truncateDescription(claim.description))
|
? escapeHtmlProperty(truncateDescription(claim.description))
|
||||||
: `View ${claimTitle} on lbry.tv`;
|
: `View ${claimTitle} on lbry.tv`;
|
||||||
const claimLanguage = escapeHtmlProperty(claim.language) || 'en_US';
|
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;
|
let imageThumbnail;
|
||||||
|
|
||||||
if (claim && isImage && isFree) {
|
if (Number(claim.fee) <= 0 && claim.source_media_type.startsWith('image/')) {
|
||||||
imageThumbnail = generateStreamUrl(claimName, claim.claim_id);
|
imageThumbnail = generateStreamUrl(claim.name, claim.claim_id, undefined, undefined, true);
|
||||||
}
|
}
|
||||||
const claimThumbnail = escapeHtmlProperty(claim.thumbnail_url) || imageThumbnail || `${URL}/v1-og.png`;
|
const claimThumbnail = escapeHtmlProperty(claim.thumbnail_url) || imageThumbnail || `${URL}/v1-og.png`;
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ const { getCookie } = require('../../ui/util/saved-passwords');
|
||||||
|
|
||||||
const CONTINENT_COOKIE = 'continent';
|
const CONTINENT_COOKIE = 'continent';
|
||||||
|
|
||||||
function generateStreamUrl(claimName, claimId, apiUrl, streamingContinent) {
|
function generateStreamUrl(claimName, claimId, apiUrl, streamingContinent, useDefaultServer) {
|
||||||
let prefix = LBRY_TV_STREAMING_API || apiUrl;
|
let prefix = LBRY_TV_STREAMING_API || apiUrl;
|
||||||
const continent = streamingContinent || getCookie(CONTINENT_COOKIE);
|
const continent = useDefaultServer ? undefined : streamingContinent || getCookie(CONTINENT_COOKIE);
|
||||||
|
|
||||||
if (continent && prefix.split('//').length > 1) {
|
if (continent && prefix.split('//').length > 1) {
|
||||||
prefix = prefix.replace('//', '//' + continent + '.');
|
prefix = prefix.replace('//', '//' + continent + '.');
|
||||||
|
|
Loading…
Add table
Reference in a new issue