Skip to content

Commit

Permalink
Merge pull request #15 from vaultec81/master
Browse files Browse the repository at this point in the history
feat: support for video preview on peakd/hive blog
  • Loading branch information
vaultec81 authored Jul 30, 2021
2 parents 1868c34 + fe72dff commit cd8a3c1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/renderer/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -563,14 +570,15 @@ const acctOps = {
var cid = ipfs.urlToCID(thumbnailSource.url);
var gateway = await ipfs.getGateway(cid, true);
const imgSrc = gateway + ipfs.urlToIpfsPath(thumbnailSource.url)
header = `<a href="https://3speak.tv/openDapp?uri=hive:${hiveInfo.username}:${commentOp.permlink}"> <img src="${imgSrc}"/></a> <br/>`;
header = `[![](${imgSrc})](https://3speak.tv/watch?v=${hiveInfo.username}/${commentOp.permlink})<br/>`;
} catch (ex) { }
}
if(header) {
body = `${header} ${commentOp.body} <br/> [▶️Watch on 3Speak Dapp](https://3speak.tv/openDapp?uri=hive:${hiveInfo.username}:${commentOp.permlink})`
} else {
body = `${commentOp.body} <br/> [▶️Watch on 3Speak Dapp](https://3speak.tv/openDapp?uri=hive:${hiveInfo.username}:${commentOp.permlink})`
}

} else {
body = commentOp.body;
}
Expand Down

0 comments on commit cd8a3c1

Please sign in to comment.