From f2e4fc4f2cf3a0412daa690683d31b58c05ac313 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 23 Aug 2026 00:39:09 -0500 Subject: hide a few application endpoints from swagger --- src/slskd/Core/API/Controllers/ApplicationController.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/slskd/Core/API') 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. /// /// + [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 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) -- cgit v1.2.3 From 1c42a24d0b74a97d8246d5a0760db1ec96461c69 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 23 Aug 2026 01:03:42 -0500 Subject: add a debug controller and an endpoint to show Soulseek.NET's transfers --- src/slskd/Core/API/Controllers/DebugController.cs | 73 +++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/slskd/Core/API/Controllers/DebugController.cs (limited to 'src/slskd/Core/API') 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 (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 +// ╰───────────────────────────────────────────╶──── ─ ─── ─ ── ──┈ ┈ +// + +namespace slskd.Core.API +{ + using Asp.Versioning; + using Microsoft.AspNetCore.Authorization; + using Microsoft.AspNetCore.Mvc; + using Soulseek; + + /// + /// Debug. + /// + [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, + }, + }); + } + } +} -- cgit v1.2.3