This commit is contained in:
AuroraLS3 2023-01-07 10:09:11 +00:00
parent 84d0cbfc90
commit c0f780e5ee
5 changed files with 48 additions and 26 deletions

View File

@ -4,7 +4,17 @@
<meta content="AuroraLS3" name="author">
<meta content="noindex, nofollow" name="robots">
<title>Plan | Player Analytics</title>
<script>window.location.href = `/?redirect=${encodeURIComponent(window.location.pathname + window.location.hash + window.location.search)}`</script>
<script>
const address = `${PLAN_ADDRESS}`;
const currentAddress = window.location.pathname + window.location.hash + window.location.search;
let basePath = address.replace("http://", "")
.replace("https://", "");
if (basePath.includes('/')) {
basePath = basePath.substring(basePath.indexOf('/') + 1);
}
const redirectTo = currentAddress.replace(basePath, '');
window.location.href = address + `/?redirect=${encodeURIComponent(redirectTo)}`;
</script>
</head>
<body>
<noscript>Please enable javascript.</noscript>

View File

@ -18,13 +18,13 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^14.4.3",
"axios": "^1.2.1",
"axios": "^1.2.2",
"bootstrap": "^5.2.3",
"datatables.net": "^1.13.1",
"datatables.net-bs5": "^1.12.1",
"datatables.net-responsive-bs5": "^2.4.0",
"highcharts": "^10.3.2",
"i18next": "^22.4.6",
"i18next": "^22.4.8",
"i18next-chained-backend": "^4.2.0",
"i18next-http-backend": "^2.1.1",
"i18next-localstorage-backend": "^4.1.0",
@ -36,7 +36,7 @@
"react-mcjsonchat": "^1.0.0",
"react-router-dom": "6",
"react-scripts": "5.0.1",
"sass": "^1.56.2",
"sass": "^1.57.1",
"source-map-explorer": "^2.5.2",
"swagger-ui": "^4.15.5",
"web-vitals": "^3.0.2"

View File

@ -12,7 +12,7 @@ import {MetadataContextProvider} from "./hooks/metadataHook";
import {AuthenticationContextProvider} from "./hooks/authenticationHook";
import {NavigationContextProvider} from "./hooks/navigationHook";
import MainPageRedirect from "./components/navigation/MainPageRedirect";
import {staticSite} from "./service/backendConfiguration";
import {baseAddress, staticSite} from "./service/backendConfiguration";
const PlayerPage = React.lazy(() => import("./views/layout/PlayerPage"));
const PlayerOverview = React.lazy(() => import("./views/player/PlayerOverview"));
@ -81,6 +81,18 @@ const Lazy = ({children}) => (
</React.Suspense>
)
const getBasename = () => {
if (baseAddress) {
const addressWithoutProtocol = baseAddress
.replace("http://", "")
.replace("https://", "");
const startOfPath = addressWithoutProtocol.indexOf("/");
return startOfPath >= 0 ? addressWithoutProtocol.substring(startOfPath) : "";
} else {
return "";
}
}
function App() {
axios.defaults.withCredentials = true;
@ -88,7 +100,7 @@ function App() {
<div className="App">
<ContextProviders>
<div id="wrapper">
<BrowserRouter>
<BrowserRouter basename={getBasename()}>
<Routes>
<Route path="" element={<MainPageRedirect/>}/>
<Route path="/" element={<MainPageRedirect/>}/>

View File

@ -15,11 +15,11 @@ export const baseAddress = javaReplaced.address.startsWith('PLAN_') || !isCurren
export const staticSite = javaReplaced.isStatic === 'true';
export const doSomeGetRequest = async (url, statusOptions) => {
return doSomeRequest(url, statusOptions, async () => axios.get(url));
return doSomeRequest(url, statusOptions, async () => axios.get(baseAddress + url));
}
export const doSomePostRequest = async (url, statusOptions, body) => {
return doSomeRequest(url, statusOptions, async () => axios.post(url, body));
return doSomeRequest(url, statusOptions, async () => axios.post(baseAddress + url, body));
}
export const doSomeRequest = async (url, statusOptions, axiosFunction) => {

View File

@ -2662,10 +2662,10 @@ axe-core@^4.3.5:
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.4.1.tgz#7dbdc25989298f9ad006645cd396782443757413"
integrity sha512-gd1kmb21kwNuWr6BQz8fv6GNECPBnUasepcoLbekws23NVBLODdsClRZ+bQ8+9Uomf3Sm3+Vwn0oYG9NvwnJCw==
axios@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.2.1.tgz#44cf04a3c9f0c2252ebd85975361c026cb9f864a"
integrity sha512-I88cFiGu9ryt/tfVEi4kX2SITsvDddTajXTOFmt2uK1ZVA8LytjtdeyefdQWEf5PU8w+4SSJDoYnggflB5tW4A==
axios@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.2.2.tgz#72681724c6e6a43a9fea860fc558127dbe32f9f1"
integrity sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==
dependencies:
follow-redirects "^1.15.0"
form-data "^4.0.0"
@ -5091,10 +5091,10 @@ i18next-localstorage-backend@^4.1.0:
dependencies:
"@babel/runtime" "^7.20.6"
i18next@^22.4.6:
version "22.4.6"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-22.4.6.tgz#876352c3ba81bdfedc38eeda124e2bbd05f46988"
integrity sha512-9Tm1ezxWyzV+306CIDMBbYBitC1jedQyYuuLtIv7oxjp2ohh8eyxP9xytIf+2bbQfhH784IQKPSYp+Zq9+YSbw==
i18next@^22.4.8:
version "22.4.8"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-22.4.8.tgz#7a3c5d26a93e8e5f32eee07b58484e2f721fb45b"
integrity sha512-XSOy17ZWqflOiJRYE/dzv6vDle2Se32dnHREHb93UnZzZ1+UnvQ8yKtt1fpNL3zvXz5AwCqqixrtTVZmRetaiQ==
dependencies:
"@babel/runtime" "^7.20.6"
@ -6030,9 +6030,9 @@ json-stable-stringify-without-jsonify@^1.0.1:
integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=
json5@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==
version "1.0.2"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593"
integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==
dependencies:
minimist "^1.2.0"
@ -6388,9 +6388,9 @@ minimatch@^5.0.1:
brace-expansion "^2.0.1"
minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.6:
version "1.2.6"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
version "1.2.7"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18"
integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==
mkdirp@^0.5.1, mkdirp@^0.5.5, mkdirp@~0.5.1:
version "0.5.6"
@ -8227,10 +8227,10 @@ sass-loader@^12.3.0:
klona "^2.0.4"
neo-async "^2.6.2"
sass@^1.56.2:
version "1.56.2"
resolved "https://registry.yarnpkg.com/sass/-/sass-1.56.2.tgz#9433b345ab3872996c82a53a58c014fd244fd095"
integrity sha512-ciEJhnyCRwzlBCB+h5cCPM6ie/6f8HrhZMQOf5vlU60Y1bI1rx5Zb0vlDZvaycHsg/MqFfF1Eq2eokAa32iw8w==
sass@^1.57.1:
version "1.57.1"
resolved "https://registry.yarnpkg.com/sass/-/sass-1.57.1.tgz#dfafd46eb3ab94817145e8825208ecf7281119b5"
integrity sha512-O2+LwLS79op7GI0xZ8fqzF7X2m/m8WFfI02dHOdsK5R2ECeS5F62zrwg/relM1rjSLy7Vd/DiMNIvPrQGsA0jw==
dependencies:
chokidar ">=3.0.0 <4.0.0"
immutable "^4.0.0"