From 1d5de68558dd90b17a87faf97e8e6a9655041e4c Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 14 Jan 2023 22:09:29 -0600 Subject: update default api in web --- src/web/src/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/web') diff --git a/src/web/src/config.js b/src/web/src/config.js index 1cec9668..2663be36 100644 --- a/src/web/src/config.js +++ b/src/web/src/config.js @@ -1,5 +1,5 @@ const urlBase = (window.urlBase === '/' ? '' : window.urlBase) || ''; -const rootUrl = process.env.NODE_ENV === 'production' ? urlBase : `http://localhost:5000${urlBase}`; +const rootUrl = process.env.NODE_ENV === 'production' ? urlBase : `http://localhost:5030${urlBase}`; const apiBaseUrl = `${rootUrl}/api/v0`; const hubBaseUrl = `${rootUrl}/hub`; const tokenKey = 'slskd-token'; -- cgit v1.2.3 From f64e5491a88adf0bdeed355f925f80dde6f43581 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 15 Jan 2023 18:30:41 -0600 Subject: use injected port in dev --- src/web/src/config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/web') diff --git a/src/web/src/config.js b/src/web/src/config.js index 2663be36..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:5030${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'; -- cgit v1.2.3 From c191636438ce1ac107a890734aca9aa8cd596faf Mon Sep 17 00:00:00 2001 From: Matt Goldspink Date: Thu, 19 Jan 2023 15:47:19 -0800 Subject: Instead of only showing the file size when some bytes have been downloaded always show it. That way a user knows the size of pending downloads too. Fixes #600 --- src/web/src/components/Transfers/TransferList.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/web') 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 { } - {f.bytesTransferred > 0 - ? formatBytesTransferred({ transferred: f.bytesTransferred, size: f.size }) - : ''} + {formatBytesTransferred({ transferred: f.bytesTransferred, size: f.size })} )} -- cgit v1.2.3 From f1f7541069eabd5234bb03676f0728ddb2a09ef7 Mon Sep 17 00:00:00 2001 From: Matt Goldspink Date: Mon, 23 Jan 2023 08:44:23 -0800 Subject: Fixing #555 to allow browser reload to stay on the same page. There were 2 issues here: 1. The Redirect in App.js seems to be being hit on reload always and would always force a redirect. I tried googling but couldn't find a good answer why and how to workaround it, so I've just excluded our known paths from that redirect. 2. Even after this in Searches.js there's a race condition with the component being connected and starting to process the searchId, but the searches haven't been set yet, so it assumes it's invalid and resets to /searches. So I've swapped the order in onUpdate and that seems to fix it with no side effects. --- src/web/src/components/App.js | 5 ++++- src/web/src/components/Search/Searches.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/web') diff --git a/src/web/src/components/App.js b/src/web/src/components/App.js index 70d154af..74ae2cd8 100644 --- a/src/web/src/components/App.js +++ b/src/web/src/components/App.js @@ -356,7 +356,10 @@ class App extends Component { ) }/> - + + /\/(searches\/?|browse|users|chat|rooms|uploads|downloads|system\/)/ + .test(props.location.pathname) ? + <> : } /> } 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(() => { -- cgit v1.2.3 From 12dce9902dc791a70b44b89c67e380402c6d019f Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 28 Jan 2023 22:12:25 -0600 Subject: tweak route matching regex --- src/web/src/components/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/web') diff --git a/src/web/src/components/App.js b/src/web/src/components/App.js index 74ae2cd8..77365e1d 100644 --- a/src/web/src/components/App.js +++ b/src/web/src/components/App.js @@ -357,7 +357,7 @@ class App extends Component { ) }/> - /\/(searches\/?|browse|users|chat|rooms|uploads|downloads|system\/)/ + /\/(searches\/?|browse|users|chat|rooms|uploads|downloads|system|system\/(info|options|shares|data|logs))$/ .test(props.location.pathname) ? <> : } /> } -- cgit v1.2.3 From 63efcf9a65baf5b15a1e36bd9fcfa1435f27ad71 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 28 Jan 2023 22:17:28 -0600 Subject: disable lint rule --- src/web/src/components/App.js | 1 + 1 file changed, 1 insertion(+) (limited to 'src/web') diff --git a/src/web/src/components/App.js b/src/web/src/components/App.js index 77365e1d..0530c903 100644 --- a/src/web/src/components/App.js +++ b/src/web/src/components/App.js @@ -357,6 +357,7 @@ class App extends Component { ) }/> + // eslint-disable-next-line max-len /\/(searches\/?|browse|users|chat|rooms|uploads|downloads|system|system\/(info|options|shares|data|logs))$/ .test(props.location.pathname) ? <> : } /> -- cgit v1.2.3 From 7ce7c570ad94765a30061263a0b1992b1316cc2f Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 29 Jan 2023 06:57:42 -0600 Subject: revert back to catch-all --- src/web/src/components/App.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/web') diff --git a/src/web/src/components/App.js b/src/web/src/components/App.js index 0530c903..70d154af 100644 --- a/src/web/src/components/App.js +++ b/src/web/src/components/App.js @@ -356,11 +356,7 @@ class App extends Component { ) }/> - - // eslint-disable-next-line max-len - /\/(searches\/?|browse|users|chat|rooms|uploads|downloads|system|system\/(info|options|shares|data|logs))$/ - .test(props.location.pathname) ? - <> : } /> + } -- cgit v1.2.3 From c614a61ea67c54fa77ec4864f04d3e9407479b6b Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 29 Jan 2023 08:36:49 -0600 Subject: wrap each set of routes in a Switch --- src/web/src/components/App.js | 77 +++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 39 deletions(-) (limited to 'src/web') 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 { - - {isAgent ? <> + {isAgent ? + this.withTokenCheck( + + ) + }/> + + : + + + this.withTokenCheck(
+ +
)} + /> + this.withTokenCheck()}/> + + this.withTokenCheck()} + /> + + this.withTokenCheck()} + /> + this.withTokenCheck()}/> + + this.withTokenCheck(
) + }/> + + this.withTokenCheck(
+ +
) + }/> this.withTokenCheck( ) }/> - - : - <> - - this.withTokenCheck(
- -
)} - /> - this.withTokenCheck()}/> - - this.withTokenCheck()} - /> - - this.withTokenCheck()} - /> - this.withTokenCheck()}/> - - this.withTokenCheck(
) - }/> - - this.withTokenCheck(
- -
) - }/> - this.withTokenCheck( - - ) - }/> - - } -
+ +
+ }
-- cgit v1.2.3