aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Shares/API/Controllers
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-09-24 12:43:46 -0500
committerJP Dillingham <jp@dillingham.me>2022-09-24 12:43:46 -0500
commit388137d3a915490fd6f589e9a5e6ad538f18512e (patch)
treeb026431b9e54038331f152b87bcc7d84d440d543 /src/slskd/Shares/API/Controllers
parent1f42f7c52862472e381dc46d8c70c23d1b017468 (diff)
downloadslskd-388137d3a915490fd6f589e9a5e6ad538f18512e.tar.gz
add cancellation endpoint
Diffstat (limited to 'src/slskd/Shares/API/Controllers')
-rw-r--r--src/slskd/Shares/API/Controllers/SharesController.cs21
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();
+ }
}
}