diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-02-13 07:58:15 -0600 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-02-13 07:58:15 -0600 |
| commit | 936ed099a6e5258f9fd5a5ac026afc0630359b98 (patch) | |
| tree | f406e1f1b9fc29391e471c65b708ba6d94b72027 /src/slskd/Controllers/ApplicationController.cs | |
| parent | 87f024fa2561f751fc26c129bfaa373a966f1c67 (diff) | |
| download | slskd-936ed099a6e5258f9fd5a5ac026afc0630359b98.tar.gz | |
move controllers and DTOs to API namespace
Diffstat (limited to 'src/slskd/Controllers/ApplicationController.cs')
| -rw-r--r-- | src/slskd/Controllers/ApplicationController.cs | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/src/slskd/Controllers/ApplicationController.cs b/src/slskd/Controllers/ApplicationController.cs deleted file mode 100644 index cc9d56a1..00000000 --- a/src/slskd/Controllers/ApplicationController.cs +++ /dev/null @@ -1,59 +0,0 @@ -namespace slskd.Controllers -{ - using Microsoft.AspNetCore.Authorization; - using Microsoft.AspNetCore.Mvc; - using System.Diagnostics; - using System; - using Microsoft.Extensions.Hosting; - using Soulseek; - - /// <summary> - /// Application - /// </summary> - [Route("api/v{version:apiVersion}/[controller]")] - [ApiVersion("0")] - [ApiController] - [Produces("application/json")] - [Consumes("application/json")] - public class ApplicationController : ControllerBase - { - private ISoulseekClient Client { get; } - private IHostApplicationLifetime Lifetime { get; } - - public ApplicationController(ISoulseekClient client, IHostApplicationLifetime lifetime) - { - Client = client; - Lifetime = lifetime; - } - - /// <summary> - /// Stops the application. - /// </summary> - /// <returns></returns> - [HttpDelete] - [Authorize] - public IActionResult Shutdown() - { - Client.Disconnect("Shut down via API"); - - Lifetime.StopApplication(); - return NoContent(); - } - - /// <summary> - /// Restarts the application. - /// </summary> - /// <returns></returns> - [HttpPut] - [Authorize] - public IActionResult Restart() - { - Client.Disconnect("Restarted via API"); - - Process.Start(Process.GetCurrentProcess().MainModule.FileName, Environment.CommandLine); - Lifetime.StopApplication(); - - return NoContent(); - } - } -} |
