aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Controllers/ApplicationController.cs
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-02-13 07:58:15 -0600
committerJP Dillingham <jpdillingham@gmail.com>2021-02-13 07:58:15 -0600
commit936ed099a6e5258f9fd5a5ac026afc0630359b98 (patch)
treef406e1f1b9fc29391e471c65b708ba6d94b72027 /src/slskd/Controllers/ApplicationController.cs
parent87f024fa2561f751fc26c129bfaa373a966f1c67 (diff)
downloadslskd-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.cs59
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();
- }
- }
-}