mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-30 19:54:14 -04:00
* Fixed a bad default setting for token key * Changed the payment link to support Google Pay * Fixed duplicate events occurring on newly added series from a scan. Fixed the version update code from not firing and made it check every 4-6 hours (random per user per restart) * Check for new releases on startup as well. Added Personal Table of Contents (called Bookmarks on epub and pdf reader). The idea is that sometimes you want to bookmark certain parts of pages to get back to quickly later. This mechanism will allow you to do that without having to edit the underlying ToC. * Added a button to update modal to show how to update for those unaware. * Darkened the link text within tables to be more visible. * Update link for how to update now is dynamic for docker users * Refactored to send proper star/end dates for scrobble read events for upcoming changes in the API. Added GoogleBooks Rating UI code if I go forward with API changes. * When Scrobbling, send when the first and last progress for the series was. Added OpenLibrary icon for upcoming enhancements for Kavita+. Changed the Update checker to execute at start. * Fixed backups not saving favicons in the correct place * Refactored the layout code for Personal ToC * More bugfixes around toc * Box alignment * Fixed up closing the overlay when bookmark mode is active * Fixed up closing the overlay when bookmark mode is active --------- Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
59 lines
1.7 KiB
C#
59 lines
1.7 KiB
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using API.Data;
|
|
using API.Services.Tasks.Scanner;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
namespace API.Services.HostedServices;
|
|
|
|
public class StartupTasksHostedService : IHostedService
|
|
{
|
|
private readonly IServiceProvider _provider;
|
|
|
|
public StartupTasksHostedService(IServiceProvider serviceProvider)
|
|
{
|
|
_provider = serviceProvider;
|
|
}
|
|
|
|
public async Task StartAsync(CancellationToken cancellationToken)
|
|
{
|
|
using var scope = _provider.CreateScope();
|
|
|
|
var taskScheduler = scope.ServiceProvider.GetRequiredService<ITaskScheduler>();
|
|
await taskScheduler.ScheduleTasks();
|
|
taskScheduler.ScheduleUpdaterTasks();
|
|
|
|
|
|
try
|
|
{
|
|
// These methods will automatically check if stat collection is disabled to prevent sending any data regardless
|
|
// of when setting was changed
|
|
await taskScheduler.ScheduleStatsTasks();
|
|
await taskScheduler.RunStatCollection();
|
|
}
|
|
catch (Exception)
|
|
{
|
|
//If stats startup fail the user can keep using the app
|
|
}
|
|
|
|
try
|
|
{
|
|
var unitOfWork = scope.ServiceProvider.GetRequiredService<IUnitOfWork>();
|
|
if ((await unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableFolderWatching)
|
|
{
|
|
var libraryWatcher = scope.ServiceProvider.GetRequiredService<ILibraryWatcher>();
|
|
await libraryWatcher.StartWatching();
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
// Fail silently
|
|
}
|
|
|
|
}
|
|
|
|
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
|
|
}
|