Add support for fb2 books (#1757)

This commit is contained in:
Dmitry Manannikov
2025-12-13 21:16:56 -07:00
committed by GitHub
parent 0486a4f070
commit 708e851e0b
12 changed files with 1408 additions and 8 deletions
@@ -38,7 +38,7 @@
<p-button [rounded]="true" icon="pi pi-info" class="info-btn" (click)="openBookInfo(book)"></p-button>
}
<p-button [hidden]="isSeriesViewActive()" [rounded]="true" icon="pi pi-book" class="read-btn" (click)="readBook(book)"></p-button>
<p-button [hidden]="isSeriesViewActive() || !canReadBook()" [rounded]="true" icon="pi pi-book" class="read-btn" (click)="readBook(book)"></p-button>
@if (isCheckboxEnabled) {
<p-checkbox
@@ -618,6 +618,7 @@ export class BookCardComponent implements OnInit, OnChanges, OnDestroy {
case 'epub':
case 'mobi':
case 'azw3':
case 'fb2':
return 'pi pi-book';
case 'cbz':
case 'cbr':
@@ -641,6 +642,10 @@ export class BookCardComponent implements OnInit, OnChanges, OnDestroy {
return this.isAdmin() || (this.userPermissions?.canEditMetadata ?? false);
}
canReadBook(): boolean {
return this.book?.bookType !== 'FB2';
}
private hasDownloadPermission(): boolean {
return this.isAdmin() || (this.userPermissions?.canDownload ?? false);
}
@@ -3,7 +3,7 @@ import {CbxBackgroundColor, CbxFitMode, CbxPageSpread, CbxPageViewMode, CbxScrol
import {BookReview} from '../components/book-reviews/book-review-service';
import {ZoomType} from 'ngx-extended-pdf-viewer';
export type BookType = "PDF" | "EPUB" | "CBX";
export type BookType = "PDF" | "EPUB" | "CBX" | "FB2";
export enum AdditionalFileType {
ALTERNATIVE_FORMAT = 'ALTERNATIVE_FORMAT',
@@ -1,7 +1,7 @@
import {SortOption} from './sort.model';
export type LibraryScanMode = 'FILE_AS_BOOK' | 'FOLDER_AS_BOOK';
export type BookFileType = 'PDF' | 'EPUB' | 'CBX';
export type BookFileType = 'PDF' | 'EPUB' | 'CBX' | 'FB2';
export interface Library {
id?: number;
@@ -459,7 +459,7 @@
<p-splitbutton label="Read" icon="pi pi-book" [model]="readItems" (onClick)="read(book.id, 'ngx')" severity="primary"/>
}
}
@if (book!.bookType !== 'PDF') {
@if (book!.bookType !== 'PDF' && book!.bookType !== 'FB2') {
<p-button label="Read" icon="pi pi-book" (onClick)="read(book?.metadata!.bookId, undefined)" severity="primary"/>
}
<p-button label="Shelf" icon="pi pi-folder" severity="secondary" outlined (onClick)="assignShelf(book.id)"></p-button>