diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2022-06-10 21:59:21 -0400 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2022-06-10 23:43:18 -0400 |
| commit | 0e1a41f7e938e415c32364ff1a4c97b8abab5fae (patch) | |
| tree | a86393f12fbfd177d66dfb8c131592e0ca55935c /Jellyfin.Api/Controllers/DlnaServerController.cs | |
| parent | 5ddf4e031c48d1df59c3fceb28f1faf965ab6868 (diff) | |
Merge pull request #7868 from cvium/disable_dlna
(cherry picked from commit aa0f6cb5eb7c7750cc750412fdfcb266b0a5409e)
Signed-off-by: crobibero <cody@robibe.ro>
Diffstat (limited to 'Jellyfin.Api/Controllers/DlnaServerController.cs')
| -rw-r--r-- | Jellyfin.Api/Controllers/DlnaServerController.cs | 91 |
1 files changed, 16 insertions, 75 deletions
diff --git a/Jellyfin.Api/Controllers/DlnaServerController.cs b/Jellyfin.Api/Controllers/DlnaServerController.cs index b1c576c33..401c0197a 100644 --- a/Jellyfin.Api/Controllers/DlnaServerController.cs +++ b/Jellyfin.Api/Controllers/DlnaServerController.cs @@ -20,6 +20,7 @@ namespace Jellyfin.Api.Controllers /// Dlna Server Controller. /// </summary> [Route("Dlna")] + [DlnaEnabled] [Authorize(Policy = Policies.AnonymousLanAccessPolicy)] public class DlnaServerController : BaseJellyfinApiController { @@ -55,15 +56,10 @@ namespace Jellyfin.Api.Controllers [ProducesFile(MediaTypeNames.Text.Xml)] public ActionResult GetDescriptionXml([FromRoute, Required] string serverId) { - if (DlnaEntryPoint.Enabled) - { - var url = GetAbsoluteUri(); - var serverAddress = url.Substring(0, url.IndexOf("/dlna/", StringComparison.OrdinalIgnoreCase)); - var xml = _dlnaManager.GetServerDescriptionXml(Request.Headers, serverId, serverAddress); - return Ok(xml); - } - - return StatusCode(StatusCodes.Status503ServiceUnavailable); + var url = GetAbsoluteUri(); + var serverAddress = url.Substring(0, url.IndexOf("/dlna/", StringComparison.OrdinalIgnoreCase)); + var xml = _dlnaManager.GetServerDescriptionXml(Request.Headers, serverId, serverAddress); + return Ok(xml); } /// <summary> @@ -83,12 +79,7 @@ namespace Jellyfin.Api.Controllers [SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")] public ActionResult GetContentDirectory([FromRoute, Required] string serverId) { - if (DlnaEntryPoint.Enabled) - { - return Ok(_contentDirectory.GetServiceXml()); - } - - return StatusCode(StatusCodes.Status503ServiceUnavailable); + return Ok(_contentDirectory.GetServiceXml()); } /// <summary> @@ -108,12 +99,7 @@ namespace Jellyfin.Api.Controllers [SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")] public ActionResult GetMediaReceiverRegistrar([FromRoute, Required] string serverId) { - if (DlnaEntryPoint.Enabled) - { - return Ok(_mediaReceiverRegistrar.GetServiceXml()); - } - - return StatusCode(StatusCodes.Status503ServiceUnavailable); + return Ok(_mediaReceiverRegistrar.GetServiceXml()); } /// <summary> @@ -133,12 +119,7 @@ namespace Jellyfin.Api.Controllers [SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")] public ActionResult GetConnectionManager([FromRoute, Required] string serverId) { - if (DlnaEntryPoint.Enabled) - { - return Ok(_connectionManager.GetServiceXml()); - } - - return StatusCode(StatusCodes.Status503ServiceUnavailable); + return Ok(_connectionManager.GetServiceXml()); } /// <summary> @@ -155,12 +136,7 @@ namespace Jellyfin.Api.Controllers [ProducesFile(MediaTypeNames.Text.Xml)] public async Task<ActionResult<ControlResponse>> ProcessContentDirectoryControlRequest([FromRoute, Required] string serverId) { - if (DlnaEntryPoint.Enabled) - { - return await ProcessControlRequestInternalAsync(serverId, Request.Body, _contentDirectory).ConfigureAwait(false); - } - - return StatusCode(StatusCodes.Status503ServiceUnavailable); + return await ProcessControlRequestInternalAsync(serverId, Request.Body, _contentDirectory).ConfigureAwait(false); } /// <summary> @@ -177,12 +153,7 @@ namespace Jellyfin.Api.Controllers [ProducesFile(MediaTypeNames.Text.Xml)] public async Task<ActionResult<ControlResponse>> ProcessConnectionManagerControlRequest([FromRoute, Required] string serverId) { - if (DlnaEntryPoint.Enabled) - { - return await ProcessControlRequestInternalAsync(serverId, Request.Body, _connectionManager).ConfigureAwait(false); - } - - return StatusCode(StatusCodes.Status503ServiceUnavailable); + return await ProcessControlRequestInternalAsync(serverId, Request.Body, _connectionManager).ConfigureAwait(false); } /// <summary> @@ -199,12 +170,7 @@ namespace Jellyfin.Api.Controllers [ProducesFile(MediaTypeNames.Text.Xml)] public async Task<ActionResult<ControlResponse>> ProcessMediaReceiverRegistrarControlRequest([FromRoute, Required] string serverId) { - if (DlnaEntryPoint.Enabled) - { - return await ProcessControlRequestInternalAsync(serverId, Request.Body, _mediaReceiverRegistrar).ConfigureAwait(false); - } - - return StatusCode(StatusCodes.Status503ServiceUnavailable); + return await ProcessControlRequestInternalAsync(serverId, Request.Body, _mediaReceiverRegistrar).ConfigureAwait(false); } /// <summary> @@ -224,12 +190,7 @@ namespace Jellyfin.Api.Controllers [ProducesFile(MediaTypeNames.Text.Xml)] public ActionResult<EventSubscriptionResponse> ProcessMediaReceiverRegistrarEventRequest(string serverId) { - if (DlnaEntryPoint.Enabled) - { - return ProcessEventRequest(_mediaReceiverRegistrar); - } - - return StatusCode(StatusCodes.Status503ServiceUnavailable); + return ProcessEventRequest(_mediaReceiverRegistrar); } /// <summary> @@ -249,12 +210,7 @@ namespace Jellyfin.Api.Controllers [ProducesFile(MediaTypeNames.Text.Xml)] public ActionResult<EventSubscriptionResponse> ProcessContentDirectoryEventRequest(string serverId) { - if (DlnaEntryPoint.Enabled) - { - return ProcessEventRequest(_contentDirectory); - } - - return StatusCode(StatusCodes.Status503ServiceUnavailable); + return ProcessEventRequest(_contentDirectory); } /// <summary> @@ -274,12 +230,7 @@ namespace Jellyfin.Api.Controllers [ProducesFile(MediaTypeNames.Text.Xml)] public ActionResult<EventSubscriptionResponse> ProcessConnectionManagerEventRequest(string serverId) { - if (DlnaEntryPoint.Enabled) - { - return ProcessEventRequest(_connectionManager); - } - - return StatusCode(StatusCodes.Status503ServiceUnavailable); + return ProcessEventRequest(_connectionManager); } /// <summary> @@ -299,12 +250,7 @@ namespace Jellyfin.Api.Controllers [ProducesImageFile] public ActionResult GetIconId([FromRoute, Required] string serverId, [FromRoute, Required] string fileName) { - if (DlnaEntryPoint.Enabled) - { - return GetIconInternal(fileName); - } - - return StatusCode(StatusCodes.Status503ServiceUnavailable); + return GetIconInternal(fileName); } /// <summary> @@ -322,12 +268,7 @@ namespace Jellyfin.Api.Controllers [ProducesImageFile] public ActionResult GetIcon([FromRoute, Required] string fileName) { - if (DlnaEntryPoint.Enabled) - { - return GetIconInternal(fileName); - } - - return StatusCode(StatusCodes.Status503ServiceUnavailable); + return GetIconInternal(fileName); } private ActionResult GetIconInternal(string fileName) |
