aboutsummaryrefslogtreecommitdiffstats
path: root/src/web
diff options
context:
space:
mode:
authorMatt Goldspink <mattgoldspink1@gmail.com>2023-02-03 11:18:22 -0800
committerGitHub <noreply@github.com>2023-02-03 11:18:22 -0800
commit7051348242058fc50c0fb474d011b90ff2c09071 (patch)
treeead84e30d063372dbc6c04b1a453e8130e935234 /src/web
parentd1177d526898da0597718e5f4b2307ea558db100 (diff)
parent3162a3f7964e924372a7744f4ce02951894dfe38 (diff)
downloadslskd-7051348242058fc50c0fb474d011b90ff2c09071.tar.gz
Merge branch 'slskd:master' into feature/dark-mode
Diffstat (limited to 'src/web')
-rw-r--r--src/web/src/components/App.js77
-rw-r--r--src/web/src/components/Search/Searches.js2
-rw-r--r--src/web/src/components/Transfers/TransferList.js4
-rw-r--r--src/web/src/config.js3
4 files changed, 42 insertions, 44 deletions
diff --git a/src/web/src/components/App.js b/src/web/src/components/App.js
index 70d154af..b52a3bdd 100644
--- a/src/web/src/components/App.js
+++ b/src/web/src/components/App.js
@@ -315,50 +315,49 @@ class App extends Component {
</Sidebar>
<Sidebar.Pusher className='app-content'>
<AppContext.Provider value={{ state: applicationState, options: applicationOptions }}>
- <Switch>
- {isAgent ? <>
+ {isAgent ? <Switch>
+ <Route path={`${urlBase}/system/:tab?`} render={
+ (props) => this.withTokenCheck(
+ <System {...props} state={applicationState} options={applicationOptions} />
+ )
+ }/>
+ <Redirect from='*' to={`${urlBase}/system`}/>
+ </Switch> :
+ <Switch>
+ <Route path={`${urlBase}/searches/:id?`} render={(props) =>
+ this.withTokenCheck(<div className='view'>
+ <Searches
+ server={applicationState.server}
+ {...props}
+ />
+ </div>)}
+ />
+ <Route path={`${urlBase}/browse`} render={(props) => this.withTokenCheck(<Browse {...props}/>)}/>
+ <Route path={`${urlBase}/users`} render={(props) =>
+ this.withTokenCheck(<Users {...props}/>)}
+ />
+ <Route path={`${urlBase}/chat`} render={(props) =>
+ this.withTokenCheck(<Chat {...props} state={applicationState}/>)}
+ />
+ <Route path={`${urlBase}/rooms`} render={(props) => this.withTokenCheck(<Rooms {...props}/>)}/>
+ <Route path={`${urlBase}/uploads`} render={
+ (props) =>
+ this.withTokenCheck(<div className='view'><Transfers {...props} direction='upload'/></div>)
+ }/>
+ <Route path={`${urlBase}/downloads`} render={
+ (props) =>
+ this.withTokenCheck(<div className='view'>
+ <Transfers {...props} direction='download' server={applicationState.server}/>
+ </div>)
+ }/>
<Route path={`${urlBase}/system/:tab?`} render={
(props) => this.withTokenCheck(
<System {...props} state={applicationState} options={applicationOptions} />
)
}/>
- <Redirect from='*' to={`${urlBase}/system`}/>
- </> :
- <>
- <Route path={`${urlBase}/searches/:id?`} render={(props) =>
- this.withTokenCheck(<div className='view'>
- <Searches
- server={applicationState.server}
- {...props}
- />
- </div>)}
- />
- <Route path={`${urlBase}/browse`} render={(props) => this.withTokenCheck(<Browse {...props}/>)}/>
- <Route path={`${urlBase}/users`} render={(props) =>
- this.withTokenCheck(<Users {...props}/>)}
- />
- <Route path={`${urlBase}/chat`} render={(props) =>
- this.withTokenCheck(<Chat {...props} state={applicationState}/>)}
- />
- <Route path={`${urlBase}/rooms`} render={(props) => this.withTokenCheck(<Rooms {...props}/>)}/>
- <Route path={`${urlBase}/uploads`} render={
- (props) =>
- this.withTokenCheck(<div className='view'><Transfers {...props} direction='upload'/></div>)
- }/>
- <Route path={`${urlBase}/downloads`} render={
- (props) =>
- this.withTokenCheck(<div className='view'>
- <Transfers {...props} direction='download' server={applicationState.server}/>
- </div>)
- }/>
- <Route path={`${urlBase}/system/:tab?`} render={
- (props) => this.withTokenCheck(
- <System {...props} state={applicationState} options={applicationOptions} />
- )
- }/>
- <Redirect from='*' to={`${urlBase}/searches`}/>
- </>}
- </Switch>
+ <Redirect from='*' to={`${urlBase}/searches`}/>
+ </Switch>
+ }
</AppContext.Provider>
</Sidebar.Pusher>
</Sidebar.Pushable>
diff --git a/src/web/src/components/Search/Searches.js b/src/web/src/components/Search/Searches.js
index 46a9f709..42b82f8c 100644
--- a/src/web/src/components/Search/Searches.js
+++ b/src/web/src/components/Search/Searches.js
@@ -42,8 +42,8 @@ const Searches = ({ server }) => {
const onConnectionError = (error) => { setConnecting(false); setError(error); };
const onUpdate = (update) => {
- onConnected();
setSearches(update);
+ onConnected();
};
useEffect(() => {
diff --git a/src/web/src/components/Transfers/TransferList.js b/src/web/src/components/Transfers/TransferList.js
index 0c725f98..c35f512f 100644
--- a/src/web/src/components/Transfers/TransferList.js
+++ b/src/web/src/components/Transfers/TransferList.js
@@ -143,9 +143,7 @@ class TransferList extends Component {
</Button>}
</Table.Cell>
<Table.Cell className='transferlist-size'>
- {f.bytesTransferred > 0
- ? formatBytesTransferred({ transferred: f.bytesTransferred, size: f.size })
- : ''}
+ {formatBytesTransferred({ transferred: f.bytesTransferred, size: f.size })}
</Table.Cell>
</Table.Row>
)}
diff --git a/src/web/src/config.js b/src/web/src/config.js
index 1cec9668..9dc19b5c 100644
--- a/src/web/src/config.js
+++ b/src/web/src/config.js
@@ -1,5 +1,6 @@
const urlBase = (window.urlBase === '/' ? '' : window.urlBase) || '';
-const rootUrl = process.env.NODE_ENV === 'production' ? urlBase : `http://localhost:5000${urlBase}`;
+const devPort = window.port ?? 5030;
+const rootUrl = process.env.NODE_ENV === 'production' ? urlBase : `http://localhost:${devPort}${urlBase}`;
const apiBaseUrl = `${rootUrl}/api/v0`;
const hubBaseUrl = `${rootUrl}/hub`;
const tokenKey = 'slskd-token';