Skip to content

Commit

Permalink
Remove deprecated CSS options
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisreimann authored and NicolasDorier committed May 8, 2024
1 parent eba3475 commit 0dde12f
Show file tree
Hide file tree
Showing 28 changed files with 13 additions and 360 deletions.
4 changes: 0 additions & 4 deletions BTCPayServer.Client/Models/CreateAppRequest.cs
Expand Up @@ -35,13 +35,11 @@ public class CreatePointOfSaleAppRequest : CreateAppRequest
public string CustomAmountPayButtonText { get; set; } = null;
public string FixedAmountPayButtonText { get; set; } = null;
public string TipText { get; set; } = null;
public string CustomCSSLink { get; set; } = null;
public string NotificationUrl { get; set; } = null;
public string RedirectUrl { get; set; } = null;
public bool? RedirectAutomatically { get; set; } = null;
public bool? Archived { get; set; } = null;
public string FormId { get; set; } = null;
public string EmbeddedCSS { get; set; } = null;
}

public enum CrowdfundResetEvery
Expand All @@ -65,9 +63,7 @@ public class CreateCrowdfundAppRequest : CreateAppRequest
[JsonConverter(typeof(NBitcoin.JsonConverters.DateTimeToUnixTimeConverter))]
public DateTimeOffset? EndDate { get; set; } = null;
public decimal? TargetAmount { get; set; } = null;
public string CustomCSSLink { get; set; } = null;
public string MainImageUrl { get; set; } = null;
public string EmbeddedCSS { get; set; } = null;
public string NotificationUrl { get; set; } = null;
public string Tagline { get; set; } = null;
public string PerksTemplate { get; set; } = null;
Expand Down
3 changes: 0 additions & 3 deletions BTCPayServer.Client/Models/PaymentRequestBaseData.cs
Expand Up @@ -17,9 +17,6 @@ public class PaymentRequestBaseData
public string Title { get; set; }
public string Description { get; set; }
public string Email { get; set; }

public string EmbeddedCSS { get; set; }
public string CustomCSSLink { get; set; }
public bool AllowCustomPaymentAmounts { get; set; }

[JsonExtensionData]
Expand Down
4 changes: 0 additions & 4 deletions BTCPayServer.Client/Models/PointOfSaleAppData.cs
Expand Up @@ -30,11 +30,9 @@ public class PointOfSaleAppData : AppDataBase
public string FixedAmountPayButtonText { get; set; }
public string CustomAmountPayButtonText { get; set; }
public string TipText { get; set; }
public string CustomCSSLink { get; set; }
public string NotificationUrl { get; set; }
public string RedirectUrl { get; set; }
public string Description { get; set; }
public string EmbeddedCSS { get; set; }
public bool? RedirectAutomatically { get; set; }
}

Expand All @@ -50,9 +48,7 @@ public class CrowdfundAppData : AppDataBase
[JsonConverter(typeof(NBitcoin.JsonConverters.DateTimeToUnixTimeConverter))]
public DateTimeOffset? EndDate { get; set; }
public decimal? TargetAmount { get; set; }
public string CustomCSSLink { get; set; }
public string MainImageUrl { get; set; }
public string EmbeddedCSS { get; set; }
public string NotificationUrl { get; set; }
public string Tagline { get; set; }
public object Perks { get; set; }
Expand Down
Expand Up @@ -233,9 +233,7 @@ private CrowdfundSettings ToCrowdfundSettings(CreateCrowdfundAppRequest request)
Description = request.Description?.Trim(),
EndDate = request.EndDate?.UtcDateTime,
TargetAmount = request.TargetAmount,
CustomCSSLink = request.CustomCSSLink?.Trim(),
MainImageUrl = request.MainImageUrl?.Trim(),
EmbeddedCSS = request.EmbeddedCSS?.Trim(),
NotificationUrl = request.NotificationUrl?.Trim(),
Tagline = request.Tagline?.Trim(),
PerksTemplate = request.PerksTemplate is not null ? AppService.SerializeTemplate(AppService.Parse(request.PerksTemplate.Trim())) : null,
Expand Down Expand Up @@ -272,11 +270,9 @@ private PointOfSaleSettings ToPointOfSaleSettings(CreatePointOfSaleAppRequest re
ButtonText = request.FixedAmountPayButtonText ?? PointOfSaleSettings.BUTTON_TEXT_DEF,
CustomButtonText = request.CustomAmountPayButtonText ?? PointOfSaleSettings.CUSTOM_BUTTON_TEXT_DEF,
CustomTipText = request.TipText ?? PointOfSaleSettings.CUSTOM_TIP_TEXT_DEF,
CustomCSSLink = request.CustomCSSLink,
NotificationUrl = request.NotificationUrl,
RedirectUrl = request.RedirectUrl,
Description = request.Description,
EmbeddedCSS = request.EmbeddedCSS,
RedirectAutomatically = request.RedirectAutomatically,
FormId = request.FormId
};
Expand Down Expand Up @@ -341,11 +337,9 @@ private PointOfSaleAppData ToPointOfSaleModel(AppData appData)
FixedAmountPayButtonText = settings.ButtonText,
CustomAmountPayButtonText = settings.CustomButtonText,
TipText = settings.CustomTipText,
CustomCSSLink = settings.CustomCSSLink,
NotificationUrl = settings.NotificationUrl,
RedirectUrl = settings.RedirectUrl,
Description = settings.Description,
EmbeddedCSS = settings.EmbeddedCSS,
RedirectAutomatically = settings.RedirectAutomatically ?? false,
};
}
Expand Down Expand Up @@ -399,9 +393,7 @@ private CrowdfundAppData ToCrowdfundModel(AppData appData)
Description = settings.Description,
EndDate = settings.EndDate,
TargetAmount = settings.TargetAmount,
CustomCSSLink = settings.CustomCSSLink,
MainImageUrl = settings.MainImageUrl,
EmbeddedCSS = settings.EmbeddedCSS,
NotificationUrl = settings.NotificationUrl,
Tagline = settings.Tagline,
Perks = JsonConvert.DeserializeObject(
Expand Down
Expand Up @@ -234,9 +234,6 @@ private async Task<IActionResult> Validate(string id, PaymentRequestBaseData dat
if (string.IsNullOrEmpty(data.Title))
ModelState.AddModelError(nameof(data.Title), "Title is required");

if (!string.IsNullOrEmpty(data.CustomCSSLink) && data.CustomCSSLink.Length > 500)
ModelState.AddModelError(nameof(data.CustomCSSLink), "CustomCSSLink is 500 chars max");

return !ModelState.IsValid ? this.CreateValidationError(ModelState) : null;
}

Expand All @@ -257,8 +254,6 @@ private static Client.Models.PaymentRequestData FromModel(PaymentRequestData dat
ExpiryDate = blob.ExpiryDate,
Email = blob.Email,
AllowCustomPaymentAmounts = blob.AllowCustomPaymentAmounts,
EmbeddedCSS = blob.EmbeddedCSS,
CustomCSSLink = blob.CustomCSSLink,
FormResponse = blob.FormResponse,
FormId = blob.FormId
};
Expand Down
15 changes: 3 additions & 12 deletions BTCPayServer/Controllers/UIPaymentRequestController.cs
Expand Up @@ -191,8 +191,6 @@ public async Task<IActionResult> EditPaymentRequest(string payReqId, UpdatePayme
blob.Amount = viewModel.Amount;
blob.ExpiryDate = viewModel.ExpiryDate?.ToUniversalTime();
blob.Currency = viewModel.Currency ?? store.GetStoreBlob().DefaultCurrency;
blob.EmbeddedCSS = viewModel.EmbeddedCSS;
blob.CustomCSSLink = viewModel.CustomCSSLink;
blob.AllowCustomPaymentAmounts = viewModel.AllowCustomPaymentAmounts;
blob.FormId = viewModel.FormId;

Expand Down Expand Up @@ -229,11 +227,7 @@ public async Task<IActionResult> ViewPaymentRequest(string payReqId)
vm.HubPath = PaymentRequestHub.GetHubPath(Request);
vm.StoreName = store.StoreName;
vm.StoreWebsite = store.StoreWebsite;
vm.StoreBranding = new StoreBrandingViewModel(storeBlob)
{
EmbeddedCSS = vm.EmbeddedCSS,
CustomCSSLink = vm.CustomCSSLink
};
vm.StoreBranding = new StoreBrandingViewModel(storeBlob);

return View(vm);
}
Expand Down Expand Up @@ -290,11 +284,8 @@ public async Task<IActionResult> ViewPaymentRequestForm(string payReqId, FormVie
viewModel.Form = form;

var storeBlob = result.StoreData.GetStoreBlob();
viewModel.StoreBranding = new StoreBrandingViewModel(storeBlob)
{
EmbeddedCSS = prBlob.EmbeddedCSS,
CustomCSSLink = prBlob.CustomCSSLink
};
viewModel.StoreBranding = new StoreBrandingViewModel(storeBlob);

return View("Views/UIForms/View", viewModel);
}

Expand Down
12 changes: 3 additions & 9 deletions BTCPayServer/Controllers/UIPullPaymentController.cs
Expand Up @@ -121,11 +121,7 @@ public async Task<IActionResult> ViewPullPayment(string pullPaymentId)
}).ToList()
};
vm.IsPending &= vm.AmountDue > 0.0m;
vm.StoreBranding = new StoreBrandingViewModel(storeBlob)
{
EmbeddedCSS = blob.View.EmbeddedCSS,
CustomCSSLink = blob.View.CustomCSSLink
};
vm.StoreBranding = new StoreBrandingViewModel(storeBlob);

if (_pullPaymentHostedService.SupportsLNURL(blob))
{
Expand Down Expand Up @@ -185,13 +181,11 @@ public async Task<IActionResult> EditPullPayment(string storeId, string pullPaym
var blob = pp.GetBlob();
blob.Description = viewModel.Description ?? string.Empty;
blob.Name = viewModel.Name ?? string.Empty;
blob.View = new PullPaymentBlob.PullPaymentView()
blob.View = new PullPaymentBlob.PullPaymentView
{
Title = viewModel.Name ?? string.Empty,
Description = viewModel.Description ?? string.Empty,
CustomCSSLink = viewModel.CustomCSSLink,
Email = null,
EmbeddedCSS = viewModel.EmbeddedCSS,
Email = null
};

pp.SetBlob(blob);
Expand Down
Expand Up @@ -95,8 +95,6 @@ public IActionResult NewPullPayment(string storeId)
{
Name = "",
Currency = CurrentStore.GetStoreBlob().DefaultCurrency,
CustomCSSLink = "",
EmbeddedCSS = "",
PayoutMethodsItem =
paymentMethods.Select(id => new SelectListItem(id.ToString(), id.ToString(), true))
});
Expand Down Expand Up @@ -145,25 +143,23 @@ public async Task<IActionResult> NewPullPayment(string storeId, NewPullPaymentMo
return View(model);
model.AutoApproveClaims = model.AutoApproveClaims && (await
_authorizationService.AuthorizeAsync(User, storeId, Policies.CanCreatePullPayments)).Succeeded;
await _pullPaymentService.CreatePullPayment(new HostedServices.CreatePullPayment()
await _pullPaymentService.CreatePullPayment(new CreatePullPayment
{
Name = model.Name,
Description = model.Description,
Amount = model.Amount,
Currency = model.Currency,
StoreId = storeId,
PayoutMethodIds = selectedPaymentMethodIds,
EmbeddedCSS = model.EmbeddedCSS,
CustomCSSLink = model.CustomCSSLink,
BOLT11Expiration = TimeSpan.FromDays(model.BOLT11Expiration),
AutoApproveClaims = model.AutoApproveClaims
});
this.TempData.SetStatusMessageModel(new StatusMessageModel()
TempData.SetStatusMessageModel(new StatusMessageModel
{
Message = "Pull payment request created",
Severity = StatusMessageModel.StatusSeverity.Success
});
return RedirectToAction(nameof(PullPayments), new { storeId = storeId });
return RedirectToAction(nameof(PullPayments), new { storeId });
}

[Authorize(Policy = Policies.CanViewPullPayments, AuthenticationSchemes = AuthenticationSchemes.Cookie)]
Expand Down
2 changes: 0 additions & 2 deletions BTCPayServer/Data/PullPayments/PullPaymentBlob.cs
Expand Up @@ -35,9 +35,7 @@ public class PullPaymentView
{
public string Title { get; set; }
public string Description { get; set; }
public string EmbeddedCSS { get; set; }
public string Email { get; set; }
public string CustomCSSLink { get; set; }
}
}
}
8 changes: 2 additions & 6 deletions BTCPayServer/HostedServices/PullPaymentHostedService.cs
Expand Up @@ -38,8 +38,6 @@ public class CreatePullPayment
public string Description { get; set; }
public decimal Amount { get; set; }
public string Currency { get; set; }
public string CustomCSSLink { get; set; }
public string EmbeddedCSS { get; set; }
public PayoutMethodId[] PayoutMethodIds { get; set; }
public bool AutoApproveClaims { get; set; }
public TimeSpan? BOLT11Expiration { get; set; }
Expand Down Expand Up @@ -131,13 +129,11 @@ public async Task<string> CreatePullPayment(CreatePullPayment create)
Limit = create.Amount,
SupportedPaymentMethods = create.PayoutMethodIds,
AutoApproveClaims = create.AutoApproveClaims,
View = new PullPaymentBlob.PullPaymentView()
View = new PullPaymentBlob.PullPaymentView
{
Title = create.Name ?? string.Empty,
Description = create.Description ?? string.Empty,
CustomCSSLink = create.CustomCSSLink,
Email = null,
EmbeddedCSS = create.EmbeddedCSS,
Email = null
},
BOLT11Expiration = create.BOLT11Expiration ?? TimeSpan.FromDays(30.0)
});
Expand Down
Expand Up @@ -48,8 +48,6 @@ public UpdatePaymentRequestViewModel(PaymentRequestData data)
Description = blob.Description;
ExpiryDate = blob.ExpiryDate?.UtcDateTime;
Email = blob.Email;
CustomCSSLink = blob.CustomCSSLink;
EmbeddedCSS = blob.EmbeddedCSS;
AllowCustomPaymentAmounts = blob.AllowCustomPaymentAmounts;
FormResponse = blob.FormResponse is null
? null
Expand Down Expand Up @@ -85,13 +83,6 @@ public UpdatePaymentRequestViewModel(PaymentRequestData data)

[MailboxAddress]
public string Email { get; set; }

[MaxLength(500)]
[Display(Name = "Custom CSS URL")]
public string CustomCSSLink { get; set; }

[Display(Name = "Custom CSS Code")]
public string EmbeddedCSS { get; set; }

[Display(Name = "Allow payee to create invoices with custom amounts")]
public bool AllowCustomPaymentAmounts { get; set; }
Expand All @@ -115,8 +106,6 @@ public ViewPaymentRequestViewModel(PaymentRequestData data)
Description = blob.Description;
ExpiryDate = blob.ExpiryDate?.UtcDateTime;
Email = blob.Email;
EmbeddedCSS = blob.EmbeddedCSS;
CustomCSSLink = blob.CustomCSSLink;
AllowCustomPaymentAmounts = blob.AllowCustomPaymentAmounts;
switch (data.Status)
{
Expand Down Expand Up @@ -154,8 +143,6 @@ public ViewPaymentRequestViewModel(PaymentRequestData data)
public string Description { get; set; }
public string StoreName { get; set; }
public string StoreWebsite { get; set; }
public string EmbeddedCSS { get; set; }
public string CustomCSSLink { get; set; }

#nullable enable
public class InvoiceList : List<PaymentRequestInvoice>
Expand Down
2 changes: 0 additions & 2 deletions BTCPayServer/Models/StoreBrandingViewModel.cs
Expand Up @@ -7,8 +7,6 @@ public class StoreBrandingViewModel
public string BrandColor { get; set; }
public string LogoFileId { get; set; }
public string CssFileId { get; set; }
public string CustomCSSLink { get; set; }
public string EmbeddedCSS { get; set; }

public StoreBrandingViewModel()
{
Expand Down
13 changes: 0 additions & 13 deletions BTCPayServer/Models/WalletViewModels/PullPaymentsModel.cs
Expand Up @@ -55,11 +55,6 @@ public decimal Amount
[Required]
[ReadOnly(true)]
public string Currency { get; set; }
[MaxLength(500)]
[Display(Name = "Custom CSS URL")]
public string CustomCSSLink { get; set; }
[Display(Name = "Custom CSS Code")]
public string EmbeddedCSS { get; set; }

[Display(Name = "Payout Methods")]
public IEnumerable<string> PayoutMethods { get; set; }
Expand Down Expand Up @@ -91,20 +86,12 @@ public UpdatePullPaymentModel(Data.PullPaymentData data)
var blob = data.GetBlob();
Name = blob.Name;
Description = blob.Description;
CustomCSSLink = blob.View.CustomCSSLink;
EmbeddedCSS = blob.View.EmbeddedCSS;
}

[MaxLength(30)]
public string Name { get; set; }

[Display(Name = "Memo")]
public string Description { get; set; }

[Display(Name = "Custom CSS URL")]
public string CustomCSSLink { get; set; }

[Display(Name = "Custom CSS Code")]
public string EmbeddedCSS { get; set; }
}
}
Expand Up @@ -403,10 +403,8 @@ public async Task<IActionResult> UpdateCrowdfund(string appId)
TargetCurrency = settings.TargetCurrency,
Description = settings.Description,
MainImageUrl = settings.MainImageUrl,
EmbeddedCSS = settings.EmbeddedCSS,
EndDate = settings.EndDate,
TargetAmount = settings.TargetAmount,
CustomCSSLink = settings.CustomCSSLink,
NotificationUrl = settings.NotificationUrl,
Tagline = settings.Tagline,
PerksTemplate = settings.PerksTemplate,
Expand Down Expand Up @@ -518,9 +516,7 @@ public async Task<IActionResult> UpdateCrowdfund(string appId, UpdateCrowdfundVi
Description = vm.Description,
EndDate = vm.EndDate?.ToUniversalTime(),
TargetAmount = vm.TargetAmount,
CustomCSSLink = vm.CustomCSSLink,
MainImageUrl = vm.MainImageUrl,
EmbeddedCSS = vm.EmbeddedCSS,
NotificationUrl = vm.NotificationUrl,
Tagline = vm.Tagline,
PerksTemplate = vm.PerksTemplate,
Expand Down
6 changes: 1 addition & 5 deletions BTCPayServer/Plugins/Crowdfund/CrowdfundPlugin.cs
Expand Up @@ -180,11 +180,7 @@ public Task<IEnumerable<ItemStats>> GetItemStats(AppData appData, InvoiceEntity[

var store = appData.StoreData;
var storeBlob = store.GetStoreBlob();
var storeBranding = new StoreBrandingViewModel(storeBlob)
{
CustomCSSLink = settings.CustomCSSLink,
EmbeddedCSS = settings.EmbeddedCSS
};
var storeBranding = new StoreBrandingViewModel(storeBlob);
var formUrl = settings.FormId != null
? _linkGenerator.GetPathByAction(nameof(UICrowdfundController.CrowdfundForm), "UICrowdfund",
new { appId = appData.Id }, _options.Value.RootPath)
Expand Down
Expand Up @@ -86,13 +86,6 @@ public class UpdateCrowdfundViewModel
[Display(Name = "Contribution Perks Template")]
public string PerksTemplate { get; set; }

[MaxLength(500)]
[Display(Name = "Custom CSS URL")]
public string CustomCSSLink { get; set; }

[Display(Name = "Custom CSS Code")]
public string EmbeddedCSS { get; set; }

[Display(Name = "Count all invoices created on the store as part of the goal")]
public bool UseAllStoreInvoices { get; set; }

Expand Down

0 comments on commit 0dde12f

Please sign in to comment.