diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-06-02 10:33:35 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-02 10:33:35 -0500 |
| commit | e044a75f285b1b1bfb19631ea2eef5509714a703 (patch) | |
| tree | a9bdec768dbd36d831fb655aeefd5754e96d8e87 /src/slskd/Core/API | |
| parent | adf5e7800452e861903b00faa5729c92187ef3ce (diff) | |
| parent | 908972ae3655973cb2d1536e12b7c2dd42437062 (diff) | |
| download | slskd-e044a75f285b1b1bfb19631ea2eef5509714a703.tar.gz | |
Merge branch 'master' into dependabot/npm_and_yarn/src/web/eventsource-1.1.1
Diffstat (limited to 'src/slskd/Core/API')
| -rw-r--r-- | src/slskd/Core/API/Controllers/ApplicationController.cs | 15 | ||||
| -rw-r--r-- | src/slskd/Core/API/Controllers/OptionsController.cs | 20 |
2 files changed, 20 insertions, 15 deletions
diff --git a/src/slskd/Core/API/Controllers/ApplicationController.cs b/src/slskd/Core/API/Controllers/ApplicationController.cs index cd03d96f..3cf3c0a3 100644 --- a/src/slskd/Core/API/Controllers/ApplicationController.cs +++ b/src/slskd/Core/API/Controllers/ApplicationController.cs @@ -136,20 +136,5 @@ namespace slskd.Core.API return Ok(); } - - [HttpPut] - [Route("shares")] - [Authorize] - public IActionResult RescanSharesAsync() - { - if (ApplicationStateMonitor.CurrentValue.SharedFileCache.Filling) - { - return Conflict("A share scan is already in progress."); - } - - _ = Application.RescanSharesAsync(); - - return Ok(); - } } } diff --git a/src/slskd/Core/API/Controllers/OptionsController.cs b/src/slskd/Core/API/Controllers/OptionsController.cs index 062de8f7..b0856ed3 100644 --- a/src/slskd/Core/API/Controllers/OptionsController.cs +++ b/src/slskd/Core/API/Controllers/OptionsController.cs @@ -21,8 +21,10 @@ namespace slskd.Core.API { using System; using System.IO; + using System.Reflection; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; + using Microsoft.Extensions.Configuration; using Serilog; using slskd.Validation; using IOFile = System.IO.File; @@ -74,6 +76,24 @@ namespace slskd.Core.API return Ok(OptionsAtStartup.Redact()); } + /// <summary> + /// Gets the debug view of the current application options. + /// </summary> + /// <returns></returns> + [HttpGet] + [Route("debug")] + [Authorize] + [ProducesResponseType(typeof(string), 200)] + public IActionResult Debug() + { + // retrieve the IConfigurationRoot instance with reflection to avoid + // exposing it as a public member of Program. + var property = typeof(Program).GetProperty("Configuration", BindingFlags.NonPublic | BindingFlags.Static); + var configurationRoot = (IConfigurationRoot)property.GetValue(null, null); + + return Ok(configurationRoot.GetDebugView()); + } + [HttpGet] [Authorize] [Route("yaml/location")] |
