#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
Route mobile scanner API and vendor loads through the app base path (#6648)
Anthony Stirlingeefa8eff61dc
diff --git a/frontend/editor/src/core/pages/MobileScannerPage.tsx b/frontend/editor/src/core/pages/MobileScannerPage.tsxindex ca797a6c32..0424125aa8 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.tsindex 2057ddbdc5..93dec00394 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<void> | null = null;