mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): handle proxy configs rewriting paths
We can't assume that the base URL is `host:port/` - it could be `host:port/some/path/`. Make the path handling dynamic to account for this.
This commit is contained in:
parent
e59954f956
commit
fc448d5b6d
@ -45,7 +45,7 @@ export const useSocketIO = () => {
|
||||
const socketOptions = useMemo(() => {
|
||||
const options: Partial<ManagerOptions & SocketOptions> = {
|
||||
timeout: 60000,
|
||||
path: '/ws/socket.io',
|
||||
path: `${window.location.pathname}ws/socket.io`,
|
||||
autoConnect: false, // achtung! removing this breaks the dynamic middleware
|
||||
forceNew: true,
|
||||
};
|
||||
|
@ -32,7 +32,7 @@ if (import.meta.env.MODE === 'package') {
|
||||
fallbackLng: 'en',
|
||||
debug: false,
|
||||
backend: {
|
||||
loadPath: '/locales/{{lng}}.json',
|
||||
loadPath: `${window.location.href.replace(/\/$/, '')}/locales/{{lng}}.json`,
|
||||
},
|
||||
interpolation: {
|
||||
escapeValue: false,
|
||||
|
@ -57,7 +57,9 @@ const dynamicBaseQuery: BaseQueryFn<
|
||||
const projectId = $projectId.get();
|
||||
|
||||
const rawBaseQuery = fetchBaseQuery({
|
||||
baseUrl: `${baseUrl ?? ''}/api/v1`,
|
||||
baseUrl: baseUrl
|
||||
? `${baseUrl}/api/v1`
|
||||
: `${window.location.href.replace(/\/$/, '')}/api/v1`,
|
||||
prepareHeaders: (headers) => {
|
||||
if (authToken) {
|
||||
headers.set('Authorization', `Bearer ${authToken}`);
|
||||
|
@ -26,8 +26,9 @@ export const receivedOpenAPISchema = createAsyncThunk(
|
||||
'nodes/receivedOpenAPISchema',
|
||||
async (_, { rejectWithValue }) => {
|
||||
try {
|
||||
const url = [window.location.origin, 'openapi.json'].join('/');
|
||||
const response = await fetch(url);
|
||||
const response = await fetch(
|
||||
`${window.location.href.replace(/\/$/, '')}/openapi.json`
|
||||
);
|
||||
const openAPISchema = await response.json();
|
||||
|
||||
const schemaJSON = JSON.parse(
|
||||
|
Loading…
Reference in New Issue
Block a user