mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-04-13 16:30:48 +02:00
Include NzbDrone.Update in mono/osx package Do not ignore certificate warnings for services Check hash before extracting update New: Update support for Linux/OS X - see the wiki for more information
44 lines
No EOL
1.4 KiB
C#
44 lines
No EOL
1.4 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using NzbDrone.Common.EnvironmentInfo;
|
|
using NzbDrone.Core.Update;
|
|
using NzbDrone.Api.Mapping;
|
|
|
|
namespace NzbDrone.Api.Update
|
|
{
|
|
public class UpdateModule : NzbDroneRestModule<UpdateResource>
|
|
{
|
|
private readonly IRecentUpdateProvider _recentUpdateProvider;
|
|
private readonly IInstallUpdates _installUpdateService;
|
|
|
|
public UpdateModule(IRecentUpdateProvider recentUpdateProvider,
|
|
IInstallUpdates installUpdateService)
|
|
{
|
|
_recentUpdateProvider = recentUpdateProvider;
|
|
_installUpdateService = installUpdateService;
|
|
GetResourceAll = GetRecentUpdates;
|
|
}
|
|
|
|
private List<UpdateResource> GetRecentUpdates()
|
|
{
|
|
var resources = _recentUpdateProvider.GetRecentUpdatePackages()
|
|
.OrderByDescending(u => u.Version)
|
|
.InjectTo<List<UpdateResource>>();
|
|
|
|
foreach (var updateResource in resources)
|
|
{
|
|
if (updateResource.Version > BuildInfo.Version)
|
|
{
|
|
updateResource.IsUpgrade = true;
|
|
}
|
|
|
|
else if (updateResource.Version == BuildInfo.Version)
|
|
{
|
|
updateResource.Installed = true;
|
|
}
|
|
}
|
|
|
|
return resources;
|
|
}
|
|
}
|
|
} |