chore: update

This commit is contained in:
DDMeaqua 2024-08-16 16:10:31 +08:00
parent 9c7bacc65e
commit d88cc575e5
3 changed files with 15 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import md5 from "spark-md5"; import md5 from "spark-md5";
import { DEFAULT_MODELS } from "../constant"; import { DEFAULT_MODELS, DEFAULT_GA_ID } from "../constant";
declare global { declare global {
namespace NodeJS { namespace NodeJS {
@ -159,6 +159,7 @@ export const getServerSideConfig = () => {
alibabaApiKey: getApiKey(process.env.ALIBABA_API_KEY), alibabaApiKey: getApiKey(process.env.ALIBABA_API_KEY),
gtmId: process.env.GTM_ID, gtmId: process.env.GTM_ID,
gaId: process.env.GA_ID || DEFAULT_GA_ID,
needCode: ACCESS_CODES.size > 0, needCode: ACCESS_CODES.size > 0,
code: process.env.CODE, code: process.env.CODE,

View File

@ -351,3 +351,6 @@ export const internalAllowedWebDavEndpoints = [
"https://webdav.yandex.com", "https://webdav.yandex.com",
"https://app.koofr.net/dav/Koofr", "https://app.koofr.net/dav/Koofr",
]; ];
export const DEFAULT_GA_ID = "G-89WN60ZK2E";
export const PLUGINS = [{ name: "Stable Diffusion", path: Path.Sd }];

View File

@ -6,7 +6,7 @@ import { getClientConfig } from "./config/client";
import type { Metadata, Viewport } from "next"; import type { Metadata, Viewport } from "next";
import { SpeedInsights } from "@vercel/speed-insights/next"; import { SpeedInsights } from "@vercel/speed-insights/next";
import { getServerSideConfig } from "./config/server"; import { getServerSideConfig } from "./config/server";
import { GoogleTagManager } from "@next/third-parties/google"; import { GoogleTagManager, GoogleAnalytics } from "@next/third-parties/google";
const serverConfig = getServerSideConfig(); const serverConfig = getServerSideConfig();
export const metadata: Metadata = { export const metadata: Metadata = {
@ -37,7 +37,10 @@ export default function RootLayout({
<html lang="en"> <html lang="en">
<head> <head>
<meta name="config" content={JSON.stringify(getClientConfig())} /> <meta name="config" content={JSON.stringify(getClientConfig())} />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<link rel="manifest" href="/site.webmanifest"></link> <link rel="manifest" href="/site.webmanifest"></link>
<script src="/serviceWorkerRegister.js" defer></script> <script src="/serviceWorkerRegister.js" defer></script>
</head> </head>
@ -53,6 +56,11 @@ export default function RootLayout({
<GoogleTagManager gtmId={serverConfig.gtmId} /> <GoogleTagManager gtmId={serverConfig.gtmId} />
</> </>
)} )}
{serverConfig?.gaId && (
<>
<GoogleAnalytics gaId={serverConfig.gaId} />
</>
)}
</body> </body>
</html> </html>
); );