|
|
|
@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using NzbDrone.Common.EnvironmentInfo;
|
|
|
|
|
using NzbDrone.Core.Configuration;
|
|
|
|
|
using NzbDrone.Core.Update;
|
|
|
|
|
using NzbDrone.Core.Update.History;
|
|
|
|
|
using Sonarr.Http;
|
|
|
|
@ -13,11 +14,13 @@ namespace Sonarr.Api.V3.Update
|
|
|
|
|
{
|
|
|
|
|
private readonly IRecentUpdateProvider _recentUpdateProvider;
|
|
|
|
|
private readonly IUpdateHistoryService _updateHistoryService;
|
|
|
|
|
private readonly IConfigFileProvider _configFileProvider;
|
|
|
|
|
|
|
|
|
|
public UpdateController(IRecentUpdateProvider recentUpdateProvider, IUpdateHistoryService updateHistoryService)
|
|
|
|
|
public UpdateController(IRecentUpdateProvider recentUpdateProvider, IUpdateHistoryService updateHistoryService, IConfigFileProvider configFileProvider)
|
|
|
|
|
{
|
|
|
|
|
_recentUpdateProvider = recentUpdateProvider;
|
|
|
|
|
_updateHistoryService = updateHistoryService;
|
|
|
|
|
_configFileProvider = configFileProvider;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
@ -45,7 +48,11 @@ namespace Sonarr.Api.V3.Update
|
|
|
|
|
installed.Installed = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var installDates = _updateHistoryService.InstalledSince(resources.Last().ReleaseDate)
|
|
|
|
|
var updateHistory = _configFileProvider.LogDbEnabled
|
|
|
|
|
? _updateHistoryService.InstalledSince(resources.Last().ReleaseDate)
|
|
|
|
|
: new List<UpdateHistory>();
|
|
|
|
|
|
|
|
|
|
var installDates = updateHistory
|
|
|
|
|
.DistinctBy(v => v.Version)
|
|
|
|
|
.ToDictionary(v => v.Version);
|
|
|
|
|
|
|
|
|
|