2024-05-09 02:18:02 +02:00
|
|
|
using System;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using BTCPayServer.Abstractions.Extensions;
|
2023-12-01 16:13:44 +01:00
|
|
|
using BTCPayServer.Data;
|
2024-05-09 02:18:02 +02:00
|
|
|
using BTCPayServer.Services;
|
|
|
|
using Microsoft.AspNetCore.Http;
|
2023-12-01 16:13:44 +01:00
|
|
|
|
|
|
|
namespace BTCPayServer.Models;
|
|
|
|
|
|
|
|
public class StoreBrandingViewModel
|
|
|
|
{
|
|
|
|
public string BrandColor { get; set; }
|
2024-05-09 02:18:02 +02:00
|
|
|
public string LogoUrl { get; set; }
|
|
|
|
public string CssUrl { get; set; }
|
2023-12-01 16:13:44 +01:00
|
|
|
|
|
|
|
public StoreBrandingViewModel()
|
|
|
|
{
|
|
|
|
}
|
2024-05-09 02:18:02 +02:00
|
|
|
public static async Task<StoreBrandingViewModel> CreateAsync(HttpRequest request, UriResolver uriResolver, StoreBlob storeBlob)
|
|
|
|
{
|
|
|
|
if (storeBlob == null)
|
|
|
|
return new StoreBrandingViewModel();
|
|
|
|
var result = new StoreBrandingViewModel(storeBlob);
|
|
|
|
result.LogoUrl = await uriResolver.Resolve(request.GetAbsoluteRootUri(), storeBlob.LogoUrl);
|
|
|
|
result.CssUrl = await uriResolver.Resolve(request.GetAbsoluteRootUri(), storeBlob.CssUrl);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
private StoreBrandingViewModel(StoreBlob storeBlob)
|
2023-12-01 16:13:44 +01:00
|
|
|
{
|
|
|
|
BrandColor = storeBlob.BrandColor;
|
|
|
|
}
|
|
|
|
}
|