diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-09-24 12:43:46 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2022-09-24 12:43:46 -0500 |
| commit | 388137d3a915490fd6f589e9a5e6ad538f18512e (patch) | |
| tree | b026431b9e54038331f152b87bcc7d84d440d543 /src | |
| parent | 1f42f7c52862472e381dc46d8c70c23d1b017468 (diff) | |
| download | slskd-388137d3a915490fd6f589e9a5e6ad538f18512e.tar.gz | |
add cancellation endpoint
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Shares/API/Controllers/SharesController.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/slskd/Shares/API/Controllers/SharesController.cs b/src/slskd/Shares/API/Controllers/SharesController.cs index 12a1c7b2..a8d5ae96 100644 --- a/src/slskd/Shares/API/Controllers/SharesController.cs +++ b/src/slskd/Shares/API/Controllers/SharesController.cs @@ -189,5 +189,26 @@ namespace slskd.Shares.API return Ok(); } + + /// <summary> + /// Cancels a share scan, if one is running. + /// </summary> + /// <returns></returns> + /// <response code="204">The request completed successfully.</response> + /// <response code="409">A share scan was not in progress.</response> + [HttpDelete] + [Route("")] + [Authorize] + [ProducesResponseType(204)] + [ProducesResponseType(404)] + public IActionResult CancelShareScan() + { + if (Shares.TryCancelScan()) + { + return StatusCode(204); + } + + return NotFound(); + } } } |
