Bugfix/release cleanup (#512)

* Lots of cleanup on the warnings in the solution. Deprecated IsLastWriteLessThan and made a new method HasFileBeenModifiedSince.

* Added some tests for the new extension method.

* Changed filter import to use correct import

* Scan Series now uses Refresh Metadata for Series, rather than library one.

* Fixed an issue where cover generation wasn't properly taking forced update into consideration. Removed a case of cover generation for no reason.

* Fixed series downloads not triggering backend call
This commit is contained in:
Joseph Milazzo 2021-08-21 10:03:47 -07:00 committed by GitHub
parent 2a3a08de74
commit 0d2d73e8ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 116 additions and 131 deletions

View file

@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using API.DTOs;

View file

@ -70,7 +70,7 @@ namespace API.Controllers
{
return await GetFirstFileDownload(files);
}
var (fileBytes, zipPath) = await _archiveService.CreateZipForDownload(files.Select(c => c.FilePath),
var (fileBytes, _) = await _archiveService.CreateZipForDownload(files.Select(c => c.FilePath),
$"download_{User.GetUsername()}_v{volumeId}");
return File(fileBytes, DefaultContentType, $"{series.Name} - Volume {volume.Number}.zip");
}
@ -116,7 +116,7 @@ namespace API.Controllers
{
return await GetFirstFileDownload(files);
}
var (fileBytes, zipPath) = await _archiveService.CreateZipForDownload(files.Select(c => c.FilePath),
var (fileBytes, _) = await _archiveService.CreateZipForDownload(files.Select(c => c.FilePath),
$"download_{User.GetUsername()}_c{chapterId}");
return File(fileBytes, DefaultContentType, $"{series.Name} - Chapter {chapter.Number}.zip");
}
@ -137,7 +137,7 @@ namespace API.Controllers
{
return await GetFirstFileDownload(files);
}
var (fileBytes, zipPath) = await _archiveService.CreateZipForDownload(files.Select(c => c.FilePath),
var (fileBytes, _) = await _archiveService.CreateZipForDownload(files.Select(c => c.FilePath),
$"download_{User.GetUsername()}_s{seriesId}");
return File(fileBytes, DefaultContentType, $"{series.Name}.zip");
}
@ -194,11 +194,11 @@ namespace API.Controllers
var files = _directoryService.GetFilesWithExtension(chapterExtractPath, Parser.Parser.ImageFileExtensions);
// Filter out images that aren't in bookmarks
Array.Sort(files, _numericComparer);
totalFilePaths.AddRange(files.Where((t, i) => chapterPages.Contains(i)));
totalFilePaths.AddRange(files.Where((_, i) => chapterPages.Contains(i)));
}
var (fileBytes, zipPath) = await _archiveService.CreateZipForDownload(totalFilePaths,
var (fileBytes, _) = await _archiveService.CreateZipForDownload(totalFilePaths,
tempFolder);
DirectoryService.ClearAndDeleteDirectory(fullExtractPath);
return File(fileBytes, DefaultContentType, $"{series.Name} - Bookmarks.zip");

View file

@ -368,7 +368,7 @@ namespace API.Controllers
/// <summary>
/// Removes all bookmarks for all chapters linked to a Series
/// </summary>
/// <param name="seriesId"></param>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("remove-bookmarks")]
public async Task<ActionResult> RemoveBookmarks(RemoveBookmarkForSeriesDto dto)

View file

@ -12,7 +12,6 @@ using API.Interfaces;
using Kavita.Common;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace API.Controllers

View file

@ -5,7 +5,6 @@ using System.Threading.Tasks;
using API.DTOs.Stats;
using API.DTOs.Update;
using API.Extensions;
using API.Interfaces;
using API.Interfaces.Services;
using API.Services.Tasks;
using Kavita.Common;
@ -26,11 +25,10 @@ namespace API.Controllers
private readonly IBackupService _backupService;
private readonly IArchiveService _archiveService;
private readonly ICacheService _cacheService;
private readonly ITaskScheduler _taskScheduler;
private readonly IVersionUpdaterService _versionUpdaterService;
public ServerController(IHostApplicationLifetime applicationLifetime, ILogger<ServerController> logger, IConfiguration config,
IBackupService backupService, IArchiveService archiveService, ICacheService cacheService, ITaskScheduler taskScheduler,
IBackupService backupService, IArchiveService archiveService, ICacheService cacheService,
IVersionUpdaterService versionUpdaterService)
{
_applicationLifetime = applicationLifetime;
@ -39,7 +37,6 @@ namespace API.Controllers
_backupService = backupService;
_archiveService = archiveService;
_cacheService = cacheService;
_taskScheduler = taskScheduler;
_versionUpdaterService = versionUpdaterService;
}