mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 06:35:13 +01:00
* Remove Bootstrap/Creative CSS file customizability Customizations should be done using themes * Remove deprecated Casa and Classic themes They are still available in the design system repo and should be added as custom theme CSS file * Use either standard or custom theme * Remove deprecated themes * Improve theme select UI * Finish and refactor theme switching * updates theme copy * Update BTCPayServer/Views/Server/Theme.cshtml Co-authored-by: Zaxounette <51208677+Zaxounette@users.noreply.github.com> * Combine creative.css and site.css Co-authored-by: dstrukt <gfxdsign@gmail.com> Co-authored-by: Zaxounette <51208677+Zaxounette@users.noreply.github.com>
32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using System;
|
|
using BTCPayServer.Abstractions.Contracts;
|
|
using BTCPayServer.Security;
|
|
using Microsoft.AspNetCore.Mvc.Filters;
|
|
|
|
namespace BTCPayServer.HostedServices
|
|
{
|
|
public class ContentSecurityPolicyCssThemeManager : Attribute, IActionFilter, IOrderedFilter
|
|
{
|
|
public int Order => 1001;
|
|
|
|
public void OnActionExecuted(ActionExecutedContext context)
|
|
{
|
|
|
|
}
|
|
|
|
public void OnActionExecuting(ActionExecutingContext context)
|
|
{
|
|
var settingsRepository = context.HttpContext.RequestServices.GetService(typeof(ISettingsRepository)) as ISettingsRepository;
|
|
|
|
var policies = context.HttpContext.RequestServices.GetService(typeof(ContentSecurityPolicies)) as ContentSecurityPolicies;
|
|
if (policies != null)
|
|
{
|
|
var theme = settingsRepository.GetTheme().GetAwaiter().GetResult();
|
|
if (theme.CssUri != null && Uri.TryCreate(theme.CssUri, UriKind.Absolute, out var uri))
|
|
{
|
|
policies.Clear();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|