diff --git a/src/Lumina.Presentation.Web/Common/DTO/Plugins/LibraryArtworkProviderDto.cs b/src/Lumina.Presentation.Web/Common/DTO/Plugins/LibraryArtworkProviderDto.cs
new file mode 100644
index 00000000..2c62d195
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/DTO/Plugins/LibraryArtworkProviderDto.cs
@@ -0,0 +1,33 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.DTO.Plugins;
+
+///
+/// Data transfer object for an artwork provider configured for a media library.
+///
+[DebuggerDisplay("Name: {Name}")]
+public class LibraryArtworkProviderDto
+{
+ ///
+ /// Gets or sets the unique identifier of the plugin providing the artwork.
+ ///
+ public Guid PluginId { get; set; }
+
+ ///
+ /// Gets or sets the display name of the artwork provider.
+ ///
+ public string Name { get; set; } = string.Empty;
+
+ ///
+ /// Gets or sets whether the artwork provider is enabled for the media library.
+ ///
+ public bool IsEnabled { get; set; }
+
+ ///
+ /// Gets or sets the rank of the artwork provider, determining the order in which providers are tried.
+ ///
+ public int Rank { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetArtworkProvidersRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetArtworkProvidersRequest.cs
new file mode 100644
index 00000000..f53a3f16
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetArtworkProvidersRequest.cs
@@ -0,0 +1,15 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
+
+///
+/// Represents the request for retrieving the artwork providers of a media library.
+///
+/// The unique identifier of the media library whose artwork providers are retrieved.
+[DebuggerDisplay("LibraryId: {LibraryId}")]
+public record GetArtworkProvidersRequest(
+ Guid LibraryId
+);
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequest.cs
new file mode 100644
index 00000000..173bb1e2
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequest.cs
@@ -0,0 +1,24 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Plugins;
+
+///
+/// Represents a request to reorder the artwork providers of a media library.
+///
+[DebuggerDisplay("LibraryId: {LibraryId}")]
+public class ReorderLibraryArtworkProvidersRequest
+{
+ ///
+ /// Gets or sets the Id of the media library whose artwork providers are reordered.
+ ///
+ public Guid LibraryId { get; set; }
+
+ ///
+ /// Gets or sets the plugin Ids in the new order, from highest to lowest rank.
+ ///
+ public List PluginIds { get; set; } = [];
+}
diff --git a/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequest.cs
new file mode 100644
index 00000000..e5178468
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequest.cs
@@ -0,0 +1,28 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Presentation.Web.Common.Requests.Plugins;
+
+///
+/// Represents a request to enable or disable an artwork provider for a media library.
+///
+[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
+public class SetLibraryArtworkProviderEnabledRequest
+{
+ ///
+ /// Gets or sets the Id of the media library whose artwork provider is enabled or disabled.
+ ///
+ public Guid LibraryId { get; set; }
+
+ ///
+ /// Gets or sets the unique identifier of the plugin providing the artwork.
+ ///
+ public Guid PluginId { get; set; }
+
+ ///
+ /// Gets or sets whether the artwork provider should be enabled for the media library.
+ ///
+ public bool IsEnabled { get; set; }
+}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Libraries.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Libraries.cs
index ceef0553..91b14c52 100644
--- a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Libraries.cs
+++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Libraries.cs
@@ -24,5 +24,8 @@ public static partial class ApiRoutes
public const string GET_LIBRARY_METADATA_PROVIDERS = "libraries/{libraryId}/metadata-providers";
public const string SET_LIBRARY_METADATA_PROVIDER_ENABLED = "libraries/{libraryId}/metadata-providers/{pluginId}/enabled";
public const string REORDER_LIBRARY_METADATA_PROVIDERS = "libraries/{libraryId}/metadata-providers/reorder";
+ public const string GET_LIBRARY_ARTWORK_PROVIDERS = "libraries/{libraryId}/artwork-providers";
+ public const string SET_LIBRARY_ARTWORK_PROVIDER_ENABLED = "libraries/{libraryId}/artwork-providers/{pluginId}/enabled";
+ public const string REORDER_LIBRARY_ARTWORK_PROVIDERS = "libraries/{libraryId}/artwork-providers/reorder";
}
}
diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.LibraryManagement.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.LibraryManagement.cs
index 3a54fc3a..7159d3af 100644
--- a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.LibraryManagement.cs
+++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.LibraryManagement.cs
@@ -25,5 +25,8 @@ public static partial class WebRoutes
public const string GET_METADATA_PROVIDERS = "{culture}/libraries/manage/api-get-metadata-providers/{libraryId}";
public const string SET_METADATA_PROVIDER_ENABLED = "{culture}/libraries/manage/api-set-metadata-provider-enabled";
public const string REORDER_METADATA_PROVIDERS = "{culture}/libraries/manage/api-reorder-metadata-providers";
+ public const string GET_ARTWORK_PROVIDERS = "{culture}/libraries/manage/api-get-artwork-providers/{libraryId}";
+ public const string SET_ARTWORK_PROVIDER_ENABLED = "{culture}/libraries/manage/api-set-artwork-provider-enabled";
+ public const string REORDER_ARTWORK_PROVIDERS = "{culture}/libraries/manage/api-reorder-artwork-providers";
}
}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/GetArtworkProviders/GetArtworkProvidersEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/GetArtworkProviders/GetArtworkProvidersEndpoint.cs
new file mode 100644
index 00000000..b4b37fc7
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/GetArtworkProviders/GetArtworkProvidersEndpoint.cs
@@ -0,0 +1,54 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.Api;
+using Lumina.Presentation.Web.Common.DTO.Plugins;
+using Lumina.Presentation.Web.Common.Requests.Library.Management;
+using Lumina.Presentation.Web.Common.Routes;
+using Lumina.Presentation.Web.Core.Endpoints.Common;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Http;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Library.Management.GetArtworkProviders;
+
+///
+/// API endpoint for the /{culture}/libraries/manage/api-get-artwork-providers/{libraryId} route.
+///
+public class GetArtworkProvidersEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public GetArtworkProvidersEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.GET);
+ Routes(WebRoutes.LibraryManagement.GET_ARTWORK_PROVIDERS);
+ DontAutoTag();
+ Options(options => options.WithTags("Libraries"));
+ }
+
+ ///
+ /// Retrieves the artwork providers of a media library.
+ ///
+ /// The request containing the Id of the media library whose artwork providers are retrieved.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task ExecuteAsync(GetArtworkProvidersRequest request, CancellationToken cancellationToken)
+ {
+ LibraryArtworkProviderDto[] response = await _apiHttpClient.GetAsync(ApiRoutes.Libraries.GET_LIBRARY_ARTWORK_PROVIDERS.Replace("{libraryId}", request.LibraryId.ToString()), cancellationToken).ConfigureAwait(false);
+ return JsonSuccess(response);
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/GetArtworkProviders/GetArtworkProvidersEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/GetArtworkProviders/GetArtworkProvidersEndpointSummary.cs
new file mode 100644
index 00000000..33e85d64
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/GetArtworkProviders/GetArtworkProvidersEndpointSummary.cs
@@ -0,0 +1,30 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.DTO.Common;
+using Lumina.Presentation.Web.Common.DTO.Plugins;
+using Lumina.Presentation.Web.Common.Requests.Library.Management;
+using System;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Library.Management.GetArtworkProviders;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class GetArtworkProvidersEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public GetArtworkProvidersEndpointSummary()
+ {
+ Summary = "Retrieves the artwork providers of a media library.";
+ Description = "Retrieves the artwork providers of the media library identified by the request.";
+
+ RequestParam(r => r.LibraryId, "The unique identifier of the media library whose artwork providers are retrieved.");
+
+ Response(200, "The artwork providers of the media library are returned.", example: new SuccessResponse(true, default));
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpoint.cs
new file mode 100644
index 00000000..fc468634
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpoint.cs
@@ -0,0 +1,54 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.Api;
+using Lumina.Presentation.Web.Common.Requests.Plugins;
+using Lumina.Presentation.Web.Common.Routes;
+using Lumina.Presentation.Web.Core.Endpoints.Common;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Http;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Library.Management.ReorderArtworkProviders;
+
+///
+/// API endpoint for the /{culture}/libraries/manage/api-reorder-artwork-providers route.
+///
+public class ReorderArtworkProvidersEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public ReorderArtworkProvidersEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.PUT);
+ Routes(WebRoutes.LibraryManagement.REORDER_ARTWORK_PROVIDERS);
+ DontAutoTag();
+ Options(options => options.WithTags("Libraries"));
+ EnableAntiforgery();
+ }
+
+ ///
+ /// Reorders the artwork providers of a media library.
+ ///
+ /// The request containing the Id of the media library and the plugin Ids in the new order.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task ExecuteAsync(ReorderLibraryArtworkProvidersRequest request, CancellationToken cancellationToken)
+ {
+ await _apiHttpClient.PutAsync(ApiRoutes.Libraries.REORDER_LIBRARY_ARTWORK_PROVIDERS.Replace("{libraryId}", request.LibraryId.ToString()), request, cancellationToken).ConfigureAwait(false);
+ return JsonSuccess();
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpointSummary.cs
new file mode 100644
index 00000000..8614c515
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpointSummary.cs
@@ -0,0 +1,34 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.DTO.Common;
+using Lumina.Presentation.Web.Common.Requests.Plugins;
+using System;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Library.Management.ReorderArtworkProviders;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class ReorderArtworkProvidersEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public ReorderArtworkProvidersEndpointSummary()
+ {
+ Summary = "Reorders the artwork providers of a media library.";
+ Description = "Reorders the artwork providers of the media library identified by the request, in the provided order.";
+ RequestParam(r => r.LibraryId, "The Id of the media library whose artwork providers are reordered. Required.");
+
+ ExampleRequest = new ReorderLibraryArtworkProvidersRequest
+ {
+ LibraryId = Guid.NewGuid(),
+ PluginIds = [Guid.NewGuid(), Guid.NewGuid()]
+ };
+
+ Response(200, "The artwork providers of the media library are reordered.", example: new SuccessResponse(true));
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpoint.cs
new file mode 100644
index 00000000..4d454ce8
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpoint.cs
@@ -0,0 +1,54 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.Api;
+using Lumina.Presentation.Web.Common.Requests.Plugins;
+using Lumina.Presentation.Web.Common.Routes;
+using Lumina.Presentation.Web.Core.Endpoints.Common;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Http;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Library.Management.SetArtworkProviderEnabled;
+
+///
+/// API endpoint for the /{culture}/libraries/manage/api-set-artwork-provider-enabled route.
+///
+public class SetArtworkProviderEnabledEndpoint : BaseEndpoint
+{
+ private readonly IApiHttpClient _apiHttpClient;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected service for interactions with the API.
+ public SetArtworkProviderEnabledEndpoint(IApiHttpClient apiHttpClient)
+ {
+ _apiHttpClient = apiHttpClient;
+ }
+
+ ///
+ /// Configures the endpoint.
+ ///
+ public override void Configure()
+ {
+ base.Configure();
+ Verbs(Http.PUT);
+ Routes(WebRoutes.LibraryManagement.SET_ARTWORK_PROVIDER_ENABLED);
+ DontAutoTag();
+ Options(options => options.WithTags("Libraries"));
+ EnableAntiforgery();
+ }
+
+ ///
+ /// Enables or disables an artwork provider of a media library.
+ ///
+ /// The request containing the Ids of the media library and of the plugin, and whether the provider is enabled.
+ /// Cancellation token that can be used to stop the execution.
+ public override async Task ExecuteAsync(SetLibraryArtworkProviderEnabledRequest request, CancellationToken cancellationToken)
+ {
+ await _apiHttpClient.PutAsync(ApiRoutes.Libraries.SET_LIBRARY_ARTWORK_PROVIDER_ENABLED.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{pluginId}", request.PluginId.ToString()), request, cancellationToken).ConfigureAwait(false);
+ return JsonSuccess();
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpointSummary.cs
new file mode 100644
index 00000000..a926f9d0
--- /dev/null
+++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpointSummary.cs
@@ -0,0 +1,37 @@
+#region ========================================================================= USING =====================================================================================
+using FastEndpoints;
+using Lumina.Presentation.Web.Common.DTO.Common;
+using Lumina.Presentation.Web.Common.Requests.Plugins;
+using System;
+using System.Diagnostics.CodeAnalysis;
+#endregion
+
+namespace Lumina.Presentation.Web.Core.Endpoints.Library.Management.SetArtworkProviderEnabled;
+
+///
+/// Class used for providing a textual description for the endpoint, for OpenAPI.
+///
+[ExcludeFromCodeCoverage]
+public class SetArtworkProviderEnabledEndpointSummary : Summary
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public SetArtworkProviderEnabledEndpointSummary()
+ {
+ Summary = "Enables or disables an artwork provider of a media library.";
+ Description = "Enables or disables the artwork provider of the media library identified by the request.";
+ RequestParam(r => r.LibraryId, "The Id of the media library whose artwork provider is enabled or disabled. Required.");
+ RequestParam(r => r.PluginId, "The unique identifier of the plugin providing the artwork. Required.");
+ RequestParam(r => r.IsEnabled, "Whether the artwork provider should be enabled for the media library, or not. Required.");
+
+ ExampleRequest = new SetLibraryArtworkProviderEnabledRequest
+ {
+ LibraryId = Guid.NewGuid(),
+ PluginId = Guid.NewGuid(),
+ IsEnabled = true
+ };
+
+ Response(200, "The artwork provider of the media library is enabled or disabled.", example: new SuccessResponse(true));
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.ar-SA.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.ar-SA.resx
index 01372ba1..1fb27bc8 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.ar-SA.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.ar-SA.resx
@@ -336,4 +336,10 @@
مزوّدو البيانات الوصفية المستخدمون لإثراء عناصر هذه المكتبة، بالترتيب الذي يتم تجريبهم به.
+
+ Artwork providers
+
+
+ The artwork providers used to retrieve the covers of the items of this library, in the order they are tried.
+
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.de-DE.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.de-DE.resx
index 8c6adc7d..32e91b0a 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.de-DE.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.de-DE.resx
@@ -336,4 +336,10 @@
Die Metadatenanbieter, die verwendet werden, um die Elemente dieser Bibliothek anzureichern, in der Reihenfolge, in der sie versucht werden.
+
+ Artwork providers
+
+
+ The artwork providers used to retrieve the covers of the items of this library, in the order they are tried.
+
\ No newline at end of file
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.en-US.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.en-US.resx
index cdf78c97..00b5c77e 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.en-US.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.en-US.resx
@@ -336,4 +336,10 @@
The metadata providers used to enrich the items of this library, in the order they are tried.
+
+ Artwork providers
+
+
+ The artwork providers used to retrieve the covers of the items of this library, in the order they are tried.
+
\ No newline at end of file
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.es-ES.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.es-ES.resx
index f4866518..e1ae5061 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.es-ES.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.es-ES.resx
@@ -336,4 +336,10 @@
Los proveedores de metadatos utilizados para enriquecer los elementos de esta biblioteca, en el orden en que se prueban.
+
+ Artwork providers
+
+
+ The artwork providers used to retrieve the covers of the items of this library, in the order they are tried.
+
\ No newline at end of file
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.fr-FR.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.fr-FR.resx
index 949f7343..ac0f6204 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.fr-FR.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.fr-FR.resx
@@ -336,4 +336,10 @@
Les fournisseurs de métadonnées utilisés pour enrichir les éléments de cette bibliothèque, dans l'ordre où ils sont essayés.
+
+ Artwork providers
+
+
+ The artwork providers used to retrieve the covers of the items of this library, in the order they are tried.
+
\ No newline at end of file
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.it-IT.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.it-IT.resx
index eec472aa..01ce6fbc 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.it-IT.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.it-IT.resx
@@ -336,4 +336,10 @@
I fornitori di metadati utilizzati per arricchire gli elementi di questa libreria, nell'ordine in cui vengono provati.
+
+ Artwork providers
+
+
+ The artwork providers used to retrieve the covers of the items of this library, in the order they are tried.
+
\ No newline at end of file
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.ja-JP.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.ja-JP.resx
index e087496f..168e84d4 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.ja-JP.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.ja-JP.resx
@@ -336,4 +336,10 @@
このライブラリのアイテムを補完するために使用されるメタデータプロバイダーを、試行する順序で指定します。
+
+ Artwork providers
+
+
+ The artwork providers used to retrieve the covers of the items of this library, in the order they are tried.
+
\ No newline at end of file
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.resx
index cdf78c97..00b5c77e 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.resx
@@ -336,4 +336,10 @@
The metadata providers used to enrich the items of this library, in the order they are tried.
+
+ Artwork providers
+
+
+ The artwork providers used to retrieve the covers of the items of this library, in the order they are tried.
+
\ No newline at end of file
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.ro-RO.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.ro-RO.resx
index 051df339..c7408932 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.ro-RO.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.ro-RO.resx
@@ -336,4 +336,10 @@
Furnizorii de metadate folosiți pentru a îmbogăți elementele acestei biblioteci, în ordinea în care sunt încercați.
+
+ Artwork providers
+
+
+ The artwork providers used to retrieve the covers of the items of this library, in the order they are tried.
+
\ No newline at end of file
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.uk-UA.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.uk-UA.resx
index 2141b238..bc8e1ab8 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.uk-UA.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.uk-UA.resx
@@ -336,4 +336,10 @@
Постачальники метаданих, які використовуються для збагачення елементів цієї бібліотеки, у порядку, в якому вони випробовуються.
+
+ Artwork providers
+
+
+ The artwork providers used to retrieve the covers of the items of this library, in the order they are tried.
+
\ No newline at end of file
diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.zh-CN.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.zh-CN.resx
index e56c76ee..5c281a96 100644
--- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.zh-CN.resx
+++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/Management/Item.zh-CN.resx
@@ -336,4 +336,10 @@
用于丰富此库项目内容的元数据提供程序,按其尝试顺序排列。
+
+ Artwork providers
+
+
+ The artwork providers used to retrieve the covers of the items of this library, in the order they are tried.
+
\ No newline at end of file
diff --git a/src/Lumina.Presentation.Web/Core/Views/Library/Management/Item.cshtml b/src/Lumina.Presentation.Web/Core/Views/Library/Management/Item.cshtml
index a6f0009d..5e5e88cd 100644
--- a/src/Lumina.Presentation.Web/Core/Views/Library/Management/Item.cshtml
+++ b/src/Lumina.Presentation.Web/Core/Views/Library/Management/Item.cshtml
@@ -222,6 +222,22 @@
@_localizer["DescriptionMetadataProviders"]
+
@_localizer["ArtworkProviders"]
+
+
+
+
+
@_localizer["Name"]
+
@_localizer["Enabled"]
+
@_localizer["Order"]
+
+
+
+
+
+
+ @_localizer["DescriptionArtworkProviders"]
+
}
@@ -435,6 +451,77 @@
}
};
+ const artworkProvidersTable = document.getElementById('artwork-providers-table');
+ const artworkProvidersTbody = artworkProvidersTable ? artworkProvidersTable.querySelector('tbody') : null;
+
+ // loads the artwork providers configured for the library, when editing an existing library
+ async function loadArtworkProvidersAsync() {
+ if (!id || !artworkProvidersTbody) return;
+ const url = '@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.GET_ARTWORK_PROVIDERS, new { libraryId = default(Guid) })'
+ .replace('/@(default(Guid))', `/${id}`); // libraryId needs to be replaced here, because GetAbsoluteUrl is server side, libraryId is client side
+ const response = await callApiGetAsync(url);
+ if (response && response.length > 0) {
+ artworkProvidersTbody.innerHTML = response.map((provider, index) => renderArtworkProviderRow(provider, index, response.length)).join('');
+ }
+ }
+
+ // renders an artwork provider row of the library
+ function renderArtworkProviderRow(provider, index, count) {
+ return `
+
+
${provider.name}
+
+
+
+
+
+
+
+
`;
+ }
+
+ // on artwork provider move button click, reorders the providers and persists the new order
+ async function handleArtworkProviderReorderAsync(e) {
+ const button = e.target.closest('.artwork-provider-move-up, .artwork-provider-move-down');
+ if (!button || !artworkProvidersTbody) return;
+ const row = button.closest('tr');
+ if (button.classList.contains('artwork-provider-move-up')) {
+ const previousRow = row.previousElementSibling;
+ if (previousRow) artworkProvidersTbody.insertBefore(row, previousRow);
+ } else {
+ const nextRow = row.nextElementSibling;
+ if (nextRow) artworkProvidersTbody.insertBefore(nextRow, row);
+ }
+ await saveArtworkProviderOrderAsync();
+ }
+
+ // persists the current order of the artwork providers of the library
+ async function saveArtworkProviderOrderAsync() {
+ if (!id || !artworkProvidersTbody) return;
+ const pluginIds = Array.from(artworkProvidersTbody.querySelectorAll('tr[data-provider-plugin-id]'))
+ .map(row => row.getAttribute('data-provider-plugin-id'));
+ const result = await callApiPutAsync('@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.REORDER_ARTWORK_PROVIDERS)', { libraryId: id, pluginIds: pluginIds });
+ if (result.success) {
+ notificationService.show('@_localizer["OrderSaved"]', NotificationType.SUCCESS);
+ }
+ }
+
+ // on artwork provider enabled checkbox change, persists the new state
+ async function handleArtworkProviderEnabledChangeAsync(e) {
+ if (e.target.matches('.artwork-provider-enabled')) {
+ const row = e.target.closest('tr');
+ const pluginId = row.getAttribute('data-provider-plugin-id');
+ const isEnabled = e.target.checked;
+ const result = await callApiPutAsync('@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.SET_ARTWORK_PROVIDER_ENABLED)', { libraryId: id, pluginId: pluginId, isEnabled: isEnabled });
+ if (!result.success) {
+ e.target.checked = !isEnabled;
+ }
+ }
+ };
+
// add listeners
form.addEventListener('keypress', handleEnterKey);
form.addEventListener('submit', handleSubmit);
@@ -448,6 +535,10 @@
metadataProvidersTbody.addEventListener('click', handleMetadataProviderReorderAsync);
metadataProvidersTbody.addEventListener('change', handleMetadataProviderEnabledChangeAsync);
}
+ if (artworkProvidersTbody) {
+ artworkProvidersTbody.addEventListener('click', handleArtworkProviderReorderAsync);
+ artworkProvidersTbody.addEventListener('change', handleArtworkProviderEnabledChangeAsync);
+ }
// register cleanup for these listeners
cleanupFunctions.push(() => {
@@ -463,11 +554,16 @@
metadataProvidersTbody.removeEventListener('click', handleMetadataProviderReorderAsync);
metadataProvidersTbody.removeEventListener('change', handleMetadataProviderEnabledChangeAsync);
}
+ if (artworkProvidersTbody) {
+ artworkProvidersTbody.removeEventListener('click', handleArtworkProviderReorderAsync);
+ artworkProvidersTbody.removeEventListener('change', handleArtworkProviderEnabledChangeAsync);
+ }
});
- // load the metadata providers when editing an existing library
+ // load the metadata and artwork providers when editing an existing library
if (id) {
loadMetadataProvidersAsync();
+ loadArtworkProvidersAsync();
}
// store all cleanups for this view on window object using the scriptId
diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Plugins/LibraryArtworkProviderDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Plugins/LibraryArtworkProviderDtoFixture.cs
new file mode 100644
index 00000000..3b423c12
--- /dev/null
+++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Plugins/LibraryArtworkProviderDtoFixture.cs
@@ -0,0 +1,52 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Presentation.Web.Common.DTO.Plugins;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Presentation.Web.Fixtures.Common.DTO.Plugins;
+
+///
+/// Fixture class for generating test data.
+///
+[ExcludeFromCodeCoverage]
+public class LibraryArtworkProviderDtoFixture
+{
+ private readonly Faker _faker = new();
+
+ ///
+ /// Creates a new instance with randomized test data.
+ ///
+ /// Optional unique identifier of the plugin providing the artwork.
+ /// Optional display name of the artwork provider.
+ /// Whether the artwork provider is enabled for the media library or not.
+ /// Optional rank of the artwork provider, determining the order in which providers are tried.
+ /// A configured instance.
+ public LibraryArtworkProviderDto Create(
+ Guid? pluginId = null,
+ string? name = null,
+ bool? isEnabled = null,
+ int? rank = null)
+ {
+ return new LibraryArtworkProviderDto
+ {
+ PluginId = pluginId ?? Guid.NewGuid(),
+ Name = name ?? _faker.Company.CompanyName(),
+ IsEnabled = isEnabled ?? _faker.Random.Bool(),
+ Rank = rank ?? _faker.Random.Int(0, 100)
+ };
+ }
+
+ ///
+ /// Creates multiple instances with randomized test data.
+ ///
+ /// Number of instances to create.
+ /// List of configured instances.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequestFixture.cs
new file mode 100644
index 00000000..9a6eef5d
--- /dev/null
+++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequestFixture.cs
@@ -0,0 +1,46 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Presentation.Web.Common.Requests.Plugins;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
+
+///
+/// Fixture class for generating test data.
+///
+[ExcludeFromCodeCoverage]
+public class ReorderLibraryArtworkProvidersRequestFixture
+{
+ private readonly Faker _faker = new();
+
+ ///
+ /// Creates a new instance with randomized test data.
+ ///
+ /// Optional identifier of the media library.
+ /// Optional plugin Ids in the new order.
+ /// A configured instance.
+ public ReorderLibraryArtworkProvidersRequest Create(
+ Guid? libraryId = null,
+ List? pluginIds = null)
+ {
+ return new ReorderLibraryArtworkProvidersRequest
+ {
+ LibraryId = libraryId ?? Guid.NewGuid(),
+ PluginIds = pluginIds ?? [_faker.Random.Guid(), _faker.Random.Guid()]
+ };
+ }
+
+ ///
+ /// Creates multiple instances with randomized test data.
+ ///
+ /// Number of instances to create.
+ /// List of configured instances.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequestFixture.cs
new file mode 100644
index 00000000..8ee3fc34
--- /dev/null
+++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequestFixture.cs
@@ -0,0 +1,49 @@
+#region ========================================================================= USING =====================================================================================
+using Bogus;
+using Lumina.Presentation.Web.Common.Requests.Plugins;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+#endregion
+
+namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
+
+///
+/// Fixture class for generating test data.
+///
+[ExcludeFromCodeCoverage]
+public class SetLibraryArtworkProviderEnabledRequestFixture
+{
+ private readonly Faker _faker = new();
+
+ ///
+ /// Creates a new instance with randomized test data.
+ ///
+ /// Optional identifier of the media library.
+ /// Optional identifier of the plugin.
+ /// Optional value indicating whether the artwork provider is enabled.
+ /// A configured instance.
+ public SetLibraryArtworkProviderEnabledRequest Create(
+ Guid? libraryId = null,
+ Guid? pluginId = null,
+ bool? isEnabled = null)
+ {
+ return new SetLibraryArtworkProviderEnabledRequest
+ {
+ LibraryId = libraryId ?? Guid.NewGuid(),
+ PluginId = pluginId ?? Guid.NewGuid(),
+ IsEnabled = isEnabled ?? _faker.Random.Bool()
+ };
+ }
+
+ ///
+ /// Creates multiple instances with randomized test data.
+ ///
+ /// Number of instances to create.
+ /// List of configured instances.
+ public List CreateMany(int count = 3)
+ {
+ return [.. Enumerable.Range(0, count).Select(_ => Create())];
+ }
+}
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetArtworkProviders/GetArtworkProvidersEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetArtworkProviders/GetArtworkProvidersEndpointTests.cs
new file mode 100644
index 00000000..3b87c503
--- /dev/null
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/GetArtworkProviders/GetArtworkProvidersEndpointTests.cs
@@ -0,0 +1,84 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Presentation.Web.Common.DTO.Plugins;
+using Lumina.Presentation.Web.Core.Endpoints.Library.Management.GetArtworkProviders;
+using Lumina.Presentation.Web.Fixtures.Common.DTO.Plugins;
+using Lumina.Presentation.Web.Fixtures.Common.TestHelpers;
+using Lumina.Presentation.Web.IntegrationTests.Common.Setup;
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text.Json;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.GetArtworkProviders;
+
+///
+/// Contains integration tests for the /{culture}/libraries/manage/api-get-artwork-providers/{{libraryId}} route served by the class.
+///
+[ExcludeFromCodeCoverage]
+public class GetArtworkProvidersEndpointTests : IClassFixture
+{
+ private readonly LuminaWebFactory _apiFactory;
+ private readonly LibraryArtworkProviderDtoFixture _libraryArtworkProviderDtoFixture = new();
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected Web application factory.
+ public GetArtworkProvidersEndpointTests(LuminaWebFactory apiFactory)
+ {
+ _apiFactory = apiFactory;
+ }
+
+ [Fact]
+ public async Task GetArtworkProviders_WhenCalledByAuthenticatedUser_ShouldReturnArtworkProvidersJson()
+ {
+ // Arrange
+ _apiFactory.ApiClientStub.Reset();
+ Guid libraryId = Guid.NewGuid();
+ LibraryArtworkProviderDto[] expectedProviders =
+ [
+ _libraryArtworkProviderDtoFixture.Create(name: "Artwork Provider One", isEnabled: true, rank: 1),
+ _libraryArtworkProviderDtoFixture.Create(name: "Artwork Provider Two", isEnabled: false, rank: 2)
+ ];
+ _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}/artwork-providers", expectedProviders);
+ AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory);
+ HttpRequestMessage getRequest = new(HttpMethod.Get, $"/en-us/libraries/manage/api-get-artwork-providers/{libraryId}");
+ getRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+
+ // Act
+ HttpResponseMessage response = await webClient.Client.SendAsync(getRequest);
+ string content = await response.Content.ReadAsStringAsync();
+
+ // Assert
+ response.EnsureSuccessStatusCode();
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ using JsonDocument json = JsonDocument.Parse(content);
+ Assert.True(json.RootElement.GetProperty("success").GetBoolean());
+ JsonElement data = json.RootElement.GetProperty("data");
+ Assert.Equal(2, data.GetArrayLength());
+ Assert.Equal("Artwork Provider One", data[0].GetProperty("name").GetString());
+ }
+
+ [Fact]
+ public async Task GetArtworkProviders_WhenCalled_ShouldRequestArtworkProvidersFromApi()
+ {
+ // Arrange
+ _apiFactory.ApiClientStub.Reset();
+ Guid libraryId = Guid.NewGuid();
+ _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}/artwork-providers", Array.Empty());
+ AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory);
+ HttpRequestMessage getRequest = new(HttpMethod.Get, $"/en-us/libraries/manage/api-get-artwork-providers/{libraryId}");
+ getRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+
+ // Act
+ HttpResponseMessage response = await webClient.Client.SendAsync(getRequest);
+
+ // Assert
+ response.EnsureSuccessStatusCode();
+ Assert.Contains($"libraries/{libraryId}/artwork-providers", _apiFactory.ApiClientStub.GetEndpointsCalled);
+ }
+}
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpointTests.cs
new file mode 100644
index 00000000..2a64e24a
--- /dev/null
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpointTests.cs
@@ -0,0 +1,71 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Presentation.Web.Common.Requests.Plugins;
+using Lumina.Presentation.Web.Core.Endpoints.Library.Management.ReorderArtworkProviders;
+using Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
+using Lumina.Presentation.Web.Fixtures.Common.TestHelpers;
+using Lumina.Presentation.Web.IntegrationTests.Common.Setup;
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Net.Http.Json;
+using System.Text.Json;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.ReorderArtworkProviders;
+
+///
+/// Contains integration tests for the /{culture}/libraries/manage/api-reorder-artwork-providers route served by the class.
+///
+[ExcludeFromCodeCoverage]
+public class ReorderArtworkProvidersEndpointTests : IClassFixture
+{
+ private readonly LuminaWebFactory _apiFactory;
+ private readonly ReorderLibraryArtworkProvidersRequestFixture _reorderLibraryArtworkProvidersRequestFixture = new();
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected Web application factory.
+ public ReorderArtworkProvidersEndpointTests(LuminaWebFactory apiFactory)
+ {
+ _apiFactory = apiFactory;
+ }
+
+ [Fact]
+ public async Task ReorderArtworkProviders_WhenCalledByAuthenticatedUserWithAntiforgeryToken_ShouldReorderProvidersAndReturnSuccess()
+ {
+ // Arrange
+ _apiFactory.ApiClientStub.Reset();
+ Guid libraryId = Guid.NewGuid();
+ Guid firstPluginId = Guid.NewGuid();
+ Guid secondPluginId = Guid.NewGuid();
+ ReorderLibraryArtworkProvidersRequest request = _reorderLibraryArtworkProvidersRequestFixture.Create(
+ libraryId: libraryId,
+ pluginIds: [firstPluginId, secondPluginId]
+ );
+ string expectedEndpoint = $"libraries/{libraryId}/artwork-providers/reorder";
+ _apiFactory.ApiClientStub.RegisterPutResponseFactory(expectedEndpoint, _ => new Lumina.Presentation.Web.Common.Requests.Common.EmptyRequest());
+ AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory);
+ HttpRequestMessage updateRequest = new(HttpMethod.Put, "/en-us/libraries/manage/api-reorder-artwork-providers")
+ {
+ Content = JsonContent.Create(request)
+ };
+ updateRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json");
+ updateRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+ updateRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken);
+
+ // Act
+ HttpResponseMessage response = await webClient.Client.SendAsync(updateRequest);
+ string content = await response.Content.ReadAsStringAsync();
+
+ // Assert
+ response.EnsureSuccessStatusCode();
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ using JsonDocument json = JsonDocument.Parse(content);
+ Assert.True(json.RootElement.GetProperty("success").GetBoolean());
+ Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == expectedEndpoint);
+ }
+}
diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpointTests.cs
new file mode 100644
index 00000000..dcbef9fb
--- /dev/null
+++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpointTests.cs
@@ -0,0 +1,71 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Presentation.Web.Common.Requests.Plugins;
+using Lumina.Presentation.Web.Core.Endpoints.Library.Management.SetArtworkProviderEnabled;
+using Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
+using Lumina.Presentation.Web.Fixtures.Common.TestHelpers;
+using Lumina.Presentation.Web.IntegrationTests.Common.Setup;
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Net.Http.Json;
+using System.Text.Json;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.Management.SetArtworkProviderEnabled;
+
+///
+/// Contains integration tests for the /{culture}/libraries/manage/api-set-artwork-provider-enabled route served by the class.
+///
+[ExcludeFromCodeCoverage]
+public class SetArtworkProviderEnabledEndpointTests : IClassFixture
+{
+ private readonly LuminaWebFactory _apiFactory;
+ private readonly SetLibraryArtworkProviderEnabledRequestFixture _setLibraryArtworkProviderEnabledRequestFixture = new();
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Injected Web application factory.
+ public SetArtworkProviderEnabledEndpointTests(LuminaWebFactory apiFactory)
+ {
+ _apiFactory = apiFactory;
+ }
+
+ [Fact]
+ public async Task SetArtworkProviderEnabled_WhenCalledByAuthenticatedUserWithAntiforgeryToken_ShouldEnableProviderAndReturnSuccess()
+ {
+ // Arrange
+ _apiFactory.ApiClientStub.Reset();
+ Guid libraryId = Guid.NewGuid();
+ Guid pluginId = Guid.NewGuid();
+ SetLibraryArtworkProviderEnabledRequest request = _setLibraryArtworkProviderEnabledRequestFixture.Create(
+ libraryId: libraryId,
+ pluginId: pluginId,
+ isEnabled: true
+ );
+ string expectedEndpoint = $"libraries/{libraryId}/artwork-providers/{pluginId}/enabled";
+ _apiFactory.ApiClientStub.RegisterPutResponseFactory(expectedEndpoint, _ => new Lumina.Presentation.Web.Common.Requests.Common.EmptyRequest());
+ AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory);
+ HttpRequestMessage updateRequest = new(HttpMethod.Put, "/en-us/libraries/manage/api-set-artwork-provider-enabled")
+ {
+ Content = JsonContent.Create(request)
+ };
+ updateRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json");
+ updateRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+ updateRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken);
+
+ // Act
+ HttpResponseMessage response = await webClient.Client.SendAsync(updateRequest);
+ string content = await response.Content.ReadAsStringAsync();
+
+ // Assert
+ response.EnsureSuccessStatusCode();
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ using JsonDocument json = JsonDocument.Parse(content);
+ Assert.True(json.RootElement.GetProperty("success").GetBoolean());
+ Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == expectedEndpoint);
+ }
+}