Misc Fixes (#1031)
* Changed the default margin for mobile in book reader to 5% * Fixed a bug where checking for update did no current version validation before sending the update to the UI. * Added some documentation to the book code * Changed token expiry to 2 weeks. * Search bar will by default not have a border outline * Cleaned up some styles for white mode hovering on search * Added missing genre search group, reworked some clearing code, fixed click handlers * Fixed genre property * Changed the series title to show bookmarks and the edit button will now take you to series * Fixed up accordion tabpanel color in dark mode * Fixed a typo of CoverArtist instead of "Cover artist" * Added some documentation changes * Fixed a bug where sort options on All-Series wasn't working * Added a thanks to Palace-Designs who hosts our infrastructure to the readme. * Fixed a bug where duplicate people for the same role would be returned * Fixed a bug where when user cleared out input manually, search would retain old search results
This commit is contained in:
parent
dc2d5b505f
commit
19e17c85fa
22 changed files with 130 additions and 55 deletions
|
@ -77,11 +77,16 @@ namespace API.Controllers
|
|||
return File(content, contentType, $"{chapterId}-{file}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This will return a list of mappings from ID -> page num. ID will be the xhtml key and page num will be the reading order
|
||||
/// this is used to rewrite anchors in the book text so that we always load properly in FE
|
||||
/// </summary>
|
||||
/// <remarks>This is essentially building the table of contents</remarks>
|
||||
/// <param name="chapterId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{chapterId}/chapters")]
|
||||
public async Task<ActionResult<ICollection<BookChapterItem>>> GetBookChapters(int chapterId)
|
||||
{
|
||||
// This will return a list of mappings from ID -> pagenum. ID will be the xhtml key and pagenum will be the reading order
|
||||
// this is used to rewrite anchors in the book text so that we always load properly in FE
|
||||
var chapter = await _unitOfWork.ChapterRepository.GetChapterAsync(chapterId);
|
||||
using var book = await EpubReader.OpenBookAsync(chapter.Files.ElementAt(0).FilePath);
|
||||
var mappings = await _bookService.CreateKeyToPageMappingAsync(book);
|
||||
|
@ -126,7 +131,7 @@ namespace API.Controllers
|
|||
var tocPage = book.Content.Html.Keys.FirstOrDefault(k => k.ToUpper().Contains("TOC"));
|
||||
if (tocPage == null) return Ok(chaptersList);
|
||||
|
||||
// Find all anchor tags, for each anchor we get inner text, to lower then titlecase on UI. Get href and generate page content
|
||||
// Find all anchor tags, for each anchor we get inner text, to lower then title case on UI. Get href and generate page content
|
||||
var doc = new HtmlDocument();
|
||||
var content = await book.Content.Html[tocPage].ReadContentAsync();
|
||||
doc.LoadHtml(content);
|
||||
|
@ -252,7 +257,7 @@ namespace API.Controllers
|
|||
return BadRequest("Could not find the appropriate html for that page");
|
||||
}
|
||||
|
||||
private void LogBookErrors(EpubBookRef book, EpubTextContentFileRef contentFileRef, HtmlDocument doc)
|
||||
private void LogBookErrors(EpubBookRef book, EpubContentFileRef contentFileRef, HtmlDocument doc)
|
||||
{
|
||||
_logger.LogError("{FilePath} has an invalid html file (Page {PageName})", book.FilePath, contentFileRef.FileName);
|
||||
foreach (var error in doc.ParseErrors)
|
||||
|
|
|
@ -25,22 +25,20 @@ namespace API.Controllers
|
|||
private readonly IConfiguration _config;
|
||||
private readonly IBackupService _backupService;
|
||||
private readonly IArchiveService _archiveService;
|
||||
private readonly ICacheService _cacheService;
|
||||
private readonly IVersionUpdaterService _versionUpdaterService;
|
||||
private readonly IStatsService _statsService;
|
||||
private readonly ICleanupService _cleanupService;
|
||||
private readonly IEmailService _emailService;
|
||||
|
||||
public ServerController(IHostApplicationLifetime applicationLifetime, ILogger<ServerController> logger, IConfiguration config,
|
||||
IBackupService backupService, IArchiveService archiveService, ICacheService cacheService,
|
||||
IVersionUpdaterService versionUpdaterService, IStatsService statsService, ICleanupService cleanupService, IEmailService emailService)
|
||||
IBackupService backupService, IArchiveService archiveService, IVersionUpdaterService versionUpdaterService, IStatsService statsService,
|
||||
ICleanupService cleanupService, IEmailService emailService)
|
||||
{
|
||||
_applicationLifetime = applicationLifetime;
|
||||
_logger = logger;
|
||||
_config = config;
|
||||
_backupService = backupService;
|
||||
_archiveService = archiveService;
|
||||
_cacheService = cacheService;
|
||||
_versionUpdaterService = versionUpdaterService;
|
||||
_statsService = statsService;
|
||||
_cleanupService = cleanupService;
|
||||
|
@ -111,6 +109,9 @@ namespace API.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks for updates, if no updates that are > current version installed, returns null
|
||||
/// </summary>
|
||||
[HttpGet("check-update")]
|
||||
public async Task<ActionResult<UpdateNotificationDto>> CheckForUpdates()
|
||||
{
|
||||
|
|
|
@ -240,11 +240,6 @@ public class SeriesRepository : ISeriesRepository
|
|||
{
|
||||
var query = await CreateFilteredSearchQueryable(userId, libraryId, filter);
|
||||
|
||||
if (filter.SortOptions == null)
|
||||
{
|
||||
query = query.OrderBy(s => s.SortName);
|
||||
}
|
||||
|
||||
var retSeries = query
|
||||
.ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)
|
||||
.AsSplitQuery()
|
||||
|
@ -314,6 +309,7 @@ public class SeriesRepository : ISeriesRepository
|
|||
.Where(sm => seriesIds.Contains(sm.SeriesId))
|
||||
.SelectMany(sm => sm.People.Where(t => EF.Functions.Like(t.Name, $"%{searchQuery}%")))
|
||||
.AsSplitQuery()
|
||||
.Distinct()
|
||||
.ProjectTo<PersonDto>(_mapper.ConfigurationProvider)
|
||||
.ToListAsync();
|
||||
|
||||
|
|
|
@ -458,6 +458,11 @@ namespace API.Services
|
|||
return content;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the leading ../
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static string CleanContentKeys(string key)
|
||||
{
|
||||
return key.Replace("../", string.Empty);
|
||||
|
|
|
@ -57,8 +57,8 @@ public class VersionUpdaterService : IVersionUpdaterService
|
|||
private readonly IPresenceTracker _tracker;
|
||||
private readonly Markdown _markdown = new MarkdownDeep.Markdown();
|
||||
#pragma warning disable S1075
|
||||
private static readonly string GithubLatestReleasesUrl = "https://api.github.com/repos/Kareadita/Kavita/releases/latest";
|
||||
private static readonly string GithubAllReleasesUrl = "https://api.github.com/repos/Kareadita/Kavita/releases";
|
||||
private const string GithubLatestReleasesUrl = "https://api.github.com/repos/Kareadita/Kavita/releases/latest";
|
||||
private const string GithubAllReleasesUrl = "https://api.github.com/repos/Kareadita/Kavita/releases";
|
||||
#pragma warning restore S1075
|
||||
|
||||
public VersionUpdaterService(ILogger<VersionUpdaterService> logger, IHubContext<MessageHub> messageHub, IPresenceTracker tracker)
|
||||
|
@ -76,10 +76,12 @@ public class VersionUpdaterService : IVersionUpdaterService
|
|||
/// <summary>
|
||||
/// Fetches the latest release from Github
|
||||
/// </summary>
|
||||
public async Task<UpdateNotificationDto> CheckForUpdate()
|
||||
/// <returns>Latest update or null if current version is greater than latest update</returns>
|
||||
public async Task<UpdateNotificationDto?> CheckForUpdate()
|
||||
{
|
||||
var update = await GetGithubRelease();
|
||||
return CreateDto(update);
|
||||
var dto = CreateDto(update);
|
||||
return new Version(dto.UpdateVersion) <= new Version(dto.CurrentVersion) ? null : dto;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<UpdateNotificationDto>> GetAllReleases()
|
||||
|
|
|
@ -50,7 +50,7 @@ public class TokenService : ITokenService
|
|||
var tokenDescriptor = new SecurityTokenDescriptor()
|
||||
{
|
||||
Subject = new ClaimsIdentity(claims),
|
||||
Expires = DateTime.Now.AddDays(7),
|
||||
Expires = DateTime.Now.AddDays(14),
|
||||
SigningCredentials = creds
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue