Manga Redesign (#321)
* Code cleanup, refactored FileRepository into Unit of Work. * Added AutoCloseMenu and ReaderMode user perferences to match UI * Added extra information to ChapterInfo * Build changes * Updated the readme to have open collective information and thanks to sponsors * Fixed an issue with UnitOfWork refactor and how stats was bootsrapped. Replaced stats.kavitareader with a temp url to test out redirection bug.
This commit is contained in:
parent
b958342394
commit
be2b78fa5a
40 changed files with 1608 additions and 87 deletions
|
|
@ -63,10 +63,6 @@ namespace API.Services
|
|||
}
|
||||
|
||||
new DirectoryInfo(extractPath).Flatten();
|
||||
// if (fileCount > 1)
|
||||
// {
|
||||
// new DirectoryInfo(extractPath).Flatten();
|
||||
// }
|
||||
|
||||
return chapter;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,20 +2,25 @@
|
|||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using API.Configurations.CustomOptions;
|
||||
using API.DTOs;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace API.Services.Clients
|
||||
{
|
||||
public class StatsApiClient
|
||||
{
|
||||
private readonly HttpClient _client;
|
||||
private readonly StatsOptions _options;
|
||||
private readonly ILogger<StatsApiClient> _logger;
|
||||
|
||||
public StatsApiClient(HttpClient client, ILogger<StatsApiClient> logger)
|
||||
public StatsApiClient(HttpClient client, IOptions<StatsOptions> options, ILogger<StatsApiClient> logger)
|
||||
{
|
||||
_client = client;
|
||||
_logger = logger;
|
||||
_options = options.Value ?? throw new ArgumentNullException(nameof(options));
|
||||
}
|
||||
|
||||
public async Task SendDataToStatsServer(UsageStatisticsDto data)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
public string Publisher { get; set; }
|
||||
public string Genre { get; set; }
|
||||
public int PageCount { get; set; }
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public string LanguageISO { get; set; }
|
||||
public string Web { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace API.Services.HostedServices
|
|||
{
|
||||
await ManageStartupStatsTasks(scope, taskScheduler);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception)
|
||||
{
|
||||
//If stats startup fail the user can keep using the app
|
||||
}
|
||||
|
|
@ -36,9 +36,9 @@ namespace API.Services.HostedServices
|
|||
|
||||
private async Task ManageStartupStatsTasks(IServiceScope serviceScope, ITaskScheduler taskScheduler)
|
||||
{
|
||||
var settingsRepository = serviceScope.ServiceProvider.GetRequiredService<ISettingsRepository>();
|
||||
var unitOfWork = serviceScope.ServiceProvider.GetRequiredService<IUnitOfWork>();
|
||||
|
||||
var settingsDto = await settingsRepository.GetSettingsDtoAsync();
|
||||
var settingsDto = await unitOfWork.SettingsRepository.GetSettingsDtoAsync();
|
||||
|
||||
if (!settingsDto.AllowStatCollection) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,15 +25,15 @@ namespace API.Services
|
|||
private readonly StatsApiClient _client;
|
||||
private readonly DataContext _dbContext;
|
||||
private readonly ILogger<StatsService> _logger;
|
||||
private readonly IFileRepository _fileRepository;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public StatsService(StatsApiClient client, DataContext dbContext, ILogger<StatsService> logger,
|
||||
IFileRepository fileRepository)
|
||||
IUnitOfWork unitOfWork)
|
||||
{
|
||||
_client = client;
|
||||
_dbContext = dbContext;
|
||||
_logger = logger;
|
||||
_fileRepository = fileRepository;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
private static string FinalPath => Path.Combine(Directory.GetCurrentDirectory(), TempFilePath, TempFileName);
|
||||
|
|
@ -77,9 +77,9 @@ namespace API.Services
|
|||
_logger.LogInformation("Deleting the file from disk");
|
||||
if (FileExists) File.Delete(FinalPath);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error Finalizing Stats collection flow", e);
|
||||
_logger.LogError(ex, "Error Finalizing Stats collection flow");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
|
@ -121,7 +121,7 @@ namespace API.Services
|
|||
.Select(x => new LibInfo {Type = x.Key, Count = x.Count()})
|
||||
.ToArrayAsync();
|
||||
|
||||
var uniqueFileTypes = await _fileRepository.GetFileExtensions();
|
||||
var uniqueFileTypes = await _unitOfWork.FileRepository.GetFileExtensions();
|
||||
|
||||
var usageInfo = new UsageInfoDto
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue