mirror of
https://github.com/penxio/penx.git
synced 2026-05-12 03:03:12 -04:00
feat: improve auth
This commit is contained in:
6
.env
6
.env
@@ -18,9 +18,3 @@ DATABASE_URL="postgresql://user:penx@43.154.135.183:5432/penx"
|
||||
# Setup instructions: https://vercel.com/docs/storage/vercel-blob/quickstart
|
||||
BLOB_READ_WRITE_TOKEN=
|
||||
|
||||
# privy
|
||||
NEXT_PUBLIC_PRIVY_APP_ID=
|
||||
PRIVY_APP_SECRET=
|
||||
|
||||
|
||||
POSTGRES_PRISMA_URL=""
|
||||
|
||||
@@ -21,7 +21,7 @@ The best way to build web3 independent blog.
|
||||
|
||||
Click the button to clone this repository and deploy it on Vercel:
|
||||
|
||||
[](https://vercel.com/new/clone?s=https%3A%2F%2Fgithub.com%2F0xjojo1%2Fplantree&project-name=plantree&repository-name=plantree&env=NEXTAUTH_SECRET,NEXT_PUBLIC_THEME,BLOB_READ_WRITE_TOKEN,DATABASE_URL,NEXT_PUBLIC_SPACE_ID,NEXT_PUBLIC_PROJECT_ID,NEXT_PUBLIC_NETWORK,NEXT_PUBLIC_CONNECT_TYPE,NEXT_PUBLIC_POSTS_PAGE_SIZE,NEXT_PUBLIC_PRIVY_APP_ID,PRIVY_APP_SECRET&envDescription=Please%20provide%20the%20following%20environment%20variables&envLink=https%3A%2F%2Fgithub.com%2F0xjojo1%2Fplantree%2Fblob%2Fmain%2FREADME.md)
|
||||
[](https://vercel.com/new/clone?s=https%3A%2F%2Fgithub.com%2F0xjojo1%2Fplantree&project-name=plantree&repository-name=plantree&env=NEXTAUTH_SECRET,NEXT_PUBLIC_THEME,BLOB_READ_WRITE_TOKEN,DATABASE_URL,NEXT_PUBLIC_SPACE_ID,NEXT_PUBLIC_PROJECT_ID,NEXT_PUBLIC_NETWORK,NEXT_PUBLIC_CONNECT_TYPE,NEXT_PUBLIC_POSTS_PAGE_SIZE,&envDescription=Please%20provide%20the%20following%20environment%20variables&envLink=https%3A%2F%2Fgithub.com%2F0xjojo1%2Fplantree%2Fblob%2Fmain%2FREADME.md)
|
||||
|
||||
## web
|
||||
|
||||
|
||||
@@ -17,16 +17,17 @@ import {
|
||||
FormMessage,
|
||||
} from '@/components/ui/form'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { useCheckChain } from '@/hooks/useCheckChain'
|
||||
import { useWagmiConfig } from '@/hooks/useWagmiConfig'
|
||||
import { spaceAbi } from '@/lib/abi'
|
||||
import { addToIpfs } from '@/lib/addToIpfs'
|
||||
import { checkChain } from '@/lib/checkChain'
|
||||
import { extractErrorMessage } from '@/lib/extractErrorMessage'
|
||||
import { precision } from '@/lib/math'
|
||||
import { wagmiConfig } from '@/lib/wagmi'
|
||||
import { zodResolver } from '@hookform/resolvers/zod'
|
||||
import { waitForTransactionReceipt, writeContract } from '@wagmi/core'
|
||||
import { toast } from 'sonner'
|
||||
import { Address } from 'viem'
|
||||
import { useWaitForTransactionReceipt, useWriteContract } from 'wagmi'
|
||||
import { z } from 'zod'
|
||||
import { useMintPostDialog } from './useMintPostDialog'
|
||||
|
||||
@@ -40,6 +41,9 @@ export function MintPostForm() {
|
||||
const { setIsOpen } = useMintPostDialog()
|
||||
const { space } = useSpace()
|
||||
const { ethPrice } = useEthPrice()
|
||||
const { writeContractAsync } = useWriteContract()
|
||||
const wagmiConfig = useWagmiConfig()
|
||||
const checkChain = useCheckChain()
|
||||
|
||||
const form = useForm<z.infer<typeof FormSchema>>({
|
||||
resolver: zodResolver(FormSchema),
|
||||
@@ -68,7 +72,7 @@ export function MintPostForm() {
|
||||
)
|
||||
|
||||
const price = precision.token(Number(data.price) / ethPrice)
|
||||
const hash = await writeContract(wagmiConfig, {
|
||||
const hash = await writeContractAsync({
|
||||
address: space.address as Address,
|
||||
abi: spaceAbi,
|
||||
functionName: 'createPlan',
|
||||
|
||||
@@ -6,11 +6,11 @@ import LoadingDots from '@/components/icons/loading-dots'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { WalletConnectButton } from '@/components/WalletConnectButton'
|
||||
import { useAddress } from '@/hooks/useAddress'
|
||||
import { useCheckChain } from '@/hooks/useCheckChain'
|
||||
import { useWagmiConfig } from '@/hooks/useWagmiConfig'
|
||||
import { spaceAbi } from '@/lib/abi'
|
||||
import { checkChain } from '@/lib/checkChain'
|
||||
import { extractErrorMessage } from '@/lib/extractErrorMessage'
|
||||
import { precision } from '@/lib/math'
|
||||
import { wagmiConfig } from '@/lib/wagmi'
|
||||
import { waitForTransactionReceipt } from '@wagmi/core'
|
||||
import { toast } from 'sonner'
|
||||
import { Address } from 'viem'
|
||||
@@ -39,6 +39,8 @@ export const BuyBtn = ({
|
||||
const address = useAddress()
|
||||
const { space } = useSpace()
|
||||
const trade = useTrades()
|
||||
const wagmiConfig = useWagmiConfig()
|
||||
const checkChain = useCheckChain()
|
||||
|
||||
const onBuy = async () => {
|
||||
setLoading(true)
|
||||
|
||||
@@ -6,11 +6,11 @@ import { useTrades } from '@/app/(creator-fi)/hooks/useTrades'
|
||||
import LoadingDots from '@/components/icons/loading-dots'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { WalletConnectButton } from '@/components/WalletConnectButton'
|
||||
import { useCheckChain } from '@/hooks/useCheckChain'
|
||||
import { useWagmiConfig } from '@/hooks/useWagmiConfig'
|
||||
import { erc20Abi, spaceAbi } from '@/lib/abi'
|
||||
import { checkChain } from '@/lib/checkChain'
|
||||
import { extractErrorMessage } from '@/lib/extractErrorMessage'
|
||||
import { precision } from '@/lib/math'
|
||||
import { wagmiConfig } from '@/lib/wagmi'
|
||||
import { waitForTransactionReceipt } from '@wagmi/core'
|
||||
import { toast } from 'sonner'
|
||||
import { Address } from 'viem'
|
||||
@@ -38,6 +38,8 @@ export const SellBtn = ({
|
||||
const { writeContractAsync } = useWriteContract()
|
||||
const balance = useSpaceTokenBalance()
|
||||
const address = useAddress()
|
||||
const wagmiConfig = useWagmiConfig()
|
||||
const checkChain = useCheckChain()
|
||||
const { refetch: refetchEth } = useQueryEthBalance()
|
||||
const trade = useTrades()
|
||||
|
||||
|
||||
@@ -3,15 +3,11 @@ import { useAddress } from '@/app/(creator-fi)/hooks/useAddress'
|
||||
import { useMembers } from '@/app/(creator-fi)/hooks/useMembers'
|
||||
import { refetchSpaces } from '@/app/(creator-fi)/hooks/useSpaces'
|
||||
import { useSubscriptions } from '@/app/(creator-fi)/hooks/useSubscriptions'
|
||||
import { useCheckChain } from '@/hooks/useCheckChain'
|
||||
import { useWagmiConfig } from '@/hooks/useWagmiConfig'
|
||||
import { erc20Abi, spaceAbi } from '@/lib/abi'
|
||||
import { checkChain } from '@/lib/checkChain'
|
||||
import { extractErrorMessage } from '@/lib/extractErrorMessage'
|
||||
import { wagmiConfig } from '@/lib/wagmi'
|
||||
import {
|
||||
readContract,
|
||||
waitForTransactionReceipt,
|
||||
writeContract,
|
||||
} from '@wagmi/core'
|
||||
import { readContract, waitForTransactionReceipt } from '@wagmi/core'
|
||||
import { useSession } from 'next-auth/react'
|
||||
import { useRouter, useSearchParams } from 'next/navigation'
|
||||
import { toast } from 'sonner'
|
||||
@@ -29,6 +25,8 @@ export function useSubscribe(space: Space) {
|
||||
const params = useSearchParams()
|
||||
const postSlug = params.get('post_slug')
|
||||
const { update } = useSession()
|
||||
const wagmiConfig = useWagmiConfig()
|
||||
const checkChain = useCheckChain()
|
||||
|
||||
return async (token: string, amount: bigint, isSubscribe: boolean) => {
|
||||
const spaceAddress = space.address as Address
|
||||
|
||||
@@ -17,12 +17,12 @@ import {
|
||||
FormMessage,
|
||||
} from '@/components/ui/form'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { useCheckChain } from '@/hooks/useCheckChain'
|
||||
import { useWagmiConfig } from '@/hooks/useWagmiConfig'
|
||||
import { spaceAbi } from '@/lib/abi'
|
||||
import { addToIpfs } from '@/lib/addToIpfs'
|
||||
import { checkChain } from '@/lib/checkChain'
|
||||
import { extractErrorMessage } from '@/lib/extractErrorMessage'
|
||||
import { precision } from '@/lib/math'
|
||||
import { wagmiConfig } from '@/lib/wagmi'
|
||||
import { zodResolver } from '@hookform/resolvers/zod'
|
||||
import { waitForTransactionReceipt, writeContract } from '@wagmi/core'
|
||||
import { toast } from 'sonner'
|
||||
@@ -40,6 +40,8 @@ export function AddPlanForm() {
|
||||
const { setIsOpen } = useAddPlanDialog()
|
||||
const { space } = useSpace()
|
||||
const { ethPrice } = useEthPrice()
|
||||
const wagmiConfig = useWagmiConfig()
|
||||
const checkChain = useCheckChain()
|
||||
|
||||
const form = useForm<z.infer<typeof FormSchema>>({
|
||||
resolver: zodResolver(FormSchema),
|
||||
|
||||
@@ -20,12 +20,12 @@ import {
|
||||
} from '@/components/ui/form'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'
|
||||
import { useCheckChain } from '@/hooks/useCheckChain'
|
||||
import { useWagmiConfig } from '@/hooks/useWagmiConfig'
|
||||
import { spaceAbi } from '@/lib/abi'
|
||||
import { addToIpfs } from '@/lib/addToIpfs'
|
||||
import { checkChain } from '@/lib/checkChain'
|
||||
import { extractErrorMessage } from '@/lib/extractErrorMessage'
|
||||
import { precision } from '@/lib/math'
|
||||
import { wagmiConfig } from '@/lib/wagmi'
|
||||
import { zodResolver } from '@hookform/resolvers/zod'
|
||||
import { waitForTransactionReceipt, writeContract } from '@wagmi/core'
|
||||
import { toast } from 'sonner'
|
||||
@@ -42,11 +42,13 @@ const FormSchema = z.object({
|
||||
|
||||
export function UpdatePlanForm() {
|
||||
const [isLoading, setLoading] = useState(false)
|
||||
const wagmiConfig = useWagmiConfig()
|
||||
const { setIsOpen } = useUpdatePlanDialog()
|
||||
const { space } = useSpace()
|
||||
const { ethPrice } = useEthPrice()
|
||||
const { plan } = useUpdatePlanDialog()
|
||||
const { refetch } = usePlans()
|
||||
const checkChain = useCheckChain()
|
||||
|
||||
const form = useForm<z.infer<typeof FormSchema>>({
|
||||
resolver: zodResolver(FormSchema),
|
||||
|
||||
@@ -3,12 +3,12 @@ import { useSpace } from '@/app/(creator-fi)/hooks/useSpace'
|
||||
import LoadingDots from '@/components/icons/loading-dots'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { WalletConnectButton } from '@/components/WalletConnectButton'
|
||||
import { useCheckChain } from '@/hooks/useCheckChain'
|
||||
import { useWagmiConfig } from '@/hooks/useWagmiConfig'
|
||||
import { erc20Abi, spaceAbi } from '@/lib/abi'
|
||||
import { checkChain } from '@/lib/checkChain'
|
||||
import { extractErrorMessage } from '@/lib/extractErrorMessage'
|
||||
import { precision } from '@/lib/math'
|
||||
import { toFloorFixed } from '@/lib/utils'
|
||||
import { wagmiConfig } from '@/lib/wagmi'
|
||||
import { waitForTransactionReceipt } from '@wagmi/core'
|
||||
import { toast } from 'sonner'
|
||||
import { Address } from 'viem'
|
||||
@@ -27,6 +27,8 @@ export const StakingPanel = () => {
|
||||
const { data: tokenBalance } = useSpaceTokenBalance()
|
||||
const { space } = useSpace()
|
||||
const { isConnected } = useAccount()
|
||||
const wagmiConfig = useWagmiConfig()
|
||||
const checkChain = useCheckChain()
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [stakingDirection, setStakingDirection] = useState<StakingDirection>(
|
||||
StakingDirection.Staking,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Plan, PlanInfo } from '@/app/(creator-fi)/domains/Plan'
|
||||
import { useWagmiConfig } from '@/hooks/useWagmiConfig'
|
||||
import { spaceAbi } from '@/lib/abi'
|
||||
import { isIPFSCID } from '@/lib/utils'
|
||||
import { wagmiConfig } from '@/lib/wagmi'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { readContracts } from '@wagmi/core'
|
||||
import ky from 'ky'
|
||||
@@ -10,6 +10,7 @@ import { useSpace } from './useSpace'
|
||||
|
||||
export function usePlans() {
|
||||
const { space } = useSpace()
|
||||
const wagmiConfig = useWagmiConfig()
|
||||
const { data: plans = [], ...rest } = useQuery({
|
||||
queryKey: ['plans', space.address],
|
||||
queryFn: async () => {
|
||||
|
||||
@@ -47,6 +47,7 @@ export default async function RootLayout({
|
||||
const headerList = headers()
|
||||
const cookies = headers().get('cookie')
|
||||
const url = headerList.get('x-current-path') || ''
|
||||
const site = await getSite()
|
||||
|
||||
return (
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
@@ -73,7 +74,7 @@ export default async function RootLayout({
|
||||
enableSystem
|
||||
disableTransitionOnChange
|
||||
>
|
||||
<Providers cookies={cookies}>
|
||||
<Providers cookies={cookies} site={site}>
|
||||
{children}
|
||||
<Analytics />
|
||||
</Providers>
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
} from '@/components/ui/card'
|
||||
import { Separator } from '@/components/ui/separator'
|
||||
import { WalletConnectButton } from '@/components/WalletConnectButton'
|
||||
import { AuthType } from '@prisma/client'
|
||||
|
||||
export const dynamic = 'force-static'
|
||||
export const revalidate = 3600 * 24
|
||||
@@ -17,17 +18,25 @@ export default function HomePage() {
|
||||
<div className="h-screen flex items-center justify-center">
|
||||
<Card className="flex flex-col sm:w-96">
|
||||
<CardHeader>
|
||||
<CardTitle>Login with Google</CardTitle>
|
||||
<CardTitle>Login</CardTitle>
|
||||
<CardDescription>Login with Google or Web3 Wallets</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-6">
|
||||
<div className="space-y-1">
|
||||
<div className="text-foreground/40">Wallet login</div>
|
||||
<WalletConnectButton authType="reown" size="lg" className="w-full">
|
||||
<WalletConnectButton
|
||||
authType={AuthType.REOWN}
|
||||
size="lg"
|
||||
className="w-full"
|
||||
>
|
||||
<span className="i-[token--ethm] w-6 h-5"></span>
|
||||
Login with Reown
|
||||
</WalletConnectButton>
|
||||
<WalletConnectButton authType="privy" size="lg" className="w-full">
|
||||
<WalletConnectButton
|
||||
authType={AuthType.PRIVY}
|
||||
size="lg"
|
||||
className="w-full"
|
||||
>
|
||||
<span className="i-[token--ethm] w-6 h-5"></span>
|
||||
Login with Privy
|
||||
</WalletConnectButton>
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
import { PrivyWagmiProvider } from '@/components/PrivyWagmiProvider'
|
||||
import { ReownWagmiProvider } from '@/components/ReownWagmiProvider'
|
||||
import { isPrivy, PRIVY_APP_ID } from '@/lib/constants'
|
||||
import { SiteProvider } from '@/components/SiteContext'
|
||||
import { trpc, trpcClient } from '@/lib/trpc'
|
||||
import { StoreProvider } from '@/store'
|
||||
import { Site } from '@plantreexyz/types'
|
||||
import { AuthType } from '@prisma/client'
|
||||
import { PrivyProvider } from '@privy-io/react-auth'
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { SessionProvider } from 'next-auth/react'
|
||||
@@ -15,15 +17,19 @@ const queryClient = new QueryClient()
|
||||
export function Providers({
|
||||
children,
|
||||
cookies,
|
||||
site,
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
cookies: string | null
|
||||
site: Site
|
||||
}) {
|
||||
const WagmiProvider = isPrivy ? PrivyWagmiProvider : ReownWagmiProvider
|
||||
const WagmiProvider =
|
||||
site.authType === AuthType.PRIVY ? PrivyWagmiProvider : ReownWagmiProvider
|
||||
|
||||
const authConfig = site.authConfig as any
|
||||
return (
|
||||
<PrivyProvider
|
||||
appId={PRIVY_APP_ID}
|
||||
appId={authConfig?.privyAppId || 'cm2m05e510d9rexwjez8j66gv'}
|
||||
config={{
|
||||
// Customize Privy's appearance in your app
|
||||
appearance: {
|
||||
@@ -38,15 +44,17 @@ export function Providers({
|
||||
}}
|
||||
>
|
||||
<SessionProvider>
|
||||
<Toaster className="dark:hidden" />
|
||||
<Toaster theme="dark" className="hidden dark:block" />
|
||||
<trpc.Provider client={trpcClient} queryClient={queryClient}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<WagmiProvider cookies={cookies}>
|
||||
<StoreProvider>{children}</StoreProvider>
|
||||
</WagmiProvider>
|
||||
</QueryClientProvider>
|
||||
</trpc.Provider>
|
||||
<SiteProvider site={site}>
|
||||
<Toaster className="dark:hidden" />
|
||||
<Toaster theme="dark" className="hidden dark:block" />
|
||||
<trpc.Provider client={trpcClient} queryClient={queryClient}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<WagmiProvider cookies={cookies}>
|
||||
<StoreProvider>{children}</StoreProvider>
|
||||
</WagmiProvider>
|
||||
</QueryClientProvider>
|
||||
</trpc.Provider>
|
||||
</SiteProvider>
|
||||
</SessionProvider>
|
||||
</PrivyProvider>
|
||||
)
|
||||
|
||||
@@ -16,7 +16,8 @@ import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
|
||||
import { extractErrorMessage } from '@/lib/extractErrorMessage'
|
||||
import { trpc } from '@/lib/trpc'
|
||||
import { zodResolver } from '@hookform/resolvers/zod'
|
||||
import { AuthType, Site } from '@prisma/client'
|
||||
import { Site } from '@plantreexyz/types'
|
||||
import { AuthType } from '@prisma/client'
|
||||
import { toast } from 'sonner'
|
||||
import { z } from 'zod'
|
||||
|
||||
@@ -68,7 +69,7 @@ export function AuthTypeSettingForm({ site }: Props) {
|
||||
|
||||
return (
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className="w-2/3 space-y-6">
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="authType"
|
||||
@@ -115,6 +116,9 @@ export function AuthTypeSettingForm({ site }: Props) {
|
||||
render={({ field }) => (
|
||||
<FormItem className="w-full">
|
||||
<FormLabel>Privy App ID</FormLabel>
|
||||
<FormDescription>
|
||||
Get App ID in https://dashboard.privy.io
|
||||
</FormDescription>
|
||||
<FormControl>
|
||||
<Input placeholder="" {...field} className="w-full" />
|
||||
</FormControl>
|
||||
|
||||
@@ -16,7 +16,8 @@ import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
|
||||
import { extractErrorMessage } from '@/lib/extractErrorMessage'
|
||||
import { trpc } from '@/lib/trpc'
|
||||
import { zodResolver } from '@hookform/resolvers/zod'
|
||||
import { AuthType, Site, StorageProvider } from '@prisma/client'
|
||||
import { Site } from '@plantreexyz/types'
|
||||
import { StorageProvider } from '@prisma/client'
|
||||
import { toast } from 'sonner'
|
||||
import { z } from 'zod'
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ export function GoogleOauthButton({
|
||||
return (
|
||||
<Button
|
||||
className={cn('rounded-lg gap-2 text-sm w-24', className)}
|
||||
variant="secondary"
|
||||
disabled={loading}
|
||||
onClick={() => {
|
||||
setLoading(true)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
'use client'
|
||||
|
||||
import React, { ReactNode } from 'react'
|
||||
import { wagmiConfig } from '@/lib/wagmi/wagmiConfig'
|
||||
import { privyWagmiConfig } from '@/lib/wagmi'
|
||||
import { WagmiProvider } from '@privy-io/wagmi'
|
||||
import { Config, cookieToInitialState, State } from 'wagmi'
|
||||
import { cookieToInitialState } from 'wagmi'
|
||||
|
||||
const metadata = {
|
||||
name: 'Plantree',
|
||||
@@ -21,10 +21,10 @@ export function PrivyWagmiProvider({
|
||||
children: ReactNode
|
||||
cookies: string | null
|
||||
}) {
|
||||
const initialState = cookieToInitialState(wagmiConfig, cookies)
|
||||
const initialState = cookieToInitialState(privyWagmiConfig, cookies)
|
||||
|
||||
return (
|
||||
<WagmiProvider config={wagmiConfig} initialState={initialState}>
|
||||
<WagmiProvider config={privyWagmiConfig} initialState={initialState}>
|
||||
{children}
|
||||
</WagmiProvider>
|
||||
)
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
'use client'
|
||||
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
import { WalletConnectButton } from '@/components/WalletConnectButton'
|
||||
import { isGoogleOauth } from '@/lib/constants'
|
||||
import {
|
||||
PrivyConnectButton,
|
||||
ReownConnectButton,
|
||||
WalletConnectButton,
|
||||
} from '@/components/WalletConnectButton'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { AuthType } from '@prisma/client'
|
||||
import { useSession } from 'next-auth/react'
|
||||
import { Button } from '../ui/button'
|
||||
import { GoogleOauthButton } from '../GoogleOauthButton'
|
||||
import { useSiteContext } from '../SiteContext'
|
||||
import { GoogleOauthDialog } from './GoogleOauthDialog/GoogleOauthDialog'
|
||||
import { ProfileDialog } from './ProfileDialog/ProfileDialog'
|
||||
import { ProfilePopover } from './ProfilePopover'
|
||||
@@ -15,10 +19,12 @@ interface Props {}
|
||||
|
||||
export function Profile({}: Props) {
|
||||
const { data, status } = useSession()
|
||||
const site = useSiteContext()
|
||||
|
||||
if (status == 'loading') return <Skeleton className="h-10 w-[100px]" />
|
||||
|
||||
const authenticated = !!data
|
||||
const isGoogleOauth = site.authType === AuthType.GOOGLE
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -28,9 +34,8 @@ export function Profile({}: Props) {
|
||||
{!authenticated && (
|
||||
<>
|
||||
{isGoogleOauth && <GoogleOauthButton />}
|
||||
{!isGoogleOauth && (
|
||||
<WalletConnectButton className={cn('rounded-xl')} />
|
||||
)}
|
||||
{site.authType === AuthType.REOWN && <ReownConnectButton />}
|
||||
{site.authType === AuthType.PRIVY && <PrivyConnectButton />}
|
||||
</>
|
||||
)}
|
||||
|
||||
|
||||
@@ -15,10 +15,8 @@ import {
|
||||
DropdownMenuSubTrigger,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu'
|
||||
import { useAddress } from '@/hooks/useAddress'
|
||||
import { GateType, isGoogleOauth, isPrivy } from '@/lib/constants'
|
||||
import { trpc } from '@/lib/trpc'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { AuthType } from '@prisma/client'
|
||||
import { usePrivy } from '@privy-io/react-auth'
|
||||
import {
|
||||
DatabaseBackup,
|
||||
@@ -31,6 +29,7 @@ import {
|
||||
} from 'lucide-react'
|
||||
import { signOut, useSession } from 'next-auth/react'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { useSiteContext } from '../SiteContext'
|
||||
import { ProfileAvatar } from './ProfileAvatar'
|
||||
import { WalletInfo } from './WalletInfo'
|
||||
|
||||
@@ -48,6 +47,8 @@ export function ProfilePopover({
|
||||
const { data } = useSession()
|
||||
const { push } = useRouter()
|
||||
const { logout } = usePrivy()
|
||||
const { authType } = useSiteContext()
|
||||
const isGoogleOauth = authType === AuthType.GOOGLE
|
||||
|
||||
if (!data) return null
|
||||
const isEditor = ['ADMIN', 'AUTHOR'].includes(data.role)
|
||||
@@ -137,7 +138,7 @@ export function ProfilePopover({
|
||||
<DropdownMenuItem
|
||||
className="cursor-pointer"
|
||||
onClick={() => {
|
||||
if (isPrivy) {
|
||||
if (authType === AuthType.PRIVY) {
|
||||
logout()
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
import React, { ReactNode } from 'react'
|
||||
import { PROJECT_ID } from '@/lib/constants'
|
||||
import { siweConfig } from '@/lib/wagmi/siweConfig'
|
||||
import { networks, wagmiAdapter, wagmiConfig } from '@/lib/wagmi/wagmiConfig'
|
||||
import {
|
||||
networks,
|
||||
reownWagmiConfig,
|
||||
wagmiAdapter,
|
||||
} from '@/lib/wagmi/wagmiConfig'
|
||||
import { createAppKit } from '@reown/appkit/react'
|
||||
import { Config, cookieToInitialState, State, WagmiProvider } from 'wagmi'
|
||||
|
||||
@@ -44,7 +48,7 @@ export function ReownWagmiProvider({
|
||||
)
|
||||
|
||||
return (
|
||||
<WagmiProvider config={wagmiConfig} initialState={initialState}>
|
||||
<WagmiProvider config={reownWagmiConfig} initialState={initialState}>
|
||||
{children}
|
||||
</WagmiProvider>
|
||||
)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { createContext, PropsWithChildren, useContext } from 'react'
|
||||
import { isServer } from '@/lib/constants'
|
||||
import { runWorker } from '@/lib/worker'
|
||||
import { Site } from '@plantreexyz/types'
|
||||
|
||||
let inited = false
|
||||
@@ -18,7 +17,7 @@ if (!isServer) {
|
||||
export const SiteContext = createContext({} as Site)
|
||||
|
||||
interface Props {
|
||||
site: Site;
|
||||
site: Site
|
||||
}
|
||||
|
||||
export const SiteProvider = ({ site, children }: PropsWithChildren<Props>) => {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
'use client'
|
||||
|
||||
import { Button, ButtonProps } from '@/components/ui/button'
|
||||
import { isPrivy } from '@/lib/constants'
|
||||
import { AuthType } from '@prisma/client'
|
||||
import { getAccessToken, useLogin } from '@privy-io/react-auth'
|
||||
import { useAppKit } from '@reown/appkit/react'
|
||||
import { signIn } from 'next-auth/react'
|
||||
|
||||
interface Props extends ButtonProps {
|
||||
authType?: 'privy' | 'reown'
|
||||
authType?: AuthType
|
||||
}
|
||||
|
||||
const ReownConnectButton = (props: Props) => {
|
||||
export const ReownConnectButton = (props: Props) => {
|
||||
const { open } = useAppKit()
|
||||
async function onOpen() {
|
||||
await open()
|
||||
@@ -27,7 +27,7 @@ const ReownConnectButton = (props: Props) => {
|
||||
)
|
||||
}
|
||||
|
||||
const PrivyConnectButton = (props: Props) => {
|
||||
export const PrivyConnectButton = (props: Props) => {
|
||||
const { login } = useLogin({
|
||||
onComplete: async (
|
||||
user,
|
||||
@@ -74,9 +74,10 @@ const PrivyConnectButton = (props: Props) => {
|
||||
}
|
||||
|
||||
export const WalletConnectButton = (props: Props) => {
|
||||
if (props.authType === 'privy') return <PrivyConnectButton {...props} />
|
||||
if (props.authType === 'reown') return <ReownConnectButton {...props} />
|
||||
if (props.authType === AuthType.PRIVY)
|
||||
return <PrivyConnectButton {...props} />
|
||||
if (props.authType === AuthType.REOWN)
|
||||
return <ReownConnectButton {...props} />
|
||||
|
||||
if (isPrivy) return <PrivyConnectButton {...props} />
|
||||
return <ReownConnectButton {...props} />
|
||||
}
|
||||
|
||||
15
hooks/useCheckChain.ts
Normal file
15
hooks/useCheckChain.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { getAccount, getChains, switchChain } from '@wagmi/core'
|
||||
import { useWagmiConfig } from './useWagmiConfig'
|
||||
|
||||
export function useCheckChain() {
|
||||
const wagmiConfig = useWagmiConfig()
|
||||
return async () => {
|
||||
const account = getAccount(wagmiConfig)
|
||||
const chains = getChains(wagmiConfig)
|
||||
const isSupported = chains.some((chain) => chain.id === account.chainId)
|
||||
|
||||
if (!isSupported) {
|
||||
await switchChain(wagmiConfig, { chainId: chains[0].id })
|
||||
}
|
||||
}
|
||||
}
|
||||
8
hooks/useWagmiConfig.ts
Normal file
8
hooks/useWagmiConfig.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { useSiteContext } from '@/components/SiteContext'
|
||||
import { getWagmiConfig } from '@/lib/wagmi'
|
||||
import { AuthType } from '@prisma/client'
|
||||
|
||||
export function useWagmiConfig() {
|
||||
const { authType } = useSiteContext()
|
||||
return getWagmiConfig(authType === AuthType.PRIVY)
|
||||
}
|
||||
17
lib/auth.ts
17
lib/auth.ts
@@ -12,12 +12,7 @@ import credentialsProvider from 'next-auth/providers/credentials'
|
||||
import { Address, createPublicClient, http } from 'viem'
|
||||
import { baseSepolia } from 'viem/chains'
|
||||
import { spaceAbi } from './abi'
|
||||
import {
|
||||
PRIVY_APP_ID,
|
||||
PRIVY_APP_SECRET,
|
||||
PROJECT_ID,
|
||||
SPACE_ID,
|
||||
} from './constants'
|
||||
import { PROJECT_ID, SPACE_ID } from './constants'
|
||||
|
||||
type GoogleLoginInfo = {
|
||||
email: string
|
||||
@@ -31,8 +26,6 @@ if (!nextAuthSecret) {
|
||||
throw new Error('NEXTAUTH_SECRET is not set')
|
||||
}
|
||||
|
||||
const privy = new PrivyClient(PRIVY_APP_ID!, PRIVY_APP_SECRET!)
|
||||
|
||||
export const authOptions: NextAuthOptions = {
|
||||
secret: nextAuthSecret,
|
||||
providers: [
|
||||
@@ -102,6 +95,14 @@ export const authOptions: NextAuthOptions = {
|
||||
|
||||
const { token, address } = credentials
|
||||
// console.log('====== token, address:', token, address)
|
||||
const site = await prisma.site.findFirst()
|
||||
if (!site) return null
|
||||
|
||||
const authConfig = site.authConfig as any
|
||||
const privy = new PrivyClient(
|
||||
authConfig.privyAppId,
|
||||
authConfig.privyAppSecret,
|
||||
)
|
||||
|
||||
try {
|
||||
const t0 = Date.now()
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { getAccount, getChains, switchChain } from '@wagmi/core'
|
||||
import { networks, wagmiConfig } from './wagmi'
|
||||
|
||||
export async function checkChain() {
|
||||
const account = getAccount(wagmiConfig)
|
||||
const chains = getChains(wagmiConfig)
|
||||
const isSupported = chains.some((chain) => chain.id === account.chainId)
|
||||
|
||||
if (!isSupported) {
|
||||
await switchChain(wagmiConfig, { chainId: chains[0].id })
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,6 @@ export const isProd = process.env.NODE_ENV === 'production'
|
||||
// GOOGLE|REOWN|PRIVY
|
||||
export const AUTH_TYPE = process.env.NEXT_PUBLIC_AUTH_TYPE! || 'GOOGLE'
|
||||
|
||||
export const PRIVY_APP_ID =
|
||||
process.env.NEXT_PUBLIC_PRIVY_APP_ID || 'cm2m05e510d9rexwjez8j66gv'
|
||||
export const PRIVY_APP_SECRET = process.env.PRIVY_APP_SECRET!
|
||||
|
||||
export const isPrivy = AUTH_TYPE === 'PRIVY'
|
||||
export const isGoogleOauth = AUTH_TYPE === 'GOOGLE'
|
||||
|
||||
export const GOOGLE_OAUTH_REDIRECT_URI =
|
||||
'https://www.plantree.xyz/api/google-oauth'
|
||||
|
||||
|
||||
@@ -5,16 +5,11 @@ import { getAccessToken } from '@privy-io/react-auth'
|
||||
import { createTRPCClient, httpBatchLink } from '@trpc/client'
|
||||
import { createTRPCReact } from '@trpc/react-query'
|
||||
import superjson from 'superjson'
|
||||
import { isPrivy } from './constants'
|
||||
|
||||
const link = httpBatchLink({
|
||||
url: `/api/trpc`,
|
||||
transformer: superjson,
|
||||
async headers() {
|
||||
// const token = isPrivy ? await getAccessToken() : (window as any).__TOKEN__
|
||||
// return {
|
||||
// authorization: `Bearer privy_${token}`,
|
||||
// }
|
||||
return {}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -5,7 +5,7 @@ import { WagmiAdapter } from '@reown/appkit-adapter-wagmi'
|
||||
import { AppKitNetwork, baseSepolia } from '@reown/appkit/networks'
|
||||
import { cookieStorage, createStorage, http } from '@wagmi/core'
|
||||
import { baseSepolia as viemBaseSepolia } from 'viem/chains'
|
||||
import { isPrivy, PROJECT_ID } from '../constants'
|
||||
import { PROJECT_ID } from '../constants'
|
||||
|
||||
export const networks: [AppKitNetwork, ...AppKitNetwork[]] = [baseSepolia]
|
||||
|
||||
@@ -26,4 +26,8 @@ export const privyWagmiConfig = createConfig({
|
||||
},
|
||||
})
|
||||
|
||||
export const wagmiConfig = isPrivy ? privyWagmiConfig : wagmiAdapter.wagmiConfig
|
||||
export const reownWagmiConfig = wagmiAdapter.wagmiConfig
|
||||
|
||||
export function getWagmiConfig(isPrivy: boolean) {
|
||||
return isPrivy ? privyWagmiConfig : reownWagmiConfig
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.9.0",
|
||||
"@plantreexyz/types": "0.0.5",
|
||||
"@plantreexyz/types": "0.0.6",
|
||||
"@prisma/client": "^5.21.1",
|
||||
"@privy-io/react-auth": "^1.92.2",
|
||||
"@privy-io/server-auth": "^1.15.0",
|
||||
@@ -81,9 +81,9 @@
|
||||
"nextjs-toploader": "^1.6.12",
|
||||
"novel": "^0.5.0",
|
||||
"openai-edge": "^1.2.2",
|
||||
"plantree-theme-card": "0.0.5",
|
||||
"plantree-theme-micro": "0.0.5",
|
||||
"plantree-theme-minimal": "0.0.5",
|
||||
"plantree-theme-card": "0.0.6",
|
||||
"plantree-theme-micro": "0.0.6",
|
||||
"plantree-theme-minimal": "0.0.6",
|
||||
"prisma-extension-pagination": "^0.7.4",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
|
||||
58
pnpm-lock.yaml
generated
58
pnpm-lock.yaml
generated
@@ -12,8 +12,8 @@ importers:
|
||||
specifier: ^3.9.0
|
||||
version: 3.9.0(react-hook-form@7.53.1(react@18.2.0))
|
||||
'@plantreexyz/types':
|
||||
specifier: 0.0.5
|
||||
version: 0.0.5
|
||||
specifier: 0.0.6
|
||||
version: 0.0.6
|
||||
'@prisma/client':
|
||||
specifier: ^5.21.1
|
||||
version: 5.21.1(prisma@5.21.1)
|
||||
@@ -216,14 +216,14 @@ importers:
|
||||
specifier: ^1.2.2
|
||||
version: 1.2.2
|
||||
plantree-theme-card:
|
||||
specifier: 0.0.5
|
||||
version: 0.0.5
|
||||
specifier: 0.0.6
|
||||
version: 0.0.6
|
||||
plantree-theme-micro:
|
||||
specifier: 0.0.5
|
||||
version: 0.0.5
|
||||
specifier: 0.0.6
|
||||
version: 0.0.6
|
||||
plantree-theme-minimal:
|
||||
specifier: 0.0.5
|
||||
version: 0.0.5
|
||||
specifier: 0.0.6
|
||||
version: 0.0.6
|
||||
prisma-extension-pagination:
|
||||
specifier: ^0.7.4
|
||||
version: 0.7.4(@prisma/client@5.21.1(prisma@5.21.1))
|
||||
@@ -1772,11 +1772,11 @@ packages:
|
||||
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
|
||||
engines: {node: '>=14'}
|
||||
|
||||
'@plantreexyz/types@0.0.5':
|
||||
resolution: {integrity: sha512-TLhSAXDua5D9bevtjbFsEbyPaHpZNTc3vAn/6UlGegKeZAsNwper3Hfr6XN2lxczAHq2dFNY5HMtOn2Dvl2XOQ==}
|
||||
'@plantreexyz/types@0.0.6':
|
||||
resolution: {integrity: sha512-4Bm2dQKyInVzDeKIMm8qkRo1uASJnrTwraysgF20Jag9uOaM6cGI1Gd+alvFF/BOvLEwGS+5dcfOdRrkReidvw==}
|
||||
|
||||
'@plantreexyz/utils@0.0.5':
|
||||
resolution: {integrity: sha512-OXtQMEceZANZAP2ayNuaGc4q18pPmUjR2zCpY0N/1ZNNAU/JLSISf1K0dgevc5oxe7QQ2T6jigvoR91v8+u1rA==}
|
||||
'@plantreexyz/utils@0.0.6':
|
||||
resolution: {integrity: sha512-u4eBUpRWhIqtF8UEV5EulgpkabVml70DQ99YOKo8IBSj6m2zE/nZgYCtf3f6kd7hjWdItTyzH2XNkFi123lbqA==}
|
||||
|
||||
'@popperjs/core@2.11.8':
|
||||
resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==}
|
||||
@@ -6781,14 +6781,14 @@ packages:
|
||||
pkg-types@1.2.1:
|
||||
resolution: {integrity: sha512-sQoqa8alT3nHjGuTjuKgOnvjo4cljkufdtLMnO2LBP/wRwuDlo1tkaEdMxCRhyGRPacv/ztlZgDPm2b7FAmEvw==}
|
||||
|
||||
plantree-theme-card@0.0.5:
|
||||
resolution: {integrity: sha512-ieJpk0Um1lNrn7imgeSuE+wGWFjdfnTM9JZ7vufR58u2+S9yHAkIeJAF/8CUjC56BfX45yxJPhSVhDkDrXFPGQ==}
|
||||
plantree-theme-card@0.0.6:
|
||||
resolution: {integrity: sha512-PeXYn3Z/kqLl9sLSnCLJVKB3sCpyuYyzGxnXmrcIkRYbGdXoiEwESM7ocGMMmsJUfz5BEJaAUw0XNL67j5XjNg==}
|
||||
|
||||
plantree-theme-micro@0.0.5:
|
||||
resolution: {integrity: sha512-R5V9K+J/Vipr2LNjtZJV9E9LMAXzYlSgUSsvtSHUIW+lUYt/TM5o7AhZ+uXgMvTuiZ8hbZkHNSNJUdYVgd4Dkw==}
|
||||
plantree-theme-micro@0.0.6:
|
||||
resolution: {integrity: sha512-Z1SiZ08wbuHbfRUOe2WRuICbGYub7gpk4NkuJIYSYMmgL8gy/TqEBFb8dwzQ04IXKtIHgmbQNgKPRcUP/hqg6w==}
|
||||
|
||||
plantree-theme-minimal@0.0.5:
|
||||
resolution: {integrity: sha512-xCwyAdlJwafKf85ZyQNM9MqxxstEnWOfekva+ZN5kd+3vZgLTRVw6X3PbYawNdrzhvYj5+y++SFBBC9awOEnow==}
|
||||
plantree-theme-minimal@0.0.6:
|
||||
resolution: {integrity: sha512-QBkR0o4e/2V8w/SOrHKLr2x9+llYec5iZAGnXb45xfYZsvtNjoolLml/y3gtCgY5glllLjUu8gN2y0+EfNOyHw==}
|
||||
|
||||
pngjs@5.0.0:
|
||||
resolution: {integrity: sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==}
|
||||
@@ -10744,9 +10744,9 @@ snapshots:
|
||||
'@pkgjs/parseargs@0.11.0':
|
||||
optional: true
|
||||
|
||||
'@plantreexyz/types@0.0.5': {}
|
||||
'@plantreexyz/types@0.0.6': {}
|
||||
|
||||
'@plantreexyz/utils@0.0.5':
|
||||
'@plantreexyz/utils@0.0.6':
|
||||
dependencies:
|
||||
'@troop.com/tiptap-react-render': 0.0.2
|
||||
clsx: 2.1.1
|
||||
@@ -17559,28 +17559,28 @@ snapshots:
|
||||
mlly: 1.7.2
|
||||
pathe: 1.1.2
|
||||
|
||||
plantree-theme-card@0.0.5:
|
||||
plantree-theme-card@0.0.6:
|
||||
dependencies:
|
||||
'@plantreexyz/types': 0.0.5
|
||||
'@plantreexyz/utils': 0.0.5
|
||||
'@plantreexyz/types': 0.0.6
|
||||
'@plantreexyz/utils': 0.0.6
|
||||
'@troop.com/tiptap-react-render': 0.0.2
|
||||
clsx: 2.1.1
|
||||
github-slugger: 2.0.0
|
||||
tailwind-merge: 2.5.4
|
||||
|
||||
plantree-theme-micro@0.0.5:
|
||||
plantree-theme-micro@0.0.6:
|
||||
dependencies:
|
||||
'@plantreexyz/types': 0.0.5
|
||||
'@plantreexyz/utils': 0.0.5
|
||||
'@plantreexyz/types': 0.0.6
|
||||
'@plantreexyz/utils': 0.0.6
|
||||
'@troop.com/tiptap-react-render': 0.0.2
|
||||
clsx: 2.1.1
|
||||
github-slugger: 2.0.0
|
||||
tailwind-merge: 2.5.4
|
||||
|
||||
plantree-theme-minimal@0.0.5:
|
||||
plantree-theme-minimal@0.0.6:
|
||||
dependencies:
|
||||
'@plantreexyz/types': 0.0.5
|
||||
'@plantreexyz/utils': 0.0.5
|
||||
'@plantreexyz/types': 0.0.6
|
||||
'@plantreexyz/utils': 0.0.6
|
||||
'@troop.com/tiptap-react-render': 0.0.2
|
||||
clsx: 2.1.1
|
||||
github-slugger: 2.0.0
|
||||
|
||||
@@ -21,35 +21,33 @@ enum StorageProvider {
|
||||
R2
|
||||
VERCEL_BLOB
|
||||
SUPABASE_STORAGE
|
||||
|
||||
@@map("StorageType")
|
||||
}
|
||||
|
||||
model Site {
|
||||
id String @id @default(uuid())
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
description String @default("") @db.Text
|
||||
about String @default("") @db.Text
|
||||
logo String? @default("https://public.blob.vercel-storage.com/eEZHAoPTOBSYGBE3/JRajRyC-PhBHEinQkupt02jqfKacBVHLWJq7Iy.png") @db.Text
|
||||
font String @default("font-cal")
|
||||
image String? @default("") @db.Text
|
||||
description String @default("") @db.Text
|
||||
about String @default("") @db.Text
|
||||
logo String? @default("https://public.blob.vercel-storage.com/eEZHAoPTOBSYGBE3/JRajRyC-PhBHEinQkupt02jqfKacBVHLWJq7Iy.png") @db.Text
|
||||
font String @default("font-cal")
|
||||
image String? @default("") @db.Text
|
||||
email String?
|
||||
authType AuthType? @default(GOOGLE)
|
||||
authType AuthType @default(GOOGLE)
|
||||
authConfig Json?
|
||||
storageProvider StorageProvider? @default(IPFS)
|
||||
storageProvider StorageProvider @default(IPFS)
|
||||
storageConfig Json?
|
||||
socials Json?
|
||||
config Json?
|
||||
subdomain String? @unique
|
||||
customDomain String? @unique
|
||||
memberCount Int @default(0)
|
||||
postCount Int @default(0)
|
||||
message404 String? @default("Blimey! You've found a page that doesn't exist.") @db.Text
|
||||
themeName String @default("")
|
||||
symbolName String? @unique
|
||||
spaceAddress String? @unique // space on chain address
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
subdomain String? @unique
|
||||
customDomain String? @unique
|
||||
memberCount Int @default(0)
|
||||
postCount Int @default(0)
|
||||
message404 String? @default("Blimey! You've found a page that doesn't exist.") @db.Text
|
||||
themeName String @default("")
|
||||
symbolName String? @unique
|
||||
spaceAddress String? @unique // space on chain address
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@map("site")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user