mirror of https://github.com/stashapp/stash.git
Fix setup/migrate redirects on subpath proxies (#2982)
This commit is contained in:
parent
6c04f9199f
commit
043b67e076
|
@ -29,7 +29,7 @@ import { InteractiveProvider } from "./hooks/Interactive/context";
|
|||
import { ReleaseNotesDialog } from "./components/Dialogs/ReleaseNotesDialog";
|
||||
import { IUIConfig } from "./core/config";
|
||||
import { releaseNotes } from "./docs/en/ReleaseNotes";
|
||||
import { getPlatformURL } from "./core/createClient";
|
||||
import { getPlatformURL, getBaseURL } from "./core/createClient";
|
||||
|
||||
const Performers = lazy(() => import("./components/Performers/Performers"));
|
||||
const FrontPage = lazy(() => import("./components/FrontPage/FrontPage"));
|
||||
|
@ -121,22 +121,24 @@ export const App: React.FC = () => {
|
|||
return;
|
||||
}
|
||||
|
||||
const baseURL = getBaseURL();
|
||||
|
||||
if (
|
||||
window.location.pathname !== "/setup" &&
|
||||
window.location.pathname !== baseURL + "setup" &&
|
||||
systemStatusData.systemStatus.status === GQL.SystemStatusEnum.Setup
|
||||
) {
|
||||
// redirect to setup page
|
||||
const newURL = new URL("/setup", window.location.toString());
|
||||
const newURL = new URL("setup", window.location.origin + baseURL);
|
||||
window.location.href = newURL.toString();
|
||||
}
|
||||
|
||||
if (
|
||||
window.location.pathname !== "/migrate" &&
|
||||
window.location.pathname !== baseURL + "migrate" &&
|
||||
systemStatusData.systemStatus.status ===
|
||||
GQL.SystemStatusEnum.NeedsMigration
|
||||
) {
|
||||
// redirect to setup page
|
||||
const newURL = new URL("/migrate", window.location.toString());
|
||||
const newURL = new URL("migrate", window.location.origin + baseURL);
|
||||
window.location.href = newURL.toString();
|
||||
}
|
||||
}, [systemStatusData]);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import { Button, Card, Container, Form } from "react-bootstrap";
|
||||
import { useIntl, FormattedMessage } from "react-intl";
|
||||
import { getBaseURL } from "src/core/createClient";
|
||||
import * as GQL from "src/core/generated-graphql";
|
||||
import { useSystemStatus, mutateMigrate } from "src/core/StashService";
|
||||
import { migrationNotes } from "src/docs/en/MigrationNotes";
|
||||
|
@ -115,7 +116,7 @@ export const Migrate: React.FC = () => {
|
|||
backupPath: backupPath ?? "",
|
||||
});
|
||||
|
||||
const newURL = new URL("/", window.location.toString());
|
||||
const newURL = new URL("", window.location.origin + getBaseURL());
|
||||
window.location.href = newURL.toString();
|
||||
} catch (e) {
|
||||
if (e instanceof Error) setMigrateError(e.message ?? e.toString());
|
||||
|
|
Loading…
Reference in New Issue