mirror of https://github.com/ErsatzTV/ErsatzTV.git
5 changed files with 44 additions and 4 deletions
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
using Microsoft.AspNetCore.Mvc; |
||||
using Microsoft.AspNetCore.Mvc.Filters; |
||||
|
||||
namespace ErsatzTV.Filters; |
||||
|
||||
public class V2ApiActionFilter : ActionFilterAttribute |
||||
{ |
||||
private static readonly Lazy<bool> UseV2Ui = |
||||
new(() => !string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("ETV_V2_UI"))); |
||||
|
||||
public override void OnActionExecuting(ActionExecutingContext context) |
||||
{ |
||||
if (!UseV2Ui.Value) |
||||
{ |
||||
context.Result = new NotFoundResult(); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue