mirror of https://github.com/langgenius/dify.git
fix: add missed systemFeatures in webapp pages
This commit is contained in:
parent
fb10f50ed9
commit
db92ba92b8
|
|
@ -45,6 +45,7 @@ import { TransferMethod } from '@/types/app'
|
|||
import { noop } from 'lodash-es'
|
||||
import { useGetAppAccessMode, useGetUserCanAccessApp } from '@/service/access-control'
|
||||
import { useGlobalPublicStore } from '@/context/global-public-context'
|
||||
import { AccessMode } from '@/models/access-control'
|
||||
|
||||
function getFormattedChatList(messages: any[]) {
|
||||
const newChatList: ChatItem[] = []
|
||||
|
|
@ -460,9 +461,9 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
|
|||
|
||||
return {
|
||||
appInfoError,
|
||||
appInfoLoading: appInfoLoading || isGettingAccessMode || isCheckingPermission,
|
||||
accessMode: appAccessMode?.accessMode,
|
||||
userCanAccess: userCanAccessResult?.result,
|
||||
appInfoLoading: appInfoLoading || (systemFeatures.webapp_auth.enabled && (isGettingAccessMode || isCheckingPermission)),
|
||||
accessMode: systemFeatures.webapp_auth.enabled ? appAccessMode?.accessMode : AccessMode.PUBLIC,
|
||||
userCanAccess: systemFeatures.webapp_auth.enabled ? userCanAccessResult?.result : true,
|
||||
isInstalledApp,
|
||||
appId,
|
||||
currentConversationId,
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import { addFileInfos, sortAgentSorts } from '@/app/components/tools/utils'
|
|||
import { noop } from 'lodash-es'
|
||||
import { useGetAppAccessMode, useGetUserCanAccessApp } from '@/service/access-control'
|
||||
import { useGlobalPublicStore } from '@/context/global-public-context'
|
||||
import { AccessMode } from '@/models/access-control'
|
||||
|
||||
function getFormattedChatList(messages: any[]) {
|
||||
const newChatList: ChatItem[] = []
|
||||
|
|
@ -377,9 +378,9 @@ export const useEmbeddedChatbot = () => {
|
|||
|
||||
return {
|
||||
appInfoError,
|
||||
appInfoLoading: appInfoLoading || isGettingAccessMode || isCheckingPermission,
|
||||
accessMode: appAccessMode?.accessMode,
|
||||
userCanAccess: userCanAccessResult?.result,
|
||||
appInfoLoading: appInfoLoading || (systemFeatures.webapp_auth.enabled && (isGettingAccessMode || isCheckingPermission)),
|
||||
accessMode: systemFeatures.webapp_auth.enabled ? appAccessMode?.accessMode : AccessMode.PUBLIC,
|
||||
userCanAccess: systemFeatures.webapp_auth.enabled ? userCanAccessResult?.result : true,
|
||||
isInstalledApp,
|
||||
allowResetChat,
|
||||
appId,
|
||||
|
|
|
|||
|
|
@ -434,7 +434,7 @@ const TextGeneration: FC<IMainProps> = ({
|
|||
setMoreLikeThisConfig(more_like_this)
|
||||
setTextToSpeechConfig(text_to_speech)
|
||||
})()
|
||||
}, [fetchInitData])
|
||||
}, [])
|
||||
|
||||
// Can Use metadata(https://beta.nextjs.org/docs/api-reference/metadata) to set title. But it only works in server side client.
|
||||
useDocumentTitle(siteInfo?.title || t('share.generation.title'))
|
||||
|
|
@ -536,13 +536,13 @@ const TextGeneration: FC<IMainProps> = ({
|
|||
</div>
|
||||
)
|
||||
|
||||
if (!appId || !siteInfo || !promptConfig || isGettingAccessMode || isCheckingPermission) {
|
||||
if (!appId || !siteInfo || !promptConfig || (systemFeatures.webapp_auth.enabled && (isGettingAccessMode || isCheckingPermission))) {
|
||||
return (
|
||||
<div className='flex h-screen items-center'>
|
||||
<Loading type='app' />
|
||||
</div>)
|
||||
}
|
||||
if (!userCanAccessResult?.result)
|
||||
if (systemFeatures.webapp_auth.enabled && !userCanAccessResult?.result)
|
||||
return <AppUnavailable code={403} unknownReason='no permission.' />
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in New Issue