Small Fixes (#3951)

This commit is contained in:
Joe Milazzo
2025-07-24 13:37:17 -06:00
committed by GitHub
parent 152f7ad00e
commit 032b8f54b7
23 changed files with 459 additions and 285 deletions
+22
View File
@@ -16,6 +16,7 @@ using API.Extensions;
using API.Helpers.Builders;
using API.Services;
using API.Services.Tasks.Scanner;
using API.Services.Tasks.Scanner.Parser;
using API.SignalR;
using AutoMapper;
using EasyCaching.Core;
@@ -83,6 +84,7 @@ public class LibraryController : BaseApiController
.WithManageReadingLists(dto.ManageReadingLists)
.WithAllowScrobbling(dto.AllowScrobbling)
.WithAllowMetadataMatching(dto.AllowMetadataMatching)
.WithEnableMetadata(dto.EnableMetadata)
.Build();
library.LibraryFileTypes = dto.FileGroupTypes
@@ -173,6 +175,26 @@ public class LibraryController : BaseApiController
return Ok(_directoryService.ListDirectory(path));
}
/// <summary>
/// For each root, checks if there are any supported files at root to warn the user during library creation about an invalid setup
/// </summary>
/// <returns></returns>
[Authorize(Policy = "RequireAdminRole")]
[HttpPost("has-files-at-root")]
public ActionResult<IDictionary<string, bool>> AnyFilesAtRoot(CheckForFilesInFolderRootsDto dto)
{
var results = new Dictionary<string, bool>();
foreach (var root in dto.Roots)
{
results.TryAdd(root,
_directoryService
.GetFilesWithCertainExtensions(root, Parser.SupportedExtensions, SearchOption.TopDirectoryOnly)
.Any());
}
return Ok(results);
}
/// <summary>
/// Return a specific library
/// </summary>