diff --git a/Jellyfin.Api/Controllers/DlnaController.cs b/Jellyfin.Api/Controllers/DlnaController.cs index 68cd144f4e..dcd31a48ba 100644 --- a/Jellyfin.Api/Controllers/DlnaController.cs +++ b/Jellyfin.Api/Controllers/DlnaController.cs @@ -1,9 +1,8 @@ -#nullable enable - using System.Collections.Generic; +using Jellyfin.Api.Constants; using MediaBrowser.Controller.Dlna; -using MediaBrowser.Controller.Net; using MediaBrowser.Model.Dlna; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -12,7 +11,7 @@ namespace Jellyfin.Api.Controllers /// /// Dlna Controller. /// - [Authenticated(Roles = "Admin")] + [Authorize(Policy = Policies.RequiresElevation)] public class DlnaController : BaseJellyfinApiController { private readonly IDlnaManager _dlnaManager; @@ -29,34 +28,38 @@ namespace Jellyfin.Api.Controllers /// /// Get profile infos. /// - /// Profile infos. + /// Device profile infos returned. + /// An containing the device profile infos. [HttpGet("ProfileInfos")] [ProducesResponseType(StatusCodes.Status200OK)] - public IEnumerable GetProfileInfos() + public ActionResult> GetProfileInfos() { - return _dlnaManager.GetProfileInfos(); + return Ok(_dlnaManager.GetProfileInfos()); } /// /// Gets the default profile. /// - /// Default profile. + /// Default device profile returned. + /// An containing the default profile. [HttpGet("Profiles/Default")] [ProducesResponseType(StatusCodes.Status200OK)] - public ActionResult GetDefaultProfile() + public ActionResult GetDefaultProfile() { - return Ok(_dlnaManager.GetDefaultProfile()); + return _dlnaManager.GetDefaultProfile(); } /// /// Gets a single profile. /// /// Profile Id. - /// Profile. + /// Device profile returned. + /// Device profile not found. + /// An containing the profile on success, or a if device profile not found. [HttpGet("Profiles/{Id}")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] - public ActionResult GetProfile([FromRoute] string id) + public ActionResult GetProfile([FromRoute] string id) { var profile = _dlnaManager.GetProfile(id); if (profile == null) @@ -64,16 +67,18 @@ namespace Jellyfin.Api.Controllers return NotFound(); } - return Ok(profile); + return profile; } /// /// Deletes a profile. /// /// Profile id. - /// Status. + /// Device profile deleted. + /// Device profile not found. + /// A on success, or a if profile not found. [HttpDelete("Profiles/{Id}")] - [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ProducesResponseType(StatusCodes.Status404NotFound)] public ActionResult DeleteProfile([FromRoute] string id) { @@ -84,20 +89,21 @@ namespace Jellyfin.Api.Controllers } _dlnaManager.DeleteProfile(id); - return Ok(); + return NoContent(); } /// /// Creates a profile. /// /// Device profile. - /// Status. + /// Device profile created. + /// A . [HttpPost("Profiles")] - [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult CreateProfile([FromBody] DeviceProfile deviceProfile) { _dlnaManager.CreateProfile(deviceProfile); - return Ok(); + return NoContent(); } /// @@ -105,9 +111,11 @@ namespace Jellyfin.Api.Controllers /// /// Profile id. /// Device profile. - /// Status. + /// Device profile updated. + /// Device profile not found. + /// A on success, or a if profile not found. [HttpPost("Profiles/{Id}")] - [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ProducesResponseType(StatusCodes.Status404NotFound)] public ActionResult UpdateProfile([FromRoute] string id, [FromBody] DeviceProfile deviceProfile) { @@ -118,7 +126,7 @@ namespace Jellyfin.Api.Controllers } _dlnaManager.UpdateProfile(deviceProfile); - return Ok(); + return NoContent(); } } }