ChatGPT-Next-Web/app/layout.tsx

69 lines
1.7 KiB
TypeScript
Raw Normal View History

2023-03-25 22:24:52 +08:00
/* eslint-disable @next/next/no-page-custom-font */
2023-03-19 22:13:00 +08:00
import "./styles/globals.scss";
import "./styles/markdown.scss";
import "./styles/prism.scss";
2023-03-25 22:24:52 +08:00
import process from "child_process";
import { ACCESS_CODES } from "./api/access";
2023-03-27 18:31:04 +08:00
let COMMIT_ID: string | undefined;
try {
COMMIT_ID = process
.execSync("git rev-parse --short HEAD")
.toString()
.trim();
} catch (e) {
console.error("No git or not from git repo.")
}
2023-03-07 23:23:54 +08:00
export const metadata = {
2023-03-10 01:01:40 +08:00
title: "ChatGPT Next Web",
2023-03-25 22:24:52 +08:00
description: "Your personal ChatGPT Chat Bot.",
2023-03-27 15:02:12 +08:00
appleWebApp: {
title: "ChatGPT Next Web",
statusBarStyle: "black-translucent",
},
themeColor: "#fafafa"
2023-03-10 01:01:40 +08:00
};
2023-03-07 23:23:54 +08:00
function Meta() {
const metas = {
2023-03-27 18:31:04 +08:00
version: COMMIT_ID ?? "unknown",
access: ACCESS_CODES.size > 0 ? "enabled" : "disabled",
};
return (
<>
{Object.entries(metas).map(([k, v]) => (
<meta name={k} content={v} key={k} />
))}
</>
);
}
2023-03-24 00:01:00 +08:00
2023-03-07 23:23:54 +08:00
export default function RootLayout({
children,
}: {
2023-03-10 01:01:40 +08:00
children: React.ReactNode;
2023-03-07 23:23:54 +08:00
}) {
return (
2023-03-16 01:24:03 +08:00
<html lang="en">
<head>
<meta
name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
/>
<Meta />
<link rel="manifest" href="/site.webmanifest"></link>
2023-03-24 00:01:00 +08:00
<link rel="preconnect" href="https://fonts.googleapis.com"></link>
<link rel="preconnect" href="https://fonts.gstatic.com"></link>
<link
href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;700;900&display=swap"
rel="stylesheet"
></link>
2023-03-27 18:02:35 +08:00
<script src="/serviceWorkerRegister.js" defer></script>
</head>
2023-03-07 23:23:54 +08:00
<body>{children}</body>
</html>
2023-03-10 01:01:40 +08:00
);
2023-03-07 23:23:54 +08:00
}