mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 14:04:26 +01:00
Add debug notifications
This adds a test notif only available in debug mode + endpoint `/Notifications/GenerateJunk` that generates x amount of notifications.
This commit is contained in:
@@ -87,7 +87,18 @@ namespace BTCPayServer.Controllers
|
|||||||
|
|
||||||
return new EmptyResult();
|
return new EmptyResult();
|
||||||
}
|
}
|
||||||
|
#if DEBUG
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IActionResult> GenerateJunk(int x = 100)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < x; i++)
|
||||||
|
{
|
||||||
|
await _notificationSender.SendNotification(new AdminScope(), new JunkNotification());
|
||||||
|
}
|
||||||
|
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Index(int skip = 0, int count = 50, int timezoneOffset = 0)
|
public IActionResult Index(int skip = 0, int count = 50, int timezoneOffset = 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -246,7 +246,10 @@ namespace BTCPayServer.Hosting
|
|||||||
|
|
||||||
services.AddSingleton<INotificationHandler, InvoiceEventNotification.Handler>();
|
services.AddSingleton<INotificationHandler, InvoiceEventNotification.Handler>();
|
||||||
services.AddSingleton<INotificationHandler, PayoutNotification.Handler>();
|
services.AddSingleton<INotificationHandler, PayoutNotification.Handler>();
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
services.AddSingleton<INotificationHandler, JunkNotification.Handler>();
|
||||||
|
#endif
|
||||||
services.TryAddSingleton<ExplorerClientProvider>();
|
services.TryAddSingleton<ExplorerClientProvider>();
|
||||||
services.TryAddSingleton<Bitpay>(o =>
|
services.TryAddSingleton<Bitpay>(o =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#if DEBUG
|
||||||
|
using BTCPayServer.Models.NotificationViewModels;
|
||||||
|
|
||||||
|
namespace BTCPayServer.Services.Notifications.Blobs
|
||||||
|
{
|
||||||
|
internal class JunkNotification
|
||||||
|
{
|
||||||
|
internal class Handler : NotificationHandler<JunkNotification>
|
||||||
|
{
|
||||||
|
public override string NotificationType => "junk";
|
||||||
|
|
||||||
|
protected override void FillViewModel(JunkNotification notification, NotificationViewModel vm)
|
||||||
|
{
|
||||||
|
vm.Body = $"All your junk r belong to us!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user