mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 18:08:07 +08:00
@ -1,6 +1,7 @@
|
||||
import type { FC } from 'react'
|
||||
import React from 'react'
|
||||
import Script from 'next/script'
|
||||
import { headers } from 'next/headers'
|
||||
import { IS_CE_EDITION } from '@/config'
|
||||
|
||||
export enum GaType {
|
||||
@ -23,9 +24,16 @@ const GA: FC<IGAProps> = ({
|
||||
if (IS_CE_EDITION)
|
||||
return null
|
||||
|
||||
const nonce = process.env.NODE_ENV === 'production' ? headers().get('x-nonce') : ''
|
||||
|
||||
return (
|
||||
<>
|
||||
<Script strategy="beforeInteractive" async src={`https://www.googletagmanager.com/gtag/js?id=${gaIdMaps[gaType]}`}></Script>
|
||||
<Script
|
||||
strategy="beforeInteractive"
|
||||
async
|
||||
src={`https://www.googletagmanager.com/gtag/js?id=${gaIdMaps[gaType]}`}
|
||||
nonce={nonce!}
|
||||
></Script>
|
||||
<Script
|
||||
id="ga-init"
|
||||
dangerouslySetInnerHTML={{
|
||||
@ -36,6 +44,7 @@ gtag('js', new Date());
|
||||
gtag('config', '${gaIdMaps[gaType]}');
|
||||
`,
|
||||
}}
|
||||
nonce={nonce!}
|
||||
>
|
||||
</Script>
|
||||
</>
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
'use client'
|
||||
|
||||
import { AppProgressBar as ProgressBar } from 'next-nprogress-bar'
|
||||
|
||||
const Topbar = () => {
|
||||
return (
|
||||
<>
|
||||
<ProgressBar
|
||||
height='2px'
|
||||
color="#1C64F2FF"
|
||||
options={{ showSpinner: false }}
|
||||
shallowRouting />
|
||||
</>)
|
||||
}
|
||||
|
||||
export default Topbar
|
||||
@ -2,7 +2,6 @@ import type { Viewport } from 'next'
|
||||
import I18nServer from './components/i18n-server'
|
||||
import BrowserInitor from './components/browser-initor'
|
||||
import SentryInitor from './components/sentry-initor'
|
||||
import Topbar from './components/base/topbar'
|
||||
import { getLocaleOnServer } from '@/i18n/server'
|
||||
import './styles/globals.css'
|
||||
import './styles/markdown.scss'
|
||||
@ -45,7 +44,6 @@ const LocaleLayout = ({
|
||||
data-public-site-about={process.env.NEXT_PUBLIC_SITE_ABOUT}
|
||||
data-public-text-generation-timeout-ms={process.env.NEXT_PUBLIC_TEXT_GENERATION_TIMEOUT_MS}
|
||||
>
|
||||
<Topbar />
|
||||
<BrowserInitor>
|
||||
<SentryInitor>
|
||||
<I18nServer>{children}</I18nServer>
|
||||
|
||||
Reference in New Issue
Block a user