mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 11:45:57 +08:00
Merge branch 'e-0154' into deploy/enterprise
This commit is contained in:
commit
66f35c2b7e
@ -7,8 +7,10 @@ import Button from '@/app/components/base/button'
|
|||||||
|
|
||||||
import { invitationCheck } from '@/service/common'
|
import { invitationCheck } from '@/service/common'
|
||||||
import Loading from '@/app/components/base/loading'
|
import Loading from '@/app/components/base/loading'
|
||||||
|
import useDocumentTitle from '@/hooks/use-document-title'
|
||||||
|
|
||||||
const ActivateForm = () => {
|
const ActivateForm = () => {
|
||||||
|
useDocumentTitle('')
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const searchParams = useSearchParams()
|
const searchParams = useSearchParams()
|
||||||
|
@ -6,8 +6,10 @@ import Header from '../signin/_header'
|
|||||||
import style from '../signin/page.module.css'
|
import style from '../signin/page.module.css'
|
||||||
import ForgotPasswordForm from './ForgotPasswordForm'
|
import ForgotPasswordForm from './ForgotPasswordForm'
|
||||||
import ChangePasswordForm from '@/app/forgot-password/ChangePasswordForm'
|
import ChangePasswordForm from '@/app/forgot-password/ChangePasswordForm'
|
||||||
|
import useDocumentTitle from '@/hooks/use-document-title'
|
||||||
|
|
||||||
const ForgotPassword = () => {
|
const ForgotPassword = () => {
|
||||||
|
useDocumentTitle('')
|
||||||
const searchParams = useSearchParams()
|
const searchParams = useSearchParams()
|
||||||
const token = searchParams.get('token')
|
const token = searchParams.get('token')
|
||||||
|
|
||||||
|
@ -7,8 +7,10 @@ import Loading from '../components/base/loading'
|
|||||||
import Button from '@/app/components/base/button'
|
import Button from '@/app/components/base/button'
|
||||||
import { fetchInitValidateStatus, initValidate } from '@/service/common'
|
import { fetchInitValidateStatus, initValidate } from '@/service/common'
|
||||||
import type { InitValidateStatusResponse } from '@/models/common'
|
import type { InitValidateStatusResponse } from '@/models/common'
|
||||||
|
import useDocumentTitle from '@/hooks/use-document-title'
|
||||||
|
|
||||||
const InitPasswordPopup = () => {
|
const InitPasswordPopup = () => {
|
||||||
|
useDocumentTitle('')
|
||||||
const [password, setPassword] = useState('')
|
const [password, setPassword] = useState('')
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
const [validated, setValidated] = useState(false)
|
const [validated, setValidated] = useState(false)
|
||||||
|
@ -15,6 +15,7 @@ import Button from '@/app/components/base/button'
|
|||||||
|
|
||||||
import { fetchInitValidateStatus, fetchSetupStatus, setup } from '@/service/common'
|
import { fetchInitValidateStatus, fetchSetupStatus, setup } from '@/service/common'
|
||||||
import type { InitValidateStatusResponse, SetupStatusResponse } from '@/models/common'
|
import type { InitValidateStatusResponse, SetupStatusResponse } from '@/models/common'
|
||||||
|
import useDocumentTitle from '@/hooks/use-document-title'
|
||||||
|
|
||||||
const validPassword = /^(?=.*[a-zA-Z])(?=.*\d).{8,}$/
|
const validPassword = /^(?=.*[a-zA-Z])(?=.*\d).{8,}$/
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ const accountFormSchema = z.object({
|
|||||||
type AccountFormValues = z.infer<typeof accountFormSchema>
|
type AccountFormValues = z.infer<typeof accountFormSchema>
|
||||||
|
|
||||||
const InstallForm = () => {
|
const InstallForm = () => {
|
||||||
|
useDocumentTitle('')
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [showPassword, setShowPassword] = React.useState(false)
|
const [showPassword, setShowPassword] = React.useState(false)
|
||||||
|
@ -7,9 +7,6 @@ import { TanstackQueryIniter } from '@/context/query-client'
|
|||||||
import './styles/globals.css'
|
import './styles/globals.css'
|
||||||
import './styles/markdown.scss'
|
import './styles/markdown.scss'
|
||||||
import GlobalPublicStoreProvider from '@/context/global-public-context'
|
import GlobalPublicStoreProvider from '@/context/global-public-context'
|
||||||
import type { SystemFeatures } from '@/types/feature'
|
|
||||||
import { defaultSystemFeatures } from '@/types/feature'
|
|
||||||
import { API_PREFIX } from '@/config'
|
|
||||||
|
|
||||||
export const viewport: Viewport = {
|
export const viewport: Viewport = {
|
||||||
width: 'device-width',
|
width: 'device-width',
|
||||||
@ -18,22 +15,9 @@ export const viewport: Viewport = {
|
|||||||
viewportFit: 'cover',
|
viewportFit: 'cover',
|
||||||
userScalable: false,
|
userScalable: false,
|
||||||
}
|
}
|
||||||
|
export const metadata: Metadata = {
|
||||||
export async function generateMetadata(): Promise<Metadata> {
|
title: ' ',
|
||||||
const ret = await fetch(`${API_PREFIX}/system-features`, { cache: 'no-cache' }).then(res => res.json())
|
icons: 'data:',
|
||||||
const config: SystemFeatures = { ...defaultSystemFeatures, ...ret.data }
|
|
||||||
if (config.branding.enabled) {
|
|
||||||
return {
|
|
||||||
title: { template: `%s - ${config.branding.application_title}`, default: config.branding.application_title },
|
|
||||||
icons: config.branding.favicon,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
title: {
|
|
||||||
template: '%s - Dify',
|
|
||||||
default: 'Dify',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const LocaleLayout = ({
|
const LocaleLayout = ({
|
||||||
|
@ -12,9 +12,11 @@ import Input from '@/app/components/base/input'
|
|||||||
import Toast from '@/app/components/base/toast'
|
import Toast from '@/app/components/base/toast'
|
||||||
import { sendResetPasswordCode } from '@/service/common'
|
import { sendResetPasswordCode } from '@/service/common'
|
||||||
import I18NContext from '@/context/i18n'
|
import I18NContext from '@/context/i18n'
|
||||||
|
import useDocumentTitle from '@/hooks/use-document-title'
|
||||||
|
|
||||||
export default function CheckCode() {
|
export default function CheckCode() {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
useDocumentTitle('')
|
||||||
const searchParams = useSearchParams()
|
const searchParams = useSearchParams()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [email, setEmail] = useState('')
|
const [email, setEmail] = useState('')
|
||||||
|
@ -4,9 +4,11 @@ import style from './page.module.css'
|
|||||||
|
|
||||||
import cn from '@/utils/classnames'
|
import cn from '@/utils/classnames'
|
||||||
import { useGlobalPublicStore } from '@/context/global-public-context'
|
import { useGlobalPublicStore } from '@/context/global-public-context'
|
||||||
|
import useDocumentTitle from '@/hooks/use-document-title'
|
||||||
|
|
||||||
export default function SignInLayout({ children }: any) {
|
export default function SignInLayout({ children }: any) {
|
||||||
const { systemFeatures } = useGlobalPublicStore()
|
const { systemFeatures } = useGlobalPublicStore()
|
||||||
|
useDocumentTitle('')
|
||||||
return <>
|
return <>
|
||||||
<div className={cn(
|
<div className={cn(
|
||||||
style.background,
|
style.background,
|
||||||
|
@ -5,9 +5,14 @@ import { useGlobalPublicStore } from '@/context/global-public-context'
|
|||||||
export default function useDocumentTitle(title: string) {
|
export default function useDocumentTitle(title: string) {
|
||||||
const { systemFeatures } = useGlobalPublicStore()
|
const { systemFeatures } = useGlobalPublicStore()
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (systemFeatures.branding.enabled)
|
const prefix = title ? `${title} - ` : ''
|
||||||
document.title = `${title} - ${systemFeatures.branding.application_title}`
|
if (systemFeatures.branding.enabled) {
|
||||||
else
|
document.title = `${prefix}${systemFeatures.branding.application_title}`
|
||||||
document.title = `${title} - Dify`
|
const faviconEle = document.querySelector('link[rel*=\'icon\']') as HTMLLinkElement
|
||||||
|
faviconEle.href = systemFeatures.branding.favicon
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
document.title = `${prefix}Dify`
|
||||||
|
}
|
||||||
}, [systemFeatures, title])
|
}, [systemFeatures, title])
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user