Polish Round 2 (#2411)
This commit is contained in:
parent
ba3e760b31
commit
a2fd87c454
35 changed files with 213 additions and 95 deletions
|
@ -687,7 +687,7 @@ public class AccountController : BaseApiController
|
|||
|
||||
if (!_emailService.IsValidEmail(dto.Email))
|
||||
{
|
||||
_logger.LogInformation("[Invite User] {Email} doesn't appear to be an email, so will not send an email to address", dto.Email);
|
||||
_logger.LogInformation("[Invite User] {Email} doesn't appear to be an email, so will not send an email to address", dto.Email.Replace(Environment.NewLine, string.Empty));
|
||||
return Ok(new InviteUserResponse
|
||||
{
|
||||
EmailLink = emailLink,
|
||||
|
|
|
@ -59,7 +59,7 @@ public class CollectionController : BaseApiController
|
|||
/// <returns></returns>
|
||||
[Authorize(Policy = "RequireAdminRole")]
|
||||
[HttpGet("search")]
|
||||
public async Task<ActionResult<IEnumerable<CollectionTagDto>>> SearchTags(string queryString)
|
||||
public async Task<ActionResult<IEnumerable<CollectionTagDto>>> SearchTags(string? queryString)
|
||||
{
|
||||
queryString ??= string.Empty;
|
||||
queryString = queryString.Replace(@"%", string.Empty);
|
||||
|
|
|
@ -134,7 +134,7 @@ public class LibraryController : BaseApiController
|
|||
/// <returns></returns>
|
||||
[Authorize(Policy = "RequireAdminRole")]
|
||||
[HttpGet("list")]
|
||||
public ActionResult<IEnumerable<DirectoryDto>> GetDirectories(string path)
|
||||
public ActionResult<IEnumerable<DirectoryDto>> GetDirectories(string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
|
@ -385,7 +385,7 @@ public class LibraryController : BaseApiController
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, await _localizationService.Translate(User.GetUserId(), "generic-library"));
|
||||
_logger.LogError(ex, "There was a critical issue. Please try again");
|
||||
await _unitOfWork.RollbackAsync();
|
||||
return Ok(false);
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ public class LibraryController : BaseApiController
|
|||
// Override Scrobbling for Comic libraries since there are no providers to scrobble to
|
||||
if (library.Type == LibraryType.Comic)
|
||||
{
|
||||
_logger.LogInformation("Overrode Library {Name} to disable scrobbling since there are no providers for Comics", dto.Name);
|
||||
_logger.LogInformation("Overrode Library {Name} to disable scrobbling since there are no providers for Comics", dto.Name.Replace(Environment.NewLine, string.Empty));
|
||||
library.AllowScrobbling = false;
|
||||
}
|
||||
|
||||
|
@ -471,7 +471,11 @@ public class LibraryController : BaseApiController
|
|||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the type of the underlying library
|
||||
/// </summary>
|
||||
/// <param name="libraryId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("type")]
|
||||
public async Task<ActionResult<LibraryType>> GetLibraryType(int libraryId)
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ public class PluginController : BaseApiController
|
|||
var userId = await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey);
|
||||
if (userId <= 0)
|
||||
{
|
||||
_logger.LogInformation("A Plugin ({PluginName}) tried to authenticate with an apiKey that doesn't match. Information {@Information}", Uri.EscapeDataString(pluginName), new
|
||||
_logger.LogInformation("A Plugin ({PluginName}) tried to authenticate with an apiKey that doesn't match. Information {@Information}", pluginName.Replace(Environment.NewLine, string.Empty), new
|
||||
{
|
||||
IpAddress = ipAddress,
|
||||
UserAgent = userAgent,
|
||||
|
@ -55,7 +55,7 @@ public class PluginController : BaseApiController
|
|||
throw new KavitaUnauthenticatedUserException();
|
||||
}
|
||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId);
|
||||
_logger.LogInformation("Plugin {PluginName} has authenticated with {UserName} ({UserId})'s API Key", Uri.EscapeDataString(pluginName), user!.UserName, userId);
|
||||
_logger.LogInformation("Plugin {PluginName} has authenticated with {UserName} ({UserId})'s API Key", pluginName.Replace(Environment.NewLine, string.Empty), user!.UserName, userId);
|
||||
return new UserDto
|
||||
{
|
||||
Username = user.UserName!,
|
||||
|
|
|
@ -230,6 +230,8 @@ public class ReaderController : BaseApiController
|
|||
if (dto == null) return BadRequest(await _localizationService.Translate(User.GetUserId(), "perform-scan"));
|
||||
var mangaFile = chapter.Files.First();
|
||||
|
||||
var series = await _unitOfWork.SeriesRepository.GetSeriesDtoByIdAsync(dto.SeriesId, User.GetUserId());
|
||||
|
||||
var info = new ChapterInfoDto()
|
||||
{
|
||||
ChapterNumber = dto.ChapterNumber,
|
||||
|
@ -242,6 +244,8 @@ public class ReaderController : BaseApiController
|
|||
LibraryId = dto.LibraryId,
|
||||
IsSpecial = dto.IsSpecial,
|
||||
Pages = dto.Pages,
|
||||
SeriesTotalPages = series?.Pages ?? 0,
|
||||
SeriesTotalPagesRead = series?.PagesRead ?? 0,
|
||||
ChapterTitle = dto.ChapterTitle ?? string.Empty,
|
||||
Subtitle = string.Empty,
|
||||
Title = dto.SeriesName,
|
||||
|
@ -266,8 +270,7 @@ public class ReaderController : BaseApiController
|
|||
}
|
||||
else
|
||||
{
|
||||
//info.Subtitle = await _localizationService.Translate(User.GetUserId(), "volume-num", info.VolumeNumber);
|
||||
info.Subtitle = $"Volume {info.VolumeNumber}";
|
||||
info.Subtitle = await _localizationService.Translate(User.GetUserId(), "volume-num", info.VolumeNumber);
|
||||
if (!info.ChapterNumber.Equals(Services.Tasks.Scanner.Parser.Parser.DefaultChapter))
|
||||
{
|
||||
info.Subtitle += " " + ReaderService.FormatChapterName(info.LibraryType, true, true) +
|
||||
|
|
|
@ -143,7 +143,7 @@ public class SeriesController : BaseApiController
|
|||
public async Task<ActionResult> DeleteMultipleSeries(DeleteSeriesDto dto)
|
||||
{
|
||||
var username = User.GetUsername();
|
||||
_logger.LogInformation("Series {SeriesId} is being deleted by {UserName}", dto.SeriesIds, username);
|
||||
_logger.LogInformation("Series {@SeriesId} is being deleted by {UserName}", dto.SeriesIds, username);
|
||||
|
||||
if (await _seriesService.DeleteMultipleSeries(dto.SeriesIds)) return Ok();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue