diff --git a/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs b/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs
index 1fdb34f0..6a84977f 100644
--- a/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs
+++ b/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs
@@ -33,6 +33,7 @@ namespace Kyoo.Abstractions.Models
///
/// An arbitrary index should not be used, instead use indexes from
///
+ /// {"0": "example.com/dune/poster"}
public Dictionary Images { get; set; }
}
diff --git a/src/Kyoo.Core/Views/Helper/Serializers/JsonSerializerContract.cs b/src/Kyoo.Core/Views/Helper/Serializers/JsonSerializerContract.cs
index 429c7c60..b1e58c1b 100644
--- a/src/Kyoo.Core/Views/Helper/Serializers/JsonSerializerContract.cs
+++ b/src/Kyoo.Core/Views/Helper/Serializers/JsonSerializerContract.cs
@@ -105,7 +105,7 @@ namespace Kyoo.Core.Api
ShouldSerialize = x =>
{
IThumbnails thumb = (IThumbnails)x;
- return thumb.Images?.ContainsKey(id) == true;
+ return thumb?.Images?.ContainsKey(id) == true;
},
ValueProvider = new ThumbnailProvider(_options.Value.PublicUrl, id)
});
diff --git a/src/Kyoo.Core/Views/Resources/CollectionApi.cs b/src/Kyoo.Core/Views/Resources/CollectionApi.cs
index c004fc43..3cee88b6 100644
--- a/src/Kyoo.Core/Views/Resources/CollectionApi.cs
+++ b/src/Kyoo.Core/Views/Resources/CollectionApi.cs
@@ -91,7 +91,7 @@ namespace Kyoo.Core.Api
try
{
ICollection resources = await _libraryManager.GetAll(
- ApiHelper.ParseWhere(where, x => x.Collections.Any(identifier.IsSame)),
+ ApiHelper.ParseWhere(where, identifier.IsContainedIn(x => x.Collections)),
new Sort(sortBy),
new Pagination(limit, afterID)
);
@@ -135,7 +135,7 @@ namespace Kyoo.Core.Api
try
{
ICollection resources = await _libraryManager.GetAll(
- ApiHelper.ParseWhere(where, x => x.Collections.Any(identifier.IsSame)),
+ ApiHelper.ParseWhere(where, identifier.IsContainedIn(x => x.Collections)),
new Sort(sortBy),
new Pagination(limit, afterID)
);
diff --git a/src/Kyoo.Swagger/SwaggerModule.cs b/src/Kyoo.Swagger/SwaggerModule.cs
index b929ed62..88f1d7e1 100644
--- a/src/Kyoo.Swagger/SwaggerModule.cs
+++ b/src/Kyoo.Swagger/SwaggerModule.cs
@@ -97,6 +97,7 @@ namespace Kyoo.Swagger
x.IsNullableRaw = false;
x.Type = JsonObjectType.String | JsonObjectType.Integer;
}));
+ document.SchemaProcessors.Add(new ThumbnailProcessor());
document.AddSecurity("Kyoo", new OpenApiSecurityScheme
{
diff --git a/src/Kyoo.Swagger/ThumbnailProcessor.cs b/src/Kyoo.Swagger/ThumbnailProcessor.cs
new file mode 100644
index 00000000..dba8d682
--- /dev/null
+++ b/src/Kyoo.Swagger/ThumbnailProcessor.cs
@@ -0,0 +1,49 @@
+// 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 Kyoo.Abstractions.Models;
+using NJsonSchema;
+using NJsonSchema.Generation;
+
+namespace Kyoo.Swagger
+{
+ ///
+ /// An operation processor to add computed fields of .
+ ///
+ public class ThumbnailProcessor : ISchemaProcessor
+ {
+ ///
+ public void Process(SchemaProcessorContext context)
+ {
+ if (!context.Type.IsAssignableTo(typeof(IThumbnails)))
+ return;
+ foreach ((int _, string imageP) in Images.ImageName)
+ {
+ string image = imageP.ToLower()[0] + imageP[1..];
+ context.Schema.Properties.Add(image, new JsonSchemaProperty
+ {
+ Type = JsonObjectType.String,
+ IsNullableRaw = true,
+ Description = $"An url to the {image} of this resource. If this resource does not have an image, " +
+ $"the link will be null. If the kyoo's instance is not capable of handling this kind of image " +
+ $"for the specific resource, this field won't be present."
+ });
+ }
+ }
+ }
+}
diff --git a/src/Kyoo.WebApp/Front b/src/Kyoo.WebApp/Front
index 846dbcb2..0170abcf 160000
--- a/src/Kyoo.WebApp/Front
+++ b/src/Kyoo.WebApp/Front
@@ -1 +1 @@
-Subproject commit 846dbcb22ed29244a2384d240180c821ec18df2b
+Subproject commit 0170abcffd4da197ccbf1155623311b07777314b