mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 14:04:26 +01:00
Rename UI controllers
This commit is contained in:
28
BTCPayServer/Controllers/UIErrorController.cs
Normal file
28
BTCPayServer/Controllers/UIErrorController.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace BTCPayServer.Controllers
|
||||
{
|
||||
public class UIErrorController : Controller
|
||||
{
|
||||
[Route("/errors/{statusCode:int}")]
|
||||
public IActionResult Handle(int? statusCode = null)
|
||||
{
|
||||
if (Request.Headers.TryGetValue("Accept", out var v) && v.Any(v => v.Contains("text/html", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
if (statusCode.HasValue)
|
||||
{
|
||||
var specialPages = new[] { 404, 406, 417, 429, 500, 502, 403 };
|
||||
if (specialPages.Any(a => a == statusCode.Value))
|
||||
{
|
||||
var viewName = statusCode.ToString();
|
||||
return View(viewName);
|
||||
}
|
||||
}
|
||||
return View(statusCode);
|
||||
}
|
||||
return this.StatusCode(statusCode.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user