Show User Agent in System->Tasks for externally triggered commands (#1047)

* Show User Agent in System->Tasks for externally triggered commands

(cherry picked from commit fe8f319f7bfdadb7218b6313ada6cae1d2a35ad8)

* Fix ESLint

(cherry picked from commit c3837c9f7b50534e3eafe1d9fbaf360fee4588b7)

* fixup

Co-authored-by: Taloth Saldono <Taloth@users.noreply.github.com>
Co-authored-by: Mark McDowall <mark@mcdowall.ca>
This commit is contained in:
Robin Dadswell
2021-05-23 20:52:14 +01:00
committed by GitHub
parent 8711c5d824
commit 6acd42e82b
6 changed files with 52 additions and 1 deletions
@@ -63,6 +63,7 @@ namespace Readarr.Api.V1.Commands
command.Trigger = CommandTrigger.Manual;
command.SuppressMessages = !command.SendUpdatesToClient;
command.SendUpdatesToClient = true;
command.ClientUserAgent = Request.Headers["User-Agent"];
var trackedCommand = _commandQueueManager.Push(command, CommandPriority.Normal, CommandTrigger.Manual);
return Created(trackedCommand.Id);
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http;
using NzbDrone.Core.Messaging.Commands;
using Readarr.Http.REST;
@@ -23,6 +24,8 @@ namespace Readarr.Api.V1.Commands
public string Exception { get; set; }
public CommandTrigger Trigger { get; set; }
public string ClientUserAgent { get; set; }
[JsonIgnore]
public string CompletionMessage { get; set; }
@@ -106,6 +109,8 @@ namespace Readarr.Api.V1.Commands
Exception = model.Exception,
Trigger = model.Trigger,
ClientUserAgent = UserAgentParser.SimplifyUserAgent(model.Body.ClientUserAgent),
CompletionMessage = model.Body.CompletionMessage,
LastExecutionTime = model.Body.LastExecutionTime
};