This commit is contained in:
maojindao55
2025-07-20 08:04:16 +08:00
parent 0c320203b8
commit 2a4d3f815f
3 changed files with 4 additions and 10 deletions

View File

@@ -2,6 +2,6 @@
// 部署时可以直接修改这个文件来改变配置,无需重新编译
window.APP_CONFIG = {
// 权限验证开关:'1' 开启,'0' 关闭
AUTH_ACCESS: "1",
AUTH_ACCESS: "0",
ICP_NUMBER: "",
};

View File

@@ -3,12 +3,9 @@ import { Navigate, useLocation } from 'react-router-dom';
export default function AuthGuard({ children }) {
//判断环境变量中的AUTH_ACCESS是否为1开启权限校验
//const authAccess = import.meta.env.AUTH_ACCESS;
let authAccess = window.APP_CONFIG?.AUTH_ACCESS || '0';
const isCf = import.meta.env.IS_CF || '0';
console.log(isCf, 'isCf');
if (isCf === '1') {
authAccess = import.meta.env.AUTH_ACCESS || '0';
}
const authAccess = window.APP_CONFIG?.AUTH_ACCESS ||
import.meta.env.AUTH_ACCESS ||
'0';
console.log(authAccess, 'authAccess');
if (authAccess === '1') {
const location = useLocation();

View File

@@ -7,6 +7,3 @@ preview_id = "cbd11575c3504e6bb043c1c250d2f7ed" # 本地开发环境使用
binding = "bgdb" # available in your Worker on env.DB
database_name = "friends"
database_id = "f68e9fa5-4aea-45db-9516-2d7052e936fa"
[vars]
IS_CF = '1'