Bugfixes + Potential iOS Webtoon Reader Fix (#2650)
This commit is contained in:
parent
56fa393cf0
commit
f660a1cd06
25 changed files with 157 additions and 197 deletions
|
@ -142,7 +142,8 @@ public class DeviceController : BaseApiController
|
|||
if (dto.SeriesId <= 0) return BadRequest(await _localizationService.Translate(User.GetUserId(), "greater-0", "SeriesId"));
|
||||
if (dto.DeviceId < 0) return BadRequest(await _localizationService.Translate(User.GetUserId(), "greater-0", "DeviceId"));
|
||||
|
||||
if (await _emailService.IsDefaultEmailService())
|
||||
var isEmailSetup = (await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).IsEmailSetup();
|
||||
if (!isEmailSetup)
|
||||
return BadRequest(await _localizationService.Translate(User.GetUserId(), "send-to-kavita-email"));
|
||||
|
||||
var userId = User.GetUserId();
|
||||
|
|
|
@ -8,6 +8,7 @@ using API.Data;
|
|||
using API.DTOs;
|
||||
using API.DTOs.Filtering;
|
||||
using API.DTOs.Metadata;
|
||||
using API.DTOs.Recommendation;
|
||||
using API.DTOs.SeriesDetail;
|
||||
using API.Entities.Enums;
|
||||
using API.Extensions;
|
||||
|
@ -207,13 +208,18 @@ public class MetadataController(IUnitOfWork unitOfWork, ILocalizationService loc
|
|||
.OrderByDescending(review => review.Username.Equals(user.UserName) ? 1 : 0)
|
||||
.ToList();
|
||||
|
||||
var cacheKey = CacheKey + seriesId + "_" + user.Id;
|
||||
var cacheKey = CacheKey + seriesId;
|
||||
var results = await _cacheProvider.GetAsync<SeriesDetailPlusDto>(cacheKey);
|
||||
if (results.HasValue)
|
||||
{
|
||||
var cachedResult = results.Value;
|
||||
userReviews.AddRange(cachedResult.Reviews);
|
||||
cachedResult.Reviews = ReviewService.SelectSpectrumOfReviews(userReviews);
|
||||
if (!await unitOfWork.UserRepository.IsUserAdminAsync(user))
|
||||
{
|
||||
cachedResult.Recommendations.ExternalSeries = new List<ExternalSeriesDto>();
|
||||
}
|
||||
|
||||
return cachedResult;
|
||||
}
|
||||
|
||||
|
@ -221,10 +227,13 @@ public class MetadataController(IUnitOfWork unitOfWork, ILocalizationService loc
|
|||
if (ret == null) return Ok(null);
|
||||
userReviews.AddRange(ret.Reviews);
|
||||
ret.Reviews = ReviewService.SelectSpectrumOfReviews(userReviews);
|
||||
|
||||
|
||||
await _cacheProvider.SetAsync(cacheKey, ret, TimeSpan.FromHours(24));
|
||||
|
||||
if (!await unitOfWork.UserRepository.IsUserAdminAsync(user))
|
||||
{
|
||||
ret.Recommendations.ExternalSeries = new List<ExternalSeriesDto>();
|
||||
}
|
||||
|
||||
return Ok(ret);
|
||||
|
||||
}
|
||||
|
|
|
@ -189,6 +189,15 @@ public class ServerController : BaseApiController
|
|||
return Ok(await _versionUpdaterService.CheckForUpdate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns how many versions out of date this install is
|
||||
/// </summary>
|
||||
[HttpGet("check-out-of-date")]
|
||||
public async Task<ActionResult<int>> CheckHowOutOfDate()
|
||||
{
|
||||
return Ok(await _versionUpdaterService.GetNumberOfReleasesBehind());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Pull the Changelog for Kavita from Github and display
|
||||
|
@ -260,7 +269,7 @@ public class ServerController : BaseApiController
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Authorize("RequireAdminRole")]
|
||||
[HttpPost("bust-review-and-rec-cache")]
|
||||
[HttpPost("bust-kavitaplus-cache")]
|
||||
public async Task<ActionResult> BustReviewAndRecCache()
|
||||
{
|
||||
_logger.LogInformation("Busting Kavita+ Cache");
|
||||
|
|
|
@ -124,19 +124,6 @@ public class SettingsController : BaseApiController
|
|||
return Ok(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a test email from the Email Service.
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize(Policy = "RequireAdminRole")]
|
||||
[HttpPost("test-email-url")]
|
||||
public async Task<ActionResult<EmailTestResultDto>> TestEmailServiceUrl(TestEmailDto dto)
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(User.GetUserId());
|
||||
return Ok(await _emailService.SendTestEmail(user!.Email));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is the minimum information setup for Email to work
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue