mirror of
https://github.com/Radarr/Radarr.git
synced 2026-03-18 16:24:34 -04:00
Compare commits
2 Commits
v6-develop
...
update-cha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b4a6b1309 | ||
|
|
fcebfe6759 |
@@ -89,12 +89,12 @@ function AppUpdatedModalContent(props) {
|
|||||||
|
|
||||||
<UpdateChanges
|
<UpdateChanges
|
||||||
title={translate('New')}
|
title={translate('New')}
|
||||||
changes={update.changes.new}
|
changes={Array.from(new Set(update.changes.new))}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<UpdateChanges
|
<UpdateChanges
|
||||||
title={translate('Fixed')}
|
title={translate('Fixed')}
|
||||||
changes={update.changes.fixed}
|
changes={Array.from(new Set(update.changes.fixed))}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using NzbDrone.Core.Update;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Notifications
|
namespace NzbDrone.Core.Notifications
|
||||||
{
|
{
|
||||||
@@ -7,6 +8,7 @@ namespace NzbDrone.Core.Notifications
|
|||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
public Version PreviousVersion { get; set; }
|
public Version PreviousVersion { get; set; }
|
||||||
public Version NewVersion { get; set; }
|
public Version NewVersion { get; set; }
|
||||||
|
public UpdateChanges Changes { get; set; }
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -212,6 +212,16 @@ namespace NzbDrone.Core.Notifications.CustomScript
|
|||||||
environmentVariables.Add("Radarr_Update_NewVersion", updateMessage.NewVersion.ToString());
|
environmentVariables.Add("Radarr_Update_NewVersion", updateMessage.NewVersion.ToString());
|
||||||
environmentVariables.Add("Radarr_Update_PreviousVersion", updateMessage.PreviousVersion.ToString());
|
environmentVariables.Add("Radarr_Update_PreviousVersion", updateMessage.PreviousVersion.ToString());
|
||||||
|
|
||||||
|
if (updateMessage.Changes.New.Any())
|
||||||
|
{
|
||||||
|
environmentVariables.Add("Radarr_Update_NewChanges", string.Join("|", updateMessage.Changes.New.Select(e => e)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updateMessage.Changes.Fixed.Any())
|
||||||
|
{
|
||||||
|
environmentVariables.Add("Radarr_Update_FixedChanges", string.Join("|", updateMessage.Changes.Fixed.Select(e => e)));
|
||||||
|
}
|
||||||
|
|
||||||
ExecuteScript(environmentVariables);
|
ExecuteScript(environmentVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -317,6 +317,16 @@ namespace NzbDrone.Core.Notifications.Discord
|
|||||||
{
|
{
|
||||||
Name = "New Version",
|
Name = "New Version",
|
||||||
Value = updateMessage.NewVersion.ToString()
|
Value = updateMessage.NewVersion.ToString()
|
||||||
|
},
|
||||||
|
new DiscordField()
|
||||||
|
{
|
||||||
|
Name = "New",
|
||||||
|
Value = string.Format("```{0}```", string.Join(Environment.NewLine, updateMessage.Changes.New))
|
||||||
|
},
|
||||||
|
new DiscordField()
|
||||||
|
{
|
||||||
|
Name = "Fixed",
|
||||||
|
Value = string.Format("```{0}```", string.Join(Environment.NewLine, updateMessage.Changes.Fixed))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,6 +176,16 @@ namespace NzbDrone.Core.Notifications.Notifiarr
|
|||||||
variables.Add("Radarr_Update_NewVersion", updateMessage.NewVersion.ToString());
|
variables.Add("Radarr_Update_NewVersion", updateMessage.NewVersion.ToString());
|
||||||
variables.Add("Radarr_Update_PreviousVersion", updateMessage.PreviousVersion.ToString());
|
variables.Add("Radarr_Update_PreviousVersion", updateMessage.PreviousVersion.ToString());
|
||||||
|
|
||||||
|
if (updateMessage.Changes.New.Any())
|
||||||
|
{
|
||||||
|
variables.Add("Radarr_Update_NewChanges", string.Join("|", updateMessage.Changes.New.Select(e => e)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updateMessage.Changes.Fixed.Any())
|
||||||
|
{
|
||||||
|
variables.Add("Radarr_Update_FixedChanges", string.Join("|", updateMessage.Changes.Fixed.Select(e => e)));
|
||||||
|
}
|
||||||
|
|
||||||
_proxy.SendNotification(variables, Settings);
|
_proxy.SendNotification(variables, Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -198,6 +198,7 @@ namespace NzbDrone.Core.Notifications
|
|||||||
updateMessage.Message = $"Radarr updated from {message.PreviousVerison.ToString()} to {message.NewVersion.ToString()}";
|
updateMessage.Message = $"Radarr updated from {message.PreviousVerison.ToString()} to {message.NewVersion.ToString()}";
|
||||||
updateMessage.PreviousVersion = message.PreviousVerison;
|
updateMessage.PreviousVersion = message.PreviousVerison;
|
||||||
updateMessage.NewVersion = message.NewVersion;
|
updateMessage.NewVersion = message.NewVersion;
|
||||||
|
updateMessage.Changes = message.Changes;
|
||||||
|
|
||||||
foreach (var notification in _notificationFactory.OnApplicationUpdateEnabled())
|
foreach (var notification in _notificationFactory.OnApplicationUpdateEnabled())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -136,7 +136,9 @@ namespace NzbDrone.Core.Notifications.Webhook
|
|||||||
EventType = WebhookEventType.ApplicationUpdate,
|
EventType = WebhookEventType.ApplicationUpdate,
|
||||||
Message = updateMessage.Message,
|
Message = updateMessage.Message,
|
||||||
PreviousVersion = updateMessage.PreviousVersion.ToString(),
|
PreviousVersion = updateMessage.PreviousVersion.ToString(),
|
||||||
NewVersion = updateMessage.NewVersion.ToString()
|
NewVersion = updateMessage.NewVersion.ToString(),
|
||||||
|
NewChanges = updateMessage.Changes.New,
|
||||||
|
FixedChanges = updateMessage.Changes.Fixed
|
||||||
};
|
};
|
||||||
|
|
||||||
_proxy.SendWebhook(payload, Settings);
|
_proxy.SendWebhook(payload, Settings);
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Notifications.Webhook
|
namespace NzbDrone.Core.Notifications.Webhook
|
||||||
{
|
{
|
||||||
public class WebhookApplicationUpdatePayload : WebhookPayload
|
public class WebhookApplicationUpdatePayload : WebhookPayload
|
||||||
@@ -5,5 +7,7 @@ namespace NzbDrone.Core.Notifications.Webhook
|
|||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
public string PreviousVersion { get; set; }
|
public string PreviousVersion { get; set; }
|
||||||
public string NewVersion { get; set; }
|
public string NewVersion { get; set; }
|
||||||
|
public List<string> NewChanges { get; set; }
|
||||||
|
public List<string> FixedChanges { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,13 @@ namespace NzbDrone.Core.Update.History.Events
|
|||||||
{
|
{
|
||||||
public Version PreviousVerison { get; set; }
|
public Version PreviousVerison { get; set; }
|
||||||
public Version NewVersion { get; set; }
|
public Version NewVersion { get; set; }
|
||||||
|
public UpdateChanges Changes { get; set; }
|
||||||
|
|
||||||
public UpdateInstalledEvent(Version previousVersion, Version newVersion)
|
public UpdateInstalledEvent(Version previousVersion, Version newVersion, UpdateChanges changes)
|
||||||
{
|
{
|
||||||
PreviousVerison = previousVersion;
|
PreviousVerison = previousVersion;
|
||||||
NewVersion = newVersion;
|
NewVersion = newVersion;
|
||||||
|
Changes = changes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
using NzbDrone.Core.Update.History.Events;
|
using NzbDrone.Core.Update.History.Events;
|
||||||
@@ -17,13 +19,21 @@ namespace NzbDrone.Core.Update.History
|
|||||||
public class UpdateHistoryService : IUpdateHistoryService, IHandle<ApplicationStartedEvent>, IHandleAsync<ApplicationStartedEvent>
|
public class UpdateHistoryService : IUpdateHistoryService, IHandle<ApplicationStartedEvent>, IHandleAsync<ApplicationStartedEvent>
|
||||||
{
|
{
|
||||||
private readonly IUpdateHistoryRepository _repository;
|
private readonly IUpdateHistoryRepository _repository;
|
||||||
|
private readonly IConfigFileProvider _configFileProvider;
|
||||||
|
private readonly IUpdatePackageProvider _updatePackageProvider;
|
||||||
private readonly IEventAggregator _eventAggregator;
|
private readonly IEventAggregator _eventAggregator;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
private Version _prevVersion;
|
private Version _prevVersion;
|
||||||
|
|
||||||
public UpdateHistoryService(IUpdateHistoryRepository repository, IEventAggregator eventAggregator, Logger logger)
|
public UpdateHistoryService(IUpdateHistoryRepository repository,
|
||||||
|
IConfigFileProvider configFileProvider,
|
||||||
|
IUpdatePackageProvider updatePackageProvider,
|
||||||
|
IEventAggregator eventAggregator,
|
||||||
|
Logger logger)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_configFileProvider = configFileProvider;
|
||||||
|
_updatePackageProvider = updatePackageProvider;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
@@ -93,7 +103,20 @@ namespace NzbDrone.Core.Update.History
|
|||||||
{
|
{
|
||||||
if (_prevVersion != null)
|
if (_prevVersion != null)
|
||||||
{
|
{
|
||||||
_eventAggregator.PublishEvent(new UpdateInstalledEvent(_prevVersion, BuildInfo.Version));
|
var branch = _configFileProvider.Branch;
|
||||||
|
var version = BuildInfo.Version;
|
||||||
|
var packageChanges = _updatePackageProvider.GetRecentUpdates(branch, version, _prevVersion)
|
||||||
|
.Select(u => u.Changes);
|
||||||
|
|
||||||
|
var changes = new UpdateChanges();
|
||||||
|
|
||||||
|
foreach (var change in packageChanges)
|
||||||
|
{
|
||||||
|
changes.New = change.New.Union(change.New).ToList();
|
||||||
|
changes.Fixed = change.Fixed.Union(change.Fixed).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
_eventAggregator.PublishEvent(new UpdateInstalledEvent(_prevVersion, BuildInfo.Version, changes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user