From 2c719dd8f5f330de61caf850c9087b5b989c1611 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 23 Aug 2026 18:10:29 -0500 Subject: docs, change routes, lock endpoints down to administrators only --- src/slskd/Core/API/Controllers/LogsController.cs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/slskd/Core/API/Controllers/LogsController.cs') diff --git a/src/slskd/Core/API/Controllers/LogsController.cs b/src/slskd/Core/API/Controllers/LogsController.cs index a12d9187..465993c1 100644 --- a/src/slskd/Core/API/Controllers/LogsController.cs +++ b/src/slskd/Core/API/Controllers/LogsController.cs @@ -67,15 +67,19 @@ namespace slskd.Core.API /// Gets the last few application logs. /// /// - [HttpGet("buffer")] - [Authorize(Policy = AuthPolicy.Any)] + [HttpGet("live")] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.AdministratorOnly)] public IActionResult Logs() { return Ok(Program.LogBuffer); } - [HttpGet] - [Authorize(Policy = AuthPolicy.Any)] + /// + /// Lists the log files currently on disk. + /// + /// + [HttpGet("files")] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.AdministratorOnly)] public async Task List() { var directory = await Files.ListDirectoryContentsAsync(System.IO.Path.GetFullPath(Program.LogDirectory), enumerationOptions: new EnumerationOptions @@ -87,8 +91,14 @@ namespace slskd.Core.API return Ok(directory.Files); } - [HttpGet("{filename}")] - [Authorize(Policy = AuthPolicy.Any)] + /// + /// Retrieves the requested log file from disk. + /// + /// + /// + /// + [HttpGet("files/{filename}")] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.AdministratorOnly)] public async Task Get(string filename, [FromQuery] bool download = false) { filename = FileSafety.GetFileNameSafely(filename); -- cgit v1.2.3