Make changes for reverse proxy stuff
This commit is contained in:
parent
e91fa6dad2
commit
a2acb0cc52
@ -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
|
||||
|
||||
@ -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;
|
||||
},
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -9,4 +9,5 @@ export default defineConfig({
|
||||
"@": path.resolve(__dirname, "./src"),
|
||||
},
|
||||
},
|
||||
base: "/replay-viewer/",
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user