Files
btcpayserver/BTCPayServer/Filters/CheatModeRouteAttribute.cs
2021-12-31 16:59:02 +09:00

21 lines
583 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BTCPayServer.Services;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.Extensions.DependencyInjection;
namespace BTCPayServer.Filters
{
public class CheatModeRouteAttribute : Attribute, IActionConstraint
{
public int Order => 100;
public bool Accept(ActionConstraintContext context)
{
return context.RouteContext.HttpContext.RequestServices.GetRequiredService<BTCPayServerEnvironment>().CheatMode;
}
}
}