Updated NFT OEmbed provider to return metadata

refs https://github.com/TryGhost/Team/issues/1211

Instead of rendering the HTML as an embed - we will send back the
necessary data. This will allow us to keep all the knowledge of HTML
structure in the Koenig repository.
This commit is contained in:
Fabien O'Carroll 2021-11-15 10:14:45 +02:00
parent c2fe04f681
commit 31e103be9d

View File

@ -46,24 +46,13 @@ class NFTOEmbedProvider {
author_url: `https://opensea.io/${result.body.creator.user.username}`,
provider_name: 'OpenSea',
provider_url: 'https://opensea.io',
html: `
<a href="${result.body.permalink}" class="kg-nft-card">
<img class="kg-nft-image" src="${result.body.image_url}">
<div class="kg-nft-metadata">
<div class="kg-nft-header">
<h4 class="kg-nft-title"> ${result.body.name} </h4>
</div>
<div class="kg-nft-creator">
Created by <span class="kg-nft-creator-name">${result.body.creator.user.username}</span>
${(result.body.collection.name ? `&bull; ${result.body.collection.name}` : ``)}
</div>
${(result.body.description ? `<p class="kg-nft-description">${result.body.description}</p>` : ``)}
</div>
</a>
`,
html: '',
width: 1000,
height: 1000,
noIframe: true
card_type: 'nft',
image_url: result.body.image_url,
creator_name: result.body.creator.user.username,
description: result.body.description
};
}
}