Files
iot-device-management-frontend/apps/web-antd/vite.config.mts
lzh fd946c132e 重构: aiot 模块重命名为 video,WVP 凭据移至环境变量
路径重命名:
- api/aiot/{alarm,device,edge,request} → api/video/{alarm,device,edge,request}
- views/aiot/{alarm,device,edge} → views/video/{alarm,device,edge}
- vite.config.mts 代理路径 /admin-api/aiot/* → /admin-api/video/*

video/request.ts 改造:
- WVP 用户名/密码 MD5 改读 import.meta.env,不再写死在源码里
- force 截图失败时补一条 console.debug,便于回溯 COS 图片加载异常

video/alarm/index.ts 顺带清理:
- 移除无调用方的重复 API getRecentAlerts(与 getAlertPage 重叠)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 11:40:02 +08:00

86 lines
3.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig } from '@vben/vite-config';
export default defineConfig(async () => {
return {
application: {},
vite: {
server: {
allowedHosts: true,
proxy: {
// ==================== Video 模块统一路由 ====================
// video/alarm, video/edge -> 告警服务 :8000直通
'/admin-api/video/alarm': {
changeOrigin: true,
target: 'http://127.0.0.1:8000',
},
'/admin-api/video/edge': {
changeOrigin: true,
target: 'http://127.0.0.1:8000',
},
// 告警截图静态文件 -> 告警服务 :8000
'/uploads': {
changeOrigin: true,
target: 'http://127.0.0.1:8000',
},
// Edge 本地截图COS 未配置时回退)-> 告警服务 :8000
'/captures': {
changeOrigin: true,
target: 'http://127.0.0.1:8000',
},
// COS 存储相关接口 -> 告警服务 :8000
'/admin-api/video/storage': {
changeOrigin: true,
target: 'http://127.0.0.1:8000',
},
// video/device/* -> WVP :18080按子路径分别 rewrite
// 注意:更具体的路径必须写在通配路径前面
// 摄像头拉流代理: /admin-api/video/device/proxy -> /api/proxy
'/admin-api/video/device/proxy': {
changeOrigin: true,
target: 'http://127.0.0.1:18080',
rewrite: (path: string) =>
path.replace('/admin-api/video/device/proxy', '/api/proxy'),
},
// WVP 用户认证: /admin-api/video/device/user -> /api/user
'/admin-api/video/device/user': {
changeOrigin: true,
target: 'http://127.0.0.1:18080',
rewrite: (path: string) =>
path.replace('/admin-api/video/device/user', '/api/user'),
},
// 媒体服务器: /admin-api/video/device/server -> /api/server/media_server
'/admin-api/video/device/server': {
changeOrigin: true,
target: 'http://127.0.0.1:18080',
rewrite: (path: string) =>
path.replace(
'/admin-api/video/device/server',
'/api/server/media_server',
),
},
// ROI/算法/配置等: /admin-api/video/device -> /api/ai通配放最后
'/admin-api/video/device': {
changeOrigin: true,
target: 'http://127.0.0.1:18080',
rewrite: (path: string) =>
path.replace('/admin-api/video/device', '/api/ai'),
},
// ==================== 芋道主平台 ====================
// 所有 system/*、infra/* 等基础接口 -> 芋道后端 48080
'/admin-api': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/admin-api/, ''),
// mock代理目标地址
target: 'http://localhost:48080/admin-api',
ws: true,
},
},
},
},
};
});