diff --git a/BTCPayServer.Abstractions/Extensions/HttpRequestExtensions.cs b/BTCPayServer.Abstractions/Extensions/HttpRequestExtensions.cs index b6a40fe77..c83c6bcfd 100644 --- a/BTCPayServer.Abstractions/Extensions/HttpRequestExtensions.cs +++ b/BTCPayServer.Abstractions/Extensions/HttpRequestExtensions.cs @@ -104,10 +104,15 @@ public static class HttpRequestExtensions return isRelative ? request.GetAbsoluteRoot() + redirectUrl : redirectUrl; } + public static Uri GetAbsoluteUriNoPathBase(this HttpRequest request, string relativeOrAbsolute) + { + return GetAbsoluteUriNoPathBase(request, new Uri(relativeOrAbsolute, UriKind.RelativeOrAbsolute)); + } + /// /// Will return an absolute URL. - /// If `relativeOrAsbolute` is absolute, returns it. - /// If `relativeOrAsbolute` is relative, send absolute url based on the HOST of this request (without PathBase) + /// If `relativeOrAbsolute` is absolute, returns it. + /// If `relativeOrAbsolute` is relative, send absolute url based on the HOST of this request (without PathBase) /// /// /// diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainWalletsController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainWalletsController.cs index d9b77fbca..f6c1e1ef8 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainWalletsController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldStoreOnChainWalletsController.cs @@ -171,9 +171,10 @@ namespace BTCPayServer.Controllers.Greenfield var allowedPayjoin = derivationScheme.IsHotWallet && Store.GetStoreBlob().PayJoinEnabled; if (allowedPayjoin) { - bip21.QueryParams.Add(PayjoinClient.BIP21EndpointKey, - Request.GetAbsoluteUri(Url.Action(nameof(PayJoinEndpointController.Submit), "PayJoinEndpoint", - new { network.CryptoCode }))); + var endpoint = Request.GetAbsoluteUriNoPathBase( + Url.Action(nameof(PayJoinEndpointController.Submit), "PayJoinEndpoint", + new { network.CryptoCode })).ToString(); + bip21.QueryParams.Add(PayjoinClient.BIP21EndpointKey, endpoint); } return Ok(new OnChainWalletAddressData() diff --git a/BTCPayServer/Controllers/UIServerController.cs b/BTCPayServer/Controllers/UIServerController.cs index 0a2071857..1a96fd54d 100644 --- a/BTCPayServer/Controllers/UIServerController.cs +++ b/BTCPayServer/Controllers/UIServerController.cs @@ -697,7 +697,7 @@ namespace BTCPayServer.Controllers var lnConfig = _LnConfigProvider.GetConfig(configKey); if (lnConfig != null) { - model.QRCodeLink = Request.GetAbsoluteUri(Url.Action(nameof(GetLNDConfig), new { configKey = configKey })); + model.QRCodeLink = Request.GetAbsoluteUriNoPathBase(Url.Action(nameof(GetLNDConfig), new { configKey })).ToString(); model.QRCode = $"config={model.QRCodeLink}"; } } diff --git a/BTCPayServer/Controllers/UIWalletsController.cs b/BTCPayServer/Controllers/UIWalletsController.cs index c583e5b42..d9a7c3a2e 100644 --- a/BTCPayServer/Controllers/UIWalletsController.cs +++ b/BTCPayServer/Controllers/UIWalletsController.cs @@ -404,9 +404,10 @@ namespace BTCPayServer.Controllers var bip21 = network.GenerateBIP21(address?.ToString(), null); if (allowedPayjoin) { - bip21.QueryParams.Add(PayjoinClient.BIP21EndpointKey, - Request.GetAbsoluteUri(Url.Action(nameof(PayJoinEndpointController.Submit), "PayJoinEndpoint", - new { cryptoCode = walletId.CryptoCode }))); + var endpoint = Request.GetAbsoluteUriNoPathBase( + Url.Action(nameof(PayJoinEndpointController.Submit), "PayJoinEndpoint", + new { cryptoCode = walletId.CryptoCode })).ToString(); + bip21.QueryParams.Add(PayjoinClient.BIP21EndpointKey, endpoint); } string[]? labels = null; diff --git a/BTCPayServer/Plugins/PointOfSale/Controllers/UIPointOfSaleController.cs b/BTCPayServer/Plugins/PointOfSale/Controllers/UIPointOfSaleController.cs index 32e08023a..f45ac4edf 100644 --- a/BTCPayServer/Plugins/PointOfSale/Controllers/UIPointOfSaleController.cs +++ b/BTCPayServer/Plugins/PointOfSale/Controllers/UIPointOfSaleController.cs @@ -348,7 +348,7 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers RedirectAutomatically = settings.RedirectAutomatically, RedirectURL = !string.IsNullOrEmpty(redirectUrl) ? redirectUrl : !string.IsNullOrEmpty(settings.RedirectUrl) ? settings.RedirectUrl - : Request.GetAbsoluteUri(Url.Action(nameof(ViewPointOfSale), "UIPointOfSale", new { appId, viewType })), + : Request.GetAbsoluteUriNoPathBase(Url.Action(nameof(ViewPointOfSale), "UIPointOfSale", new { appId, viewType })).ToString(), PaymentMethods = paymentMethods?.Where(p => p.Value.Enabled).Select(p => p.Key).ToArray() }, AdditionalSearchTerms = new[] { AppService.GetAppSearchTerm(app) } @@ -534,7 +534,7 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers { var controller = nameof(UIPointOfSaleController).TrimEnd("Controller", StringComparison.InvariantCulture); var redirectUrl = - Request.GetAbsoluteUri(Url.Action(nameof(ViewPointOfSale), controller, new { appId, viewType })); + Request.GetAbsoluteUriNoPathBase(Url.Action(nameof(ViewPointOfSale), controller, new { appId, viewType })).ToString(); formParameters.Add("formResponse", FormDataService.GetValues(form).ToString()); return View("PostRedirect", new PostRedirectViewModel { diff --git a/BTCPayServer/Views/Shared/NFC/CheckoutEnd.cshtml b/BTCPayServer/Views/Shared/NFC/CheckoutEnd.cshtml index 58d1f3346..642037e88 100644 --- a/BTCPayServer/Views/Shared/NFC/CheckoutEnd.cshtml +++ b/BTCPayServer/Views/Shared/NFC/CheckoutEnd.cshtml @@ -55,7 +55,7 @@ Vue.component("lnurl-withdraw-checkout", { }, data () { return { - url: @Safe.Json(Context.Request.GetAbsoluteUri(Url.Action("SubmitLNURLWithdrawForInvoice", "NFC"))), + url: @Safe.Json(Context.Request.GetAbsoluteUriNoPathBase(Url.Action("SubmitLNURLWithdrawForInvoice", "NFC")).ToString()), amount: 0, submitting: false } diff --git a/BTCPayServer/Views/UIForms/FormsList.cshtml b/BTCPayServer/Views/UIForms/FormsList.cshtml index f216d6329..3e7089f32 100644 --- a/BTCPayServer/Views/UIForms/FormsList.cshtml +++ b/BTCPayServer/Views/UIForms/FormsList.cshtml @@ -18,6 +18,7 @@ Create Form +
diff --git a/BTCPayServer/Views/UIForms/Modify.cshtml b/BTCPayServer/Views/UIForms/Modify.cshtml index f8ca0e6fb..c87e8ab6e 100644 --- a/BTCPayServer/Views/UIForms/Modify.cshtml +++ b/BTCPayServer/Views/UIForms/Modify.cshtml @@ -215,6 +215,7 @@ }
+
@if (!ViewContext.ModelState.IsValid)