Do not allow generation of dummy even if regtest

This commit is contained in:
nicolas.dorier 2020-06-15 17:06:38 +09:00
parent 7cdfa7d4c5
commit d7eeadac41
No known key found for this signature in database
GPG key ID: 6618763EF09186FE

View file

@ -9,6 +9,7 @@ using BTCPayServer.Filters;
using BTCPayServer.HostedServices;
using BTCPayServer.Models.NotificationViewModels;
using BTCPayServer.Security;
using BTCPayServer.Services;
using BTCPayServer.Services.Notifications;
using BTCPayServer.Services.Notifications.Blobs;
using Google;
@ -22,12 +23,14 @@ namespace BTCPayServer.Controllers
[Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie)]
public class NotificationsController : Controller
{
private readonly BTCPayServerEnvironment _env;
private readonly ApplicationDbContext _db;
private readonly NotificationSender _notificationSender;
private readonly UserManager<ApplicationUser> _userManager;
public NotificationsController(ApplicationDbContext db, NotificationSender notificationSender, UserManager<ApplicationUser> userManager)
public NotificationsController(BTCPayServerEnvironment env, ApplicationDbContext db, NotificationSender notificationSender, UserManager<ApplicationUser> userManager)
{
_env = env;
_db = db;
_notificationSender = notificationSender;
_userManager = userManager;
@ -58,6 +61,8 @@ namespace BTCPayServer.Controllers
[HttpGet]
public async Task<IActionResult> Generate(string version)
{
if (_env.NetworkType != NBitcoin.NetworkType.Regtest)
return NotFound();
await _notificationSender.SendNotification(new AdminScope(), new NewVersionNotification(version));
return RedirectToAction(nameof(Index));
}