about summary refs log tree commit diff
path: root/pkgs/servers/web-apps/kavita/change-webroot.diff
blob: a7ac56430254d025b1c09f65dca6708d0f6427d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 =>