layout.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* eslint-disable @next/next/no-page-custom-font */
  2. import "./styles/globals.scss";
  3. import "./styles/markdown.scss";
  4. import "./styles/prism.scss";
  5. import process from "child_process";
  6. import { ACCESS_CODES } from "./api/access";
  7. const COMMIT_ID = process
  8. .execSync("git rev-parse --short HEAD")
  9. .toString()
  10. .trim();
  11. export const metadata = {
  12. title: "ChatGPT Next Web",
  13. description: "Your personal ChatGPT Chat Bot.",
  14. appleWebApp: {
  15. title: "ChatGPT Next Web",
  16. statusBarStyle: "black-translucent",
  17. },
  18. themeColor: "#fafafa"
  19. };
  20. function Meta() {
  21. const metas = {
  22. version: COMMIT_ID,
  23. access: ACCESS_CODES.size > 0 ? "enabled" : "disabled",
  24. };
  25. return (
  26. <>
  27. {Object.entries(metas).map(([k, v]) => (
  28. <meta name={k} content={v} key={k} />
  29. ))}
  30. </>
  31. );
  32. }
  33. export default function RootLayout({
  34. children,
  35. }: {
  36. children: React.ReactNode;
  37. }) {
  38. return (
  39. <html lang="en">
  40. <head>
  41. <meta
  42. name="viewport"
  43. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
  44. />
  45. <Meta />
  46. <link rel="manifest" href="/site.webmanifest"></link>
  47. <link rel="preconnect" href="https://fonts.googleapis.com"></link>
  48. <link rel="preconnect" href="https://fonts.gstatic.com"></link>
  49. <link
  50. href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;700;900&display=swap"
  51. rel="stylesheet"
  52. ></link>
  53. <script src="/serviceWorkerRegister.js" defer></script>
  54. </head>
  55. <body>{children}</body>
  56. </html>
  57. );
  58. }