Make checkout CSS and logo paths relative (#4354)

* Make sure custom logo and CSS paths are relative

* match request host and scheme before replacing

* Fix the issue for greenfield as well

Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
This commit is contained in:
Umar Bolatov
2022-12-21 22:05:56 -08:00
committed by GitHub
parent b83eb41df3
commit ea03b6c19c
3 changed files with 30 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ using BTCPayServer.Security;
using BTCPayServer.Services.Stores;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using StoreData = BTCPayServer.Data.StoreData;
@@ -149,7 +150,7 @@ namespace BTCPayServer.Controllers.Greenfield
};
}
private static void ToModel(StoreBaseData restModel, Data.StoreData model, PaymentMethodId defaultPaymentMethod)
private void ToModel(StoreBaseData restModel, Data.StoreData model, PaymentMethodId defaultPaymentMethod)
{
var blob = model.GetStoreBlob();
model.StoreName = restModel.Name;
@@ -185,6 +186,7 @@ namespace BTCPayServer.Controllers.Greenfield
blob.LightningDescriptionTemplate = restModel.LightningDescriptionTemplate;
blob.PaymentTolerance = restModel.PaymentTolerance;
blob.PayJoinEnabled = restModel.PayJoinEnabled;
blob.NormalizeToRelativeLinks(Request);
model.SetStoreBlob(blob);
}

View File

@@ -505,7 +505,7 @@ namespace BTCPayServer.Controllers
{
blob.OnChainWithLnInvoiceFallback = model.OnChainWithLnInvoiceFallback;
}
blob.RequiresRefundEmail = model.RequiresRefundEmail;
blob.LazyPaymentMethods = model.LazyPaymentMethods;
blob.RedirectAutomatically = model.RedirectAutomatically;
@@ -515,7 +515,7 @@ namespace BTCPayServer.Controllers
blob.HtmlTitle = string.IsNullOrWhiteSpace(model.HtmlTitle) ? null : model.HtmlTitle;
blob.AutoDetectLanguage = model.AutoDetectLanguage;
blob.DefaultLang = model.DefaultLang;
blob.NormalizeToRelativeLinks(Request);
if (CurrentStore.SetStoreBlob(blob))
{
needUpdate = true;