Kavita/API/Controllers/FallbackController.cs
Joe Milazzo 9f29fa593d
Progress Overhaul + Profile Page and a LOT more! (#4262)
Co-authored-by: Amelia <77553571+Fesaa@users.noreply.github.com>
Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
2025-12-09 10:00:11 -07:00

36 lines
1019 B
C#

using System.IO;
using API.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace API.Controllers;
#nullable enable
[AllowAnonymous]
public class FallbackController : Controller
{
// ReSharper disable once S4487
// ReSharper disable once NotAccessedField.Local
#pragma warning disable S4487
private readonly ITaskScheduler _taskScheduler;
#pragma warning restore S4487
public FallbackController(ITaskScheduler taskScheduler)
{
// This is used to load TaskScheduler on startup without having to navigate to a Controller that uses.
_taskScheduler = taskScheduler; // TODO: Validate if this is needed as a DI anymore since we have a HostedStartupService
}
public IActionResult Index()
{
if (HttpContext.Request.Path.StartsWithSegments("/api"))
{
return NotFound();
}
return PhysicalFile(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "index.html"), "text/HTML");
}
}