1.添加移动端用户的检测工具类,移动端用户只能访问对话页面。
2.评查点列表添加文档属性类型字段。 3.优化dify的对话侧边栏的显示效果。 4.评查点规则添加使用文档属性类型的输入框。添加多实体开关的操作开关。
This commit is contained in:
+20
-2
@@ -47,6 +47,13 @@ import {
|
||||
getCurrentPort
|
||||
} from "~/config/api-config";
|
||||
|
||||
// 导入移动端检测工具
|
||||
import {
|
||||
isMobileDevice,
|
||||
isMobileAllowedPath,
|
||||
MOBILE_CHAT_PATH
|
||||
} from "~/utils/mobile-detect.server";
|
||||
|
||||
// 定义需要高级权限的路径
|
||||
// export const developerOnlyPaths = [
|
||||
// '/settings',
|
||||
@@ -296,6 +303,16 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
||||
// 如果执行到这里,说明已通过认证或是公共路径
|
||||
}
|
||||
|
||||
// 🔒 移动端路由守卫
|
||||
// 移动端用户只能访问对话页面,尝试访问其他页面时重定向
|
||||
const isMobile = isMobileDevice(request);
|
||||
if (isMobile && !isPublicPath) {
|
||||
if (!isMobileAllowedPath(pathname)) {
|
||||
console.log(`📱 [Root Loader] 移动端用户尝试访问 ${pathname},重定向到对话页面`);
|
||||
return redirect(MOBILE_CHAT_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
// 检查交叉评查专属模式访问控制
|
||||
// 当 CROSS_CHECKING_ONLY_MODE=true 且端口为指定端口时,只允许访问 /cross-checking 相关路由
|
||||
const currentPort = getCurrentPort();
|
||||
@@ -330,6 +347,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
||||
pathname,
|
||||
frontendJWT,
|
||||
isPublicPath, // 传递给客户端,用于判断是否需要认证
|
||||
isMobile, // 🔒 传递移动端标识
|
||||
permissionMap, // ✅ 传递权限映射表
|
||||
ENV: {
|
||||
// 客户端不再需要直接调用 Dify API
|
||||
@@ -366,7 +384,7 @@ export function links() {
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
const { userRole, ENV, frontendJWT, isPublicPath } = useLoaderData<typeof loader>();
|
||||
const { userRole, ENV, frontendJWT, isPublicPath, isMobile } = useLoaderData<typeof loader>();
|
||||
|
||||
|
||||
return (
|
||||
@@ -406,7 +424,7 @@ export default function App() {
|
||||
{isPublicPath ? (
|
||||
<Outlet />
|
||||
) : (
|
||||
<Layout userRole={userRole} frontendJWT={frontendJWT}>
|
||||
<Layout userRole={userRole} frontendJWT={frontendJWT} isMobile={isMobile}>
|
||||
<Outlet />
|
||||
</Layout>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user