fix: post images not include audio cover

This commit is contained in:
DIYgod 2023-07-19 20:12:59 +01:00
parent b8c321f823
commit e717d8afc2
No known key found for this signature in database
1 changed files with 7 additions and 3 deletions

View File

@ -24,15 +24,19 @@ export const rehypeAudio: Plugin<Array<{ env: MarkdownEnv }>, Root> = ({
node.properties.src = toGateway(src)
if (node.properties.cover && typeof node.properties.cover === "string") {
const coverIpfsUrl = toGateway(node.properties.cover)
node.properties.cover = coverIpfsUrl
env.images.push(coverIpfsUrl)
}
if (first) {
if (
!env.cover &&
node.properties.cover &&
typeof node.properties.cover === "string"
) {
const coverIpfsUrl = toGateway(node.properties.cover)
node.properties.cover = coverIpfsUrl
env.cover = coverIpfsUrl
env.cover = node.properties.cover
}
env.audio = node.properties.src
first = false