layout.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. };
  15. function Meta() {
  16. const metas = {
  17. version: COMMIT_ID,
  18. access: ACCESS_CODES.size > 0 ? "enabled" : "disabled",
  19. };
  20. return (
  21. <>
  22. {Object.entries(metas).map(([k, v]) => (
  23. <meta name={k} content={v} key={k} />
  24. ))}
  25. </>
  26. );
  27. }
  28. export default function RootLayout({
  29. children,
  30. }: {
  31. children: React.ReactNode;
  32. }) {
  33. return (
  34. <html lang="en">
  35. <head>
  36. <meta
  37. name="viewport"
  38. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
  39. />
  40. <Meta />
  41. <link rel="manifest" href="/site.webmanifest"></link>
  42. <link rel="preconnect" href="https://fonts.googleapis.com"></link>
  43. <link rel="preconnect" href="https://fonts.gstatic.com"></link>
  44. <link
  45. href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;700;900&display=swap"
  46. rel="stylesheet"
  47. ></link>
  48. </head>
  49. <body>{children}</body>
  50. </html>
  51. );
  52. }