aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-08-23 01:15:45 -0500
committerGitHub <noreply@github.com>2026-08-23 01:15:45 -0500
commit675113541dd548240e9e950bf3faaabdc834a621 (patch)
tree9617970772e17bd5b306431ccbcebc3e3c2fb15e
parent5770c7e4d489ac9580a1ea268ce8952b6436b72d (diff)
parent1c42a24d0b74a97d8246d5a0760db1ec96461c69 (diff)
downloadslskd-675113541dd548240e9e950bf3faaabdc834a621.tar.gz
Merge pull request #1828 from slskd/download-inspect
Add a debug API controller and a /transfers endpoint to return SoulseekClient's transfer lists
-rw-r--r--src/slskd/Core/API/Controllers/ApplicationController.cs3
-rw-r--r--src/slskd/Core/API/Controllers/DebugController.cs73
2 files changed, 76 insertions, 0 deletions
diff --git a/src/slskd/Core/API/Controllers/ApplicationController.cs b/src/slskd/Core/API/Controllers/ApplicationController.cs
index b55fc865..70c260f6 100644
--- a/src/slskd/Core/API/Controllers/ApplicationController.cs
+++ b/src/slskd/Core/API/Controllers/ApplicationController.cs
@@ -148,6 +148,7 @@ namespace slskd.Core.API
/// Forces garbage collection.
/// </summary>
/// <returns></returns>
+ [ApiExplorerSettings(IgnoreApi = true)]
[HttpPost("gc")]
[Authorize(Policy = AuthPolicy.Any)]
public IActionResult CollectGarbage()
@@ -157,6 +158,7 @@ namespace slskd.Core.API
return Ok();
}
+ [ApiExplorerSettings(IgnoreApi = true)]
[HttpGet("dump")]
[Authorize(Policy = AuthPolicy.Any)]
public async Task<IActionResult> DumpMemory()
@@ -167,6 +169,7 @@ namespace slskd.Core.API
return PhysicalFile(file, "application/octet-stream", "slskd.dmp");
}
+ [ApiExplorerSettings(IgnoreApi = true)]
[HttpPost("loopback")]
[Authorize(Policy = AuthPolicy.Any)]
public IActionResult Loopback([FromBody] object body)
diff --git a/src/slskd/Core/API/Controllers/DebugController.cs b/src/slskd/Core/API/Controllers/DebugController.cs
new file mode 100644
index 00000000..b5f6cd33
--- /dev/null
+++ b/src/slskd/Core/API/Controllers/DebugController.cs
@@ -0,0 +1,73 @@
+// <copyright file="DebugController.cs" company="JP Dillingham">
+// ▄▄▄▄ ▄▄▄▄ ▄▄▄▄
+// ▄▄▄▄▄▄█ █▄▄▄▄▄█ █▄▄▄▄▄█ █
+// █__ --█ █__ --█ ◄█ - █
+// █▄▄▄▄▄█▄▄█▄▄▄▄▄█▄▄█▄▄█▄▄▄▄▄█
+// ┍━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ━━━━ ━ ━┉ ┉ ┉
+// │ Copyright (c) JP Dillingham.
+// │
+// │ 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, version 3.
+// │
+// │ 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/.
+// │
+// │ This program is distributed with Additional Terms pursuant to Section 7
+// │ of the AGPLv3. See the LICENSE file in the root directory of this
+// │ project for the complete terms and conditions.
+// │
+// │ https://slskd.org
+// │
+// ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ╌ ╌╌╌╌ ╌
+// │ SPDX-FileCopyrightText: JP Dillingham
+// │ SPDX-License-Identifier: AGPL-3.0-only
+// ╰───────────────────────────────────────────╶──── ─ ─── ─ ── ──┈ ┈
+// </copyright>
+
+namespace slskd.Core.API
+{
+ using Asp.Versioning;
+ using Microsoft.AspNetCore.Authorization;
+ using Microsoft.AspNetCore.Mvc;
+ using Soulseek;
+
+ /// <summary>
+ /// Debug.
+ /// </summary>
+ [ApiExplorerSettings(IgnoreApi = true)]
+ [Route("api/v{version:apiVersion}/[controller]")]
+ [ApiVersion("0")]
+ [ApiController]
+ [Produces("application/json")]
+ [Consumes("application/json")]
+ public class DebugController : ControllerBase
+ {
+ public DebugController(ISoulseekClient soulseekClient)
+ {
+ Client = soulseekClient;
+ }
+
+ private ISoulseekClient Client { get; }
+
+ [HttpGet("transfers")]
+ [Authorize(Policy = AuthPolicy.Any)]
+ [ProducesResponseType(typeof(Transfer), 200)]
+ public IActionResult Transfers()
+ {
+ return Ok(new
+ {
+ Soulseek = new
+ {
+ Client.Uploads,
+ Client.Downloads,
+ },
+ });
+ }
+ }
+}