diff --git a/frontend/editor/src/core/pages/MobileScannerPage.tsx b/frontend/editor/src/core/pages/MobileScannerPage.tsx index ca797a6c3..0424125aa 100644 --- a/frontend/editor/src/core/pages/MobileScannerPage.tsx +++ b/frontend/editor/src/core/pages/MobileScannerPage.tsx @@ -21,6 +21,10 @@ import UploadRoundedIcon from "@mui/icons-material/UploadRounded"; import AddPhotoAlternateRoundedIcon from "@mui/icons-material/AddPhotoAlternateRounded"; import CheckCircleRoundedIcon from "@mui/icons-material/CheckCircleRounded"; import { loadJscanify } from "@app/utils/loadJscanify"; +import apiClient from "@app/services/apiClient"; + +// Use the configured API base (e.g. api.stirling.com), not the page origin. +const API_BASE = (apiClient.defaults.baseURL ?? "").replace(/\/+$/, ""); /** * MobileScannerPage @@ -83,7 +87,7 @@ export default function MobileScannerPage() { try { const response = await fetch( - `/api/v1/mobile-scanner/validate-session/${sessionId}`, + `${API_BASE}/api/v1/mobile-scanner/validate-session/${sessionId}`, ); if (response.ok) { @@ -841,7 +845,7 @@ export default function MobileScannerPage() { }); const uploadResponse = await fetch( - `/api/v1/mobile-scanner/upload/${sessionId}`, + `${API_BASE}/api/v1/mobile-scanner/upload/${sessionId}`, { method: "POST", body: formData, diff --git a/frontend/editor/src/core/utils/loadJscanify.ts b/frontend/editor/src/core/utils/loadJscanify.ts index 2057ddbdc..93dec0039 100644 --- a/frontend/editor/src/core/utils/loadJscanify.ts +++ b/frontend/editor/src/core/utils/loadJscanify.ts @@ -1,3 +1,5 @@ +import { withBasePath } from "@app/constants/app"; + declare global { interface Window { cv?: any; @@ -5,8 +7,9 @@ declare global { } } -const OPENCV_SRC = "/vendor/jscanify/opencv.js"; -const JSCANIFY_SRC = "/vendor/jscanify/jscanify.js"; +// Served under the app's base path (handles sub-path deploys like /app). +const OPENCV_SRC = withBasePath("/vendor/jscanify/opencv.js"); +const JSCANIFY_SRC = withBasePath("/vendor/jscanify/jscanify.js"); let loadPromise: Promise | null = null;