Files
iot-device-management-frontend/apps/web-antd/vite.config.mts
lzh 2a7fec30a9 重构: video 模块走芋道网关统一鉴权,移除独立 WVP JWT 客户端
- api/video/request.ts: 删除自实现的 WVP access-token 登录/缓存/401 续期逻辑,
  直接 re-export requestClient(yudao Authorization: Bearer),
  wvpRequestClient 名字仅作过渡期别名,TODO 标记后续统一重命名。
- api/video/device/index.ts: 路径从 /video/device/{proxy,user,server,...} 迁移到
  后端 @RequestMapping 对齐的 /video/{proxy,ai/*,server/media_server};
  删除 getAlertImageUrl(老 WVP 时代产物),删除截图 URL 里的 ?access-token。
- api/video/edge/index.ts: /video/device/device/* -> /video/ai/device/*(对齐 AiEdgeDeviceController)。
- views/video/device/camera: HEAD 探活 URL 同步,补注释说明后端需对
  /video/ai/roi/snap/image permitAll 或依赖 session cookie。
- vite.config: 删除 /admin-api/video/device/* 按子路径 rewrite 到 WVP:18080 的规则,
  统一走 /admin-api 到芋道网关 48080;去掉 VITE_WVP_USERNAME/PASSWORD_MD5 依赖
  (安全改进:凭据不再打进客户端 bundle)。

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

52 lines
1.6 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',
},
// ==================== 芋道主平台 ====================
// 所有 system/*、infra/*、video/device/* 等业务接口 -> 芋道网关 48080
// video 微服务已挂到 gateway不再直连 WVP :18080
'/admin-api': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/admin-api/, ''),
// mock代理目标地址
target: 'http://localhost:48080/admin-api',
ws: true,
},
},
},
},
};
});