From d2f65bc5c4731423678285b718e699d0579105ca Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 14 Jan 2023 22:04:52 -0600 Subject: change default http/s ports --- src/slskd/Core/Options.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 05331cd4..e0d67c59 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -1366,7 +1366,7 @@ namespace slskd [Description("HTTP listen port for web UI")] [Range(1, 65535)] [RequiresRestart] - public int Port { get; init; } = 5000; + public int Port { get; init; } = 5030; /// /// Gets HTTPS options. @@ -1557,7 +1557,7 @@ namespace slskd [Description("HTTPS listen port for web UI")] [Range(1, 65535)] [RequiresRestart] - public int Port { get; init; } = 5001; + public int Port { get; init; } = 5031; /// /// Gets a value indicating whether HTTP requests should be redirected to HTTPS. -- cgit v1.2.3 From 738c97d815068e9596d1b209fd1ce3da8244409e Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 14 Jan 2023 22:09:18 -0600 Subject: update launchSettings --- src/slskd/Properties/launchSettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/slskd/Properties/launchSettings.json b/src/slskd/Properties/launchSettings.json index b151b2f4..04eb101f 100644 --- a/src/slskd/Properties/launchSettings.json +++ b/src/slskd/Properties/launchSettings.json @@ -5,7 +5,7 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, - "applicationUrl": "https://localhost:5001;http://localhost:5000" + "applicationUrl": "https://localhost:5031;http://localhost:5030" } } } \ No newline at end of file -- cgit v1.2.3 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') 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 19dad4bba1d60b686db54fb612fe04aaad7acd24 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 15 Jan 2023 18:30:32 -0600 Subject: inject http port into html --- src/slskd/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs index af5d7420..f1f6bc03 100644 --- a/src/slskd/Program.cs +++ b/src/slskd/Program.cs @@ -815,7 +815,7 @@ namespace slskd // prepend the url base. app.UsePathBase(urlBase); app.UseHTMLRewrite("((\\.)?\\/static)", $"{(urlBase == "/" ? string.Empty : urlBase)}/static"); - app.UseHTMLInjection($"", excludedRoutes: new[] { "/api", "/swagger" }); + app.UseHTMLInjection($"", excludedRoutes: new[] { "/api", "/swagger" }); Log.Information("Using base url {UrlBase}", urlBase); // serve static content from the configured path -- 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') 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 86e0b7331247ed1c171435916ed482aceb751fa0 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 16 Jan 2023 21:47:11 -0600 Subject: update default listen port --- src/slskd/Core/Options.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index e0d67c59..c9b46239 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -1127,7 +1127,7 @@ namespace slskd [EnvironmentVariable("SLSK_LISTEN_PORT")] [Description("port on which to listen for incoming connections")] [Range(1024, 65535)] - public int ListenPort { get; init; } = 50000; + public int ListenPort { get; init; } = 50300; /// /// Gets the minimum diagnostic level. -- 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') 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 a5ca9a6c0397370ac2ea6b79be1641b9e64a4336 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 20 Jan 2023 16:15:44 -0600 Subject: docs, add controller connect/disconnect to route --- src/slskd/Relay/API/Controllers/RelayController.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/slskd/Relay/API/Controllers/RelayController.cs b/src/slskd/Relay/API/Controllers/RelayController.cs index f6c6d778..e3c3d28b 100644 --- a/src/slskd/Relay/API/Controllers/RelayController.cs +++ b/src/slskd/Relay/API/Controllers/RelayController.cs @@ -41,6 +41,12 @@ namespace slskd.Relay [ApiController] public class RelayController : ControllerBase { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// public RelayController( IRelayService relayService, IOptionsMonitor optionsMonitor, @@ -57,7 +63,11 @@ namespace slskd.Relay private RelayMode OperationMode => OptionsAtStartup.Relay.Mode.ToEnum(); private IOptionsMonitor OptionsMonitor { get; } - [HttpPut("")] + /// + /// Connects to the configured controller. + /// + /// + [HttpPut("controller")] [Authorize(Policy = AuthPolicy.JwtOnly)] public async Task Connect() { @@ -70,7 +80,11 @@ namespace slskd.Relay return Ok(); } - [HttpDelete("")] + /// + /// Disconnects from the connected controller. + /// + /// + [HttpDelete("controller")] [Authorize(Policy = AuthPolicy.JwtOnly)] public async Task Disconnect() { -- cgit v1.2.3 From 2f1d36d46836f90bac27bb8dd957a15ba7b6429b Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 20 Jan 2023 16:17:18 -0600 Subject: separate agent and controller actions by route --- src/slskd/Relay/API/Controllers/RelayController.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/slskd/Relay/API/Controllers/RelayController.cs b/src/slskd/Relay/API/Controllers/RelayController.cs index e3c3d28b..f76e8288 100644 --- a/src/slskd/Relay/API/Controllers/RelayController.cs +++ b/src/slskd/Relay/API/Controllers/RelayController.cs @@ -67,7 +67,7 @@ namespace slskd.Relay /// Connects to the configured controller. /// /// - [HttpPut("controller")] + [HttpPut("agent")] [Authorize(Policy = AuthPolicy.JwtOnly)] public async Task Connect() { @@ -84,7 +84,7 @@ namespace slskd.Relay /// Disconnects from the connected controller. /// /// - [HttpDelete("controller")] + [HttpDelete("agent")] [Authorize(Policy = AuthPolicy.JwtOnly)] public async Task Disconnect() { @@ -102,7 +102,7 @@ namespace slskd.Relay /// /// The unique identifier for the request. /// - [HttpGet("downloads/{token}")] + [HttpGet("controller/downloads/{token}")] [Authorize(Policy = AuthPolicy.ApiKeyOnly)] public IActionResult DownloadFile([FromRoute]string token) { @@ -153,7 +153,7 @@ namespace slskd.Relay /// /// The unique identifier for the request. /// - [HttpPost("files/{token}")] + [HttpPost("controller/files/{token}")] [RequestSizeLimit(10L * 1024L * 1024L * 1024L)] [RequestFormLimits(MultipartBodyLengthLimit = 10L * 1024L * 1024L * 1024L)] [DisableFormValueModelBinding] @@ -251,7 +251,7 @@ namespace slskd.Relay /// /// The unique identifier for the request. /// - [HttpPost("shares/{token}")] + [HttpPost("controller/shares/{token}")] [Authorize(Policy = AuthPolicy.ApiKeyOnly)] public async Task UploadShares(string token) { -- cgit v1.2.3 From 3b4f9e74ae0032f1f54c53f4fb5e39abd34db106 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 21 Jan 2023 11:19:50 -0600 Subject: docs --- src/slskd/Relay/API/Controllers/RelayController.cs | 6 +++--- src/slskd/Relay/API/Hubs/RelayHub.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/slskd/Relay/API/Controllers/RelayController.cs b/src/slskd/Relay/API/Controllers/RelayController.cs index f76e8288..ee282b17 100644 --- a/src/slskd/Relay/API/Controllers/RelayController.cs +++ b/src/slskd/Relay/API/Controllers/RelayController.cs @@ -98,7 +98,7 @@ namespace slskd.Relay } /// - /// Downloads a file. + /// Downloads a file from the connected controller. /// /// The unique identifier for the request. /// @@ -149,7 +149,7 @@ namespace slskd.Relay } /// - /// Uploads a file. + /// Uploads a file to the connected controller. /// /// The unique identifier for the request. /// @@ -247,7 +247,7 @@ namespace slskd.Relay } /// - /// Uploads share information. + /// Uploads share information to the connected controller. /// /// The unique identifier for the request. /// diff --git a/src/slskd/Relay/API/Hubs/RelayHub.cs b/src/slskd/Relay/API/Hubs/RelayHub.cs index 43f49976..e246711e 100644 --- a/src/slskd/Relay/API/Hubs/RelayHub.cs +++ b/src/slskd/Relay/API/Hubs/RelayHub.cs @@ -169,7 +169,7 @@ namespace slskd.Relay } /// - /// Initiates the share upload workflow by generating and retrieving a request token. + /// Executed by the agent to initiate the share upload workflow by generating and retrieving a request token. /// /// The generated token. /// Thrown when the agent is not fully authenticated. @@ -188,7 +188,7 @@ namespace slskd.Relay } /// - /// Notifies the controller that the agent was unable to upload the file requested by a call to . + /// Executed by the agent to notify the controller that the agent was unable to upload the file requested by a call to . /// /// The unique identifier of the request. /// The Exception that caused the failure. @@ -207,7 +207,7 @@ namespace slskd.Relay } /// - /// Returns the response to a call to . + /// Executed by the agent to return the response to a call to . /// /// The unique identifier for the request. /// A value indicating whether the requested file exists on the agent's filesystem. -- cgit v1.2.3 From 77756da125291c0ff2110c83dafa8f987a8e6627 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 21 Jan 2023 11:20:08 -0600 Subject: docs --- src/slskd/Relay/Types/Agent.cs | 10 ++++++++++ src/slskd/Relay/Types/RelayClientState.cs | 18 ++++++++++++++++++ src/slskd/Relay/Types/RelayMode.cs | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/slskd/Relay/Types/Agent.cs b/src/slskd/Relay/Types/Agent.cs index 3ed1767e..6a70cbd2 100644 --- a/src/slskd/Relay/Types/Agent.cs +++ b/src/slskd/Relay/Types/Agent.cs @@ -17,9 +17,19 @@ namespace slskd.Relay { + /// + /// Tracking information for a Relay agent. + /// public record Agent { + /// + /// The name of the agent. + /// public string Name { get; init; } + + /// + /// The IP address associated with the active connection. + /// public string IPAddress { get; init; } } } diff --git a/src/slskd/Relay/Types/RelayClientState.cs b/src/slskd/Relay/Types/RelayClientState.cs index def25411..79f90e69 100644 --- a/src/slskd/Relay/Types/RelayClientState.cs +++ b/src/slskd/Relay/Types/RelayClientState.cs @@ -17,11 +17,29 @@ namespace slskd.Relay { + /// + /// The state of a Relay client. + /// public enum RelayClientState { + /// + /// Disconnected. + /// Disconnected, + + /// + /// Connected. + /// Connected, + + /// + /// Connecting. + /// Connecting, + + /// + /// Reconnecting. + /// Reconnecting, } } diff --git a/src/slskd/Relay/Types/RelayMode.cs b/src/slskd/Relay/Types/RelayMode.cs index d45a8933..3663271c 100644 --- a/src/slskd/Relay/Types/RelayMode.cs +++ b/src/slskd/Relay/Types/RelayMode.cs @@ -18,7 +18,7 @@ namespace slskd.Relay { /// - /// The relay mode. + /// The mode the Relay is operating under. /// public enum RelayMode { -- cgit v1.2.3 From cbf0c9749c0eb64c47e9ab09b8d0453a37c70f8e Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 21 Jan 2023 11:20:26 -0600 Subject: split interface from implementation --- src/slskd/Relay/IRelayClient.cs | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/slskd/Relay/IRelayClient.cs (limited to 'src') diff --git a/src/slskd/Relay/IRelayClient.cs b/src/slskd/Relay/IRelayClient.cs new file mode 100644 index 00000000..376f3eaf --- /dev/null +++ b/src/slskd/Relay/IRelayClient.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) slskd Team. All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see https://www.gnu.org/licenses/. +// + +namespace slskd.Relay +{ + using System; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Relay client (agent). + /// + public interface IRelayClient : IDisposable + { + /// + /// Gets the client state. + /// + IStateMonitor StateMonitor { get; } + + /// + /// Starts the client and connects to the controller. + /// + /// The token to monitor for cancellation requests. + /// The operation context. + Task StartAsync(CancellationToken cancellationToken = default); + + /// + /// Stops the client and disconnects from the controller. + /// + /// The token to monitor for cancellation requests. + /// The operation context. + Task StopAsync(CancellationToken cancellationToken = default); + + /// + /// Synchronizes state with the controller. + /// + /// The token to monitor for cancellation requests. + /// The operation context. + Task SynchronizeAsync(CancellationToken cancellationToken = default); + } +} -- cgit v1.2.3 From 68967df8b01088a88f517c75ef94e9bac8dd6dad Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 21 Jan 2023 11:20:43 -0600 Subject: rename Dummy client to Null --- src/slskd/Relay/DummyRelayClient.cs | 49 ----------------------- src/slskd/Relay/NullRelayClient.cs | 77 +++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 49 deletions(-) delete mode 100644 src/slskd/Relay/DummyRelayClient.cs create mode 100644 src/slskd/Relay/NullRelayClient.cs (limited to 'src') diff --git a/src/slskd/Relay/DummyRelayClient.cs b/src/slskd/Relay/DummyRelayClient.cs deleted file mode 100644 index c5bd477c..00000000 --- a/src/slskd/Relay/DummyRelayClient.cs +++ /dev/null @@ -1,49 +0,0 @@ -// -// Copyright (c) slskd Team. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see https://www.gnu.org/licenses/. -// - -namespace slskd.Relay -{ - using System.Threading; - using System.Threading.Tasks; - - public class DummyRelayClient : IRelayClient - { - public IStateMonitor StateMonitor => new ManagedState(); - - private bool Disposed { get; set; } - - public void Dispose() - { - Dispose(disposing: true); - System.GC.SuppressFinalize(this); - } - - public Task StartAsync(CancellationToken cancellationToken = default) => Task.CompletedTask; - - public Task StopAsync(CancellationToken cancellationToken = default) => Task.CompletedTask; - - public Task SynchronizeAsync(CancellationToken cancellationToken = default) => Task.CompletedTask; - - protected virtual void Dispose(bool disposing) - { - if (!Disposed) - { - Disposed = true; - } - } - } -} \ No newline at end of file diff --git a/src/slskd/Relay/NullRelayClient.cs b/src/slskd/Relay/NullRelayClient.cs new file mode 100644 index 00000000..d86e994f --- /dev/null +++ b/src/slskd/Relay/NullRelayClient.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) slskd Team. All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see https://www.gnu.org/licenses/. +// + +namespace slskd.Relay +{ + using System.Threading; + using System.Threading.Tasks; + + /// + /// A non-operarable Relay client. + /// + public class NullRelayClient : IRelayClient + { + /// + /// Gets the client state. + /// + public IStateMonitor StateMonitor { get; set; } = new ManagedState(); + + private bool Disposed { get; set; } + + /// + /// Disposes this instance. + /// + public void Dispose() + { + Dispose(disposing: true); + System.GC.SuppressFinalize(this); + } + + /// + /// Starts the client and connects to the controller. + /// + /// The token to monitor for cancellation requests. + /// The operation context. + public Task StartAsync(CancellationToken cancellationToken = default) => Task.CompletedTask; + + /// + /// Stops the client and disconnects from the controller. + /// + /// The token to monitor for cancellation requests. + /// The operation context. + public Task StopAsync(CancellationToken cancellationToken = default) => Task.CompletedTask; + + /// + /// Synchronizes state with the controller. + /// + /// The token to monitor for cancellation requests. + /// The operation context. + public Task SynchronizeAsync(CancellationToken cancellationToken = default) => Task.CompletedTask; + + /// + /// Disposes this instance. + /// + /// Disposing. + protected virtual void Dispose(bool disposing) + { + if (!Disposed) + { + Disposed = true; + } + } + } +} \ No newline at end of file -- cgit v1.2.3 From b5dc94966242f7fd96c2ab93be48161eedfd4820 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 21 Jan 2023 11:20:57 -0600 Subject: fix urls, docs --- src/slskd/Relay/RelayClient.cs | 48 ++++++++---------------------------------- 1 file changed, 9 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/slskd/Relay/RelayClient.cs b/src/slskd/Relay/RelayClient.cs index dae89f78..fbf13e14 100644 --- a/src/slskd/Relay/RelayClient.cs +++ b/src/slskd/Relay/RelayClient.cs @@ -30,37 +30,6 @@ namespace slskd.Relay using slskd.Cryptography; using slskd.Shares; - /// - /// Relay client (agent). - /// - public interface IRelayClient : IDisposable - { - /// - /// Gets the client state. - /// - IStateMonitor StateMonitor { get; } - - /// - /// Starts the client and connects to the controller. - /// - /// - /// - Task StartAsync(CancellationToken cancellationToken = default); - - /// - /// Stops the client and disconnects from the controller. - /// - /// - /// - Task StopAsync(CancellationToken cancellationToken = default); - - /// - /// Synchronizes state with the controller. - /// - /// The operation context. - Task SynchronizeAsync(CancellationToken cancellationToken = default); - } - /// /// Relay client (agent). /// @@ -121,8 +90,8 @@ namespace slskd.Relay /// /// Starts the client and connects to the controller. /// - /// - /// + /// The token to monitor for cancellation requests. + /// The operation context. public async Task StartAsync(CancellationToken cancellationToken = default) { if (!StateSyncRoot.Wait(0, cancellationToken)) @@ -200,8 +169,8 @@ namespace slskd.Relay /// /// Stops the client and disconnects from the controller. /// - /// - /// + /// The token to monitor for cancellation requests. + /// The operation context. public async Task StopAsync(CancellationToken cancellationToken = default) { StartRequested = false; @@ -220,6 +189,7 @@ namespace slskd.Relay /// /// Synchronizes state with the controller. /// + /// The token to monitor for cancellation requests. /// The operation context. public Task SynchronizeAsync(CancellationToken cancellationToken = default) { @@ -229,7 +199,7 @@ namespace slskd.Relay /// /// Disposes this instance. /// - /// + /// Disposing. protected virtual void Dispose(bool disposing) { if (!Disposed) @@ -419,7 +389,7 @@ namespace slskd.Relay stream.Seek(startOffset, SeekOrigin.Begin); - using var request = new HttpRequestMessage(HttpMethod.Post, $"api/v0/relay/files/{token}"); + using var request = new HttpRequestMessage(HttpMethod.Post, $"api/v0/relay/controller/files/{token}"); request.Headers.Add("X-API-Key", OptionsMonitor.CurrentValue.Relay.Controller.ApiKey); request.Headers.Add("X-Relay-Agent", OptionsMonitor.CurrentValue.InstanceName); @@ -482,7 +452,7 @@ namespace slskd.Relay await Retry.Do(task: async () => { - using var request = new HttpRequestMessage(HttpMethod.Get, $"api/v0/relay/downloads/{token}"); + using var request = new HttpRequestMessage(HttpMethod.Get, $"api/v0/relay/controller/downloads/{token}"); request.Headers.Add("X-API-Key", OptionsMonitor.CurrentValue.Relay.Controller.ApiKey); request.Headers.Add("X-Relay-Agent", OptionsMonitor.CurrentValue.InstanceName); @@ -621,7 +591,7 @@ namespace slskd.Relay var stream = new FileStream(temp, FileMode.Open, FileAccess.Read); - using var request = new HttpRequestMessage(HttpMethod.Post, $"api/v0/relay/shares/{token}"); + using var request = new HttpRequestMessage(HttpMethod.Post, $"api/v0/relay/controller/shares/{token}"); request.Headers.Add("X-API-Key", OptionsMonitor.CurrentValue.Relay.Controller.ApiKey); request.Headers.Add("X-Relay-Agent", OptionsMonitor.CurrentValue.InstanceName); -- cgit v1.2.3 From c23f95ab47c052bff94d08053c25fca53e97e601 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 21 Jan 2023 11:21:15 -0600 Subject: rename dummy client --- src/slskd/Relay/RelayService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/slskd/Relay/RelayService.cs b/src/slskd/Relay/RelayService.cs index 2cf09f8d..c0044020 100644 --- a/src/slskd/Relay/RelayService.cs +++ b/src/slskd/Relay/RelayService.cs @@ -284,7 +284,7 @@ namespace slskd.Relay HttpClientFactory = httpClientFactory; // wire up a dummy client so callers don't need to handle nulls - Client = relayClient ?? new DummyRelayClient(); + Client = relayClient ?? new NullRelayClient(); StateMonitor = State; -- cgit v1.2.3 From 1340ffa52dd3aaa63840f9e36f3e6fb495d97a86 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 22 Jan 2023 22:19:06 -0600 Subject: polish RelayService --- src/slskd/Relay/API/Controllers/RelayController.cs | 4 +- src/slskd/Relay/RelayService.cs | 162 +++++++++++---------- src/slskd/Transfers/Downloads/DownloadService.cs | 2 +- 3 files changed, 89 insertions(+), 79 deletions(-) (limited to 'src') diff --git a/src/slskd/Relay/API/Controllers/RelayController.cs b/src/slskd/Relay/API/Controllers/RelayController.cs index ee282b17..586cbbb2 100644 --- a/src/slskd/Relay/API/Controllers/RelayController.cs +++ b/src/slskd/Relay/API/Controllers/RelayController.cs @@ -235,7 +235,7 @@ namespace slskd.Relay // pass the stream back to the relay service, which will in turn pass it to the upload service, and use it to // feed data into the remote upload. await this call, it will complete when the upload is complete, one way or the other. - await Relay.HandleFileStreamResponse(agentName, id: guid, stream); + await Relay.HandleFileStreamResponseAsync(agentName, id: guid, stream); Log.Information("File upload of {Filename} ({Token}) from agent {Agent} complete", filename, token, agentName); return Ok(); @@ -321,7 +321,7 @@ namespace slskd.Relay Log.Information("Download of shares from {Agent} ({Token}) complete ({Size} in {Duration}ms)", agentName, guid, ((double)inputStream.Length).SizeSuffix(), sw.ElapsedMilliseconds); - await Relay.HandleShareUpload(agentName, id: guid, shares, temp); + await Relay.HandleShareUploadAsync(agentName, id: guid, shares, temp); return Ok(); } diff --git a/src/slskd/Relay/RelayService.cs b/src/slskd/Relay/RelayService.cs index c0044020..a403fa73 100644 --- a/src/slskd/Relay/RelayService.cs +++ b/src/slskd/Relay/RelayService.cs @@ -54,13 +54,6 @@ namespace slskd.Relay /// IStateMonitor StateMonitor { get; } - /// - /// Notifies connected agents that a file download has completed. - /// - /// The filename of the completed file, relative to the downloads directory. - /// The operation context. - Task BroadcastFileDownloadCompletedNotificationAsync(string filename); - /// /// Generates a random authentication challenge token for the specified . /// @@ -76,12 +69,13 @@ namespace slskd.Relay /// This is the first step in a multi-step workflow. The entire sequence is: /// /// - /// A remote agent makes a request to the SignalR hub to retrieve a share upload token, which in turn - /// calls . The token is generated and cached, and is only valid while it is in the cache. + /// A remote agent makes a request to the SignalR hub to retrieve a share upload token, which in turn calls + /// . The token is generated and cached, and is only valid while it is + /// in the cache. /// /// - /// The remote agent makes an HTTP POST request containing a multipart upload including a backup of its - /// shared database and a serialized list of locally configured shares, and the controller invokes . + /// The remote agent makes an HTTP POST request containing a multipart upload including a backup of its shared + /// database and a serialized list of locally configured shares, and the controller invokes . /// /// /// @@ -173,7 +167,7 @@ namespace slskd.Relay /// The ID of the request. /// The client response to the request. /// The operation context. - Task HandleFileStreamResponse(string agentName, Guid id, Stream response); + Task HandleFileStreamResponseAsync(string agentName, Guid id, Stream response); /// /// Handles incoming share uploads. @@ -183,7 +177,14 @@ namespace slskd.Relay /// The list of shares provided. /// The filename of the temporary file containing the upload. /// The operation context. - Task HandleShareUpload(string agentName, Guid id, IEnumerable shares, string filename); + Task HandleShareUploadAsync(string agentName, Guid id, IEnumerable shares, string filename); + + /// + /// Notifies connected agents that a file download has completed. + /// + /// The filename of the completed file, relative to the downloads directory. + /// The operation context. + Task NotifyFileDownloadCompleteAsync(string filename); /// /// Notifies the caller of of a failure to obtain a file stream from the requested agent. @@ -267,6 +268,16 @@ namespace slskd.Relay /// public class RelayService : IRelayService { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + /// + /// + /// public RelayService( IWaiter waiter, IShareService shareService, @@ -309,68 +320,20 @@ namespace slskd.Relay public IStateMonitor StateMonitor { get; } private IHttpClientFactory HttpClientFactory { get; } + private string LastControllerOptionsHash { get; set; } + private string LastOptionsHash { get; set; } private ILogger Log { get; } = Serilog.Log.ForContext(); private MemoryCache MemoryCache { get; } = new MemoryCache(new MemoryCacheOptions()); - private IHubContext RelayHub { get; set; } private IOptionsMonitor OptionsMonitor { get; } private ConcurrentDictionary> PendingFileInquiryDictionary { get; } = new(); private ConcurrentDictionary RegisteredAgentDictionary { get; } = new(); + private IHubContext RelayHub { get; set; } private IShareRepositoryFactory ShareRepositoryFactory { get; } private IShareService Shares { get; } - private IWaiter Waiter { get; } private IManagedState State { get; } = new ManagedState(); - private ConcurrentDictionary WaitIdDictionary { get; } = new(); private SemaphoreSlim SyncRoot { get; } = new SemaphoreSlim(1, 1); - private string LastOptionsHash { get; set; } - private string LastControllerOptionsHash { get; set; } - - /// - /// Notifies connected agents that a file download has completed. - /// - /// The filename of the completed file, relative to the downloads directory. - /// The operation context. - public Task BroadcastFileDownloadCompletedNotificationAsync(string filename) - { - if (!OptionsMonitor.CurrentValue.Relay.Enabled || - !new[] { RelayMode.Controller, RelayMode.Debug }.Contains(OptionsMonitor.CurrentValue.Relay.Mode.ToEnum())) - { - return Task.CompletedTask; - } - - var agents = RegisteredAgentDictionary.Values; - - if (!agents.Any()) - { - return Task.CompletedTask; - } - - // ensure filename is relative to the local download directory - // and make sure it doesn't start with a slash - filename = filename - .ReplaceFirst(OptionsMonitor.CurrentValue.Directories.Downloads, string.Empty) - .TrimStart(new[] { '/', '\\' }); - - async Task Notify((string ConnectionId, Agent Agent) record) - { - try - { - var id = Guid.NewGuid(); - - MemoryCache.Set(GetDownloadTokenCacheKey(filename, id), record.Agent.Name, TimeSpan.FromMinutes(10)); - Log.Debug("Cached file download token {Token} for agent {Agent}", id, record.Agent.Name); - - await RelayHub.Clients.Client(record.ConnectionId).NotifyFileDownloadCompleted(filename, id); - } - catch - { - Log.Warning("Failed to notify agent {Agent} of download completion for {Filename}", record.Agent.Name, filename); - } - } - - Log.Information("Notifying agents of download completion for {Filename}", filename); - - return Task.WhenAll(RegisteredAgentDictionary.Values.Select(Notify)); - } + private IWaiter Waiter { get; } + private ConcurrentDictionary WaitIdDictionary { get; } = new(); /// /// Generates a random authentication challenge token for the specified . @@ -396,16 +359,16 @@ namespace slskd.Relay /// This is the first step in a multi-step workflow. The entire sequence is: /// /// - /// A remote agent makes a request to the SignalR hub to retrieve a share upload token, which in turn - /// calls . The token is generated and cached. + /// A remote agent makes a request to the SignalR hub to retrieve a share upload token, which in turn calls + /// . The token is generated and cached. /// /// - /// The remote agent makes an HTTP POST request containing a multipart upload including a backup of its - /// shared database and a serialized list of locally configured shares. + /// The remote agent makes an HTTP POST request containing a multipart upload including a backup of its shared + /// database and a serialized list of locally configured shares. /// /// - /// The HTTP controller saves the database backup to a temporary file, validates it, and then adds (or updates) - /// a share host for the agent. + /// The HTTP controller saves the database backup to a temporary file, validates it, and then adds (or + /// updates) a share host for the agent. /// /// /// @@ -582,7 +545,7 @@ namespace slskd.Relay /// The ID of the request. /// The client response to the request. /// The operation context. - public async Task HandleFileStreamResponse(string agentName, Guid id, Stream response) + public async Task HandleFileStreamResponseAsync(string agentName, Guid id, Stream response) { var streamKey = new WaitKey(nameof(GetFileStreamAsync), agentName, id); @@ -596,7 +559,7 @@ namespace slskd.Relay // create a wait (but do not await it) for the completion of the upload to the remote client. we need to await this to // keep execution in the body of the API controller that provided the stream, in order to keep the stream open for the // duration of the remote transfer. omit the id from the key, the caller doesn't know it. - var completionKey = new WaitKey(nameof(HandleFileStreamResponse), agentName, id); + var completionKey = new WaitKey(nameof(HandleFileStreamResponseAsync), agentName, id); var completion = Waiter.WaitIndefinitely(completionKey); // complete the wait that's waiting for the stream, so we can send the stream back to the caller of GetFileStream this @@ -616,7 +579,7 @@ namespace slskd.Relay /// The list of shares provided. /// The filename of the temporary file containing the upload. /// The operation context. - public Task HandleShareUpload(string agentName, Guid id, IEnumerable shares, string filename) + public Task HandleShareUploadAsync(string agentName, Guid id, IEnumerable shares, string filename) { Log.Information("Loading shares from agent {Agent}", agentName); @@ -638,6 +601,53 @@ namespace slskd.Relay return Task.CompletedTask; } + /// + /// Notifies connected agents that a file download has completed. + /// + /// The filename of the completed file, relative to the downloads directory. + /// The operation context. + public Task NotifyFileDownloadCompleteAsync(string filename) + { + if (!OptionsMonitor.CurrentValue.Relay.Enabled || + !new[] { RelayMode.Controller, RelayMode.Debug }.Contains(OptionsMonitor.CurrentValue.Relay.Mode.ToEnum())) + { + return Task.CompletedTask; + } + + var agents = RegisteredAgentDictionary.Values; + + if (!agents.Any()) + { + return Task.CompletedTask; + } + + // ensure filename is relative to the local download directory and make sure it doesn't start with a slash + filename = filename + .ReplaceFirst(OptionsMonitor.CurrentValue.Directories.Downloads, string.Empty) + .TrimStart(new[] { '/', '\\' }); + + async Task Notify((string ConnectionId, Agent Agent) record) + { + try + { + var id = Guid.NewGuid(); + + MemoryCache.Set(GetDownloadTokenCacheKey(filename, id), record.Agent.Name, TimeSpan.FromMinutes(10)); + Log.Debug("Cached file download token {Token} for agent {Agent}", id, record.Agent.Name); + + await RelayHub.Clients.Client(record.ConnectionId).NotifyFileDownloadCompleted(filename, id); + } + catch + { + Log.Warning("Failed to notify agent {Agent} of download completion for {Filename}", record.Agent.Name, filename); + } + } + + Log.Information("Notifying agents of download completion for {Filename}", filename); + + return Task.WhenAll(RegisteredAgentDictionary.Values.Select(Notify)); + } + /// /// Notifies the caller of of a failure to obtain a file stream from the requested agent. /// @@ -668,7 +678,7 @@ namespace slskd.Relay /// If the transfer associated with the stream failed, the exception that caused the failure. public void TryCloseFileStream(string agentName, Guid id, Exception exception = default) { - var key = new WaitKey(nameof(HandleFileStreamResponse), agentName, id); + var key = new WaitKey(nameof(HandleFileStreamResponseAsync), agentName, id); if (exception != default) { diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs index c85ff551..827a0528 100644 --- a/src/slskd/Transfers/Downloads/DownloadService.cs +++ b/src/slskd/Transfers/Downloads/DownloadService.cs @@ -232,7 +232,7 @@ namespace slskd.Transfers.Downloads if (OptionsMonitor.CurrentValue.Relay.Enabled) { - _ = Relay.BroadcastFileDownloadCompletedNotificationAsync(finalFilename); + _ = Relay.NotifyFileDownloadCompleteAsync(finalFilename); } if (OptionsMonitor.CurrentValue.Integration.Ftp.Enabled) -- cgit v1.2.3 From b7d70dbe919fe7c64897d92bf79e6416c7a7f078 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 23 Jan 2023 08:25:26 -0600 Subject: docs --- src/slskd/Relay/RelayClient.cs | 3 +-- src/slskd/Relay/RelayService.cs | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/slskd/Relay/RelayClient.cs b/src/slskd/Relay/RelayClient.cs index fbf13e14..eef84c27 100644 --- a/src/slskd/Relay/RelayClient.cs +++ b/src/slskd/Relay/RelayClient.cs @@ -501,7 +501,6 @@ namespace slskd.Relay try { // wait for the authentication flow to complete - // time out after 5 seconds in case we get stuck waiting on a dead Task await LoggedInTaskCompletionSource.Task; Log.Information("Uploading shares..."); @@ -510,7 +509,7 @@ namespace slskd.Relay } catch (Exception ex) { - Log.Error(ex, ex.Message); + Log.Error(ex, "Failed to log in and/or upload shares: {Message}", ex.Message); Log.Error("Disconnecting from the relay controller"); // stop, then fire and forget StartAsync() to re-enter the connection retry loop diff --git a/src/slskd/Relay/RelayService.cs b/src/slskd/Relay/RelayService.cs index a403fa73..c7056a0c 100644 --- a/src/slskd/Relay/RelayService.cs +++ b/src/slskd/Relay/RelayService.cs @@ -75,7 +75,7 @@ namespace slskd.Relay /// /// /// The remote agent makes an HTTP POST request containing a multipart upload including a backup of its shared - /// database and a serialized list of locally configured shares, and the controller invokes . + /// database and a serialized list of locally configured shares, and the controller invokes . /// /// /// @@ -122,7 +122,7 @@ namespace slskd.Relay /// /// /// The remote agent makes an HTTP POST request containing a multipart upload including the file, and the - /// API controller invokes and awaits . The stream is passed from + /// API controller invokes and awaits . The stream is passed from /// this method back to the awaited , and the Upload service passes the /// stream to Soulseek.NET, streaming the data from the still-open HTTP request through to the remote /// Soulseek user. @@ -137,7 +137,7 @@ namespace slskd.Relay /// /// When the Upload is complete (successfully or otherwise), the Upload service invokes /// , passing an optional if the transfer was not - /// successful. This call signals the waiting to complete, passing + /// successful. This call signals the waiting to complete, passing /// control back to the API controller and completing the HTTP POST request from the agent. /// /// @@ -451,7 +451,7 @@ namespace slskd.Relay /// /// /// The remote agent makes an HTTP POST request containing a multipart upload including the file, and the - /// API controller invokes and awaits . The stream is passed from + /// API controller invokes and awaits . The stream is passed from /// this method back to the awaited , and the Upload service passes the /// stream to Soulseek.NET, streaming the data from the still-open HTTP request through to the remote /// Soulseek user. @@ -466,7 +466,7 @@ namespace slskd.Relay /// /// When the Upload is complete (successfully or otherwise), the Upload service invokes /// , passing an optional if the transfer was not - /// successful. This call signals the waiting to complete, passing + /// successful. This call signals the waiting to complete, passing /// control back to the API controller and completing the HTTP POST request from the agent. /// /// -- 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') 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 10559e97fbe2edb35459586d3dea43075855d3cd Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 28 Jan 2023 16:16:28 -0600 Subject: fix version check (again) --- bin/build | 2 +- bin/publish | 4 ++-- src/slskd/Program.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/bin/build b/bin/build index 04fd0805..a5ca4f29 100755 --- a/bin/build +++ b/bin/build @@ -13,7 +13,7 @@ while test $# -gt 0; do echo '--web-only skip dotnet build' echo '--dotnet-only skip web build' echo '--skip-tests skip execution of npm and dotnet tests' - echo '--version version for the binary. defaults to current git tag-SHA' + echo '--version version for the binary. defaults to current git tag+SHA' exit 0 ;; --web-only) diff --git a/bin/publish b/bin/publish index 3461c470..512fb9f6 100755 --- a/bin/publish +++ b/bin/publish @@ -11,7 +11,7 @@ while test $# -gt 0; do echo '--no-prebuild skip build and test' echo '--runtime a valid RID (https://docs.microsoft.com/en-us/dotnet/core/rid-catalog)' echo '--platform one of: linux/amd64, linux/arm64, linux/arm/v7. overrides runtime.' - echo '--version version for the binary. defaults to current git tag-SHA' + echo '--version version for the binary. defaults to current git tag+SHA' echo '--output the output directory. defaults to ../../dist/' exit 0 ;; @@ -69,7 +69,7 @@ fi if [ -z "$version" ]; then tag=$(git describe --tags --abbrev=0) sha=$(git rev-parse --short HEAD) - version=$tag-$sha + version=$tag+$sha fi if [ -z "$runtime" ]; then diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs index af5d7420..c13cfdf1 100644 --- a/src/slskd/Program.cs +++ b/src/slskd/Program.cs @@ -135,7 +135,7 @@ namespace slskd /// /// Gets the semantic application version. /// - public static string SemanticVersion { get; } = InformationalVersion.Split('-').First(); + public static string SemanticVersion { get; } = InformationalVersion.Split('+').First(); /// /// Gets the full application version, including both assembly and informational versions. @@ -246,7 +246,7 @@ namespace slskd try { - Arguments.Populate(clearExistingValues: false); + Arguments.Populate(clearExistingValues: false); } catch (Exception ex) { -- cgit v1.2.3 From 3010a89000fd08e0e5688d232c3cf70a98e6f8f2 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 28 Jan 2023 16:52:28 -0600 Subject: suppress ASP0014 --- src/slskd/Program.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs index c13cfdf1..5d7c37e1 100644 --- a/src/slskd/Program.cs +++ b/src/slskd/Program.cs @@ -841,6 +841,11 @@ namespace slskd app.UseAuthentication(); app.UseRouting(); app.UseAuthorization(); + + // starting with .NET 7 the framework *really* wants you to use top level endpoint mapping + // for whatever reason this breaks everything, and i just can't bring myself to care unless + // UseEndpoints is going to be deprecated or if there's some material benefit +#pragma warning disable ASP0014 // Suggest using top level route registrations app.UseEndpoints(endpoints => { endpoints.MapHub("/hub/application"); @@ -885,6 +890,7 @@ namespace slskd }); } }); +#pragma warning restore ASP0014 // Suggest using top level route registrations // if this is an /api route and no API controller was matched, give up and return a 404. app.Use(async (context, next) => -- 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') 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') 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') 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') 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