diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-08-23 01:03:42 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-08-23 01:03:42 -0500 |
| commit | 1c42a24d0b74a97d8246d5a0760db1ec96461c69 (patch) | |
| tree | 9617970772e17bd5b306431ccbcebc3e3c2fb15e /src/slskd/Core/API | |
| parent | f2e4fc4f2cf3a0412daa690683d31b58c05ac313 (diff) | |
| download | slskd-1c42a24d0b74a97d8246d5a0760db1ec96461c69.tar.gz | |
add a debug controller and an endpoint to show Soulseek.NET's transfers
Diffstat (limited to 'src/slskd/Core/API')
| -rw-r--r-- | src/slskd/Core/API/Controllers/DebugController.cs | 73 |
1 files changed, 73 insertions, 0 deletions
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, + }, + }); + } + } +} |
