This commit is contained in:
hailin 2025-05-18 23:14:35 +08:00
parent ba89b18bce
commit 52a445cff1
2 changed files with 9 additions and 37 deletions

View File

@ -10,6 +10,7 @@ import { Inter } from "next/font/google"
import { cookies } from "next/headers" import { cookies } from "next/headers"
import { ReactNode } from "react" import { ReactNode } from "react"
import "./globals.css" import "./globals.css"
import { getRuntimeEnv } from "@/lib/ipconfig" // 新增引入
const inter = Inter({ subsets: ["latin"] }) const inter = Inter({ subsets: ["latin"] })
const APP_NAME = "ChatAI UI" const APP_NAME = "ChatAI UI"
@ -24,42 +25,6 @@ interface RootLayoutProps {
} }
} }
// export const metadata: Metadata = {
// applicationName: APP_NAME,
// title: {
// default: APP_DEFAULT_TITLE,
// template: APP_TITLE_TEMPLATE
// },
// description: APP_DESCRIPTION,
// manifest: "/manifest.json",
// appleWebApp: {
// capable: true,
// statusBarStyle: "black",
// title: APP_DEFAULT_TITLE
// // startUpImage: [],
// },
// formatDetection: {
// telephone: false
// },
// openGraph: {
// type: "website",
// siteName: APP_NAME,
// title: {
// default: APP_DEFAULT_TITLE,
// template: APP_TITLE_TEMPLATE
// },
// description: APP_DESCRIPTION
// },
// twitter: {
// card: "summary",
// title: {
// default: APP_DEFAULT_TITLE,
// template: APP_TITLE_TEMPLATE
// },
// description: APP_DESCRIPTION
// }
// }
export async function generateMetadata({ export async function generateMetadata({
params: { locale } params: { locale }
}: { }: {
@ -127,7 +92,7 @@ export default async function RootLayout({
} }
const supabase = createServerClient<Database>( const supabase = createServerClient<Database>(
process.env.NEXT_PUBLIC_SUPABASE_URL!, getRuntimeEnv("SUPABASE_URL") ?? "http://localhost:8000",
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
{ {
cookies: { cookies: {

View File

@ -0,0 +1,7 @@
// lib/ipconfig.ts
export function getRuntimeEnv(key: string): string | undefined {
if (typeof window !== "undefined" && typeof window.RUNTIME_ENV !== "undefined") {
return window.RUNTIME_ENV[key];
}
return process.env[key];
}