fix: post ipfs address
This commit is contained in:
parent
657ac8090a
commit
0a8a2c3248
|
|
@ -1,10 +1,11 @@
|
|||
import { CSB_SCAN, IPFS_GATEWAY } from "~/lib/env"
|
||||
import { CSB_SCAN } from "~/lib/env"
|
||||
import { UniLink } from "../ui/UniLink"
|
||||
import { Profile, Note } from "~/lib/types"
|
||||
import { Disclosure } from "@headlessui/react"
|
||||
import { ChevronUpIcon } from "@heroicons/react/solid"
|
||||
import { BlockchainIcon } from "~/components/icons/BlockchainIcon"
|
||||
import { toIPFS, toGateway } from "~/lib/ipfs-parser"
|
||||
import { IPFS_SW_GATEWAY_PREFIX } from "~/lib/ipfs-gateway"
|
||||
|
||||
export const BlockchainInfo: React.FC<{
|
||||
site?: Profile
|
||||
|
|
@ -88,7 +89,9 @@ export const BlockchainInfo: React.FC<{
|
|||
<div>
|
||||
{page
|
||||
? page.related_urls
|
||||
?.filter((url) => url.startsWith(IPFS_GATEWAY))
|
||||
?.filter((url) =>
|
||||
url.startsWith(IPFS_SW_GATEWAY_PREFIX),
|
||||
)
|
||||
.map((url) => {
|
||||
return (
|
||||
<a
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
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<
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { isIpfsUrl } from "@crossbell/ipfs-gateway"
|
||||
|
||||
import { IPFS_GATEWAY } from "~/lib/env"
|
||||
import { ipfsGateway } from "./ipfs-gateway"
|
||||
import { ipfsGateway, IPFS_SW_GATEWAY_PREFIX } from "./ipfs-gateway"
|
||||
|
||||
const IPFS_PREFIX = "ipfs://"
|
||||
|
||||
|
|
@ -26,6 +26,7 @@ export const toGateway = (url: string, config?: ToGatewayConfig) => {
|
|||
export const toIPFS = (url: string) => {
|
||||
return url
|
||||
?.replace(IPFS_GATEWAY, IPFS_PREFIX)
|
||||
.replace(IPFS_SW_GATEWAY_PREFIX, IPFS_PREFIX)
|
||||
.replace("https://gateway.ipfs.io/ipfs/", IPFS_PREFIX)
|
||||
.replace("https://ipfs.io/ipfs/", IPFS_PREFIX)
|
||||
.replace("https://cf-ipfs.com/ipfs/", IPFS_PREFIX)
|
||||
|
|
|
|||
Loading…
Reference in New Issue