[Backport release-26.05] kavita: 0.8.8.3 -> 0.9.0.2 (#528952)

This commit is contained in:
nixpkgs-ci[bot] 2026-06-07 05:18:44 +00:00 committed by GitHub
commit 3a246acdfb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 708 additions and 975 deletions

View file

@ -1,14 +1,8 @@
diff --git a/API/Controllers/FallbackController.cs b/API/Controllers/FallbackController.cs
index 9aff8202..f8b6c60f 100644
--- a/API/Controllers/FallbackController.cs
+++ b/API/Controllers/FallbackController.cs
@@ -1,4 +1,4 @@
-using System.IO;
+using System.IO;
using API.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -27,7 +27,7 @@ public class FallbackController : Controller
diff --git a/Kavita.Server/Controllers/FallbackController.cs b/Kavita.Server/Controllers/FallbackController.cs
index 29012ba999512815ac5cdd45eccf2a01f228aae0..31d96c93580e211f4e444c0a4be3ee3099461544 100644
--- a/Kavita.Server/Controllers/FallbackController.cs
+++ b/Kavita.Server/Controllers/FallbackController.cs
@@ -18,7 +18,7 @@ public class FallbackController : Controller
return NotFound();
}
@ -17,17 +11,55 @@ index 9aff8202..f8b6c60f 100644
}
}
diff --git a/API/Services/DirectoryService.cs b/API/Services/DirectoryService.cs
index ecce1957..774b3169 100644
--- a/API/Services/DirectoryService.cs
+++ b/API/Services/DirectoryService.cs
diff --git a/Kavita.Server/Startup.cs b/Kavita.Server/Startup.cs
index 924c9ceb0cafacbc873eaa9e16d184d215bb761d..46847d73f0da1e6c93b0e6120b256e1c1169d83f 100644
--- a/Kavita.Server/Startup.cs
+++ b/Kavita.Server/Startup.cs
@@ -48,6 +48,7 @@ using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.Caching.Hybrid;
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;
@@ -275,8 +276,6 @@ public class Startup
app.UsePathBase(basePath);
if (!env.IsDevelopment())
{
- // We don't update the index.html in local as we don't serve from there
- UpdateBaseUrlInIndex(basePath);
// Update DB with what's in config
var dataContext = serviceProvider.GetRequiredService<DataContext>();
@@ -316,6 +315,7 @@ public class Startup
// Ensure static files is before our custom middleware stack
app.UseStaticFiles(new StaticFileOptions
{
+ FileProvider = new PhysicalFileProvider("@webroot@"),
// bcmap files needed for PDF reader localizations (https://github.com/Kareadita/Kavita/issues/2970)
// ftl files are needed for PDF zoom options (https://github.com/Kareadita/Kavita/issues/3995)
ContentTypeProvider = new FileExtensionContentTypeProvider
@@ -534,7 +534,7 @@ public class Startup
try
{
var htmlDoc = new HtmlDocument();
- var indexHtmlPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "index.html");
+ var indexHtmlPath = Path.Combine("@webroot@", "index.html");
htmlDoc.Load(indexHtmlPath);
var baseNode = htmlDoc.DocumentNode.SelectSingleNode("/html/head/base");
diff --git a/Kavita.Services/DirectoryService.cs b/Kavita.Services/DirectoryService.cs
index 38c88eeead9812895046e776667c9540bf4662a5..79ac745ef2f8ae630d74d605083a5b597aedbcec 100644
--- a/Kavita.Services/DirectoryService.cs
+++ b/Kavita.Services/DirectoryService.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
@@ -135,7 +135,7 @@ public class DirectoryService : IDirectoryService
@@ -66,7 +66,7 @@ public class DirectoryService : IDirectoryService
ExistOrCreate(SiteThemeDirectory);
FaviconDirectory = FileSystem.Path.Join(FileSystem.Directory.GetCurrentDirectory(), "config", "favicons");
ExistOrCreate(FaviconDirectory);
@ -36,17 +68,17 @@ index ecce1957..774b3169 100644
CustomizedTemplateDirectory = FileSystem.Path.Join(FileSystem.Directory.GetCurrentDirectory(), "config", "templates");
ExistOrCreate(CustomizedTemplateDirectory);
TemplateDirectory = FileSystem.Path.Join(FileSystem.Directory.GetCurrentDirectory(), "EmailTemplates");
diff --git a/API/Services/LocalizationService.cs b/API/Services/LocalizationService.cs
index 8abde664..2f207837 100644
--- a/API/Services/LocalizationService.cs
+++ b/API/Services/LocalizationService.cs
diff --git a/Kavita.Services/LocalizationService.cs b/Kavita.Services/LocalizationService.cs
index 5597f05cf65dac448bc893aeee8e6ecc0a0d58c7..c8b2746d45d547d4544ef2022c8bcc360772383f 100644
--- a/Kavita.Services/LocalizationService.cs
+++ b/Kavita.Services/LocalizationService.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
@@ -57,9 +57,7 @@ public class LocalizationService : ILocalizationService
@@ -51,9 +51,7 @@ public class LocalizationService : ILocalizationService
}
else
{
@ -57,41 +89,4 @@ index 8abde664..2f207837 100644
}
_cacheOptions = new MemoryCacheEntryOptions()
diff --git a/API/Startup.cs b/API/Startup.cs
index fad79cee..073fcdee 100644
--- a/API/Startup.cs
+++ b/API/Startup.cs
@@ -36,6 +36,7 @@ using Microsoft.AspNetCore.StaticFiles;
using Microsoft.EntityFrameworkCore;
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;
@@ -353,8 +354,6 @@ public class Startup
app.UsePathBase(basePath);
if (!env.IsDevelopment())
{
- // We don't update the index.html in local as we don't serve from there
- UpdateBaseUrlInIndex(basePath);
// Update DB with what's in config
var dataContext = serviceProvider.GetRequiredService<DataContext>();
@@ -399,6 +398,7 @@ public class Startup
app.UseStaticFiles(new StaticFileOptions
{
+ FileProvider = new PhysicalFileProvider("@webroot@"),
// bcmap files needed for PDF reader localizations (https://github.com/Kareadita/Kavita/issues/2970)
// ftl files are needed for PDF zoom options (https://github.com/Kareadita/Kavita/issues/3995)
ContentTypeProvider = new FileExtensionContentTypeProvider
@@ -481,7 +481,7 @@ public class Startup
try
{
var htmlDoc = new HtmlDocument();
- var indexHtmlPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "index.html");
+ var indexHtmlPath = Path.Combine("@webroot@", "index.html");
htmlDoc.Load(indexHtmlPath);
var baseNode = htmlDoc.DocumentNode.SelectSingleNode("/html/head/base");

File diff suppressed because it is too large Load diff

View file

@ -10,13 +10,13 @@
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "kavita";
version = "0.8.8.3";
version = "0.9.0.2";
src = fetchFromGitHub {
owner = "kareadita";
repo = "kavita";
rev = "v${finalAttrs.version}";
hash = "sha256-Va3scgMxcLhqP+s7x/iDneCPZQCF0iOIQAfTJENcvOI=";
hash = "sha256-Wfb/Lc+BvkiJLopH1NQx1YQWzm2Sdmvg1Xmn+8YwWus=";
};
backend = buildDotnetModule {
@ -31,18 +31,16 @@ stdenvNoCC.mkDerivation (finalAttrs: {
# Future updates should check if migration restoration is needed for supported upgrade paths.
];
postPatch = ''
substituteInPlace API/Services/DirectoryService.cs --subst-var out
substituteInPlace Kavita.Services/DirectoryService.cs --subst-var out
substituteInPlace API/Startup.cs API/Services/LocalizationService.cs API/Controllers/FallbackController.cs \
substituteInPlace Kavita.Server/Startup.cs Kavita.Services/LocalizationService.cs Kavita.Server/Controllers/FallbackController.cs \
--subst-var-by webroot "${finalAttrs.frontend}/lib/node_modules/kavita-webui/dist/browser"
'';
executables = [ "API" ];
projectFile = "API/API.csproj";
projectFile = "Kavita.Server/Kavita.Server.csproj";
nugetDeps = ./nuget-deps.json;
dotnet-sdk = dotnetCorePackages.sdk_9_0;
dotnet-runtime = dotnetCorePackages.aspnetcore_9_0;
dotnet-sdk = dotnetCorePackages.sdk_10_0;
dotnet-runtime = dotnetCorePackages.aspnetcore_10_0;
};
frontend = buildNpmPackage {
@ -54,7 +52,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
npmBuildScript = "prod";
npmFlags = [ "--legacy-peer-deps" ];
npmRebuildFlags = [ "--ignore-scripts" ]; # Prevent playwright from trying to install browsers
npmDepsHash = "sha256-SqW9qeg0CKfVKYsDXmVsnVNmcH7YkaXtXpPjIqGL0i0=";
npmDepsHash = "sha256-Qa/lf0hH2KMDdRcBj8GW9cJGE3YZsP32z2kfTk6YNYc=";
};
dontBuild = true;
@ -65,7 +63,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
mkdir -p $out/bin $out/lib/kavita
ln -s $backend/lib/kavita-backend $out/lib/kavita/backend
ln -s $frontend/lib/node_modules/kavita-webui/dist $out/lib/kavita/frontend
ln -s $backend/bin/API $out/bin/kavita
ln -s $backend/bin/Kavita.Server $out/bin/kavita
runHook postInstall
'';

View file

@ -14,7 +14,7 @@ popd
update-source-version kavita "$latest_version"
pushd "$(dirname "${BASH_SOURCE[0]}")"
sed -E 's#\bnpmDepsHash = ".*?"#npmDepsHash = "'"$npmDepsHash"'"#' -i default.nix
sed -E 's#\bnpmDepsHash = ".*?"#npmDepsHash = "'"$npmDepsHash"'"#' -i package.nix
popd
$(nix-build -A kavita.backend.fetch-deps --no-out-link)