From fe72dffca5f508cbdd34018379994b48ac8c9143 Mon Sep 17 00:00:00 2001 From: vaultec <47548474+vaultec81@users.noreply.github.com> Date: Fri, 30 Jul 2021 15:24:27 -0700 Subject: [PATCH] feat: support for video preview on peakd/hive blog --- src/renderer/utils.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/renderer/utils.js b/src/renderer/utils.js index a666775..ef54d71 100644 --- a/src/renderer/utils.js +++ b/src/renderer/utils.js @@ -548,6 +548,13 @@ const acctOps = { console.log(getAccount) let json_metadata; if(typeof commentOp.json_metadata === "object") { + //Note: this is for peakd/hive.blog to display a video preview + if(!commentOp.parent_author) { + commentOp.json_metadata.video.info = { + author: hiveInfo.username, + permlink: commentOp.permlink + } + } json_metadata = JSON.stringify(commentOp.json_metadata) } else { throw new Error("commentOp.json_metadata must be an object") @@ -563,7 +570,7 @@ const acctOps = { var cid = ipfs.urlToCID(thumbnailSource.url); var gateway = await ipfs.getGateway(cid, true); const imgSrc = gateway + ipfs.urlToIpfsPath(thumbnailSource.url) - header = `
`; + header = `[![](${imgSrc})](https://3speak.tv/watch?v=${hiveInfo.username}/${commentOp.permlink})
`; } catch (ex) { } } if(header) { @@ -571,6 +578,7 @@ const acctOps = { } else { body = `${commentOp.body}
[▶️Watch on 3Speak Dapp](https://3speak.tv/openDapp?uri=hive:${hiveInfo.username}:${commentOp.permlink})` } + } else { body = commentOp.body; }