Merge pull request #4821 from BaronGreenback/disableDlna
This commit is contained in:
commit
a77788906c
|
@ -126,6 +126,11 @@ namespace Emby.Dlna.Main
|
||||||
|
|
||||||
public static DlnaEntryPoint Current { get; private set; }
|
public static DlnaEntryPoint Current { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether the dlna server is enabled.
|
||||||
|
/// </summary>
|
||||||
|
public static bool Enabled { get; private set; }
|
||||||
|
|
||||||
public IContentDirectory ContentDirectory { get; private set; }
|
public IContentDirectory ContentDirectory { get; private set; }
|
||||||
|
|
||||||
public IConnectionManager ConnectionManager { get; private set; }
|
public IConnectionManager ConnectionManager { get; private set; }
|
||||||
|
@ -152,6 +157,7 @@ namespace Emby.Dlna.Main
|
||||||
private void ReloadComponents()
|
private void ReloadComponents()
|
||||||
{
|
{
|
||||||
var options = _config.GetDlnaConfiguration();
|
var options = _config.GetDlnaConfiguration();
|
||||||
|
Enabled = options.EnableServer;
|
||||||
|
|
||||||
StartSsdpHandler();
|
StartSsdpHandler();
|
||||||
|
|
||||||
|
|
|
@ -41,13 +41,17 @@ namespace Jellyfin.Api.Controllers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serverId">Server UUID.</param>
|
/// <param name="serverId">Server UUID.</param>
|
||||||
/// <response code="200">Description xml returned.</response>
|
/// <response code="200">Description xml returned.</response>
|
||||||
|
/// <response code="503">DLNA is disabled.</response>
|
||||||
/// <returns>An <see cref="OkResult"/> containing the description xml.</returns>
|
/// <returns>An <see cref="OkResult"/> containing the description xml.</returns>
|
||||||
[HttpGet("{serverId}/description")]
|
[HttpGet("{serverId}/description")]
|
||||||
[HttpGet("{serverId}/description.xml", Name = "GetDescriptionXml_2")]
|
[HttpGet("{serverId}/description.xml", Name = "GetDescriptionXml_2")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
||||||
[Produces(MediaTypeNames.Text.Xml)]
|
[Produces(MediaTypeNames.Text.Xml)]
|
||||||
[ProducesFile(MediaTypeNames.Text.Xml)]
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
||||||
public ActionResult GetDescriptionXml([FromRoute, Required] string serverId)
|
public ActionResult GetDescriptionXml([FromRoute, Required] string serverId)
|
||||||
|
{
|
||||||
|
if (DlnaEntryPoint.Enabled)
|
||||||
{
|
{
|
||||||
var url = GetAbsoluteUri();
|
var url = GetAbsoluteUri();
|
||||||
var serverAddress = url.Substring(0, url.IndexOf("/dlna/", StringComparison.OrdinalIgnoreCase));
|
var serverAddress = url.Substring(0, url.IndexOf("/dlna/", StringComparison.OrdinalIgnoreCase));
|
||||||
|
@ -55,186 +59,273 @@ namespace Jellyfin.Api.Controllers
|
||||||
return Ok(xml);
|
return Ok(xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets Dlna content directory xml.
|
/// Gets Dlna content directory xml.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serverId">Server UUID.</param>
|
/// <param name="serverId">Server UUID.</param>
|
||||||
/// <response code="200">Dlna content directory returned.</response>
|
/// <response code="200">Dlna content directory returned.</response>
|
||||||
|
/// <response code="503">DLNA is disabled.</response>
|
||||||
/// <returns>An <see cref="OkResult"/> containing the dlna content directory xml.</returns>
|
/// <returns>An <see cref="OkResult"/> containing the dlna content directory xml.</returns>
|
||||||
[HttpGet("{serverId}/ContentDirectory")]
|
[HttpGet("{serverId}/ContentDirectory")]
|
||||||
[HttpGet("{serverId}/ContentDirectory/ContentDirectory", Name = "GetContentDirectory_2")]
|
[HttpGet("{serverId}/ContentDirectory/ContentDirectory", Name = "GetContentDirectory_2")]
|
||||||
[HttpGet("{serverId}/ContentDirectory/ContentDirectory.xml", Name = "GetContentDirectory_3")]
|
[HttpGet("{serverId}/ContentDirectory/ContentDirectory.xml", Name = "GetContentDirectory_3")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
||||||
[Produces(MediaTypeNames.Text.Xml)]
|
[Produces(MediaTypeNames.Text.Xml)]
|
||||||
[ProducesFile(MediaTypeNames.Text.Xml)]
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
||||||
public ActionResult GetContentDirectory([FromRoute, Required] string serverId)
|
public ActionResult GetContentDirectory([FromRoute, Required] string serverId)
|
||||||
|
{
|
||||||
|
if (DlnaEntryPoint.Enabled)
|
||||||
{
|
{
|
||||||
return Ok(_contentDirectory.GetServiceXml());
|
return Ok(_contentDirectory.GetServiceXml());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets Dlna media receiver registrar xml.
|
/// Gets Dlna media receiver registrar xml.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serverId">Server UUID.</param>
|
/// <param name="serverId">Server UUID.</param>
|
||||||
/// <response code="200">Dlna media receiver registrar xml returned.</response>
|
/// <response code="200">Dlna media receiver registrar xml returned.</response>
|
||||||
|
/// <response code="503">DLNA is disabled.</response>
|
||||||
/// <returns>Dlna media receiver registrar xml.</returns>
|
/// <returns>Dlna media receiver registrar xml.</returns>
|
||||||
[HttpGet("{serverId}/MediaReceiverRegistrar")]
|
[HttpGet("{serverId}/MediaReceiverRegistrar")]
|
||||||
[HttpGet("{serverId}/MediaReceiverRegistrar/MediaReceiverRegistrar", Name = "GetMediaReceiverRegistrar_2")]
|
[HttpGet("{serverId}/MediaReceiverRegistrar/MediaReceiverRegistrar", Name = "GetMediaReceiverRegistrar_2")]
|
||||||
[HttpGet("{serverId}/MediaReceiverRegistrar/MediaReceiverRegistrar.xml", Name = "GetMediaReceiverRegistrar_3")]
|
[HttpGet("{serverId}/MediaReceiverRegistrar/MediaReceiverRegistrar.xml", Name = "GetMediaReceiverRegistrar_3")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
||||||
[Produces(MediaTypeNames.Text.Xml)]
|
[Produces(MediaTypeNames.Text.Xml)]
|
||||||
[ProducesFile(MediaTypeNames.Text.Xml)]
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
||||||
public ActionResult GetMediaReceiverRegistrar([FromRoute, Required] string serverId)
|
public ActionResult GetMediaReceiverRegistrar([FromRoute, Required] string serverId)
|
||||||
|
{
|
||||||
|
if (DlnaEntryPoint.Enabled)
|
||||||
{
|
{
|
||||||
return Ok(_mediaReceiverRegistrar.GetServiceXml());
|
return Ok(_mediaReceiverRegistrar.GetServiceXml());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets Dlna media receiver registrar xml.
|
/// Gets Dlna media receiver registrar xml.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serverId">Server UUID.</param>
|
/// <param name="serverId">Server UUID.</param>
|
||||||
/// <response code="200">Dlna media receiver registrar xml returned.</response>
|
/// <response code="200">Dlna media receiver registrar xml returned.</response>
|
||||||
|
/// <response code="503">DLNA is disabled.</response>
|
||||||
/// <returns>Dlna media receiver registrar xml.</returns>
|
/// <returns>Dlna media receiver registrar xml.</returns>
|
||||||
[HttpGet("{serverId}/ConnectionManager")]
|
[HttpGet("{serverId}/ConnectionManager")]
|
||||||
[HttpGet("{serverId}/ConnectionManager/ConnectionManager", Name = "GetConnectionManager_2")]
|
[HttpGet("{serverId}/ConnectionManager/ConnectionManager", Name = "GetConnectionManager_2")]
|
||||||
[HttpGet("{serverId}/ConnectionManager/ConnectionManager.xml", Name = "GetConnectionManager_3")]
|
[HttpGet("{serverId}/ConnectionManager/ConnectionManager.xml", Name = "GetConnectionManager_3")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
||||||
[Produces(MediaTypeNames.Text.Xml)]
|
[Produces(MediaTypeNames.Text.Xml)]
|
||||||
[ProducesFile(MediaTypeNames.Text.Xml)]
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
||||||
public ActionResult GetConnectionManager([FromRoute, Required] string serverId)
|
public ActionResult GetConnectionManager([FromRoute, Required] string serverId)
|
||||||
|
{
|
||||||
|
if (DlnaEntryPoint.Enabled)
|
||||||
{
|
{
|
||||||
return Ok(_connectionManager.GetServiceXml());
|
return Ok(_connectionManager.GetServiceXml());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Process a content directory control request.
|
/// Process a content directory control request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serverId">Server UUID.</param>
|
/// <param name="serverId">Server UUID.</param>
|
||||||
/// <response code="200">Request processed.</response>
|
/// <response code="200">Request processed.</response>
|
||||||
|
/// <response code="503">DLNA is disabled.</response>
|
||||||
/// <returns>Control response.</returns>
|
/// <returns>Control response.</returns>
|
||||||
[HttpPost("{serverId}/ContentDirectory/Control")]
|
[HttpPost("{serverId}/ContentDirectory/Control")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
||||||
[Produces(MediaTypeNames.Text.Xml)]
|
[Produces(MediaTypeNames.Text.Xml)]
|
||||||
[ProducesFile(MediaTypeNames.Text.Xml)]
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
||||||
public async Task<ActionResult<ControlResponse>> ProcessContentDirectoryControlRequest([FromRoute, Required] string serverId)
|
public async Task<ActionResult<ControlResponse>> ProcessContentDirectoryControlRequest([FromRoute, Required] string serverId)
|
||||||
|
{
|
||||||
|
if (DlnaEntryPoint.Enabled)
|
||||||
{
|
{
|
||||||
return await ProcessControlRequestInternalAsync(serverId, Request.Body, _contentDirectory).ConfigureAwait(false);
|
return await ProcessControlRequestInternalAsync(serverId, Request.Body, _contentDirectory).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Process a connection manager control request.
|
/// Process a connection manager control request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serverId">Server UUID.</param>
|
/// <param name="serverId">Server UUID.</param>
|
||||||
/// <response code="200">Request processed.</response>
|
/// <response code="200">Request processed.</response>
|
||||||
|
/// <response code="503">DLNA is disabled.</response>
|
||||||
/// <returns>Control response.</returns>
|
/// <returns>Control response.</returns>
|
||||||
[HttpPost("{serverId}/ConnectionManager/Control")]
|
[HttpPost("{serverId}/ConnectionManager/Control")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
||||||
[Produces(MediaTypeNames.Text.Xml)]
|
[Produces(MediaTypeNames.Text.Xml)]
|
||||||
[ProducesFile(MediaTypeNames.Text.Xml)]
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
||||||
public async Task<ActionResult<ControlResponse>> ProcessConnectionManagerControlRequest([FromRoute, Required] string serverId)
|
public async Task<ActionResult<ControlResponse>> ProcessConnectionManagerControlRequest([FromRoute, Required] string serverId)
|
||||||
|
{
|
||||||
|
if (DlnaEntryPoint.Enabled)
|
||||||
{
|
{
|
||||||
return await ProcessControlRequestInternalAsync(serverId, Request.Body, _connectionManager).ConfigureAwait(false);
|
return await ProcessControlRequestInternalAsync(serverId, Request.Body, _connectionManager).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Process a media receiver registrar control request.
|
/// Process a media receiver registrar control request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serverId">Server UUID.</param>
|
/// <param name="serverId">Server UUID.</param>
|
||||||
/// <response code="200">Request processed.</response>
|
/// <response code="200">Request processed.</response>
|
||||||
|
/// <response code="503">DLNA is disabled.</response>
|
||||||
/// <returns>Control response.</returns>
|
/// <returns>Control response.</returns>
|
||||||
[HttpPost("{serverId}/MediaReceiverRegistrar/Control")]
|
[HttpPost("{serverId}/MediaReceiverRegistrar/Control")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
||||||
[Produces(MediaTypeNames.Text.Xml)]
|
[Produces(MediaTypeNames.Text.Xml)]
|
||||||
[ProducesFile(MediaTypeNames.Text.Xml)]
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
||||||
public async Task<ActionResult<ControlResponse>> ProcessMediaReceiverRegistrarControlRequest([FromRoute, Required] string serverId)
|
public async Task<ActionResult<ControlResponse>> ProcessMediaReceiverRegistrarControlRequest([FromRoute, Required] string serverId)
|
||||||
|
{
|
||||||
|
if (DlnaEntryPoint.Enabled)
|
||||||
{
|
{
|
||||||
return await ProcessControlRequestInternalAsync(serverId, Request.Body, _mediaReceiverRegistrar).ConfigureAwait(false);
|
return await ProcessControlRequestInternalAsync(serverId, Request.Body, _mediaReceiverRegistrar).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Processes an event subscription request.
|
/// Processes an event subscription request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serverId">Server UUID.</param>
|
/// <param name="serverId">Server UUID.</param>
|
||||||
/// <response code="200">Request processed.</response>
|
/// <response code="200">Request processed.</response>
|
||||||
|
/// <response code="503">DLNA is disabled.</response>
|
||||||
/// <returns>Event subscription response.</returns>
|
/// <returns>Event subscription response.</returns>
|
||||||
[HttpSubscribe("{serverId}/MediaReceiverRegistrar/Events")]
|
[HttpSubscribe("{serverId}/MediaReceiverRegistrar/Events")]
|
||||||
[HttpUnsubscribe("{serverId}/MediaReceiverRegistrar/Events")]
|
[HttpUnsubscribe("{serverId}/MediaReceiverRegistrar/Events")]
|
||||||
[ApiExplorerSettings(IgnoreApi = true)] // Ignore in openapi docs
|
[ApiExplorerSettings(IgnoreApi = true)] // Ignore in openapi docs
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
||||||
[Produces(MediaTypeNames.Text.Xml)]
|
[Produces(MediaTypeNames.Text.Xml)]
|
||||||
[ProducesFile(MediaTypeNames.Text.Xml)]
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
||||||
public ActionResult<EventSubscriptionResponse> ProcessMediaReceiverRegistrarEventRequest(string serverId)
|
public ActionResult<EventSubscriptionResponse> ProcessMediaReceiverRegistrarEventRequest(string serverId)
|
||||||
|
{
|
||||||
|
if (DlnaEntryPoint.Enabled)
|
||||||
{
|
{
|
||||||
return ProcessEventRequest(_mediaReceiverRegistrar);
|
return ProcessEventRequest(_mediaReceiverRegistrar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Processes an event subscription request.
|
/// Processes an event subscription request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serverId">Server UUID.</param>
|
/// <param name="serverId">Server UUID.</param>
|
||||||
/// <response code="200">Request processed.</response>
|
/// <response code="200">Request processed.</response>
|
||||||
|
/// <response code="503">DLNA is disabled.</response>
|
||||||
/// <returns>Event subscription response.</returns>
|
/// <returns>Event subscription response.</returns>
|
||||||
[HttpSubscribe("{serverId}/ContentDirectory/Events")]
|
[HttpSubscribe("{serverId}/ContentDirectory/Events")]
|
||||||
[HttpUnsubscribe("{serverId}/ContentDirectory/Events")]
|
[HttpUnsubscribe("{serverId}/ContentDirectory/Events")]
|
||||||
[ApiExplorerSettings(IgnoreApi = true)] // Ignore in openapi docs
|
[ApiExplorerSettings(IgnoreApi = true)] // Ignore in openapi docs
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
||||||
[Produces(MediaTypeNames.Text.Xml)]
|
[Produces(MediaTypeNames.Text.Xml)]
|
||||||
[ProducesFile(MediaTypeNames.Text.Xml)]
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
||||||
public ActionResult<EventSubscriptionResponse> ProcessContentDirectoryEventRequest(string serverId)
|
public ActionResult<EventSubscriptionResponse> ProcessContentDirectoryEventRequest(string serverId)
|
||||||
|
{
|
||||||
|
if (DlnaEntryPoint.Enabled)
|
||||||
{
|
{
|
||||||
return ProcessEventRequest(_contentDirectory);
|
return ProcessEventRequest(_contentDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Processes an event subscription request.
|
/// Processes an event subscription request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serverId">Server UUID.</param>
|
/// <param name="serverId">Server UUID.</param>
|
||||||
/// <response code="200">Request processed.</response>
|
/// <response code="200">Request processed.</response>
|
||||||
|
/// <response code="503">DLNA is disabled.</response>
|
||||||
/// <returns>Event subscription response.</returns>
|
/// <returns>Event subscription response.</returns>
|
||||||
[HttpSubscribe("{serverId}/ConnectionManager/Events")]
|
[HttpSubscribe("{serverId}/ConnectionManager/Events")]
|
||||||
[HttpUnsubscribe("{serverId}/ConnectionManager/Events")]
|
[HttpUnsubscribe("{serverId}/ConnectionManager/Events")]
|
||||||
[ApiExplorerSettings(IgnoreApi = true)] // Ignore in openapi docs
|
[ApiExplorerSettings(IgnoreApi = true)] // Ignore in openapi docs
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
||||||
[Produces(MediaTypeNames.Text.Xml)]
|
[Produces(MediaTypeNames.Text.Xml)]
|
||||||
[ProducesFile(MediaTypeNames.Text.Xml)]
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
||||||
public ActionResult<EventSubscriptionResponse> ProcessConnectionManagerEventRequest(string serverId)
|
public ActionResult<EventSubscriptionResponse> ProcessConnectionManagerEventRequest(string serverId)
|
||||||
|
{
|
||||||
|
if (DlnaEntryPoint.Enabled)
|
||||||
{
|
{
|
||||||
return ProcessEventRequest(_connectionManager);
|
return ProcessEventRequest(_connectionManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a server icon.
|
/// Gets a server icon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serverId">Server UUID.</param>
|
/// <param name="serverId">Server UUID.</param>
|
||||||
/// <param name="fileName">The icon filename.</param>
|
/// <param name="fileName">The icon filename.</param>
|
||||||
|
/// <response code="200">Request processed.</response>
|
||||||
|
/// <response code="404">Not Found.</response>
|
||||||
|
/// <response code="503">DLNA is disabled.</response>
|
||||||
/// <returns>Icon stream.</returns>
|
/// <returns>Icon stream.</returns>
|
||||||
[HttpGet("{serverId}/icons/{fileName}")]
|
[HttpGet("{serverId}/icons/{fileName}")]
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
||||||
[ProducesImageFile]
|
[ProducesImageFile]
|
||||||
public ActionResult GetIconId([FromRoute, Required] string serverId, [FromRoute, Required] string fileName)
|
public ActionResult GetIconId([FromRoute, Required] string serverId, [FromRoute, Required] string fileName)
|
||||||
|
{
|
||||||
|
if (DlnaEntryPoint.Enabled)
|
||||||
{
|
{
|
||||||
return GetIconInternal(fileName);
|
return GetIconInternal(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a server icon.
|
/// Gets a server icon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="fileName">The icon filename.</param>
|
/// <param name="fileName">The icon filename.</param>
|
||||||
/// <returns>Icon stream.</returns>
|
/// <returns>Icon stream.</returns>
|
||||||
|
/// <response code="200">Request processed.</response>
|
||||||
|
/// <response code="404">Not Found.</response>
|
||||||
|
/// <response code="503">DLNA is disabled.</response>
|
||||||
[HttpGet("icons/{fileName}")]
|
[HttpGet("icons/{fileName}")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
||||||
[ProducesImageFile]
|
[ProducesImageFile]
|
||||||
public ActionResult GetIcon([FromRoute, Required] string fileName)
|
public ActionResult GetIcon([FromRoute, Required] string fileName)
|
||||||
|
{
|
||||||
|
if (DlnaEntryPoint.Enabled)
|
||||||
{
|
{
|
||||||
return GetIconInternal(fileName);
|
return GetIconInternal(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
||||||
|
}
|
||||||
|
|
||||||
private ActionResult GetIconInternal(string fileName)
|
private ActionResult GetIconInternal(string fileName)
|
||||||
{
|
{
|
||||||
var icon = _dlnaManager.GetIcon(fileName);
|
var icon = _dlnaManager.GetIcon(fileName);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user