nixpkgs/pkgs/servers/web-apps/kavita/change-webroot.diff
2023-05-06 13:57:53 -03:00

40 lines
1.4 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

diff --git a/API/Controllers/FallbackController.cs b/API/Controllers/FallbackController.cs
index 2f5d7fce..faaf128a 100644
--- a/API/Controllers/FallbackController.cs
+++ b/API/Controllers/FallbackController.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.IO;
using API.Services;
using Microsoft.AspNetCore.Authorization;
@@ -22,7 +22,7 @@ public class FallbackController : Controller
public ActionResult Index()
{
- return PhysicalFile(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "index.html"), "text/HTML");
+ return PhysicalFile(Path.Combine("@web_root@", "index.html"), "text/HTML");
}
}
diff --git a/API/Startup.cs b/API/Startup.cs
index f84ef638..7eaeb05e 100644
--- a/API/Startup.cs
+++ b/API/Startup.cs
@@ -33,6 +33,7 @@ using Microsoft.AspNetCore.ResponseCompression;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
@@ -298,6 +299,7 @@ public class Startup
app.UseStaticFiles(new StaticFileOptions
{
+ FileProvider = new PhysicalFileProvider("@web_root@"),
ContentTypeProvider = new FileExtensionContentTypeProvider(),
HttpsCompression = HttpsCompressionMode.Compress,
OnPrepareResponse = ctx =>