diff --git a/Kyoo.sln b/Kyoo.sln
index c240e473..618791ce 100644
--- a/Kyoo.sln
+++ b/Kyoo.sln
@@ -33,6 +33,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Databases", "Databases", "{
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Hosts", "Hosts", "{C569FF25-7E01-484C-9F72-5B99845AD94B}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kyoo.Host.Generic", "src\Kyoo.Host.Generic\Kyoo.Host.Generic.csproj", "{0938459E-2E2B-457F-8120-7D8CA93866A6}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -95,6 +97,10 @@ Global
{7D1A7596-73F6-4D35-842E-A5AD9C620596}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D1A7596-73F6-4D35-842E-A5AD9C620596}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D1A7596-73F6-4D35-842E-A5AD9C620596}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0938459E-2E2B-457F-8120-7D8CA93866A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0938459E-2E2B-457F-8120-7D8CA93866A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0938459E-2E2B-457F-8120-7D8CA93866A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0938459E-2E2B-457F-8120-7D8CA93866A6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{0C8AA7EA-E723-4532-852F-35AA4E8AFED5} = {FEAE1B0E-D797-470F-9030-0EF743575ECC}
@@ -105,5 +111,6 @@ Global
{6515380E-1E57-42DA-B6E3-E1C8A848818A} = {865461CA-EC06-4B42-91CF-8723B0A9BB67}
{D8658BEA-8949-45AC-BEBB-A4FFC4F800F5} = {C569FF25-7E01-484C-9F72-5B99845AD94B}
{98851001-40DD-46A6-94B3-2F8D90722076} = {C569FF25-7E01-484C-9F72-5B99845AD94B}
+ {0938459E-2E2B-457F-8120-7D8CA93866A6} = {C569FF25-7E01-484C-9F72-5B99845AD94B}
EndGlobalSection
EndGlobal
diff --git a/src/Kyoo.Core/Controllers/Transcoder.cs b/src/Kyoo.Core/Controllers/Transcoder.cs
index 42135a86..e23896d9 100644
--- a/src/Kyoo.Core/Controllers/Transcoder.cs
+++ b/src/Kyoo.Core/Controllers/Transcoder.cs
@@ -35,6 +35,7 @@ namespace Kyoo.Core.Controllers
///
public class Transcoder : ITranscoder
{
+#pragma warning disable IDE1006
///
/// The class that interact with the transcoder written in C.
///
@@ -156,6 +157,7 @@ namespace Kyoo.Core.Controllers
return tracks;
}
}
+#pragma warning restore IDE1006
///
/// The file system used to retrieve the extra directory of shows to know where to extract information.
diff --git a/src/Kyoo.Core/CoreModule.cs b/src/Kyoo.Core/CoreModule.cs
index dd5f2e39..c52dee27 100644
--- a/src/Kyoo.Core/CoreModule.cs
+++ b/src/Kyoo.Core/CoreModule.cs
@@ -22,7 +22,6 @@ using System.Linq;
using Autofac;
using Autofac.Core;
using Autofac.Core.Registration;
-using Autofac.Extras.AttributeMetadata;
using Kyoo.Abstractions;
using Kyoo.Abstractions.Controllers;
using Kyoo.Abstractions.Models.Utils;
@@ -37,7 +36,6 @@ using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
-using Serilog;
using IMetadataProvider = Kyoo.Abstractions.Controllers.IMetadataProvider;
using JsonOptions = Kyoo.Core.Api.JsonOptions;
@@ -60,7 +58,6 @@ namespace Kyoo.Core
///
public Dictionary Configuration => new()
{
- { BasicOptions.Path, typeof(BasicOptions) },
{ TaskOptions.Path, typeof(TaskOptions) },
{ MediaOptions.Path, typeof(MediaOptions) },
{ "database", null },
@@ -70,14 +67,9 @@ namespace Kyoo.Core
///
public void Configure(ContainerBuilder builder)
{
- builder.RegisterModule();
-
- builder.RegisterComposite().InstancePerLifetimeScope();
builder.RegisterType().As().SingleInstance();
builder.RegisterType().As().SingleInstance();
- builder.RegisterType().As().As().SingleInstance();
-
builder.RegisterType().As().SingleInstance();
builder.RegisterType().As().SingleInstance();
builder.RegisterType().As().InstancePerLifetimeScope();
@@ -172,7 +164,6 @@ namespace Kyoo.Core
app.UseHsts();
}
}, SA.Before),
- SA.New(app => app.UseSerilogRequestLogging(), SA.Before),
SA.New(app => app.UseResponseCompression(), SA.Routing + 1),
SA.New(app => app.UseRouting(), SA.Routing),
SA.New(app => app.UseEndpoints(x => x.MapControllers()), SA.Endpoint)
diff --git a/src/Kyoo.Core/Kyoo.Core.csproj b/src/Kyoo.Core/Kyoo.Core.csproj
index 03e8785e..37490d89 100644
--- a/src/Kyoo.Core/Kyoo.Core.csproj
+++ b/src/Kyoo.Core/Kyoo.Core.csproj
@@ -14,16 +14,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -32,13 +22,6 @@
-
-
-
-
-
-
-
@@ -57,10 +40,4 @@
false
-
-
-
-
-
-
diff --git a/src/Kyoo.Host.Console/Kyoo.Host.Console.csproj b/src/Kyoo.Host.Console/Kyoo.Host.Console.csproj
index 0cd712be..d123b9e7 100644
--- a/src/Kyoo.Host.Console/Kyoo.Host.Console.csproj
+++ b/src/Kyoo.Host.Console/Kyoo.Host.Console.csproj
@@ -18,6 +18,6 @@
-
+
diff --git a/src/Kyoo.Host.Console/Program.cs b/src/Kyoo.Host.Console/Program.cs
index e90bd4d4..92b7f673 100644
--- a/src/Kyoo.Host.Console/Program.cs
+++ b/src/Kyoo.Host.Console/Program.cs
@@ -17,7 +17,7 @@
// along with Kyoo. If not, see .
using System.Threading.Tasks;
-using Kyoo.Core;
+using Kyoo.Host.Generic;
using Microsoft.AspNetCore.Hosting;
namespace Kyoo.Host.Console
diff --git a/src/Kyoo.Core/Application.cs b/src/Kyoo.Host.Generic/Application.cs
similarity index 99%
rename from src/Kyoo.Core/Application.cs
rename to src/Kyoo.Host.Generic/Application.cs
index f1ee2fda..1dce4573 100644
--- a/src/Kyoo.Core/Application.cs
+++ b/src/Kyoo.Host.Generic/Application.cs
@@ -37,7 +37,7 @@ using Serilog.Templates;
using Serilog.Templates.Themes;
using ILogger = Serilog.ILogger;
-namespace Kyoo.Core
+namespace Kyoo.Host.Generic
{
///
/// The main implementation of .
diff --git a/src/Kyoo.Core/Controllers/FileSystems/FileSystemComposite.cs b/src/Kyoo.Host.Generic/Contollers/FileSystemComposite.cs
similarity index 99%
rename from src/Kyoo.Core/Controllers/FileSystems/FileSystemComposite.cs
rename to src/Kyoo.Host.Generic/Contollers/FileSystemComposite.cs
index ad5b2b32..0a9eec86 100644
--- a/src/Kyoo.Core/Controllers/FileSystems/FileSystemComposite.cs
+++ b/src/Kyoo.Host.Generic/Contollers/FileSystemComposite.cs
@@ -31,7 +31,7 @@ using Kyoo.Core.Models.Options;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
-namespace Kyoo.Core.Controllers
+namespace Kyoo.Host.Generic.Controllers
{
///
/// A composite that merge every available
diff --git a/src/Kyoo.Core/Controllers/PluginManager.cs b/src/Kyoo.Host.Generic/Contollers/PluginManager.cs
similarity index 99%
rename from src/Kyoo.Core/Controllers/PluginManager.cs
rename to src/Kyoo.Host.Generic/Contollers/PluginManager.cs
index 80464d97..72f7bb08 100644
--- a/src/Kyoo.Core/Controllers/PluginManager.cs
+++ b/src/Kyoo.Host.Generic/Contollers/PluginManager.cs
@@ -28,7 +28,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-namespace Kyoo.Core.Controllers
+namespace Kyoo.Host.Generic.Controllers
{
///
/// An implementation of .
diff --git a/src/Kyoo.Core/Controllers/TaskManager.cs b/src/Kyoo.Host.Generic/Contollers/TaskManager.cs
similarity index 99%
rename from src/Kyoo.Core/Controllers/TaskManager.cs
rename to src/Kyoo.Host.Generic/Contollers/TaskManager.cs
index 334576e4..e036cae4 100644
--- a/src/Kyoo.Core/Controllers/TaskManager.cs
+++ b/src/Kyoo.Host.Generic/Contollers/TaskManager.cs
@@ -33,7 +33,7 @@ using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-namespace Kyoo.Core.Controllers
+namespace Kyoo.Host.Generic.Controllers
{
///
/// A service to handle long running tasks and a background runner.
diff --git a/src/Kyoo.Host.Generic/HostModule.cs b/src/Kyoo.Host.Generic/HostModule.cs
new file mode 100644
index 00000000..a6538d1b
--- /dev/null
+++ b/src/Kyoo.Host.Generic/HostModule.cs
@@ -0,0 +1,84 @@
+// Kyoo - A portable and vast media library solution.
+// Copyright (c) Kyoo.
+//
+// See AUTHORS.md and LICENSE file in the project root for full license information.
+//
+// Kyoo is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// Kyoo is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Kyoo. If not, see .
+
+using System;
+using System.Collections.Generic;
+using Autofac;
+using Autofac.Extras.AttributeMetadata;
+using Kyoo.Abstractions;
+using Kyoo.Abstractions.Controllers;
+using Kyoo.Core.Models.Options;
+using Kyoo.Core.Tasks;
+using Kyoo.Host.Generic.Controllers;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.Extensions.Hosting;
+using Serilog;
+
+namespace Kyoo.Host.Generic
+{
+ ///
+ /// A module that registers host controllers and other needed things.
+ ///
+ public class HostModule : IPlugin
+ {
+ ///
+ public string Slug => "host";
+
+ ///
+ public string Name => "Host";
+
+ ///
+ public string Description => "A module that registers host controllers and other needed things.";
+
+ ///
+ public Dictionary Configuration => new()
+ {
+ { BasicOptions.Path, typeof(BasicOptions) },
+ };
+
+ ///
+ /// The plugin manager that loaded all plugins.
+ ///
+ private readonly IPluginManager _plugins;
+
+ ///
+ /// Create a new .
+ ///
+ /// The plugin manager that loaded all plugins.
+ public HostModule(IPluginManager plugins)
+ {
+ _plugins = plugins;
+ }
+
+ ///
+ public void Configure(ContainerBuilder builder)
+ {
+ builder.RegisterModule();
+ builder.RegisterInstance(_plugins).As().ExternallyOwned();
+ builder.RegisterComposite().InstancePerLifetimeScope();
+ builder.RegisterType().As().As().SingleInstance();
+ builder.RegisterTask();
+ }
+
+ ///
+ public IEnumerable ConfigureSteps => new[]
+ {
+ SA.New(app => app.UseSerilogRequestLogging(), SA.Before)
+ };
+ }
+}
diff --git a/src/Kyoo.Host.Generic/Kyoo.Host.Generic.csproj b/src/Kyoo.Host.Generic/Kyoo.Host.Generic.csproj
new file mode 100644
index 00000000..9ad8a264
--- /dev/null
+++ b/src/Kyoo.Host.Generic/Kyoo.Host.Generic.csproj
@@ -0,0 +1,40 @@
+
+
+
+ net5.0
+ default
+ Kyoo.Host.Generic
+ Kyoo.Host.Generic
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Kyoo.Core/PluginsStartup.cs b/src/Kyoo.Host.Generic/PluginsStartup.cs
similarity index 95%
rename from src/Kyoo.Core/PluginsStartup.cs
rename to src/Kyoo.Host.Generic/PluginsStartup.cs
index 047077d5..67e9f621 100644
--- a/src/Kyoo.Core/PluginsStartup.cs
+++ b/src/Kyoo.Host.Generic/PluginsStartup.cs
@@ -21,12 +21,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Autofac;
-using Kyoo.Abstractions;
using Kyoo.Abstractions.Controllers;
using Kyoo.Authentication;
-using Kyoo.Core.Controllers;
+using Kyoo.Core;
using Kyoo.Core.Models.Options;
-using Kyoo.Core.Tasks;
+using Kyoo.Host.Generic.Controllers;
using Kyoo.Postgresql;
using Kyoo.SqLite;
using Kyoo.Swagger;
@@ -42,7 +41,7 @@ using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-namespace Kyoo.Core
+namespace Kyoo.Host.Generic
{
///
/// The Startup class is used to configure the AspNet's webhost.
@@ -59,6 +58,11 @@ namespace Kyoo.Core
///
private readonly IConfiguration _configuration;
+ ///
+ /// The plugin that adds controllers and tasks specific to this host.
+ ///
+ private readonly IPlugin _hostModule;
+
///
/// Created from the DI container, those services are needed to load information and instantiate plugins.s
///
@@ -70,6 +74,7 @@ namespace Kyoo.Core
{
_plugins = plugins;
_configuration = configuration;
+ _hostModule = new HostModule(_plugins);
_plugins.LoadPlugins(
typeof(CoreModule),
typeof(WebAppModule),
@@ -112,10 +117,12 @@ namespace Kyoo.Core
foreach (Assembly assembly in _plugins.GetAllPlugins().Select(x => x.GetType().Assembly))
services.AddMvcCore().AddApplicationPart(assembly);
+ _hostModule.Configure(services);
foreach (IPlugin plugin in _plugins.GetAllPlugins())
plugin.Configure(services);
IEnumerable> configTypes = _plugins.GetAllPlugins()
+ .Append(_hostModule)
.SelectMany(x => x.Configuration)
.Where(x => x.Value != null);
foreach ((string path, Type type) in configTypes)
@@ -135,9 +142,7 @@ namespace Kyoo.Core
/// The builder to configure.
public void ConfigureContainer(ContainerBuilder builder)
{
- builder.RegisterInstance(_plugins).As().ExternallyOwned();
- builder.RegisterTask();
-
+ _hostModule.Configure(builder);
foreach (IPlugin plugin in _plugins.GetAllPlugins())
plugin.Configure(builder);
}
@@ -151,6 +156,7 @@ namespace Kyoo.Core
public void Configure(IApplicationBuilder app, ILifetimeScope container, IConfigurationManager config)
{
IEnumerable steps = _plugins.GetAllPlugins()
+ .Append(_hostModule)
.SelectMany(x => x.ConfigureSteps)
.OrderByDescending(x => x.Priority);
@@ -161,6 +167,7 @@ namespace Kyoo.Core
step.Run(provider);
IEnumerable> pluginConfig = _plugins.GetAllPlugins()
+ .Append(_hostModule)
.SelectMany(x => x.Configuration)
.GroupBy(x => x.Key.Split(':').First())
.Select(x => x
diff --git a/src/Kyoo.Core/Tasks/PluginInitializer.cs b/src/Kyoo.Host.Generic/Tasks/PluginInitializer.cs
similarity index 100%
rename from src/Kyoo.Core/Tasks/PluginInitializer.cs
rename to src/Kyoo.Host.Generic/Tasks/PluginInitializer.cs
diff --git a/src/Kyoo.Core/settings.json b/src/Kyoo.Host.Generic/settings.json
similarity index 100%
rename from src/Kyoo.Core/settings.json
rename to src/Kyoo.Host.Generic/settings.json
diff --git a/src/Kyoo.Host.WindowsTrait/Program.cs b/src/Kyoo.Host.WindowsTrait/Program.cs
index b9eabfbc..15b2ec10 100644
--- a/src/Kyoo.Host.WindowsTrait/Program.cs
+++ b/src/Kyoo.Host.WindowsTrait/Program.cs
@@ -18,7 +18,7 @@
using System.Threading.Tasks;
using Autofac;
-using Kyoo.Core;
+using Kyoo.Host.Generic;
namespace Kyoo.Host.WindowsTrait
{
diff --git a/src/Kyoo.WebApp/Front b/src/Kyoo.WebApp/Front
index 326c9aa9..a3da5f1e 160000
--- a/src/Kyoo.WebApp/Front
+++ b/src/Kyoo.WebApp/Front
@@ -1 +1 @@
-Subproject commit 326c9aa9d35a265fbada2f6b268a2740a5beab8e
+Subproject commit a3da5f1e6edb982e3b71792a7ea6fcd45661c337
diff --git a/tests/Kyoo.Tests/Kyoo.Tests.csproj b/tests/Kyoo.Tests/Kyoo.Tests.csproj
index c02609c5..f51fc87a 100644
--- a/tests/Kyoo.Tests/Kyoo.Tests.csproj
+++ b/tests/Kyoo.Tests/Kyoo.Tests.csproj
@@ -30,7 +30,7 @@
-
+