diff --git a/back/Dockerfile b/back/Dockerfile
index 3bfa1be5..862dbbfe 100644
--- a/back/Dockerfile
+++ b/back/Dockerfile
@@ -1,4 +1,4 @@
-FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0 as builder
+FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 as builder
ARG TARGETARCH
WORKDIR /kyoo
diff --git a/back/Dockerfile.dev b/back/Dockerfile.dev
index 3400f1ef..53213cbb 100644
--- a/back/Dockerfile.dev
+++ b/back/Dockerfile.dev
@@ -1,4 +1,4 @@
-FROM mcr.microsoft.com/dotnet/sdk:7.0
+FROM mcr.microsoft.com/dotnet/sdk:8.0
RUN apt-get update && apt-get install -y curl
WORKDIR /app
diff --git a/back/src/Directory.Build.props b/back/src/Directory.Build.props
index 1d56c929..34530a3a 100644
--- a/back/src/Directory.Build.props
+++ b/back/src/Directory.Build.props
@@ -1,7 +1,7 @@
- net7.0
- preview
+ net8.0
+ default
Kyoo
Kyoo
Copyright (c) Kyoo
diff --git a/back/src/Kyoo.Abstractions/Kyoo.Abstractions.csproj b/back/src/Kyoo.Abstractions/Kyoo.Abstractions.csproj
index 9613d37c..fca77439 100644
--- a/back/src/Kyoo.Abstractions/Kyoo.Abstractions.csproj
+++ b/back/src/Kyoo.Abstractions/Kyoo.Abstractions.csproj
@@ -7,13 +7,13 @@
-
-
+
+
-
-
+
+
-
+
diff --git a/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs b/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs
index 817b8487..19f5ece4 100644
--- a/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs
+++ b/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs
@@ -17,7 +17,6 @@
// along with Kyoo. If not, see .
using System;
-using System.Runtime.Serialization;
namespace Kyoo.Abstractions.Models.Exceptions;
@@ -25,28 +24,11 @@ namespace Kyoo.Abstractions.Models.Exceptions;
/// An exception raised when an item already exists in the database.
///
[Serializable]
-public class DuplicatedItemException : Exception
+public class DuplicatedItemException(object? existing = null)
+ : Exception("Already exists in the database.")
{
///
/// The existing object.
///
- public object? Existing { get; }
-
- ///
- /// Create a new with the default message.
- ///
- /// The existing object.
- public DuplicatedItemException(object? existing = null)
- : base("Already exists in the database.")
- {
- Existing = existing;
- }
-
- ///
- /// The serialization constructor.
- ///
- /// Serialization infos
- /// The serialization context
- protected DuplicatedItemException(SerializationInfo info, StreamingContext context)
- : base(info, context) { }
+ public object? Existing { get; } = existing;
}
diff --git a/back/src/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs b/back/src/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs
index eeeffc79..ef708f84 100644
--- a/back/src/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs
+++ b/back/src/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs
@@ -17,7 +17,6 @@
// along with Kyoo. If not, see .
using System;
-using System.Runtime.Serialization;
namespace Kyoo.Abstractions.Models.Exceptions;
@@ -39,12 +38,4 @@ public class ItemNotFoundException : Exception
/// The message of the exception
public ItemNotFoundException(string message)
: base(message) { }
-
- ///
- /// The serialization constructor
- ///
- /// Serialization infos
- /// The serialization context
- protected ItemNotFoundException(SerializationInfo info, StreamingContext context)
- : base(info, context) { }
}
diff --git a/back/src/Kyoo.Abstractions/Models/Exceptions/UnauthorizedException.cs b/back/src/Kyoo.Abstractions/Models/Exceptions/UnauthorizedException.cs
index af0eae6c..89f09d7a 100644
--- a/back/src/Kyoo.Abstractions/Models/Exceptions/UnauthorizedException.cs
+++ b/back/src/Kyoo.Abstractions/Models/Exceptions/UnauthorizedException.cs
@@ -17,7 +17,6 @@
// along with Kyoo. If not, see .
using System;
-using System.Runtime.Serialization;
namespace Kyoo.Abstractions.Models.Exceptions;
@@ -29,7 +28,4 @@ public class UnauthorizedException : Exception
public UnauthorizedException(string message)
: base(message) { }
-
- protected UnauthorizedException(SerializationInfo info, StreamingContext context)
- : base(info, context) { }
}
diff --git a/back/src/Kyoo.Authentication/Kyoo.Authentication.csproj b/back/src/Kyoo.Authentication/Kyoo.Authentication.csproj
index 83a794b7..7d4e1a32 100644
--- a/back/src/Kyoo.Authentication/Kyoo.Authentication.csproj
+++ b/back/src/Kyoo.Authentication/Kyoo.Authentication.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/back/src/Kyoo.Authentication/Views/AuthApi.cs b/back/src/Kyoo.Authentication/Views/AuthApi.cs
index 4ab46f64..6e3548f2 100644
--- a/back/src/Kyoo.Authentication/Views/AuthApi.cs
+++ b/back/src/Kyoo.Authentication/Views/AuthApi.cs
@@ -446,7 +446,7 @@ public class AuthApi(
{
Stream img = await thumbs.GetUserImage(User.GetIdOrThrow());
// Allow clients to cache the image for 6 month.
- Response.Headers.Add("Cache-Control", $"public, max-age={60 * 60 * 24 * 31 * 6}");
+ Response.Headers.CacheControl = $"public, max-age={60 * 60 * 24 * 31 * 6}";
return File(img, "image/webp", true);
}
diff --git a/back/src/Kyoo.Core/Kyoo.Core.csproj b/back/src/Kyoo.Core/Kyoo.Core.csproj
index 91fabccd..ed7121e3 100644
--- a/back/src/Kyoo.Core/Kyoo.Core.csproj
+++ b/back/src/Kyoo.Core/Kyoo.Core.csproj
@@ -6,14 +6,14 @@
-
+
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/back/src/Kyoo.Core/Views/Helper/CrudThumbsApi.cs b/back/src/Kyoo.Core/Views/Helper/CrudThumbsApi.cs
index c0978878..3d9ec375 100644
--- a/back/src/Kyoo.Core/Views/Helper/CrudThumbsApi.cs
+++ b/back/src/Kyoo.Core/Views/Helper/CrudThumbsApi.cs
@@ -74,10 +74,10 @@ public class CrudThumbsApi : CrudApi
if (!identifier.Match(id => false, slug => slug == "random"))
{
// Allow clients to cache the image for 6 month.
- Response.Headers.Add("Cache-Control", $"public, max-age={60 * 60 * 24 * 31 * 6}");
+ Response.Headers.CacheControl = $"public, max-age={60 * 60 * 24 * 31 * 6}";
}
else
- Response.Headers.Add("Cache-Control", $"public, no-store");
+ Response.Headers.CacheControl = $"public, no-store";
return PhysicalFile(Path.GetFullPath(path), "image/webp", true);
}
diff --git a/back/src/Kyoo.Core/Views/Resources/UserApi.cs b/back/src/Kyoo.Core/Views/Resources/UserApi.cs
index 345037d6..63d00d7d 100644
--- a/back/src/Kyoo.Core/Views/Resources/UserApi.cs
+++ b/back/src/Kyoo.Core/Views/Resources/UserApi.cs
@@ -59,11 +59,11 @@ public class UserApi(ILibraryManager libraryManager, IThumbnailsManager thumbs)
);
Stream img = await thumbs.GetUserImage(gid);
if (identifier.Is("random"))
- Response.Headers.Add("Cache-Control", $"public, no-store");
+ Response.Headers.CacheControl = $"public, no-store";
else
{
// Allow clients to cache the image for 6 month.
- Response.Headers.Add("Cache-Control", $"public, max-age={60 * 60 * 24 * 31 * 6}");
+ Response.Headers.CacheControl = $"public, max-age={60 * 60 * 24 * 31 * 6}";
}
return File(img, "image/webp", true);
}
diff --git a/back/src/Kyoo.Host/Kyoo.Host.csproj b/back/src/Kyoo.Host/Kyoo.Host.csproj
index 69870288..dfed95e7 100644
--- a/back/src/Kyoo.Host/Kyoo.Host.csproj
+++ b/back/src/Kyoo.Host/Kyoo.Host.csproj
@@ -10,14 +10,14 @@
-
-
+
+
-
+
-
-
-
+
+
+
diff --git a/back/src/Kyoo.Host/PluginsStartup.cs b/back/src/Kyoo.Host/PluginsStartup.cs
index 07fa1621..ddd6a57b 100644
--- a/back/src/Kyoo.Host/PluginsStartup.cs
+++ b/back/src/Kyoo.Host/PluginsStartup.cs
@@ -136,42 +136,12 @@ public class PluginsStartup
/// A simple host service provider used to activate plugins instance.
/// The same services as a generic host are available and an has been added.
///
- private class HostServiceProvider : IServiceProvider
+ private class HostServiceProvider(
+ IWebHostEnvironment hostEnvironment,
+ IConfiguration configuration,
+ ILoggerFactory loggerFactory
+ ) : IServiceProvider
{
- ///
- /// The host environment that could be used by plugins to configure themself.
- ///
- private readonly IWebHostEnvironment _hostEnvironment;
-
- ///
- /// The configuration context.
- ///
- private readonly IConfiguration _configuration;
-
- ///
- /// A logger factory used to create a logger for the plugin manager.
- ///
- private readonly ILoggerFactory _loggerFactory;
-
- ///
- /// Create a new that will return given services when asked.
- ///
- ///
- /// The host environment that could be used by plugins to configure themself.
- ///
- /// The configuration context
- /// A logger factory used to create a logger for the plugin manager.
- public HostServiceProvider(
- IWebHostEnvironment hostEnvironment,
- IConfiguration configuration,
- ILoggerFactory loggerFactory
- )
- {
- _hostEnvironment = hostEnvironment;
- _configuration = configuration;
- _loggerFactory = loggerFactory;
- }
-
///
public object GetService(Type serviceType)
{
@@ -179,20 +149,45 @@ public class PluginsStartup
serviceType == typeof(IWebHostEnvironment)
|| serviceType == typeof(IHostEnvironment)
)
- return _hostEnvironment;
+ return hostEnvironment;
if (serviceType == typeof(IConfiguration))
- return _configuration;
- if (serviceType.GetGenericTypeDefinition() == typeof(ILogger<>))
+ return configuration;
+ if (serviceType == typeof(IServiceProviderIsService))
+ return new ProviderIsService();
+ if (
+ serviceType.IsGenericType
+ && serviceType.GetGenericTypeDefinition() == typeof(ILogger<>)
+ )
{
return Utility.RunGenericMethod