Adds real time media libraries scan progress update via SignalR

This commit is contained in:
BinaryAlley committed 2025-02-22 17:45:09 +02:00
1 parent d70b2dcaa0
commit e0d61802df
71 files changed
+1292 -131

No files matched your search

@@ -3,6 +3,7 @@ using FastEndpoints;
using FastEndpoints.Swagger;
using Lumina.Application.Common.Infrastructure.Authentication;
using Lumina.Presentation.Api.Common.Authentication;
using MessagePack;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
@@ -201,13 +202,18 @@ public static class PresentationApiLayerServices
services.AddCors(corsOptions =>
{
corsOptions.AddPolicy("AllowAll",
corsPolicyBuilder => corsPolicyBuilder
.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader());
corsOptions.AddPolicy("SecurePolicy",
corsPolicyBuilder => corsPolicyBuilder
.WithOrigins(configuration.GetValue<string[]>("CorsSettings:AllowedOrigins") ?? [])
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
});
services.AddSignalR()
.AddMessagePackProtocol(messagePackHubProtocolOptions =>
messagePackHubProtocolOptions.SerializerOptions = MessagePackSerializerOptions.Standard.WithSecurity(MessagePackSecurity.UntrustedData));
services.AddScoped<ICurrentUserService, HttpContextCurrentUserService>();
return services;
@@ -19,6 +19,7 @@ public static partial class ApiRoutes
public const string SCAN_LIBRARIES = "/libraries/scans";
public const string SCAN_LIBRARY = "/libraries/{id}/scans";
public const string LIBRARY_SCAN_PROGRESS = "/libraries/{libraryId}/scans/{scanId}/progress";
public const string GET_RUNNING_LIBRARIES_SCAN = "/libraries/scans/running";
public const string CANCEL_LIBRARIES_SCAN = "/libraries/scans/cancel";
public const string CANCEL_LIBRARY_SCAN = "/libraries/{libraryId}/scans/{scanId}/cancel";
}