diff --git a/src/Kyoo.Core/Application.cs b/src/Kyoo.Core/Application.cs
index 7b0f4961..f1ee2fda 100644
--- a/src/Kyoo.Core/Application.cs
+++ b/src/Kyoo.Core/Application.cs
@@ -283,7 +283,7 @@ namespace Kyoo.Core
builder.ReadFrom.Services(services);
const string template =
- "[{@t:HH:mm:ss} {@l:u3} {Substring(SourceContext, LastIndexOf(SourceContext, '.') + 1), 15} "
+ "[{@t:HH:mm:ss} {@l:u3} {Substring(SourceContext, LastIndexOf(SourceContext, '.') + 1), 25} "
+ "({@i:D10})] {@m}{#if not EndsWith(@m, '\n')}\n{#end}{@x}";
if (SystemdHelpers.IsSystemdService())
diff --git a/src/Kyoo.Core/Controllers/Transcoder.cs b/src/Kyoo.Core/Controllers/Transcoder.cs
index a29966ba..04510a3d 100644
--- a/src/Kyoo.Core/Controllers/Transcoder.cs
+++ b/src/Kyoo.Core/Controllers/Transcoder.cs
@@ -27,6 +27,8 @@ using Microsoft.Extensions.Options;
// We use threads so tasks are not always awaited.
#pragma warning disable 4014
+// Private items that are external can't start with an _
+#pragma warning disable IDE1006
namespace Kyoo.Core.Controllers
{
diff --git a/src/Kyoo.Core/Kyoo.Core.csproj b/src/Kyoo.Core/Kyoo.Core.csproj
index 7b7b3cca..58a23762 100644
--- a/src/Kyoo.Core/Kyoo.Core.csproj
+++ b/src/Kyoo.Core/Kyoo.Core.csproj
@@ -38,6 +38,7 @@
+
diff --git a/src/Kyoo.Core/PluginsStartup.cs b/src/Kyoo.Core/PluginsStartup.cs
index 1a554a8b..77618842 100644
--- a/src/Kyoo.Core/PluginsStartup.cs
+++ b/src/Kyoo.Core/PluginsStartup.cs
@@ -28,6 +28,7 @@ using Kyoo.Core.Models.Options;
using Kyoo.Core.Tasks;
using Kyoo.Postgresql;
using Kyoo.SqLite;
+using Kyoo.Swagger;
using Kyoo.TheMovieDb;
using Kyoo.TheTvdb;
using Kyoo.Utils;
@@ -75,7 +76,8 @@ namespace Kyoo.Core
typeof(PostgresModule),
typeof(SqLiteModule),
typeof(PluginTvdb),
- typeof(PluginTmdb)
+ typeof(PluginTmdb),
+ typeof(SwaggerModule)
);
}
diff --git a/src/Kyoo.Core/Views/Helper/CrudApi.cs b/src/Kyoo.Core/Views/Helper/CrudApi.cs
index c621b993..8bbc47dc 100644
--- a/src/Kyoo.Core/Views/Helper/CrudApi.cs
+++ b/src/Kyoo.Core/Views/Helper/CrudApi.cs
@@ -208,6 +208,7 @@ namespace Kyoo.Core.Api
return Ok();
}
+ [HttpDelete]
[PartialPermission(Kind.Delete)]
public virtual async Task Delete(Dictionary where)
{
diff --git a/src/Kyoo.Core/settings.json b/src/Kyoo.Core/settings.json
index 64466270..6c472a6e 100644
--- a/src/Kyoo.Core/settings.json
+++ b/src/Kyoo.Core/settings.json
@@ -8,7 +8,7 @@
"metadataInShow": true,
"metadataPath": "metadata/"
},
-
+
"database": {
"enabled": "sqlite",
"configurations": {
@@ -58,7 +58,7 @@
"^(?.+)\\.(?\\w{1,3})\\.(?default\\.)?(?forced\\.)?.*$"
]
},
-
+
"authentication": {
"certificate": {
"file": "certificate.pfx",
@@ -72,7 +72,7 @@
"profilePicturePath": "users/",
"clients": []
},
-
+
"tvdb": {
"apiKey": ""
},
diff --git a/src/Kyoo.Swagger/SwaggerModule.cs b/src/Kyoo.Swagger/SwaggerModule.cs
index 250efbbd..a8aea7d4 100644
--- a/src/Kyoo.Swagger/SwaggerModule.cs
+++ b/src/Kyoo.Swagger/SwaggerModule.cs
@@ -16,12 +16,68 @@
// 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 System.IO;
+using Kyoo.Abstractions.Controllers;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.OpenApi.Models;
+
namespace Kyoo.Swagger
{
///
/// A module to enable a swagger interface and an OpenAPI endpoint to document Kyoo.
///
- public class SwaggerModule
+ public class SwaggerModule : IPlugin
{
+ ///
+ public string Slug => "swagger";
+
+ ///
+ public string Name => "Swagger";
+
+ ///
+ public string Description => "A swagger interface and an OpenAPI endpoint to document Kyoo.";
+
+ ///
+ public Dictionary Configuration => new();
+
+ ///
+ public void Configure(IServiceCollection services)
+ {
+ services.AddSwaggerGen(x =>
+ {
+ x.SwaggerDoc("v1", new OpenApiInfo
+ {
+ Version = "v1",
+ Title = "Kyoo API",
+ Description = "The Kyoo's public API",
+ Contact = new OpenApiContact
+ {
+ Name = "Kyoo's github",
+ Url = new Uri("https://github.com/AnonymusRaccoon/Kyoo/issues/new/choose")
+ },
+ License = new OpenApiLicense
+ {
+ Name = "GPL-3.0-or-later",
+ Url = new Uri("https://github.com/AnonymusRaccoon/Kyoo/blob/master/LICENSE")
+ }
+ });
+
+ foreach (string documentation in Directory.GetFiles(AppContext.BaseDirectory, "*.xml"))
+ x.IncludeXmlComments(documentation);
+ });
+ }
+
+ ///
+ public IEnumerable ConfigureSteps => new IStartupAction[]
+ {
+ SA.New(app => app.UseSwagger(), SA.Before + 1),
+ SA.New(app => app.UseSwaggerUI(x =>
+ {
+ x.SwaggerEndpoint("/swagger/v1/swagger.json", "Kyoo v1");
+ }), SA.Before)
+ };
}
}