mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-19 05:33:31 +01:00
7348a6a62f
* Store Branding: Apply brand color to backend as well Closes #5990. * Add adjustments for different theme scenarios * Add description text * Make it optional to apply the brand color to the backend * Toggle color fixes
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using System.Threading.Tasks;
|
|
using BTCPayServer.Abstractions.Extensions;
|
|
using BTCPayServer.Data;
|
|
using BTCPayServer.Services;
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
namespace BTCPayServer.Models;
|
|
|
|
public class StoreBrandingViewModel
|
|
{
|
|
public string BrandColor { get; set; }
|
|
public bool ApplyBrandColorToBackend { get; set; }
|
|
public string LogoUrl { get; set; }
|
|
public string CssUrl { get; set; }
|
|
|
|
public StoreBrandingViewModel()
|
|
{
|
|
}
|
|
public static async Task<StoreBrandingViewModel> CreateAsync(HttpRequest request, UriResolver uriResolver, StoreBlob storeBlob)
|
|
{
|
|
if (storeBlob == null)
|
|
return new StoreBrandingViewModel();
|
|
var result = new StoreBrandingViewModel(storeBlob)
|
|
{
|
|
LogoUrl = await uriResolver.Resolve(request.GetAbsoluteRootUri(), storeBlob.LogoUrl),
|
|
CssUrl = await uriResolver.Resolve(request.GetAbsoluteRootUri(), storeBlob.CssUrl)
|
|
};
|
|
return result;
|
|
}
|
|
private StoreBrandingViewModel(StoreBlob storeBlob)
|
|
{
|
|
BrandColor = storeBlob.BrandColor;
|
|
ApplyBrandColorToBackend = storeBlob.ApplyBrandColorToBackend;
|
|
}
|
|
}
|