diff --git a/public/config.json b/public/config.json index f56dedc..9d3ac9e 100644 --- a/public/config.json +++ b/public/config.json @@ -1,5 +1,5 @@ { - "streamUrl": "", + "streamUrl": "/camera/mjpg/video.mjpg", "calibration": null, - "renderDefaults": { "cutColor": "#00e5ff", "rapidColor": "#ff9800", "lineWidth": 1.5 } + "renderDefaults": { "cutColor": "#00ffff", "rapidColor": "#ff7700", "lineWidth": 3 } } diff --git a/vite.config.ts b/vite.config.ts index 9e6560a..13f47e6 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,5 +1,19 @@ import { defineConfig } from 'vitest/config'; export default defineConfig({ + // Dev-only: proxy the CNC MJPEG camera so the page can load it via a + // same-origin relative path (`/camera/...`), exactly as nginx does in + // production. Keeps `streamUrl` identical in dev and prod and avoids + // mixed-content / cross-origin issues. Override the target for a different + // camera with: VITE_CAMERA_TARGET=http://host npm run dev + server: { + proxy: { + '/camera': { + target: process.env.VITE_CAMERA_TARGET || 'http://172.17.3.38', + changeOrigin: true, + rewrite: (path) => path.replace(/^\/camera/, ''), + }, + }, + }, test: { globals: true, environment: 'node' }, });