Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

Release Shakeout Part 1 (#1440)

Joseph Milazzo9d90652792d8
diff --git a/API.Tests/Services/BookServiceTests.cs b/API.Tests/Services/BookServiceTests.cs
index 07fa2936d..f8b726ac5 100644
--- a/API.Tests/Services/BookServiceTests.cs
+++ b/API.Tests/Services/BookServiceTests.cs
@@ -22,16 +22,18 @@ namespace API.Tests.Services
[InlineData("The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub", 16)]
[InlineData("Non-existent file.epub", 0)]
[InlineData("Non an ebub.pdf", 0)]
+ [InlineData("test_ſ.pdf", 1)] // This is dependent on Docnet bug https://github.com/GowenGit/docnet/issues/80
+ [InlineData("test.pdf", 1)]
public void GetNumberOfPagesTest(string filePath, int expectedPages)
{
- var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService/EPUB");
+ var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService");
Assert.Equal(expectedPages, _bookService.GetNumberOfPages(Path.Join(testDirectory, filePath)));
}
[Fact]
public void ShouldHaveComicInfo()
{
- var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService/EPUB");
+ var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService");
var archive = Path.Join(testDirectory, "The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub");
const string summaryInfo = "Book Description";
@@ -44,7 +46,7 @@ namespace API.Tests.Services
[Fact]
public void ShouldHaveComicInfo_WithAuthors()
{
- var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService/EPUB");
+ var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService");
var archive = Path.Join(testDirectory, "The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub");
var comicInfo = _bookService.GetComicInfo(archive);
@@ -52,16 +54,5 @@ namespace API.Tests.Services
Assert.Equal("Roger Starbuck,Junya Inoue", comicInfo.Writer);
}
-
- #region BookEscaping
-
- [Fact]
- public void EscapeCSSImportReferencesTest()
- {
-
- }
-
- #endregion
-
}
}
diff --git a/API.Tests/Services/ReaderServiceTests.cs b/API.Tests/Services/ReaderServiceTests.cs
index 90bd2d279..f50cdd196 100644
--- a/API.Tests/Services/ReaderServiceTests.cs
+++ b/API.Tests/Services/ReaderServiceTests.cs
@@ -2014,7 +2014,6 @@ public class ReaderServiceTests
#endregion
-
#region MarkSeriesAsRead
[Fact]
diff --git a/API.Tests/Services/Test Data/BookService/EPUB/The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub b/API.Tests/Services/Test Data/BookService/The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub
similarity index 100%
rename from API.Tests/Services/Test Data/BookService/EPUB/The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub
rename to API.Tests/Services/Test Data/BookService/The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub
diff --git a/API.Tests/Services/Test Data/BookService/EPUB/content.opf b/API.Tests/Services/Test Data/BookService/content.opf
similarity index 100%
rename from API.Tests/Services/Test Data/BookService/EPUB/content.opf
rename to API.Tests/Services/Test Data/BookService/content.opf
diff --git a/API.Tests/Services/Test Data/BookService/test.pdf b/API.Tests/Services/Test Data/BookService/test.pdf
new file mode 100644
index 000000000..9fe4811a7
Binary files /dev/null and b/API.Tests/Services/Test Data/BookService/test.pdf differ
diff --git "a/API.Tests/Services/Test Data/BookService/test_\305\277.pdf" "b/API.Tests/Services/Test Data/BookService/test_\305\277.pdf"
new file mode 100644
index 000000000..9fe4811a7
Binary files /dev/null and "b/API.Tests/Services/Test Data/BookService/test_\305\277.pdf" differ
diff --git a/API/API.csproj b/API/API.csproj
index 4853568e0..0af5832f3 100644
--- a/API/API.csproj
+++ b/API/API.csproj
@@ -40,7 +40,7 @@
<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
- <PackageReference Include="Docnet.Core" Version="2.4.0-alpha.2" />
+ <PackageReference Include="Docnet.Core" Version="2.4.0-alpha.4" />
<PackageReference Include="ExCSS" Version="4.1.0" />
<PackageReference Include="Flurl" Version="3.0.6" />
<PackageReference Include="Flurl.Http" Version="3.2.4" />
diff --git a/API/Controllers/AccountController.cs b/API/Controllers/AccountController.cs
index 05867362f..d5336917c 100644
--- a/API/Controllers/AccountController.cs
+++ b/API/Controllers/AccountController.cs
@@ -727,21 +727,18 @@ namespace API.Controllers
private async Task<bool> ConfirmEmailToken(string token, AppUser user)
{
var result = await _userManager.ConfirmEmailAsync(user, token);
- if (!result.Succeeded)
- {
- _logger.LogCritical("Email validation failed");
- if (result.Errors.Any())
- {
- foreach (var error in result.Errors)
- {
- _logger.LogCritical("Email validation error: {Message}", error.Description);
- }
- }
+ if (result.Succeeded) return true;
+
+ _logger.LogCritical("[Account] Email validation failed");
+ if (!result.Errors.Any()) return false;
- return false;
+ foreach (var error in result.Errors)
+ {
+ _logger.LogCritical("[Account] Email validation error: {Message}", error.Description);
}
- return true;
+ return false;
+
}
}
}
diff --git a/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.html b/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.html
index f52e1afc0..184b92302 100644
--- a/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.html
+++ b/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.html
@@ -9,6 +9,8 @@
[isLoading]="loadingBookmarks"
[items]="series"
[trackByIdentity]="trackByIdentity"
+ [refresh]="refresh"
+
>
<ng-template #cardItem let-item let-position="idx">
<app-card-item [entity]="item" (reload)="loadBookmarks()" [title]="item.name" [imageUrl]="imageService.getSeriesCoverImage(item.id)"
diff --git a/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.ts b/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.ts
index 1d5dcc83f..b4ea65bb2 100644
--- a/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.ts
+++ b/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.ts
@@ -1,4 +1,4 @@
-import { ChangeDetectionStrategy, ChangeDetectorRef, Component, HostListener, OnDestroy, OnInit } from '@angular/core';
+import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, HostListener, OnDestroy, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { ToastrService } from 'ngx-toastr';
import { take, Subject } from 'rxjs';
@@ -30,6 +30,7 @@ export class BookmarksComponent implements OnInit, OnDestroy {
actions: ActionItem<Series>[] = [];
trackByIdentity = (index: number, item: Series) => `${item.name}_${item.localizedName}_${item.pagesRead}`;
+ refresh: EventEmitter<void> = new EventEmitter();
private onDestroy: Subject<void> = new Subject<void>();
@@ -153,6 +154,7 @@ export class BookmarksComponent implements OnInit, OnDestroy {
}
this.clearingSeries[series.id] = false;
this.toastr.success(series.name + '\'s bookmarks have been removed');
+ this.refresh.emit();
this.cdRef.markForCheck();
});
}
diff --git a/UI/Web/src/app/cards/bulk-selection.service.ts b/UI/Web/src/app/cards/bulk-selection.service.ts
index 94d268e77..326aba869 100644
--- a/UI/Web/src/app/cards/bulk-selection.service.ts
+++ b/UI/Web/src/app/cards/bulk-selection.service.ts
@@ -146,14 +146,7 @@ export class BulkSelectionService {
// else returns volume/chapter items
const allowedActions = [Action.AddToReadingList, Action.MarkAsRead, Action.MarkAsUnread, Action.AddToCollection, Action.Delete, Action.AddToWantToReadList, Action.RemoveFromWantToReadList];
if (Object.keys(this.selectedCards).filter(item => item === 'series').length > 0) {
- let actions = this.actionFactory.getSeriesActions(callback).filter(item => allowedActions.includes(item.action));
- if (this.activeRoute.startsWith('/want-to-read')) {
- const removeFromWantToRead = {...actions[0]};
- removeFromWantToRead.action = Action.RemoveFromWantToReadList;
- removeFromWantToRead.title = 'Remove from Want to Read';
- actions.push(removeFromWantToRead);
- }
- return actions;
+ return this.actionFactory.getSeriesActions(callback).filter(item => allowedActions.includes(item.action));
}
if (Object.keys(this.selectedCards).filter(item => item === 'bookmark').length > 0) {
diff --git a/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.ts b/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.ts
index 90232c554..2e31fff40 100644
--- a/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.ts
+++ b/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.ts
@@ -44,6 +44,7 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy, OnChanges,
@Input() actions: ActionItem<any>[] = [];
@Input() trackByIdentity!: TrackByFunction<any>; //(index: number, item: any) => string
@Input() filterSettings!: FilterSettings;
+ @Input() refresh!: EventEmitter<void>;
@Input() jumpBarKeys: Array<JumpKey> = []; // This is aprox 784 pixels wide
@@ -100,6 +101,13 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy, OnChanges,
this.pagination = {currentPage: 1, itemsPerPage: this.items.length, totalItems: this.items.length, totalPages: 1};
this.changeDetectionRef.markForCheck();
}
+
+ if (this.refresh) {
+ this.refresh.subscribe(() => {
+ this.changeDetectionRef.markForCheck();
+ this.virtualScroller.refresh();
+ });
+ }
}
ngAfterViewInit(): void {
diff --git a/UI/Web/src/app/cards/series-card/series-card.component.ts b/UI/Web/src/app/cards/series-card/series-card.component.ts
index e72e5f6df..d7b1c98bd 100644
--- a/UI/Web/src/app/cards/series-card/series-card.component.ts
+++ b/UI/Web/src/app/cards/series-card/series-card.component.ts
@@ -1,8 +1,8 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output } from '@angular/core';
-import { Router } from '@angular/router';
+import { NavigationStart, Router } from '@angular/router';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrService } from 'ngx-toastr';
-import { take } from 'rxjs/operators';
+import { filter, take } from 'rxjs/operators';
import { Series } from 'src/app/_models/series';
import { AccountService } from 'src/app/_services/account.service';
import { ImageService } from 'src/app/_services/image.service';
@@ -102,6 +102,9 @@ export class SeriesCardComponent implements OnInit, OnChanges, OnDestroy {
break;
case Action.RemoveFromWantToReadList:
this.actionService.removeMultipleSeriesFromWantToReadList([series.id]);
+ if (this.router.url.startsWith('/want-to-read')) {
+ this.reload.emit(true);
+ }
break;
case(Action.AddToCollection):
this.actionService.addMultipleSeriesToCollectionTag([series]);
diff --git a/UI/Web/src/app/reading-list/draggable-ordered-list/draggable-ordered-list.component.html b/UI/Web/src/app/reading-list/draggable-ordered-list/draggable-ordered-list.component.html
index cfce2cd03..a2eaf43a8 100644
--- a/UI/Web/src/app/reading-list/draggable-ordered-list/draggable-ordered-list.component.html
+++ b/UI/Web/src/app/reading-list/draggable-ordered-list/draggable-ordered-list.component.html
@@ -1,4 +1,5 @@
<div cdkDropList class="{{items.length > 0 ? 'example-list list-group-flush' : ''}}" (cdkDropListDropped)="drop($event)">
+ <!-- BUG: https://github.com/angular/components/issues/14098 -->
<div class="example-box" *ngFor="let item of items; index as i" cdkDrag [cdkDragData]="item" cdkDragBoundary=".example-list">
<div class="d-flex list-container">
<div class="me-3 align-middle">
diff --git a/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.html b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.html
index a09ded135..6cc8c45b3 100644
--- a/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.html
+++ b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.html
@@ -18,12 +18,18 @@
<div class="row g-0 mb-3">
<div class="col-auto me-2">
<!-- Action row-->
- <button class="btn btn-primary" title="Read" (click)="read()">
+ <button class="btn btn-primary" title="Read from beginning" (click)="read()">
<span>
- <i class="fa fa-book-open" aria-hidden="true"></i>
+ <i class="fa fa-book" aria-hidden="true"></i>
<span class="read-btn--text">&nbsp;Read</span>
</span>
</button>
+ <button class="btn btn-primary ms-2" title="Continue from last reading position" (click)="continue()">
+ <span>
+ <i class="fa fa-book-open" aria-hidden="true"></i>
+ <span class="read-btn--text">&nbsp;Continue</span>
+ </span>
+ </button>
</div>
<div class="col-auto">
<button class="btn btn-secondary" (click)="removeRead()" [disabled]="readingList.promoted && !this.isAdmin">
@@ -33,6 +39,7 @@
<span class="read-btn--text">&nbsp;Remove Read</span>
</button>
</div>
+ <!-- TODO: Move this in companion bar's page actions -->
<div class="col-auto ms-2 mt-2" *ngIf="!(readingList?.promoted && !this.isAdmin)">
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="accessibilit-mode" [value]="accessibilityMode" (change)="accessibilityMode = !accessibilityMode">
diff --git a/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.ts b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.ts
index 1c23e2fea..d2ae20323 100644
--- a/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.ts
+++ b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.ts
@@ -176,6 +176,12 @@ export class ReadingListDetailComponent implements OnInit {
}
read() {
+ if (!this.readingList) return;
+ const firstItem = this.items[0];
+ this.router.navigate(this.readerService.getNavigationArray(firstItem.libraryId, firstItem.seriesId, firstItem.chapterId, firstItem.seriesFormat), {queryParams: {readingListId: this.readingList.id}});
+ }
+
+ continue() {
// TODO: Can I do this in the backend?
if (!this.readingList) return;
let currentlyReadingChapter = this.items[0];
diff --git a/UI/Web/src/app/series-detail/series-detail.component.ts b/UI/Web/src/app/series-detail/series-detail.component.ts
index 8967929d3..5c0c81232 100644
--- a/UI/Web/src/app/series-detail/series-detail.component.ts
+++ b/UI/Web/src/app/series-detail/series-detail.component.ts
@@ -384,6 +384,12 @@ export class SeriesDetailComponent implements OnInit, OnDestroy, AfterContentChe
this.changeDetectionRef.markForCheck();
});
break;
+ case Action.RemoveFromWantToReadList:
+ this.actionService.removeMultipleSeriesFromWantToReadList([series.id], () => {
+ this.actionInProgress = false;
+ this.changeDetectionRef.markForCheck();
+ });
+ break;
case (Action.Download):
if (this.downloadInProgress) return;
this.downloadSeries();
diff --git a/UI/Web/src/app/want-to-read/want-to-read/want-to-read.component.html b/UI/Web/src/app/want-to-read/want-to-read/want-to-read.component.html
index 3e37386a4..9a6a95ad4 100644
--- a/UI/Web/src/app/want-to-read/want-to-read/want-to-read.component.html
+++ b/UI/Web/src/app/want-to-read/want-to-read/want-to-read.component.html
@@ -5,6 +5,7 @@
Want To Read
</h2>
</ng-container>
+ <h6 subtitle>{{seriesPagination.totalItems}} Series</h6>
</app-side-nav-companion-bar>
</div>
diff --git a/UI/Web/src/app/want-to-read/want-to-read/want-to-read.component.ts b/UI/Web/src/app/want-to-read/want-to-read/want-to-read.component.ts
index 0c4a0c3e7..a6f70316d 100644
--- a/UI/Web/src/app/want-to-read/want-to-read/want-to-read.component.ts
+++ b/UI/Web/src/app/want-to-read/want-to-read/want-to-read.component.ts
@@ -42,7 +42,6 @@ export class WantToReadComponent implements OnInit, OnDestroy {
jumpbarKeys: Array<JumpKey> = [];
filterOpen: EventEmitter<boolean> = new EventEmitter();
-
private onDestory: Subject<void> = new Subject<void>();
trackByIdentity = (index: number, item: Series) => `${item.name}_${item.localizedName}_${item.pagesRead}`;