2024-07-29 00:19:26 +08:00
|
|
|
|
import { defineConfig } from '@vben/vite-config';
|
2024-05-19 21:20:42 +08:00
|
|
|
|
|
2024-07-13 21:00:31 +08:00
|
|
|
|
export default defineConfig(async () => {
|
|
|
|
|
|
return {
|
2024-07-29 00:19:26 +08:00
|
|
|
|
application: {},
|
2024-07-13 21:00:31 +08:00
|
|
|
|
vite: {
|
|
|
|
|
|
server: {
|
2026-01-18 17:04:03 +08:00
|
|
|
|
allowedHosts: true,
|
2024-07-13 21:00:31 +08:00
|
|
|
|
proxy: {
|
2026-02-06 16:41:00 +08:00
|
|
|
|
// ==================== AIoT 统一路由 ====================
|
2026-02-09 10:24:47 +08:00
|
|
|
|
|
2026-02-06 16:41:00 +08:00
|
|
|
|
// aiot/alarm, aiot/edge -> 告警服务 :8000(直通)
|
|
|
|
|
|
'/admin-api/aiot/alarm': {
|
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
target: 'http://127.0.0.1:8000',
|
|
|
|
|
|
},
|
|
|
|
|
|
'/admin-api/aiot/edge': {
|
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
target: 'http://127.0.0.1:8000',
|
|
|
|
|
|
},
|
2026-02-11 09:57:29 +08:00
|
|
|
|
// 告警截图静态文件 -> 告警服务 :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/aiot/storage': {
|
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
target: 'http://127.0.0.1:8000',
|
|
|
|
|
|
},
|
2026-02-09 10:24:47 +08:00
|
|
|
|
|
|
|
|
|
|
// aiot/device/* -> WVP :18080(按子路径分别 rewrite)
|
|
|
|
|
|
// 注意:更具体的路径必须写在通配路径前面
|
|
|
|
|
|
|
|
|
|
|
|
// 摄像头拉流代理: /admin-api/aiot/device/proxy -> /api/proxy
|
2026-02-08 23:23:56 +08:00
|
|
|
|
'/admin-api/aiot/device/proxy': {
|
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
target: 'http://127.0.0.1:18080',
|
|
|
|
|
|
rewrite: (path: string) =>
|
|
|
|
|
|
path.replace('/admin-api/aiot/device/proxy', '/api/proxy'),
|
|
|
|
|
|
},
|
2026-02-09 10:24:47 +08:00
|
|
|
|
// WVP 用户认证: /admin-api/aiot/device/user -> /api/user
|
|
|
|
|
|
'/admin-api/aiot/device/user': {
|
2026-02-09 09:51:37 +08:00
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
target: 'http://127.0.0.1:18080',
|
|
|
|
|
|
rewrite: (path: string) =>
|
2026-02-09 10:24:47 +08:00
|
|
|
|
path.replace('/admin-api/aiot/device/user', '/api/user'),
|
2026-02-09 09:51:37 +08:00
|
|
|
|
},
|
2026-02-09 10:24:47 +08:00
|
|
|
|
// 媒体服务器: /admin-api/aiot/device/server -> /api/server/media_server
|
|
|
|
|
|
'/admin-api/aiot/device/server': {
|
2026-02-06 16:41:00 +08:00
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
target: 'http://127.0.0.1:18080',
|
|
|
|
|
|
rewrite: (path: string) =>
|
2026-02-09 10:24:47 +08:00
|
|
|
|
path.replace(
|
|
|
|
|
|
'/admin-api/aiot/device/server',
|
|
|
|
|
|
'/api/server/media_server',
|
|
|
|
|
|
),
|
2026-02-06 16:41:00 +08:00
|
|
|
|
},
|
2026-02-09 10:24:47 +08:00
|
|
|
|
// ROI/算法/配置等: /admin-api/aiot/device -> /api/ai(通配,放最后)
|
|
|
|
|
|
'/admin-api/aiot/device': {
|
2026-02-06 16:41:00 +08:00
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
target: 'http://127.0.0.1:18080',
|
|
|
|
|
|
rewrite: (path: string) =>
|
2026-02-09 10:24:47 +08:00
|
|
|
|
path.replace('/admin-api/aiot/device', '/api/ai'),
|
2026-02-06 16:41:00 +08:00
|
|
|
|
},
|
2026-02-09 10:24:47 +08:00
|
|
|
|
|
2026-02-06 16:41:00 +08:00
|
|
|
|
// ==================== 系统基础路由 ====================
|
2026-02-09 10:24:47 +08:00
|
|
|
|
|
2026-02-06 16:41:00 +08:00
|
|
|
|
// 认证相关接口 -> 告警平台(测试阶段提供模拟认证)
|
|
|
|
|
|
'/admin-api/system/auth': {
|
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
target: 'http://127.0.0.1:8000',
|
|
|
|
|
|
ws: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
// 租户相关接口 -> 告警平台(测试阶段返回默认值)
|
|
|
|
|
|
'/admin-api/system/tenant': {
|
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
target: 'http://127.0.0.1:8000',
|
|
|
|
|
|
},
|
|
|
|
|
|
// 验证码接口 -> 告警平台(测试阶段返回禁用状态)
|
|
|
|
|
|
'/admin-api/system/captcha': {
|
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
target: 'http://127.0.0.1:8000',
|
|
|
|
|
|
},
|
|
|
|
|
|
// 字典数据接口 -> 告警平台(测试阶段返回空)
|
|
|
|
|
|
'/admin-api/system/dict-data': {
|
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
target: 'http://127.0.0.1:8000',
|
|
|
|
|
|
},
|
|
|
|
|
|
// 消息通知接口 -> 告警平台(测试阶段返回空)
|
|
|
|
|
|
'/admin-api/system/notify-message': {
|
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
target: 'http://127.0.0.1:8000',
|
|
|
|
|
|
},
|
|
|
|
|
|
// 其他接口 -> 芋道主平台(未来对接)
|
|
|
|
|
|
// 测试阶段:这些接口会 404,但不影响核心功能
|
2025-03-18 13:06:04 +08:00
|
|
|
|
'/admin-api': {
|
2024-07-13 21:00:31 +08:00
|
|
|
|
changeOrigin: true,
|
2025-03-18 13:06:04 +08:00
|
|
|
|
rewrite: (path) => path.replace(/^\/admin-api/, ''),
|
|
|
|
|
|
target: 'http://localhost:48080/admin-api',
|
2024-07-13 21:00:31 +08:00
|
|
|
|
ws: true,
|
|
|
|
|
|
},
|
2024-05-19 21:20:42 +08:00
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2024-07-13 21:00:31 +08:00
|
|
|
|
};
|
2024-05-19 21:20:42 +08:00
|
|
|
|
});
|