Folder Watching (#1467)

* Hooked in a server setting to enable/disable folder watching

* Validated the file rename change event

* Validated delete file works

* Tweaked some logic to determine if a change occurs on a folder or a file.

* Added a note for an upcoming branch

* Some minor changes in the loop that just shift where code runs.

* Implemented ScanFolder api

* Ensure we restart watchers when we modify a library folder.

* Fixed a unit test
This commit is contained in:
Joseph Milazzo 2022-08-23 11:45:11 -05:00 committed by GitHub
parent 87ad5844f0
commit 037a1a5a8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 269 additions and 102 deletions

17
API/DTOs/ScanFolderDto.cs Normal file
View file

@ -0,0 +1,17 @@
namespace API.DTOs;
/// <summary>
/// DTO for requesting a folder to be scanned
/// </summary>
public class ScanFolderDto
{
/// <summary>
/// Api key for a user with Admin permissions
/// </summary>
public string ApiKey { get; set; }
/// <summary>
/// Folder Path to Scan
/// </summary>
/// <remarks>JSON cannot accept /, so you may need to use // escaping on paths</remarks>
public string FolderPath { get; set; }
}

View file

@ -1,5 +1,4 @@
using System.Collections.Generic;
using API.Services;
using API.Services;
namespace API.DTOs.Settings
{
@ -43,7 +42,9 @@ namespace API.DTOs.Settings
/// Represents a unique Id to this Kavita installation. Only used in Stats to identify unique installs.
/// </summary>
public string InstallId { get; set; }
/// <summary>
/// If the server should save bookmarks as WebP encoding
/// </summary>
public bool ConvertBookmarkToWebP { get; set; }
/// <summary>
/// If the Swagger UI Should be exposed. Does not require authentication, but does require a JWT.
@ -55,5 +56,9 @@ namespace API.DTOs.Settings
/// </summary>
/// <remarks>Value should be between 1 and 30</remarks>
public int TotalBackups { get; set; } = 30;
/// <summary>
/// If Kavita should watch the library folders and process changes
/// </summary>
public bool EnableFolderWatching { get; set; } = true;
}
}