Chapter/Issue level Reviews and Ratings (#3778)

Co-authored-by: Joseph Milazzo <josephmajora@gmail.com>
This commit is contained in:
Fesaa 2025-04-29 18:53:24 +02:00 committed by GitHub
parent 3b8997e46e
commit 4f7625ea77
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
60 changed files with 5097 additions and 497 deletions

View file

@ -45,6 +45,7 @@ public class CoverDbService : ICoverDbService
private readonly IImageService _imageService;
private readonly IUnitOfWork _unitOfWork;
private readonly IEventHub _eventHub;
private TimeSpan _cacheTime = TimeSpan.FromDays(10);
private const string NewHost = "https://www.kavitareader.com/CoversDB/";
@ -97,7 +98,7 @@ public class CoverDbService : ICoverDbService
throw new KavitaException($"Kavita has already tried to fetch from {sanitizedBaseUrl} and failed. Skipping duplicate check");
}
await provider.SetAsync(baseUrl, string.Empty, TimeSpan.FromDays(10));
await provider.SetAsync(baseUrl, string.Empty, _cacheTime);
if (FaviconUrlMapper.TryGetValue(baseUrl, out var value))
{
url = value;
@ -185,6 +186,17 @@ public class CoverDbService : ICoverDbService
{
try
{
// Sanitize user input
publisherName = publisherName.Replace(Environment.NewLine, string.Empty).Replace("\r", string.Empty).Replace("\n", string.Empty);
var provider = _cacheFactory.GetCachingProvider(EasyCacheProfiles.Publisher);
var res = await provider.GetAsync<string>(publisherName);
if (res.HasValue)
{
_logger.LogInformation("Kavita has already tried to fetch Publisher: {PublisherName} and failed. Skipping duplicate check", publisherName);
throw new KavitaException($"Kavita has already tried to fetch Publisher: {publisherName} and failed. Skipping duplicate check");
}
await provider.SetAsync(publisherName, string.Empty, _cacheTime);
var publisherLink = await FallbackToKavitaReaderPublisher(publisherName);
if (string.IsNullOrEmpty(publisherLink))
{