fix: 修复14个中等问题(安全+稳定性)
后端安全修复: - devices.js: page/pageSize parseInt+范围限制、CSV导入path.basename防路径遍历 - tickets.js: CSV导出收集所有metadata key、评价限制completed状态 - users.js: 重置密码加权限检查(仅管理员或本人) - systemSettings.js: Boolean改显式判断(修复false存储为true) - inventory.js: 空数组Array.isArray检查(修复无法清空目标机房) - statistics.js: 在线率改用runningDevices计算 - operationLogs.js: DATE()改strftime兼容SQLite - devicePorts.js: 端口更新白名单过滤(防修改portId/deviceId) - server.js: 生产环境禁用sync alter 前端修复: - api/index.js: 401优先React Router导航(保留SPA状态) - Scene.jsx: useFrame仅target变化时更新(减少不必要矩阵计算) - vite.config.mjs: 移除Vue插件残留(unplugin-vue-components)
This commit is contained in:
@@ -75,7 +75,12 @@ api.interceptors.response.use(
|
||||
if (!currentPath.startsWith('/login')) {
|
||||
secureStorage.remove(TOKEN_KEY);
|
||||
secureStorage.remove('user');
|
||||
window.location.href = '/login';
|
||||
// 使用 React Router 导航而非强制刷新,保留 SPA 状态
|
||||
if (window.__navigate) {
|
||||
window.__navigate('/login');
|
||||
} else {
|
||||
window.location.href = '/login';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,11 +62,16 @@ const Controls = ({ rack, onControlsReady }) => {
|
||||
}
|
||||
}, [controlsRef.current, camera, initialCameraPosition, fixedTarget, onControlsReady]);
|
||||
|
||||
const prevTargetRef = React.useRef(null);
|
||||
|
||||
useFrame(() => {
|
||||
if (controlsRef.current) {
|
||||
// 强制保持 target 在机柜中轴线
|
||||
controlsRef.current.target.copy(fixedTarget);
|
||||
controlsRef.current.update();
|
||||
// 仅在 target 变化时更新,避免每帧执行矩阵计算
|
||||
if (prevTargetRef.current !== fixedTarget) {
|
||||
controlsRef.current.target.copy(fixedTarget);
|
||||
controlsRef.current.update();
|
||||
prevTargetRef.current = fixedTarget;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user