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));
|
}, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ShouldUpdateCoverImage_OnFirstRunSeries()
|
||||||
|
{
|
||||||
|
// Represents first run
|
||||||
|
Assert.True(MetadataService.ShouldUpdateCoverImage(null,null, false, false));
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ShouldUpdateCoverImage_OnSecondRun_FileModified()
|
public void ShouldUpdateCoverImage_OnSecondRun_FileModified()
|
||||||
{
|
{
|
||||||
|
@ -73,7 +73,6 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Kavita.Common\Kavita.Common.csproj" />
|
<ProjectReference Include="..\Kavita.Common\Kavita.Common.csproj" />
|
||||||
<Content Condition=" '$(Configuration)' == 'Release' " Include="appsettings.json" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
@ -118,6 +117,9 @@
|
|||||||
<Content Remove="temp\**" />
|
<Content Remove="temp\**" />
|
||||||
<Content Remove="stats\**" />
|
<Content Remove="stats\**" />
|
||||||
<Content Condition=" '$(Configuration)' == 'Release' " Remove="appsettings.Development.json" />
|
<Content Condition=" '$(Configuration)' == 'Release' " Remove="appsettings.Development.json" />
|
||||||
|
<Content Update="appsettings.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using API.Comparators;
|
using API.Comparators;
|
||||||
@ -21,7 +20,7 @@ namespace API.Services
|
|||||||
private readonly IArchiveService _archiveService;
|
private readonly IArchiveService _archiveService;
|
||||||
private readonly IBookService _bookService;
|
private readonly IBookService _bookService;
|
||||||
private readonly IImageService _imageService;
|
private readonly IImageService _imageService;
|
||||||
private readonly ChapterSortComparer _chapterSortComparer = new ChapterSortComparer();
|
private readonly ChapterSortComparerZeroFirst _chapterSortComparerForInChapterSorting = new ChapterSortComparerZeroFirst();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Width of the Thumbnail generation
|
/// Width of the Thumbnail generation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -37,11 +36,6 @@ namespace API.Services
|
|||||||
_imageService = imageService;
|
_imageService = imageService;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsCoverImageSet(byte[] coverImage, bool forceUpdate = false)
|
|
||||||
{
|
|
||||||
return forceUpdate || HasCoverImage(coverImage);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines whether an entity should regenerate cover image
|
/// Determines whether an entity should regenerate cover image
|
||||||
/// </summary>
|
/// </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>
|
/// <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)
|
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>();
|
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;
|
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 firstCover is null and one volume, the whole series is Chapters under Vol 0.
|
||||||
if (series.Volumes.Count == 1)
|
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;
|
.FirstOrDefault(c => !c.IsSpecial)?.CoverImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HasCoverImage(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;
|
.FirstOrDefault()?.CoverImage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,7 @@ RUN apt-get update \
|
|||||||
#Creates the data directory
|
#Creates the data directory
|
||||||
RUN mkdir /kavita/data
|
RUN mkdir /kavita/data
|
||||||
|
|
||||||
RUN cp /kavita/appsettings.Development.json /kavita/appsettings.json \
|
RUN sed -i 's/Data source=kavita.db/Data source=data\/kavita.db/g' /kavita/appsettings.json
|
||||||
&& sed -i 's/Data source=kavita.db/Data source=data\/kavita.db/g' /kavita/appsettings.json
|
|
||||||
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<Company>kavitareader.com</Company>
|
<Company>kavitareader.com</Company>
|
||||||
<Product>Kavita</Product>
|
<Product>Kavita</Product>
|
||||||
<AssemblyVersion>0.4.4.3</AssemblyVersion>
|
<AssemblyVersion>0.4.4.7</AssemblyVersion>
|
||||||
<NeutralLanguage>en</NeutralLanguage>
|
<NeutralLanguage>en</NeutralLanguage>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
30
build.sh
30
build.sh
@ -1,8 +1,20 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
outputFolder='_output'
|
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()
|
ProgressStart()
|
||||||
{
|
{
|
||||||
echo "Start '$1'"
|
echo "Start '$1'"
|
||||||
@ -55,7 +67,8 @@ BuildUI()
|
|||||||
echo 'Building UI'
|
echo 'Building UI'
|
||||||
npm run prod
|
npm run prod
|
||||||
echo 'Copying back to Kavita wwwroot'
|
echo 'Copying back to Kavita wwwroot'
|
||||||
cp -r dist/* ../../API/wwwroot
|
mkdir -p ../../API/wwwroot
|
||||||
|
cp -R dist/* ../../API/wwwroot
|
||||||
cd ../../ || exit
|
cd ../../ || exit
|
||||||
ProgressEnd 'Building UI'
|
ProgressEnd 'Building UI'
|
||||||
}
|
}
|
||||||
@ -75,7 +88,7 @@ Package()
|
|||||||
dotnet publish -c Release --self-contained --runtime $runtime -o "$lOutputFolder" --framework $framework
|
dotnet publish -c Release --self-contained --runtime $runtime -o "$lOutputFolder" --framework $framework
|
||||||
|
|
||||||
echo "Recopying wwwroot due to bug"
|
echo "Recopying wwwroot due to bug"
|
||||||
cp -r ./wwwroot/* $lOutputFolder/wwwroot
|
cp -R ./wwwroot/* $lOutputFolder/wwwroot
|
||||||
|
|
||||||
echo "Copying Install information"
|
echo "Copying Install information"
|
||||||
cp ../INSTALL.txt "$lOutputFolder"/README.txt
|
cp ../INSTALL.txt "$lOutputFolder"/README.txt
|
||||||
@ -84,7 +97,15 @@ Package()
|
|||||||
cp ../LICENSE "$lOutputFolder"/LICENSE.txt
|
cp ../LICENSE "$lOutputFolder"/LICENSE.txt
|
||||||
|
|
||||||
echo "Renaming API -> Kavita"
|
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"
|
echo "Creating tar"
|
||||||
cd ../$outputFolder/"$runtime"/
|
cd ../$outputFolder/"$runtime"/
|
||||||
@ -101,6 +122,7 @@ Package()
|
|||||||
|
|
||||||
RID="$1"
|
RID="$1"
|
||||||
|
|
||||||
|
CheckRequirements
|
||||||
BuildUI
|
BuildUI
|
||||||
Build
|
Build
|
||||||
|
|
||||||
|
@ -56,6 +56,9 @@ Package()
|
|||||||
|
|
||||||
echo "Show API structure"
|
echo "Show API structure"
|
||||||
find
|
find
|
||||||
|
|
||||||
|
echo "Copying appsettings.json"
|
||||||
|
cp appsettings.Development.json $lOutputFolder/appsettings.json
|
||||||
|
|
||||||
echo "Creating tar"
|
echo "Creating tar"
|
||||||
cd ../$outputFolder/"$runtime"/
|
cd ../$outputFolder/"$runtime"/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user