From 88d9eb96f97a872b8e66be5cc5e9b4f916c2d980 Mon Sep 17 00:00:00 2001 From: Aditya Sanjeev Date: Fri, 19 Jun 2026 17:54:10 -0700 Subject: [PATCH 1/2] Make the React app the site root; remove standalone home.html; fix dataset thumbnails - Remove public/home.html so the build serves only the React SPA. The committed nginx config (deploy/nginx-bodymaps.conf) serves dist/index.html at / with SPA fallback, so the React app becomes the main page and /home.html resolves to it too. - Fix missing dataset thumbnails: route the HuggingFace fallback through the same-origin /api/proxy-image proxy instead of a direct cross-origin URL, which the viewer's COEP: require-corp header was blocking (verified: direct HF returns a 302 redirect; the proxy returns a 200 image/jpeg). --- PanTS-Demo/public/home.html | 4284 ------------------------- PanTS-Demo/src/components/Preview.tsx | 10 +- 2 files changed, 7 insertions(+), 4287 deletions(-) delete mode 100644 PanTS-Demo/public/home.html diff --git a/PanTS-Demo/public/home.html b/PanTS-Demo/public/home.html deleted file mode 100644 index 0d367fa8..00000000 --- a/PanTS-Demo/public/home.html +++ /dev/null @@ -1,4284 +0,0 @@ - - - - - - - CT Finder · Search + Viewer (Dark) - - - - - - - - - - - - - - - - - - - - - - - - - -
-
Upload
-
- - -
- - Click or drag to upload
.nii or .nii.gz
- -
- - -
-
- -
-
- 1 - Preprocessing - optional -
- -
- -
→
- -
-
- 2 - Model -
- -
- -
→
- -
-
- 3 - Postprocessing - optional -
- -
- -
- -
- - - - - -
-
- - -
-
Browse Library
-
-
-
- - -
-
- - -
- -
- - -
- -
-
-
Tumor
-
- - - -
-
-
-
Sex Multi-Select
-
- - - - -
-
-
-
Age Multi-Select
-
-
-
-
- - -
-
-
-
- - -
-
-
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/PanTS-Demo/src/components/Preview.tsx b/PanTS-Demo/src/components/Preview.tsx index c8abca9e..7998e212 100644 --- a/PanTS-Demo/src/components/Preview.tsx +++ b/PanTS-Demo/src/components/Preview.tsx @@ -25,11 +25,15 @@ export default function Preview({ id, previewMetadata }: Props) { if (!previewMetadata) return null; const caseIdStr = `PanTS_${id.toString().padStart(8, "0")}`; - const hfThumbUrl = `https://huggingface.co/datasets/BodyMaps/iPanTSMini/resolve/main/profile_only/${caseIdStr}/profile.jpg`; + // HuggingFace fallback, routed through the backend's same-origin proxy. A *direct* + // cross-origin image is blocked by the viewer's COEP: require-corp header (which is + // why thumbnails went missing); the proxy keeps it same-origin, matching home.html. + const hfProfileUrl = `https://huggingface.co/datasets/BodyMaps/iPanTSMini/resolve/main/profile_only/${caseIdStr}/profile.jpg`; + const proxyThumbUrl = `${API_BASE}/api/proxy-image?url=${encodeURIComponent(hfProfileUrl)}`; const handleImgError = () => { - if (thumbUrl !== hfThumbUrl) { - setThumbUrl(hfThumbUrl); // local failed — retry via HuggingFace + if (thumbUrl !== proxyThumbUrl) { + setThumbUrl(proxyThumbUrl); // local failed — retry via the same-origin HF proxy } else { setImgError(true); // both sources failed } From 4504ad5251a32023fd955f7b9dfab9d8a6e0b91c Mon Sep 17 00:00:00 2001 From: Aditya Sanjeev Date: Fri, 19 Jun 2026 18:00:15 -0700 Subject: [PATCH 2/2] Serve the React app at the root with no nginx change (README steps alone) The deploy only runs git pull -> npm run build -> restart gunicorn (no nginx step), and the live server serves home.html at the root. So: - build now copies dist/index.html -> dist/home.html, making home.html the React app. Whatever the server serves at / (home.html or index.html) is now the SPA, so the React app becomes the main page without any nginx/sudo change. - add a /home.html -> / redirect route so old bookmarks land on the app, not a blank React route. --- PanTS-Demo/package.json | 2 +- PanTS-Demo/src/App.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/PanTS-Demo/package.json b/PanTS-Demo/package.json index 8698cae9..1c9a2f47 100644 --- a/PanTS-Demo/package.json +++ b/PanTS-Demo/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "build": "tsc -b && vite build", + "build": "tsc -b && vite build && node -e \"require('fs').copyFileSync('dist/index.html','dist/home.html')\"", "typecheck": "tsc -b", "lint": "eslint .", "test": "vitest run", diff --git a/PanTS-Demo/src/App.tsx b/PanTS-Demo/src/App.tsx index 2aa07c4e..551af3f8 100644 --- a/PanTS-Demo/src/App.tsx +++ b/PanTS-Demo/src/App.tsx @@ -1,5 +1,5 @@ import { lazy, Suspense } from "react"; -import { BrowserRouter, Route, Routes } from "react-router"; +import { BrowserRouter, Navigate, Route, Routes } from "react-router"; import "./App.css"; import { AnnotationProvider } from "./contexts/annotationContexts"; import { FileProvider } from "./contexts/fileContexts"; @@ -51,6 +51,8 @@ function App() { }> } /> + {/* Old /home.html links now serve the React shell — send them to the app. */} + } /> } /> {/* } /> */} {/* } /> */}