Release Shakeout (#1186)
* Cleaned up some styles on the progress bar in book reader * Fixed up some phone-hidden classes and added titles around the codebase. Stat reporting on first run now takes into account that admin user wont exist. * Fixed manage library page not updating last scan time when a notification event comes in. * Integrated SeriesSort ComicInfo tag (somehow it got missed) * Some minor style changes and no results found for bookmarks on chapter detail modal * Fixed the labels in action bar on book reader so Prev/Next are in same place * Cleaned up some responsive styles around images and reduced custom classes in light of new display classes on collection detail and series detail pages * Fixed an issue with webkit browsers and book reader where the scroll to would fail as the document wasn't fully rendered. A 10ms delay seems to fix the issue. * Cleaned up some code and filtering for collections. Collection detail is missing filtering functionality somehow, disabled the button and will add in future release * Correctly validate and show a message when a user is not an admin or has change password role when going through forget password flow. * Fixed a bug on manage libraries where library last scan didn't work on first scan of a library, due to there being no updated series. * Fixed a rendering issue with text being focused on confirm email page textboxes. Fixed a bug where when deleting a theme that was default, Kavita didn't reset Dark as the default theme. * Cleaned up the naming and styles for side nav active item hover * Fixed event widget to have correct styling on eink and light * Tried to fix a rendering issue on side nav for light themes, but can't figure it out * On light more, ensure switches are green * Fixed a bug where opening a page with a preselected filter, the filter toggle button would require 2 clicks to collapse * Reverted the revert of On Deck. * Improved the upload by url experience by sending a custom fail error to UI when a url returns 401. * When deleting a library, emit a series removed event for each series removed so user's dashboards/screens update. * Fixed an api throwing an error due to text being sent back instead of json. * Fixed a refresh bug with refreshing pending invites after deleting an invite. Ensure we always refresh pending invites even if user cancel's from invite, as they might invite, then hit cancel, where invite is still active. * Fixed a bug where invited users with + in the email would fail due to validation, but UI wouldn't properly inform user.
This commit is contained in:
parent
606ce2295e
commit
78ffb8a8a2
50 changed files with 297 additions and 158 deletions
|
@ -525,6 +525,12 @@ namespace API.Controllers
|
|||
return Ok("An email will be sent to the email if it exists in our database");
|
||||
}
|
||||
|
||||
var roles = await _userManager.GetRolesAsync(user);
|
||||
|
||||
|
||||
if (!roles.Any(r => r is PolicyConstants.AdminRole or PolicyConstants.ChangePasswordRole))
|
||||
return Unauthorized("You are not permitted to this operation.");
|
||||
|
||||
var emailLink = GenerateEmailLink(await _userManager.GeneratePasswordResetTokenAsync(user), "confirm-reset-password", user.Email);
|
||||
_logger.LogCritical("[Forgot Password]: Email Link for {UserName}: {Link}", user.UserName, emailLink);
|
||||
var host = _environment.IsDevelopment() ? "localhost:4200" : Request.Host.ToString();
|
||||
|
|
|
@ -197,6 +197,12 @@ namespace API.Controllers
|
|||
_taskScheduler.CleanupChapters(chapterIds);
|
||||
}
|
||||
|
||||
foreach (var seriesId in seriesIds)
|
||||
{
|
||||
await _eventHub.SendMessageAsync(MessageFactory.SeriesRemoved,
|
||||
MessageFactory.SeriesRemovedEvent(seriesId, string.Empty, libraryId), false);
|
||||
}
|
||||
|
||||
await _eventHub.SendMessageAsync(MessageFactory.LibraryModified,
|
||||
MessageFactory.LibraryModifiedEvent(libraryId, "delete"), false);
|
||||
return Ok(true);
|
||||
|
|
|
@ -618,6 +618,12 @@ public class OpdsController : BaseApiController
|
|||
{
|
||||
if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
|
||||
return BadRequest("OPDS is not enabled on this server");
|
||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(await GetUser(apiKey));
|
||||
if (!await _downloadService.HasDownloadPermission(user))
|
||||
{
|
||||
return BadRequest("User does not have download permissions");
|
||||
}
|
||||
|
||||
var files = await _unitOfWork.ChapterRepository.GetFilesForChapterAsync(chapterId);
|
||||
var (bytes, contentType, fileDownloadName) = await _downloadService.GetFirstFileDownload(files);
|
||||
return File(bytes, contentType, fileDownloadName);
|
||||
|
@ -776,6 +782,7 @@ public class OpdsController : BaseApiController
|
|||
{
|
||||
CreateLink(FeedLinkRelation.Image, FeedLinkType.Image, $"/api/image/chapter-cover?chapterId={chapterId}"),
|
||||
CreateLink(FeedLinkRelation.Thumbnail, FeedLinkType.Image, $"/api/image/chapter-cover?chapterId={chapterId}"),
|
||||
accLink,
|
||||
CreatePageStreamLink(seriesId, volumeId, chapterId, mangaFile, apiKey)
|
||||
},
|
||||
Content = new FeedEntryContent()
|
||||
|
@ -785,11 +792,12 @@ public class OpdsController : BaseApiController
|
|||
}
|
||||
};
|
||||
|
||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(await GetUser(apiKey));
|
||||
if (await _downloadService.HasDownloadPermission(user))
|
||||
{
|
||||
entry.Links.Add(accLink);
|
||||
}
|
||||
// We can't not show acc link in the feed, panels wont work like that. We have to block download directly
|
||||
// var user = await _unitOfWork.UserRepository.GetUserByIdAsync(await GetUser(apiKey));
|
||||
// if (await _downloadService.HasDownloadPermission(user))
|
||||
// {
|
||||
// entry.Links.Add(accLink);
|
||||
// }
|
||||
|
||||
|
||||
return entry;
|
||||
|
|
|
@ -47,12 +47,24 @@ namespace API.Controllers
|
|||
{
|
||||
var dateString = $"{DateTime.Now.ToShortDateString()}_{DateTime.Now.ToLongTimeString()}".Replace("/", "_").Replace(":", "_");
|
||||
var format = _directoryService.FileSystem.Path.GetExtension(dto.Url.Split('?')[0]).Replace(".", "");
|
||||
var path = await dto.Url
|
||||
.DownloadFileAsync(_directoryService.TempDirectory, $"coverupload_{dateString}.{format}");
|
||||
try
|
||||
{
|
||||
var path = await dto.Url
|
||||
.DownloadFileAsync(_directoryService.TempDirectory, $"coverupload_{dateString}.{format}");
|
||||
|
||||
if (string.IsNullOrEmpty(path) || !_directoryService.FileSystem.File.Exists(path)) return BadRequest($"Could not download file");
|
||||
if (string.IsNullOrEmpty(path) || !_directoryService.FileSystem.File.Exists(path))
|
||||
return BadRequest($"Could not download file");
|
||||
|
||||
return $"coverupload_{dateString}.{format}";
|
||||
return $"coverupload_{dateString}.{format}";
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
// Unauthorized
|
||||
if (ex.StatusCode == 401)
|
||||
return BadRequest("The server requires authentication to load the url externally");
|
||||
}
|
||||
|
||||
return BadRequest("Unable to download image, please use another url or upload by file");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace API.Data.Metadata
|
|||
public string Summary { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Series { get; set; } = string.Empty;
|
||||
public string SeriesSort { get; set; } = string.Empty;
|
||||
public string Number { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// The total number of items in the series.
|
||||
|
|
|
@ -89,6 +89,7 @@ public class LibraryRepository : ILibraryRepository
|
|||
{
|
||||
var library = await GetLibraryForIdAsync(libraryId, LibraryIncludes.Folders | LibraryIncludes.Series);
|
||||
_context.Library.Remove(library);
|
||||
|
||||
return await _context.SaveChangesAsync() > 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -624,7 +624,7 @@ public class SeriesRepository : ISeriesRepository
|
|||
LastReadingProgress = _context.AppUserProgresses
|
||||
.Where(p => p.Id == progress.Id && p.AppUserId == userId)
|
||||
.Max(p => p.LastModified),
|
||||
// This is only taking into account chapters that have progress on them, not all chapters in said series
|
||||
// BUG: This is only taking into account chapters that have progress on them, not all chapters in said series
|
||||
LastChapterCreated = _context.Chapter.Where(c => progress.ChapterId == c.Id).Max(c => c.Created),
|
||||
//LastChapterCreated = _context.Chapter.Where(c => allChapters.Contains(c.Id)).Max(c => c.Created)
|
||||
});
|
||||
|
|
|
@ -15,6 +15,12 @@ namespace API.Extensions
|
|||
{
|
||||
public static IServiceCollection AddIdentityServices(this IServiceCollection services, IConfiguration config)
|
||||
{
|
||||
services.Configure<IdentityOptions>(options =>
|
||||
{
|
||||
options.User.AllowedUserNameCharacters =
|
||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+/";
|
||||
});
|
||||
|
||||
services.AddIdentityCore<AppUser>(opt =>
|
||||
{
|
||||
opt.Password.RequireNonAlphanumeric = false;
|
||||
|
|
|
@ -72,9 +72,8 @@ namespace API
|
|||
}
|
||||
|
||||
await context.Database.MigrateAsync();
|
||||
var roleManager = services.GetRequiredService<RoleManager<AppRole>>();
|
||||
|
||||
await Seed.SeedRoles(roleManager);
|
||||
await Seed.SeedRoles(services.GetRequiredService<RoleManager<AppRole>>());
|
||||
await Seed.SeedSettings(context, directoryService);
|
||||
await Seed.SeedThemes(context);
|
||||
await Seed.SeedUserApiKeys(context);
|
||||
|
@ -110,7 +109,7 @@ namespace API
|
|||
(await context.ServerSetting.SingleOrDefaultAsync(s =>
|
||||
s.Key == ServerSettingKey.InstallVersion))?.Value;
|
||||
}
|
||||
catch
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ public class SeriesService : ISeriesService
|
|||
}
|
||||
|
||||
await _eventHub.SendMessageAsync(MessageFactory.ScanSeries,
|
||||
MessageFactory.ScanSeriesEvent(series.Id, series.Name), false);
|
||||
MessageFactory.ScanSeriesEvent(series.LibraryId, series.Id, series.Name), false);
|
||||
|
||||
await _unitOfWork.CollectionTagRepository.RemoveTagsWithoutSeries();
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ public interface ITaskScheduler
|
|||
Task ScheduleTasks();
|
||||
Task ScheduleStatsTasks();
|
||||
void ScheduleUpdaterTasks();
|
||||
void ScanLibrary(int libraryId, bool forceUpdate = false);
|
||||
void ScanLibrary(int libraryId);
|
||||
void CleanupChapters(int[] chapterIds);
|
||||
void RefreshMetadata(int libraryId, bool forceUpdate = true);
|
||||
void RefreshSeriesMetadata(int libraryId, int seriesId, bool forceUpdate = false);
|
||||
|
@ -146,7 +146,7 @@ public class TaskScheduler : ITaskScheduler
|
|||
}
|
||||
#endregion
|
||||
|
||||
public void ScanLibrary(int libraryId, bool forceUpdate = false)
|
||||
public void ScanLibrary(int libraryId)
|
||||
{
|
||||
_logger.LogInformation("Enqueuing library scan for: {LibraryId}", libraryId);
|
||||
BackgroundJob.Enqueue(() => _scannerService.ScanLibrary(libraryId));
|
||||
|
|
|
@ -117,10 +117,15 @@ namespace API.Services.Tasks.Scanner
|
|||
}
|
||||
|
||||
// Patch is SeriesSort from ComicInfo
|
||||
if (info.ComicInfo != null && !string.IsNullOrEmpty(info.ComicInfo.TitleSort))
|
||||
if (!string.IsNullOrEmpty(info.ComicInfo.TitleSort))
|
||||
{
|
||||
info.SeriesSort = info.ComicInfo.TitleSort;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(info.ComicInfo.SeriesSort))
|
||||
{
|
||||
info.SeriesSort = info.ComicInfo.SeriesSort;
|
||||
}
|
||||
}
|
||||
|
||||
TrackSeries(info);
|
||||
|
|
|
@ -162,7 +162,7 @@ public class ScannerService : IScannerService
|
|||
}
|
||||
// Tell UI that this series is done
|
||||
await _eventHub.SendMessageAsync(MessageFactory.ScanSeries,
|
||||
MessageFactory.ScanSeriesEvent(seriesId, series.Name));
|
||||
MessageFactory.ScanSeriesEvent(libraryId, seriesId, series.Name));
|
||||
await CleanupDbEntities();
|
||||
BackgroundJob.Enqueue(() => _cacheService.CleanupChapters(chapterIds));
|
||||
BackgroundJob.Enqueue(() => _metadataService.RefreshMetadataForSeries(libraryId, series.Id, false));
|
||||
|
@ -428,7 +428,7 @@ public class ScannerService : IScannerService
|
|||
foreach (var series in librarySeries)
|
||||
{
|
||||
// This is something more like, the series has finished updating in the backend. It may or may not have been modified.
|
||||
await _eventHub.SendMessageAsync(MessageFactory.ScanSeries, MessageFactory.ScanSeriesEvent(series.Id, series.Name));
|
||||
await _eventHub.SendMessageAsync(MessageFactory.ScanSeries, MessageFactory.ScanSeriesEvent(library.Id, series.Id, series.Name));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -523,7 +523,7 @@ public class ScannerService : IScannerService
|
|||
series.Format = parsedInfos[0].Format;
|
||||
}
|
||||
series.OriginalName ??= parsedInfos[0].Series;
|
||||
if (!series.SortNameLocked) series.SortName ??= parsedInfos[0].SeriesSort;
|
||||
if (!series.SortNameLocked) series.SortName = parsedInfos[0].SeriesSort;
|
||||
|
||||
await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress, MessageFactory.LibraryScanProgressEvent(library.Name, ProgressEventType.Ended, series.Name));
|
||||
|
||||
|
|
|
@ -100,6 +100,21 @@ public class SiteThemeService : ISiteThemeService
|
|||
await _unitOfWork.CommitAsync();
|
||||
}
|
||||
|
||||
// if there are no default themes, reselect Dark as default
|
||||
var postSaveThemes = (await _unitOfWork.SiteThemeRepository.GetThemes()).ToList();
|
||||
if (!postSaveThemes.Any(t => t.IsDefault))
|
||||
{
|
||||
var defaultThemeName = Seed.DefaultThemes.Single(t => t.IsDefault).NormalizedName;
|
||||
var theme = postSaveThemes.SingleOrDefault(t => t.NormalizedName == defaultThemeName);
|
||||
if (theme != null)
|
||||
{
|
||||
theme.IsDefault = true;
|
||||
_unitOfWork.SiteThemeRepository.Update(theme);
|
||||
await _unitOfWork.CommitAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
|
||||
MessageFactory.SiteThemeProgressEvent("", "", ProgressEventType.Ended));
|
||||
|
||||
|
|
|
@ -102,11 +102,6 @@ public class StatsService : IStatsService
|
|||
var installId = await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.InstallId);
|
||||
var installVersion = await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.InstallVersion);
|
||||
|
||||
var firstAdminUser = (await _unitOfWork.UserRepository.GetAdminUsersAsync()).First();
|
||||
var firstAdminUserPref = (await _unitOfWork.UserRepository.GetPreferencesAsync(firstAdminUser.UserName));
|
||||
|
||||
var activeTheme = firstAdminUserPref.Theme ?? Seed.DefaultThemes.First(t => t.IsDefault);
|
||||
|
||||
var serverInfo = new ServerInfoDto
|
||||
{
|
||||
InstallId = installId.Value,
|
||||
|
@ -117,15 +112,24 @@ public class StatsService : IStatsService
|
|||
NumOfCores = Math.Max(Environment.ProcessorCount, 1),
|
||||
HasBookmarks = (await _unitOfWork.UserRepository.GetAllBookmarksAsync()).Any(),
|
||||
NumberOfLibraries = (await _unitOfWork.LibraryRepository.GetLibrariesAsync()).Count(),
|
||||
ActiveSiteTheme = activeTheme.Name,
|
||||
NumberOfCollections = (await _unitOfWork.CollectionTagRepository.GetAllTagsAsync()).Count(),
|
||||
NumberOfReadingLists = await _unitOfWork.ReadingListRepository.Count(),
|
||||
OPDSEnabled = (await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds,
|
||||
NumberOfUsers = (await _unitOfWork.UserRepository.GetAllUsers()).Count(),
|
||||
TotalFiles = await _unitOfWork.LibraryRepository.GetTotalFiles(),
|
||||
MangaReaderMode = firstAdminUserPref.ReaderMode
|
||||
};
|
||||
|
||||
var firstAdminUser = (await _unitOfWork.UserRepository.GetAdminUsersAsync()).FirstOrDefault();
|
||||
|
||||
if (firstAdminUser != null)
|
||||
{
|
||||
var firstAdminUserPref = (await _unitOfWork.UserRepository.GetPreferencesAsync(firstAdminUser.UserName));
|
||||
var activeTheme = firstAdminUserPref.Theme ?? Seed.DefaultThemes.First(t => t.IsDefault);
|
||||
|
||||
serverInfo.ActiveSiteTheme = activeTheme.Name;
|
||||
serverInfo.MangaReaderMode = firstAdminUserPref.ReaderMode;
|
||||
}
|
||||
|
||||
return serverInfo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,13 +80,15 @@ namespace API.SignalR
|
|||
public const string LibraryModified = "LibraryModified";
|
||||
|
||||
|
||||
public static SignalRMessage ScanSeriesEvent(int seriesId, string seriesName)
|
||||
public static SignalRMessage ScanSeriesEvent(int libraryId, int seriesId, string seriesName)
|
||||
{
|
||||
return new SignalRMessage()
|
||||
{
|
||||
Name = ScanSeries,
|
||||
EventType = ProgressEventType.Single,
|
||||
Body = new
|
||||
{
|
||||
LibraryId = libraryId,
|
||||
SeriesId = seriesId,
|
||||
SeriesName = seriesName
|
||||
}
|
||||
|
|
|
@ -120,6 +120,7 @@ namespace API
|
|||
ForwardedHeaders.All;
|
||||
});
|
||||
|
||||
|
||||
services.AddHangfire(configuration => configuration
|
||||
.UseSimpleAssemblyNameTypeSerializer()
|
||||
.UseRecommendedSerializerSettings()
|
||||
|
@ -149,7 +150,6 @@ namespace API
|
|||
// Apply all migrations on startup
|
||||
var logger = serviceProvider.GetRequiredService<ILogger<Program>>();
|
||||
var userManager = serviceProvider.GetRequiredService<UserManager<AppUser>>();
|
||||
var context = serviceProvider.GetRequiredService<DataContext>();
|
||||
|
||||
await MigrateBookmarks.Migrate(directoryService, unitOfWork,
|
||||
logger, cacheService);
|
||||
|
@ -161,6 +161,7 @@ namespace API
|
|||
var installVersion = await unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.InstallVersion);
|
||||
installVersion.Value = BuildInfo.Version.ToString();
|
||||
unitOfWork.SettingsRepository.Update(installVersion);
|
||||
|
||||
await unitOfWork.CommitAsync();
|
||||
}).GetAwaiter()
|
||||
.GetResult();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue