misc stuff to avoid scan loop (#1389)

* Implemented a workaround for nginx users with BlockCommonExploits enabled, which would interfere with book image escaping done by Kavita when images had ../ in their path.

* Added back to top support on all pages but those that untilize virtual scrolling without a parent scroll.

* Hide jumpbar on pages where there is no scroll

* Refactored jumbar code into a dedicated service

* Stash some jumpkey resume code as I can't get it working with the virtual scroller.

* Don't allow non-admins to see File locations on card detail drawer.

* Some cleanup on GetServerInfo

* When an error occurs in register, delete the user on exception.

* Fixed a NPE in Stat collection for brand new users

* When we catch an exception on registering a new user, delete the user as rolling back doesn't do anything.

* Don't close typeahead when we are selecting options from it

* Added shortcut key H to open shortcut modal on manga reader

* When processing progress updates on cards, for volumes, properly find the chapter to update pages read.

* Hide cover image on reading list if it's not set and fixed a missing closing div tag

* Hide collection poster when nothing is set on collection detail

* Small fix around updating state

* Sped up the bookmark image call by removing one DB call

* Fixed broken test from change in bookmark code

* Fixed an oversight where if there is no tag in ComicInfo after a chapter was updated with People or Genres, then the People/Genres would never be removed.

* Added test with TagHelper

* Fixed a bug where 2 clear buttons would show on search bar due to browser injecting their own. Search bar wont show clear button until text is typed.

* Fixed a bug where InstallID wasn't being selected correctly in converter
This commit is contained in:
Joseph Milazzo 2022-07-27 10:16:45 -05:00 committed by GitHub
parent b90c6aa76c
commit 5812588fe5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 474 additions and 249 deletions

View file

@ -103,18 +103,15 @@ public class StatsService : IStatsService
public async Task<ServerInfoDto> GetServerInfo()
{
var installId = await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.InstallId);
var installVersion = await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.InstallVersion);
var serverSettings = await _unitOfWork.SettingsRepository.GetSettingsDtoAsync();
var serverInfo = new ServerInfoDto
{
InstallId = installId.Value,
InstallId = serverSettings.InstallId,
Os = RuntimeInformation.OSDescription,
KavitaVersion = installVersion.Value,
KavitaVersion = serverSettings.InstallVersion,
DotnetVersion = Environment.Version.ToString(),
IsDocker = new OsInfo(Array.Empty<IOsVersionAdapter>()).IsDocker,
IsDocker = new OsInfo().IsDocker,
NumOfCores = Math.Max(Environment.ProcessorCount, 1),
HasBookmarks = (await _unitOfWork.UserRepository.GetAllBookmarksAsync()).Any(),
NumberOfLibraries = (await _unitOfWork.LibraryRepository.GetLibrariesAsync()).Count(),
@ -157,22 +154,20 @@ public class StatsService : IStatsService
return _context.SeriesRelation.AnyAsync();
}
private Task<int> MaxSeriesInAnyLibrary()
private async Task<int> MaxSeriesInAnyLibrary()
{
return _context.Series
.Select(s => new
{
LibraryId = s.LibraryId,
Count = _context.Library.Where(l => l.Id == s.LibraryId).SelectMany(l => l.Series).Count()
})
.AsNoTracking()
.AsSplitQuery()
.MaxAsync(d => d.Count);
// If first time flow, just return 0
if (!await _context.Series.AnyAsync()) return 0;
return await _context.Series
.Select(s => _context.Library.Where(l => l.Id == s.LibraryId).SelectMany(l => l.Series).Count())
.MaxAsync();
}
private Task<int> MaxVolumesInASeries()
private async Task<int> MaxVolumesInASeries()
{
return _context.Volume
// If first time flow, just return 0
if (!await _context.Volume.AnyAsync()) return 0;
return await _context.Volume
.Select(v => new
{
v.SeriesId,
@ -183,9 +178,11 @@ public class StatsService : IStatsService
.MaxAsync(d => d.Count);
}
private Task<int> MaxChaptersInASeries()
private async Task<int> MaxChaptersInASeries()
{
return _context.Series
// If first time flow, just return 0
if (!await _context.Chapter.AnyAsync()) return 0;
return await _context.Series
.AsNoTracking()
.AsSplitQuery()
.MaxAsync(s => s.Volumes