2020-06-11 18:14:23 -05:00
|
|
|
|
using BTCPayServer.Data;
|
2020-06-11 01:00:41 -05:00
|
|
|
|
using BTCPayServer.Models.NotificationViewModels;
|
|
|
|
|
using Newtonsoft.Json;
|
2020-05-27 18:41:00 -05:00
|
|
|
|
|
|
|
|
|
namespace BTCPayServer.Events.Notifications
|
|
|
|
|
{
|
|
|
|
|
public class NewVersionNotification : NotificationEventBase
|
|
|
|
|
{
|
|
|
|
|
public string Version { get; set; }
|
2020-06-11 01:00:41 -05:00
|
|
|
|
|
|
|
|
|
public override NotificationViewModel ToViewModel(NotificationData data)
|
|
|
|
|
{
|
2020-06-11 18:14:23 -05:00
|
|
|
|
var casted = JsonConvert.DeserializeObject<NewVersionNotification>(ZipUtils.Unzip(data.Blob));
|
2020-06-11 01:00:41 -05:00
|
|
|
|
var obj = new NotificationViewModel
|
|
|
|
|
{
|
|
|
|
|
Id = data.Id,
|
|
|
|
|
Created = data.Created,
|
|
|
|
|
Body = $"New version {casted.Version} released!",
|
|
|
|
|
ActionLink = "https://github.com/btcpayserver/btcpayserver/releases/tag/v" + casted.Version,
|
|
|
|
|
Seen = data.Seen
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
2020-05-27 18:41:00 -05:00
|
|
|
|
}
|
|
|
|
|
}
|