mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 07:43:12 +09:00
Fix web root path confusion
Remove basename in favor of making webRoot absolute. The distinction between the two were supposed to be that basename was absolute and did not have a trailing slash while webRoot was relative and had a traling slash. This was not how it ended up working in the code, which lead to double forward slashes in requests sent out when webRoot was not equal to './'.
This commit is contained in:
1 parent
ceae2b25b5
commit
bd53339532
7 files changed
+6
-17
No files matched your search
@@ -4,7 +4,6 @@ import { BrowserRouter } from "react-router-dom";
|
||||
|
||||
import { logger } from "@clusterio/lib/logging";
|
||||
|
||||
import basename from "../basename";
|
||||
import ErrorBoundary from "./ErrorBoundary";
|
||||
import SiteLayout from "./SiteLayout";
|
||||
import ControlContext from "./ControlContext";
|
||||
@@ -89,7 +88,7 @@ export default function App(props) {
|
||||
<ErrorBoundary Component={ErrorCard}>
|
||||
<ControlContext.Provider value={props.control}>
|
||||
<PluginsContext.Provider value={props.plugins}>
|
||||
<BrowserRouter basename={basename}>
|
||||
<BrowserRouter basename={webRoot}>
|
||||
{page}
|
||||
</BrowserRouter>
|
||||
</PluginsContext.Provider>
|
||||
|
||||
@@ -2,7 +2,6 @@ import React, { useEffect, useContext, useState } from "react";
|
||||
import { useHistory, useParams } from "react-router-dom";
|
||||
import { Alert, Descriptions, Spin } from "antd";
|
||||
|
||||
import basename from "../basename";
|
||||
import PluginsContext from "./PluginsContext";
|
||||
import PageLayout from "./PageLayout";
|
||||
import { notifyErrorHandler } from "../util/notify";
|
||||
@@ -16,7 +15,7 @@ export default function PluginViewPage() {
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
let response = await fetch(`${basename}/api/plugins`);
|
||||
let response = await fetch(`${webRoot}api/plugins`);
|
||||
if (response.ok) {
|
||||
setPluginList(await response.json());
|
||||
} else {
|
||||
|
||||
@@ -3,7 +3,6 @@ import { useHistory } from "react-router-dom";
|
||||
import { Table } from "antd";
|
||||
|
||||
import notify from "../util/notify";
|
||||
import basename from "../basename";
|
||||
import PluginsContext from "./PluginsContext";
|
||||
import PageLayout from "./PageLayout";
|
||||
|
||||
@@ -15,7 +14,7 @@ export default function PluginsPage() {
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
let response = await fetch(`${basename}/api/plugins`);
|
||||
let response = await fetch(`${webRoot}api/plugins`);
|
||||
if (response.ok) {
|
||||
setPluginList(await response.json());
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user