feat: use ipfs protocol in content and change ipfs service

This commit is contained in:
DIYgod
2022-08-23 15:18:48 +01:00
parent 4fd30a0d63
commit 52c185eabf
8 changed files with 419 additions and 70 deletions
+2 -4
View File
@@ -1,6 +1,7 @@
import clsx from "clsx"
import React, { useMemo } from "react"
import { IPFS_GATEWAY } from "~/lib/env"
import { toGateway } from "~/lib/ipfs-parser"
export const Avatar: React.FC<
{
@@ -22,10 +23,7 @@ export const Avatar: React.FC<
const image = useMemo(() => {
for (const image of images) {
if (image)
return image
.replace("ipfs://", IPFS_GATEWAY)
.replace("https://gateway.ipfs.io/ipfs/", IPFS_GATEWAY)
if (image) return toGateway(image)
}
}, [images])