diff --git a/.env.example b/.env.example
index ea6eb608..d89b51a6 100644
--- a/.env.example
+++ b/.env.example
@@ -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=
\ No newline at end of file
diff --git a/deploy/env.production b/deploy/env.production
index 877f0270..98eb0642 100644
--- a/deploy/env.production
+++ b/deploy/env.production
@@ -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
diff --git a/deploy/prod/secrets.yaml b/deploy/prod/secrets.yaml
index adb95e77..fad8d7cd 100644
--- a/deploy/prod/secrets.yaml
+++ b/deploy/prod/secrets.yaml
@@ -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:
diff --git a/src/components/common/BlockchainInfo.tsx b/src/components/common/BlockchainInfo.tsx
index 5ae1d0cd..99577a24 100644
--- a/src/components/common/BlockchainInfo.tsx
+++ b/src/components/common/BlockchainInfo.tsx
@@ -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<{
{page
? page?.related_urls
- ?.filter((url) =>
- url.startsWith("https://scan.crossbell.io/tx/"),
- )
+ ?.filter((url) => url.startsWith(CSB_SCAN + "/tx/"))
.map((url) => {
return (
{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)}
)
})
@@ -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}
diff --git a/src/components/common/Comment.tsx b/src/components/common/Comment.tsx
index d57981ed..58e7b285 100644
--- a/src/components/common/Comment.tsx
+++ b/src/components/common/Comment.tsx
@@ -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"
>
{comment?.character?.metadata?.content?.name}
@@ -174,9 +175,7 @@ export const Comment: React.FC<{
)
.humanize()}{" "}
ago ยท{" "}
-
+
diff --git a/src/components/site/PostFooter.tsx b/src/components/site/PostFooter.tsx
index d80cf04b..c261fad1 100644
--- a/src/components/site/PostFooter.tsx
+++ b/src/components/site/PostFooter.tsx
@@ -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{" "}
here
@@ -261,7 +261,7 @@ export const PostFooter: React.FC<{
them{" "}
here
@@ -284,7 +284,7 @@ export const PostFooter: React.FC<{
key={index}
>
-
+
@@ -326,7 +324,7 @@ export const PostFooter: React.FC<{
key={index}
>
-
+
diff --git a/src/components/site/PostMeta.tsx b/src/components/site/PostMeta.tsx
index f3a68dc6..afd0f5d6 100644
--- a/src/components/site/PostMeta.tsx
+++ b/src/components/site/PostMeta.tsx
@@ -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]
}
>
diff --git a/src/components/site/SiteHeader.tsx b/src/components/site/SiteHeader.tsx
index faf69526..8e4b3e76 100644
--- a/src/components/site/SiteHeader.tsx
+++ b/src/components/site/SiteHeader.tsx
@@ -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: ,
- 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: ,
- url: `https://scan.crossbell.io/address/${site?.metadata?.owner}/transactions`,
+ url: `${CSB_SCAN}/address/${site?.metadata?.owner}/transactions`,
},
]
diff --git a/src/components/ui/UniLink.tsx b/src/components/ui/UniLink.tsx
index 18243a79..e6c751f1 100644
--- a/src/components/ui/UniLink.tsx
+++ b/src/components/ui/UniLink.tsx
@@ -15,8 +15,7 @@ export const UniLink: React.FC<{
}
if (!href) {
- console.error("missing href")
- return null
+ return {children}
}
const isExternal = href && /^https?:\/\//.test(href)
diff --git a/src/lib/env.ts b/src/lib/env.ts
index da10bfd4..63202c87 100644
--- a/src/lib/env.ts
+++ b/src/lib/env.ts
@@ -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
diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx
index 4ecda4c2..aff05e0d 100644
--- a/src/pages/_app.tsx
+++ b/src/pages/_app.tsx
@@ -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,