fix redirect uri for crowdfund invoices

closes #759
This commit is contained in:
Kukks
2019-04-13 13:43:05 +02:00
parent 7ef11817c1
commit 8d10186fdf

View File

@@ -7,6 +7,7 @@ using System.Linq;
using System.Security.Claims; using System.Security.Claims;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using BTCPayServer.Configuration;
using BTCPayServer.Data; using BTCPayServer.Data;
using BTCPayServer.Filters; using BTCPayServer.Filters;
using BTCPayServer.ModelBinders; using BTCPayServer.ModelBinders;
@@ -33,15 +34,18 @@ namespace BTCPayServer.Controllers
public class AppsPublicController : Controller public class AppsPublicController : Controller
{ {
public AppsPublicController(AppService AppService, public AppsPublicController(AppService AppService,
BTCPayServerOptions btcPayServerOptions,
InvoiceController invoiceController, InvoiceController invoiceController,
UserManager<ApplicationUser> userManager) UserManager<ApplicationUser> userManager)
{ {
_AppService = AppService; _AppService = AppService;
_BtcPayServerOptions = btcPayServerOptions;
_InvoiceController = invoiceController; _InvoiceController = invoiceController;
_UserManager = userManager; _UserManager = userManager;
} }
private AppService _AppService; private AppService _AppService;
private readonly BTCPayServerOptions _BtcPayServerOptions;
private InvoiceController _InvoiceController; private InvoiceController _InvoiceController;
private readonly UserManager<ApplicationUser> _UserManager; private readonly UserManager<ApplicationUser> _UserManager;
@@ -189,8 +193,11 @@ namespace BTCPayServer.Controllers
NotificationEmail = settings.NotificationEmail, NotificationEmail = settings.NotificationEmail,
FullNotifications = true, FullNotifications = true,
ExtendedNotifications = true, ExtendedNotifications = true,
RedirectURL = request.RedirectUrl ?? Request.GetDisplayUrl() RedirectURL = request.RedirectUrl ??
}, store, HttpContext.Request.GetAbsoluteRoot(), new List<string> { AppService.GetAppInternalTag(appId) }, cancellationToken: cancellationToken); new Uri(new Uri( new Uri(HttpContext.Request.GetAbsoluteRoot()), _BtcPayServerOptions.RootPath), $"apps/{appId}/crowdfund").ToString()
}, store, HttpContext.Request.GetAbsoluteRoot(),
new List<string> {AppService.GetAppInternalTag(appId)},
cancellationToken: cancellationToken);
if (request.RedirectToCheckout) if (request.RedirectToCheckout)
{ {
return RedirectToAction(nameof(InvoiceController.Checkout), "Invoice", return RedirectToAction(nameof(InvoiceController.Checkout), "Invoice",