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
f8579b8311
21
.github/workflows/stable-docker.yml
vendored
21
.github/workflows/stable-docker.yml
vendored
@ -30,7 +30,7 @@ jobs:
|
|||||||
rsync -a dist/ ../../API/wwwroot/
|
rsync -a dist/ ../../API/wwwroot/
|
||||||
|
|
||||||
cd ../ || exit
|
cd ../ || exit
|
||||||
|
|
||||||
- name: Get csproj Version
|
- name: Get csproj Version
|
||||||
uses: naminodarie/get-net-sdk-project-versions-action@v1
|
uses: naminodarie/get-net-sdk-project-versions-action@v1
|
||||||
id: get-version
|
id: get-version
|
||||||
@ -38,7 +38,15 @@ jobs:
|
|||||||
proj-path: Kavita.Common/Kavita.Common.csproj
|
proj-path: Kavita.Common/Kavita.Common.csproj
|
||||||
|
|
||||||
- name: Echo csproj version
|
- name: Echo csproj version
|
||||||
run: echo "${{steps.get-version.outputs.assembly-version}}"
|
run: echo "${{steps.get-version.outputs.assembly-version}}"
|
||||||
|
|
||||||
|
- name: Parse Version
|
||||||
|
run: |
|
||||||
|
version='${{steps.get-version.outputs.assembly-version}}'
|
||||||
|
newVersion=${version%.*}
|
||||||
|
echo $newVersion
|
||||||
|
echo "::set-output name=VERSION::$newVersion"
|
||||||
|
id: parse-version
|
||||||
|
|
||||||
- name: Compile dotnet app
|
- name: Compile dotnet app
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v1
|
||||||
@ -75,6 +83,15 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: kizaing/kavita:latest
|
tags: kizaing/kavita:latest
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
id: docker_build
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: kizaing/kavita:${{ steps.parse-version.outputs.VERSION }}
|
||||||
|
|
||||||
- name: Image digest
|
- name: Image digest
|
||||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
|
|
||||||
|
@ -106,8 +106,9 @@ namespace API.Controllers
|
|||||||
{
|
{
|
||||||
foreach (var chapter in volume.Chapters)
|
foreach (var chapter in volume.Chapters)
|
||||||
{
|
{
|
||||||
var userProgress = user.Progresses.SingleOrDefault(x => x.ChapterId == chapter.Id && x.AppUserId == user.Id);
|
var userProgress = GetUserProgressForChapter(user, chapter);
|
||||||
if (userProgress == null) // I need to get all chapters and generate new user progresses for them?
|
|
||||||
|
if (userProgress == null)
|
||||||
{
|
{
|
||||||
user.Progresses.Add(new AppUserProgress
|
user.Progresses.Add(new AppUserProgress
|
||||||
{
|
{
|
||||||
@ -137,6 +138,31 @@ namespace API.Controllers
|
|||||||
return BadRequest("There was an issue saving progress");
|
return BadRequest("There was an issue saving progress");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static AppUserProgress GetUserProgressForChapter(AppUser user, Chapter chapter)
|
||||||
|
{
|
||||||
|
AppUserProgress userProgress = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
userProgress =
|
||||||
|
user.Progresses.SingleOrDefault(x => x.ChapterId == chapter.Id && x.AppUserId == user.Id);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// There is a very rare chance that user progress will duplicate current row. If that happens delete one with less pages
|
||||||
|
var progresses = user.Progresses.Where(x => x.ChapterId == chapter.Id && x.AppUserId == user.Id).ToList();
|
||||||
|
if (progresses.Count > 1)
|
||||||
|
{
|
||||||
|
user.Progresses = new List<AppUserProgress>()
|
||||||
|
{
|
||||||
|
user.Progresses.First()
|
||||||
|
};
|
||||||
|
userProgress = user.Progresses.First();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return userProgress;
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost("mark-unread")]
|
[HttpPost("mark-unread")]
|
||||||
public async Task<ActionResult> MarkUnread(MarkReadDto markReadDto)
|
public async Task<ActionResult> MarkUnread(MarkReadDto markReadDto)
|
||||||
{
|
{
|
||||||
@ -147,23 +173,12 @@ namespace API.Controllers
|
|||||||
{
|
{
|
||||||
foreach (var chapter in volume.Chapters)
|
foreach (var chapter in volume.Chapters)
|
||||||
{
|
{
|
||||||
var userProgress = user.Progresses.SingleOrDefault(x => x.ChapterId == chapter.Id && x.AppUserId == user.Id);
|
var userProgress = GetUserProgressForChapter(user, chapter);
|
||||||
if (userProgress == null)
|
|
||||||
{
|
if (userProgress == null) continue;
|
||||||
user.Progresses.Add(new AppUserProgress
|
userProgress.PagesRead = 0;
|
||||||
{
|
userProgress.SeriesId = markReadDto.SeriesId;
|
||||||
PagesRead = 0,
|
userProgress.VolumeId = volume.Id;
|
||||||
VolumeId = volume.Id,
|
|
||||||
SeriesId = markReadDto.SeriesId,
|
|
||||||
ChapterId = chapter.Id
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
userProgress.PagesRead = 0;
|
|
||||||
userProgress.SeriesId = markReadDto.SeriesId;
|
|
||||||
userProgress.VolumeId = volume.Id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.3.0</AssemblyVersion>
|
<AssemblyVersion>0.4.3.1</AssemblyVersion>
|
||||||
<NeutralLanguage>en</NeutralLanguage>
|
<NeutralLanguage>en</NeutralLanguage>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user