feat: configable CSB_IO and CSB_SCAN
This commit is contained in:
parent
10cedc560f
commit
2ec52bcc29
|
|
@ -7,5 +7,7 @@ NEXT_PUBLIC_APP_NAME=xlog
|
|||
NEXT_PUBLIC_OUR_DOMAIN=localhost:3000
|
||||
NEXT_PUBLIC_DISCORD_LINK="https://discord.gg/9XscSqJEq4"
|
||||
NEXT_PUBLIC_GITHUB_LINK="https://github.com/Crossbell-Box/xlog"
|
||||
NEXT_PUBLIC_CSB_IO=
|
||||
NEXT_PUBLIC_CSB_SCAN="https://scan.crossbell.io"
|
||||
|
||||
REDIS_URL=
|
||||
|
|
@ -4,4 +4,6 @@ NEXT_PUBLIC_APP_NAME=APP_NEXT_PUBLIC_APP_NAME
|
|||
NEXT_PUBLIC_OUR_DOMAIN=APP_NEXT_PUBLIC_OUR_DOMAIN
|
||||
NEXT_PUBLIC_DISCORD_LINK=APP_NEXT_PUBLIC_DISCORD_LINK
|
||||
NEXT_PUBLIC_GITHUB_LINK=APP_NEXT_PUBLIC_GITHUB_LINK
|
||||
NEXT_PUBLIC_CSB_IO=APP_NEXT_PUBLIC_CSB_IO
|
||||
NEXT_PUBLIC_CSB_SCAN=APP_NEXT_PUBLIC_CSB_SCAN
|
||||
REDIS_URL=APP_NEXT_REDIS_URL
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ stringData:
|
|||
NEXT_PUBLIC_OUR_DOMAIN: xlog.app
|
||||
NEXT_PUBLIC_DISCORD_LINK: "https://discord.gg/9XscSqJEq4"
|
||||
NEXT_PUBLIC_GITHUB_LINK: "https://github.com/Crossbell-Box/xlog"
|
||||
NEXT_PUBLIC_CSB_IO: ""
|
||||
NEXT_PUBLIC_CSB_SCAN: "https://scan.crossbell.io"
|
||||
REDIS_URL: ${REDIS_URL}
|
||||
kind: Secret
|
||||
metadata:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { APP_NAME, OUR_DOMAIN } 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"
|
||||
|
|
@ -40,7 +40,7 @@ export const BlockchainInfo: React.FC<{
|
|||
Blockchain Transaction
|
||||
{(
|
||||
page?.related_urls?.filter((url) =>
|
||||
url.startsWith("https://scan.crossbell.io/tx/"),
|
||||
url.startsWith(CSB_SCAN + "/tx/"),
|
||||
) || site?.metadata?.transactions
|
||||
)?.length > 1
|
||||
? "s"
|
||||
|
|
@ -49,9 +49,7 @@ export const BlockchainInfo: React.FC<{
|
|||
<div>
|
||||
{page
|
||||
? page?.related_urls
|
||||
?.filter((url) =>
|
||||
url.startsWith("https://scan.crossbell.io/tx/"),
|
||||
)
|
||||
?.filter((url) => url.startsWith(CSB_SCAN + "/tx/"))
|
||||
.map((url) => {
|
||||
return (
|
||||
<a
|
||||
|
|
@ -62,12 +60,10 @@ export const BlockchainInfo: React.FC<{
|
|||
key={url}
|
||||
>
|
||||
{url
|
||||
.replace("https://scan.crossbell.io/tx/", "")
|
||||
.replace(CSB_SCAN + "/tx/", "")
|
||||
.slice(0, 10)}
|
||||
...
|
||||
{url
|
||||
.replace("https://scan.crossbell.io/tx/", "")
|
||||
.slice(-10)}
|
||||
{url.replace(CSB_SCAN + "/tx/", "").slice(-10)}
|
||||
</a>
|
||||
)
|
||||
})
|
||||
|
|
@ -77,7 +73,7 @@ export const BlockchainInfo: React.FC<{
|
|||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="inline-block mr-4 break-all"
|
||||
href={`https://scan.crossbell.io/tx/${hash}`}
|
||||
href={`${CSB_SCAN}/tx/${hash}`}
|
||||
key={hash}
|
||||
>
|
||||
{hash.slice(0, 10)}...{hash.slice(-10)}
|
||||
|
|
@ -133,7 +129,7 @@ export const BlockchainInfo: React.FC<{
|
|||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="inline-block mr-4 break-all"
|
||||
href={`https://scan.crossbell.io/address/${
|
||||
href={`${CSB_SCAN}/address/${
|
||||
page?.metadata?.owner || site?.metadata?.owner
|
||||
}`}
|
||||
key={page?.metadata?.owner || site?.metadata?.owner}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import data from "@emoji-mart/data"
|
|||
import Picker from "@emoji-mart/react"
|
||||
import { Popover } from "@headlessui/react"
|
||||
import { EmojiHappyIcon } from "@heroicons/react/outline"
|
||||
import { CSB_SCAN, CSB_IO } from "~/lib/env"
|
||||
|
||||
dayjs.extend(duration)
|
||||
dayjs.extend(relativeTime)
|
||||
|
|
@ -149,7 +150,7 @@ export const Comment: React.FC<{
|
|||
className="flex border-b border-dashed py-6"
|
||||
>
|
||||
<UniLink
|
||||
href={`https://crossbell.kindjeff.com/@${comment?.character?.handle}`}
|
||||
href={CSB_IO && `${CSB_IO}/@${comment?.character?.handle}`}
|
||||
className="align-middle mr-3"
|
||||
>
|
||||
<Avatar
|
||||
|
|
@ -161,7 +162,7 @@ export const Comment: React.FC<{
|
|||
<div className="flex-1 flex flex-col rounded-lg">
|
||||
<div className="mb-2 text-sm">
|
||||
<UniLink
|
||||
href={`https://crossbell.kindjeff.com/@${comment?.character?.handle}`}
|
||||
href={CSB_IO && `${CSB_IO}/@${comment?.character?.handle}`}
|
||||
className="font-medium text-indigo-600"
|
||||
>
|
||||
{comment?.character?.metadata?.content?.name}
|
||||
|
|
@ -174,9 +175,7 @@ export const Comment: React.FC<{
|
|||
)
|
||||
.humanize()}{" "}
|
||||
ago ·{" "}
|
||||
<UniLink
|
||||
href={`https://scan.crossbell.io/tx/${comment.transactionHash}`}
|
||||
>
|
||||
<UniLink href={`${CSB_SCAN}/tx/${comment.transactionHash}`}>
|
||||
<BlockchainIcon className="w-3 h-3 inline-block" />
|
||||
</UniLink>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import { useConnectModal } from "@rainbow-me/rainbowkit"
|
|||
import { useState, useEffect } from "react"
|
||||
import { Button } from "../ui/Button"
|
||||
import { useRouter } from "next/router"
|
||||
import { SITE_URL } from "~/lib/env"
|
||||
import { SITE_URL, CSB_SCAN, CSB_IO } from "~/lib/env"
|
||||
import { DuplicateIcon } from "@heroicons/react/solid"
|
||||
import { Comment } from "~/components/common/Comment"
|
||||
import { UniLink } from "~/components/ui/UniLink"
|
||||
|
|
@ -240,7 +240,7 @@ export const PostFooter: React.FC<{
|
|||
Your like has been permanently stored on the blockchain, view them{" "}
|
||||
<UniLink
|
||||
className="text-indigo-600"
|
||||
href={`https://scan.crossbell.io/tx/${isLike.data?.list?.[0]?.transactionHash}`}
|
||||
href={`${CSB_SCAN}/tx/${isLike.data?.list?.[0]?.transactionHash}`}
|
||||
>
|
||||
here
|
||||
</UniLink>
|
||||
|
|
@ -261,7 +261,7 @@ export const PostFooter: React.FC<{
|
|||
them{" "}
|
||||
<UniLink
|
||||
className="text-indigo-600"
|
||||
href={`https://scan.crossbell.io/tx/${isMint.data?.list?.[0]?.transactionHash}`}
|
||||
href={`${CSB_SCAN}/tx/${isMint.data?.list?.[0]?.transactionHash}`}
|
||||
>
|
||||
here
|
||||
</UniLink>
|
||||
|
|
@ -284,7 +284,7 @@ export const PostFooter: React.FC<{
|
|||
key={index}
|
||||
>
|
||||
<UniLink
|
||||
href={`https://crossbell.kindjeff.com/@${like?.fromCharacter?.handle}`}
|
||||
href={CSB_IO && `${CSB_IO}/@${like?.fromCharacter?.handle}`}
|
||||
className="flex items-center space-x-2 text-sm"
|
||||
>
|
||||
<Avatar
|
||||
|
|
@ -300,9 +300,7 @@ export const PostFooter: React.FC<{
|
|||
@{like.fromCharacter?.handle}
|
||||
</span>
|
||||
</UniLink>
|
||||
<UniLink
|
||||
href={"https://scan.crossbell.io/tx/" + like.transactionHash}
|
||||
>
|
||||
<UniLink href={CSB_SCAN + "/tx/" + like.transactionHash}>
|
||||
<BlockchainIcon />
|
||||
</UniLink>
|
||||
</li>
|
||||
|
|
@ -326,7 +324,7 @@ export const PostFooter: React.FC<{
|
|||
key={index}
|
||||
>
|
||||
<UniLink
|
||||
href={`https://crossbell.kindjeff.com/@${mint?.character?.handle}`}
|
||||
href={CSB_IO && `${CSB_IO}/@${mint?.character?.handle}`}
|
||||
className="flex items-center space-x-2 text-sm"
|
||||
>
|
||||
<Avatar
|
||||
|
|
@ -340,9 +338,7 @@ export const PostFooter: React.FC<{
|
|||
@{mint.character?.handle}
|
||||
</span>
|
||||
</UniLink>
|
||||
<UniLink
|
||||
href={"https://scan.crossbell.io/tx/" + mint.transactionHash}
|
||||
>
|
||||
<UniLink href={CSB_SCAN + "/tx/" + mint.transactionHash}>
|
||||
<BlockchainIcon />
|
||||
</UniLink>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { formatDate } from "~/lib/date"
|
|||
import { BlockchainIcon } from "~/components/icons/BlockchainIcon"
|
||||
import { UniLink } from "~/components/ui/UniLink"
|
||||
import { Note } from "~/lib/types"
|
||||
import { CSB_SCAN } from "~/lib/env"
|
||||
|
||||
export const PostMeta: React.FC<{
|
||||
page: Note
|
||||
|
|
@ -14,7 +15,7 @@ export const PostMeta: React.FC<{
|
|||
className="align-middle inline-block"
|
||||
href={
|
||||
page.related_urls?.filter((url) =>
|
||||
url.startsWith("https://scan.crossbell.io/tx/"),
|
||||
url.startsWith(CSB_SCAN + "/tx/"),
|
||||
)?.[0]
|
||||
}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import clsx from "clsx"
|
|||
import { useRouter } from "next/router"
|
||||
import { logout } from "~/lib/auth.client"
|
||||
import { IS_PROD } from "~/lib/constants"
|
||||
import { SITE_URL } from "~/lib/env"
|
||||
import { SITE_URL, CSB_SCAN, CSB_IO } from "~/lib/env"
|
||||
import { useStore } from "~/lib/store"
|
||||
import { Viewer } from "~/lib/types"
|
||||
import { getUserContentsUrl } from "~/lib/user-contents"
|
||||
|
|
@ -142,7 +142,7 @@ export const SiteHeader: React.FC<{
|
|||
{
|
||||
text: "View on Crossbell.io",
|
||||
icon: <CrossbellIcon />,
|
||||
url: `https://crossbell.kindjeff.com/@${site?.username}`,
|
||||
url: CSB_IO && `${CSB_IO}/@${site?.username}`,
|
||||
},
|
||||
{
|
||||
text: "View on RSS3",
|
||||
|
|
@ -152,7 +152,7 @@ export const SiteHeader: React.FC<{
|
|||
{
|
||||
text: "View on blockchain explorer",
|
||||
icon: <BlockchainIcon />,
|
||||
url: `https://scan.crossbell.io/address/${site?.metadata?.owner}/transactions`,
|
||||
url: `${CSB_SCAN}/address/${site?.metadata?.owner}/transactions`,
|
||||
},
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@ export const UniLink: React.FC<{
|
|||
}
|
||||
|
||||
if (!href) {
|
||||
console.error("missing href")
|
||||
return null
|
||||
return <span className={className}>{children}</span>
|
||||
}
|
||||
|
||||
const isExternal = href && /^https?:\/\//.test(href)
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@ export const SITE_URL = `${IS_PROD ? "https" : "http"}://${OUR_DOMAIN}`
|
|||
export const R2_URL = process.env.NEXT_PUBLIC_R2_URL
|
||||
export const APP_DESCRIPTION = process.env.APP_DESCRIPTION
|
||||
export const DISCORD_LINK = process.env.NEXT_PUBLIC_DISCORD_LINK
|
||||
export const GITHUB_LINK = process.env.NEXT_PUBLIC_GITHUB_LINK
|
||||
export const CSB_IO = process.env.NEXT_PUBLIC_CSB_IO
|
||||
export const CSB_SCAN = process.env.NEXT_PUBLIC_CSB_SCAN
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
|
|||
import { PersistQueryClientProvider } from "@tanstack/react-query-persist-client"
|
||||
import { createIDBPersister } from "~/lib/persister.client"
|
||||
import { connectorsForWallets, wallet } from "@rainbow-me/rainbowkit"
|
||||
import { CSB_SCAN } from "~/lib/env"
|
||||
|
||||
import "@rainbow-me/rainbowkit/styles.css"
|
||||
|
||||
|
|
@ -36,7 +37,7 @@ const { chains, provider } = configureChains(
|
|||
blockExplorers: {
|
||||
default: {
|
||||
name: "Crossbell Explorer",
|
||||
url: "https://scan.crossbell.io",
|
||||
url: CSB_SCAN,
|
||||
},
|
||||
},
|
||||
testnet: false,
|
||||
|
|
|
|||
Loading…
Reference in New Issue