mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Merge branch 'develop' of https://github.com/Kareadita/Kavita into develop
This commit is contained in:
commit
52a676bb9e
@ -36,6 +36,13 @@ namespace API.Tests.Services
|
||||
}, false, false));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ShouldUpdateCoverImage_OnFirstRunSeries()
|
||||
{
|
||||
// Represents first run
|
||||
Assert.True(MetadataService.ShouldUpdateCoverImage(null,null, false, false));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ShouldUpdateCoverImage_OnSecondRun_FileModified()
|
||||
{
|
||||
|
@ -73,7 +73,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Kavita.Common\Kavita.Common.csproj" />
|
||||
<Content Condition=" '$(Configuration)' == 'Release' " Include="appsettings.json" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@ -118,6 +117,9 @@
|
||||
<Content Remove="temp\**" />
|
||||
<Content Remove="stats\**" />
|
||||
<Content Condition=" '$(Configuration)' == 'Release' " Remove="appsettings.Development.json" />
|
||||
<Content Update="appsettings.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using API.Comparators;
|
||||
@ -21,7 +20,7 @@ namespace API.Services
|
||||
private readonly IArchiveService _archiveService;
|
||||
private readonly IBookService _bookService;
|
||||
private readonly IImageService _imageService;
|
||||
private readonly ChapterSortComparer _chapterSortComparer = new ChapterSortComparer();
|
||||
private readonly ChapterSortComparerZeroFirst _chapterSortComparerForInChapterSorting = new ChapterSortComparerZeroFirst();
|
||||
/// <summary>
|
||||
/// Width of the Thumbnail generation
|
||||
/// </summary>
|
||||
@ -37,11 +36,6 @@ namespace API.Services
|
||||
_imageService = imageService;
|
||||
}
|
||||
|
||||
private static bool IsCoverImageSet(byte[] coverImage, bool forceUpdate = false)
|
||||
{
|
||||
return forceUpdate || HasCoverImage(coverImage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether an entity should regenerate cover image
|
||||
/// </summary>
|
||||
@ -104,10 +98,11 @@ namespace API.Services
|
||||
/// <param name="forceUpdate">Force updating cover image even if underlying file has not been modified or chapter already has a cover image</param>
|
||||
public void UpdateMetadata(Volume volume, bool forceUpdate)
|
||||
{
|
||||
if (volume == null || !IsCoverImageSet(volume.CoverImage, forceUpdate)) return;
|
||||
if (volume == null || !ShouldUpdateCoverImage(volume.CoverImage, null, forceUpdate
|
||||
, false)) return;
|
||||
|
||||
volume.Chapters ??= new List<Chapter>();
|
||||
var firstChapter = volume.Chapters.OrderBy(x => double.Parse(x.Number), _chapterSortComparer).FirstOrDefault();
|
||||
var firstChapter = volume.Chapters.OrderBy(x => double.Parse(x.Number), _chapterSortComparerForInChapterSorting).FirstOrDefault();
|
||||
|
||||
if (firstChapter == null) return;
|
||||
|
||||
@ -132,13 +127,13 @@ namespace API.Services
|
||||
// If firstCover is null and one volume, the whole series is Chapters under Vol 0.
|
||||
if (series.Volumes.Count == 1)
|
||||
{
|
||||
coverImage = series.Volumes[0].Chapters.OrderBy(c => double.Parse(c.Number), _chapterSortComparer)
|
||||
coverImage = series.Volumes[0].Chapters.OrderBy(c => double.Parse(c.Number), _chapterSortComparerForInChapterSorting)
|
||||
.FirstOrDefault(c => !c.IsSpecial)?.CoverImage;
|
||||
}
|
||||
|
||||
if (!HasCoverImage(coverImage))
|
||||
{
|
||||
coverImage = series.Volumes[0].Chapters.OrderBy(c => double.Parse(c.Number), _chapterSortComparer)
|
||||
coverImage = series.Volumes[0].Chapters.OrderBy(c => double.Parse(c.Number), _chapterSortComparerForInChapterSorting)
|
||||
.FirstOrDefault()?.CoverImage;
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,7 @@ RUN apt-get update \
|
||||
#Creates the data directory
|
||||
RUN mkdir /kavita/data
|
||||
|
||||
RUN cp /kavita/appsettings.Development.json /kavita/appsettings.json \
|
||||
&& sed -i 's/Data source=kavita.db/Data source=data\/kavita.db/g' /kavita/appsettings.json
|
||||
RUN sed -i 's/Data source=kavita.db/Data source=data\/kavita.db/g' /kavita/appsettings.json
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<Company>kavitareader.com</Company>
|
||||
<Product>Kavita</Product>
|
||||
<AssemblyVersion>0.4.4.3</AssemblyVersion>
|
||||
<AssemblyVersion>0.4.4.7</AssemblyVersion>
|
||||
<NeutralLanguage>en</NeutralLanguage>
|
||||
</PropertyGroup>
|
||||
|
||||
|
30
build.sh
30
build.sh
@ -1,8 +1,20 @@
|
||||
#! /bin/bash
|
||||
#! /bin/bash
|
||||
set -e
|
||||
|
||||
outputFolder='_output'
|
||||
|
||||
CheckRequirements()
|
||||
{
|
||||
if ! command -v npm &> /dev/null
|
||||
then
|
||||
echo "Warning!!! npm not found, it is required for building Kavita!"
|
||||
fi
|
||||
if ! command -v dotnet &> /dev/null
|
||||
then
|
||||
echo "Warning!!! dotnet not found, it is required for building Kavita!"
|
||||
fi
|
||||
}
|
||||
|
||||
ProgressStart()
|
||||
{
|
||||
echo "Start '$1'"
|
||||
@ -55,7 +67,8 @@ BuildUI()
|
||||
echo 'Building UI'
|
||||
npm run prod
|
||||
echo 'Copying back to Kavita wwwroot'
|
||||
cp -r dist/* ../../API/wwwroot
|
||||
mkdir -p ../../API/wwwroot
|
||||
cp -R dist/* ../../API/wwwroot
|
||||
cd ../../ || exit
|
||||
ProgressEnd 'Building UI'
|
||||
}
|
||||
@ -75,7 +88,7 @@ Package()
|
||||
dotnet publish -c Release --self-contained --runtime $runtime -o "$lOutputFolder" --framework $framework
|
||||
|
||||
echo "Recopying wwwroot due to bug"
|
||||
cp -r ./wwwroot/* $lOutputFolder/wwwroot
|
||||
cp -R ./wwwroot/* $lOutputFolder/wwwroot
|
||||
|
||||
echo "Copying Install information"
|
||||
cp ../INSTALL.txt "$lOutputFolder"/README.txt
|
||||
@ -84,7 +97,15 @@ Package()
|
||||
cp ../LICENSE "$lOutputFolder"/LICENSE.txt
|
||||
|
||||
echo "Renaming API -> Kavita"
|
||||
mv "$lOutputFolder"/API "$lOutputFolder"/Kavita
|
||||
if [ $runtime == "win-x64" ] || [ $runtime == "win-x86" ]
|
||||
then
|
||||
mv "$lOutputFolder"/API.exe "$lOutputFolder"/Kavita.exe
|
||||
else
|
||||
mv "$lOutputFolder"/API "$lOutputFolder"/Kavita
|
||||
fi
|
||||
|
||||
echo "Copying appsettings.json"
|
||||
cp appsettings.Development.json $lOutputFolder/appsettings.json
|
||||
|
||||
echo "Creating tar"
|
||||
cd ../$outputFolder/"$runtime"/
|
||||
@ -101,6 +122,7 @@ Package()
|
||||
|
||||
RID="$1"
|
||||
|
||||
CheckRequirements
|
||||
BuildUI
|
||||
Build
|
||||
|
||||
|
@ -56,6 +56,9 @@ Package()
|
||||
|
||||
echo "Show API structure"
|
||||
find
|
||||
|
||||
echo "Copying appsettings.json"
|
||||
cp appsettings.Development.json $lOutputFolder/appsettings.json
|
||||
|
||||
echo "Creating tar"
|
||||
cd ../$outputFolder/"$runtime"/
|
||||
|
Loading…
x
Reference in New Issue
Block a user