diff --git a/nise-replay-viewer/src/interface/App.tsx b/nise-replay-viewer/src/interface/App.tsx index 3467b78..8b91260 100644 --- a/nise-replay-viewer/src/interface/App.tsx +++ b/nise-replay-viewer/src/interface/App.tsx @@ -18,9 +18,12 @@ export function App() { } useEffect(() => { + // We might be beind a reverse proxy - remove the proxied URL + const path = location.pathname.replace("/replay-viewer", ""); + // This pattern matches one or more digits followed by an optional slash and any characters (non-greedy) const pathRegex = /^\/(\d+)(?:\/(\d+))?/; - const match = location.pathname.match(pathRegex); + const match = path.match(pathRegex); if (match) { // match[1] will contain the first ID, match[2] (if present) will contain the second ID diff --git a/nise-replay-viewer/src/osu/Drawer.ts b/nise-replay-viewer/src/osu/Drawer.ts index 3787305..2b042ea 100644 --- a/nise-replay-viewer/src/osu/Drawer.ts +++ b/nise-replay-viewer/src/osu/Drawer.ts @@ -39,7 +39,7 @@ export class Drawer { static async loadDefaultImages() { const imageLoadPromises = Object.keys(Drawer.images).map(imageName => - loadImageAsync(`/${imageName}.png`).then( + loadImageAsync(`/replay-viewer/${imageName}.png`).then( image => { Drawer.images[imageName as keyof typeof Drawer.images] = image; }, diff --git a/nise-replay-viewer/src/osu/OsuRenderer.ts b/nise-replay-viewer/src/osu/OsuRenderer.ts index 93b70d9..190186f 100644 --- a/nise-replay-viewer/src/osu/OsuRenderer.ts +++ b/nise-replay-viewer/src/osu/OsuRenderer.ts @@ -231,7 +231,7 @@ export class OsuRenderer { static getApiUrl(): string { return document.location.hostname === "localhost" ? `http://localhost:8080` - : `https://nise.moe/api`; + : `https://nise.stedos.dev/api`; } static async loadReplayPairFromUrl(replayId1: number, replayId2: number) { diff --git a/nise-replay-viewer/vite.config.ts b/nise-replay-viewer/vite.config.ts index cf45b55..f408419 100644 --- a/nise-replay-viewer/vite.config.ts +++ b/nise-replay-viewer/vite.config.ts @@ -9,4 +9,5 @@ export default defineConfig({ "@": path.resolve(__dirname, "./src"), }, }, + base: "/replay-viewer/", });