From 5eca39f47ce7a9677325559c9d4ec0e1f2167564 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Tue, 3 May 2022 08:56:41 -0500 Subject: force /searches --- src/web/src/components/App.js | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/web/src/components/App.js b/src/web/src/components/App.js index 3a22e0c8..19ea8d37 100644 --- a/src/web/src/components/App.js +++ b/src/web/src/components/App.js @@ -1,7 +1,8 @@ import React, { Component } from 'react'; -import { Route, Link, Switch } from "react-router-dom"; +import { Route, Link, Switch, Redirect } from "react-router-dom"; import * as session from '../lib/session'; +import * as application from '../lib/application'; import { connect, disconnect } from '../lib/server'; import { createApplicationHubConnection } from '../lib/hubFactory'; @@ -38,6 +39,7 @@ const initialState = { initialized: false, error: false, retriesExhausted: false, + urlBase: '', }; class App extends Component { @@ -50,7 +52,12 @@ class App extends Component { init = async () => { this.setState({ initialized: false }, async () => { try { - const securityEnabled = await session.getSecurityEnabled(); + const [urlBase, securityEnabled] = await Promise.all([ + application.getUrlBase(), + session.getSecurityEnabled()] + ); + + this.setState({ urlBase }); if (!securityEnabled) { console.debug('application security is not enabled, per api call') @@ -109,7 +116,7 @@ class App extends Component { }; render = () => { - const { login, applicationState = {}, applicationOptions = {}, error, initialized, retriesExhausted } = this.state; + const { login, applicationState = {}, applicationOptions = {}, error, initialized, retriesExhausted, urlBase = '' } = this.state; const { version = {}, server } = applicationState; const { isUpdateAvailable, current, latest } = version; @@ -150,37 +157,37 @@ class App extends Component { {version.isCanary && Canary } - + Search - + Downloads - + Uploads - + Rooms - + Chat - + Users - + Browse @@ -221,7 +228,7 @@ class App extends Component { href="https://github.com/slskd/slskd/releases">See Release Notes } - + System @@ -242,14 +249,15 @@ class App extends Component { + this.withTokenCheck()}/> this.withTokenCheck()}/> this.withTokenCheck()}/> this.withTokenCheck()}/> this.withTokenCheck()}/> this.withTokenCheck()}/> this.withTokenCheck()}/> - this.withTokenCheck()}/> - this.withTokenCheck()}/> + this.withTokenCheck()}/> + -- cgit v1.2.3