保存规则库 YAML 维护改造进展

This commit is contained in:
2026-04-28 22:00:00 +08:00
parent 7b86293263
commit dce5ac0c9a
96 changed files with 36801 additions and 615 deletions
+14 -16
View File
@@ -48,11 +48,12 @@ import {
} from "~/config/api-config";
// 导入移动端检测工具
import {
isMobileDevice,
isMobileAllowedPath,
MOBILE_CHAT_PATH
} from "~/utils/mobile-detect.server";
import {
isMobileDevice,
isMobileAllowedPath,
MOBILE_CHAT_PATH
} from "~/utils/mobile-detect.server";
import { normalizeRoutePathForPermission } from "~/utils/route-alias";
// 定义需要高级权限的路径
// export const developerOnlyPaths = [
@@ -138,16 +139,13 @@ function isDynamicIdSegment(segment: string): boolean {
* @param allowedPaths 允许访问的路径列表(从菜单配置中提取)
* @returns true 表示允许访问,false 表示拒绝访问
*/
function isPathAllowed(pathname: string, allowedPaths: string[]): boolean {
// --- 开发测试 STARTreviewsTest 复用 reviews 的权限(测试完后 git checkout app/root.tsx 还原)---
const testPath = pathname.replace(/^\/reviewsTest/, '/reviews');
const checkPath = testPath !== pathname ? testPath : pathname;
// --- 开发测试 END ---
// 1. 精确匹配(原版用 pathname,测试期间用 checkPath
if (allowedPaths.includes(checkPath)) {
return true;
}
function isPathAllowed(pathname: string, allowedPaths: string[]): boolean {
const checkPath = normalizeRoutePathForPermission(pathname);
// 1. 精确匹配
if (allowedPaths.includes(checkPath)) {
return true;
}
// 2. 动态路由匹配(只允许看起来像ID的子路径)
for (const allowedPath of allowedPaths) {
@@ -495,4 +493,4 @@ export function ErrorBoundary() {
</body>
</html>
);
}
}