重构: 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>
This commit is contained in:
@@ -146,9 +146,12 @@ async function loadCameraStatus() {
|
||||
for (const cam of cameraList.value) {
|
||||
const cameraCode = cam.cameraCode;
|
||||
if (!cameraCode) continue;
|
||||
// 使用 fetch HEAD 请求检测截图是否可用(/snap/image 已免认证)
|
||||
// 通过 HEAD 探测截图是否可用。
|
||||
// 前置条件:后端对 /video/ai/roi/snap/image 放行(SecurityConfig permitAll)
|
||||
// 或依赖 session cookie —— fetch 默认不会带 Authorization 头。
|
||||
// 401/403 会被视作"离线",与 4xx/5xx 行为一致,对端上逻辑透明。
|
||||
try {
|
||||
const url = `${apiURL}/video/device/roi/snap/image?cameraCode=${encodeURIComponent(cameraCode)}`;
|
||||
const url = `${apiURL}/video/ai/roi/snap/image?cameraCode=${encodeURIComponent(cameraCode)}`;
|
||||
const res = await fetch(url, { method: 'HEAD' });
|
||||
cameraStatus.value = { ...cameraStatus.value, [cameraCode]: res.ok };
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user