From 967582005213fdac6a7c64c42a786e6651b3787b Mon Sep 17 00:00:00 2001
From: adityachandelgit <>
Date: Sat, 17 May 2025 12:35:35 -0600
Subject: [PATCH 1/7] Add support for paginated and scrolled modes in EPUB
reader
---
.../booklore/model/dto/BookLoreUser.java | 1 +
.../model/dto/EpubViewerPreferences.java | 1 +
.../entity/EpubViewerPreferencesEntity.java | 3 +
.../booklore/service/BooksService.java | 2 +
.../service/user/UserProvisioningService.java | 1 +
..._flow_column_to_epub_viewer_preference.sql | 2 +
.../component/epub-viewer.component.html | 7 ++-
.../component/epub-viewer.component.ts | 55 ++++++++++++++++---
booklore-ui/src/app/book/model/book.model.ts | 1 +
.../settings/user-management/user.service.ts | 1 +
.../user-preferences.component.html | 13 +++++
.../user-preferences.component.ts | 12 +++-
12 files changed, 87 insertions(+), 12 deletions(-)
create mode 100644 booklore-api/src/main/resources/db/migration/V17__Add_flow_column_to_epub_viewer_preference.sql
diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/model/dto/BookLoreUser.java b/booklore-api/src/main/java/com/adityachandel/booklore/model/dto/BookLoreUser.java
index 0992099e2..e06623613 100644
--- a/booklore-api/src/main/java/com/adityachandel/booklore/model/dto/BookLoreUser.java
+++ b/booklore-api/src/main/java/com/adityachandel/booklore/model/dto/BookLoreUser.java
@@ -47,6 +47,7 @@ public class BookLoreUser {
private String theme;
private String font;
private int fontSize;
+ private String flow;
}
diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/model/dto/EpubViewerPreferences.java b/booklore-api/src/main/java/com/adityachandel/booklore/model/dto/EpubViewerPreferences.java
index fca4ab55b..1c8382f86 100644
--- a/booklore-api/src/main/java/com/adityachandel/booklore/model/dto/EpubViewerPreferences.java
+++ b/booklore-api/src/main/java/com/adityachandel/booklore/model/dto/EpubViewerPreferences.java
@@ -9,5 +9,6 @@ public class EpubViewerPreferences {
private Long bookId;
private String theme;
private String font;
+ private String flow;
private Integer fontSize;
}
\ No newline at end of file
diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/model/entity/EpubViewerPreferencesEntity.java b/booklore-api/src/main/java/com/adityachandel/booklore/model/entity/EpubViewerPreferencesEntity.java
index 3e44b7005..b961dfa3e 100644
--- a/booklore-api/src/main/java/com/adityachandel/booklore/model/entity/EpubViewerPreferencesEntity.java
+++ b/booklore-api/src/main/java/com/adityachandel/booklore/model/entity/EpubViewerPreferencesEntity.java
@@ -32,4 +32,7 @@ public class EpubViewerPreferencesEntity {
@Column(name = "font_size")
private Integer fontSize;
+
+ @Column(name = "flow")
+ private String flow;
}
\ No newline at end of file
diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/service/BooksService.java b/booklore-api/src/main/java/com/adityachandel/booklore/service/BooksService.java
index c857a737e..83ad2fca7 100644
--- a/booklore-api/src/main/java/com/adityachandel/booklore/service/BooksService.java
+++ b/booklore-api/src/main/java/com/adityachandel/booklore/service/BooksService.java
@@ -58,6 +58,7 @@ public class BooksService {
.font(epubPref.getFont())
.fontSize(epubPref.getFontSize())
.theme(epubPref.getTheme())
+ .flow(epubPref.getFlow())
.build()));
} else if (bookEntity.getBookType() == BookFileType.PDF) {
pdfViewerPreferencesRepository.findByBookIdAndUserId(bookId, user.getId())
@@ -107,6 +108,7 @@ public class BooksService {
epubPrefs.setFont(epubSettings.getFont());
epubPrefs.setFontSize(epubSettings.getFontSize());
epubPrefs.setTheme(epubSettings.getTheme());
+ epubPrefs.setFlow(epubSettings.getFlow());
epubViewerPreferencesRepository.save(epubPrefs);
} else {
diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/service/user/UserProvisioningService.java b/booklore-api/src/main/java/com/adityachandel/booklore/service/user/UserProvisioningService.java
index 003cf7574..fecf8d588 100644
--- a/booklore-api/src/main/java/com/adityachandel/booklore/service/user/UserProvisioningService.java
+++ b/booklore-api/src/main/java/com/adityachandel/booklore/service/user/UserProvisioningService.java
@@ -218,6 +218,7 @@ public class UserProvisioningService {
.theme("white")
.font("serif")
.fontSize(150)
+ .flow("paginated")
.build();
}
diff --git a/booklore-api/src/main/resources/db/migration/V17__Add_flow_column_to_epub_viewer_preference.sql b/booklore-api/src/main/resources/db/migration/V17__Add_flow_column_to_epub_viewer_preference.sql
new file mode 100644
index 000000000..76016aaea
--- /dev/null
+++ b/booklore-api/src/main/resources/db/migration/V17__Add_flow_column_to_epub_viewer_preference.sql
@@ -0,0 +1,2 @@
+ALTER TABLE epub_viewer_preference
+ ADD COLUMN flow VARCHAR(32) NULL;
\ No newline at end of file
diff --git a/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.html b/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.html
index 98784d06c..13484cdbc 100644
--- a/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.html
+++ b/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.html
@@ -33,6 +33,9 @@
Flow:
+Font Size:
{{ (item.bookCount$ | async)?.toString() || '0' }}
diff --git a/booklore-ui/src/app/layout/component/layout-menu/app.menuitem.component.ts b/booklore-ui/src/app/layout/component/layout-menu/app.menuitem.component.ts index c5929e094..285ff733b 100644 --- a/booklore-ui/src/app/layout/component/layout-menu/app.menuitem.component.ts +++ b/booklore-ui/src/app/layout/component/layout-menu/app.menuitem.component.ts @@ -49,6 +49,7 @@ export class AppMenuitemComponent implements OnInit, OnDestroy { key: string = ""; canManipulateLibrary: boolean = false; + admin: boolean = false; menuSourceSubscription: Subscription; menuResetSubscription: Subscription; @@ -57,6 +58,7 @@ export class AppMenuitemComponent implements OnInit, OnDestroy { this.userService.userData$.subscribe(userData => { if (userData) { this.canManipulateLibrary = userData.permissions.canManipulateLibrary; + this.admin = userData.permissions.admin; } }); this.menuSourceSubscription = this.menuService.menuSource$.subscribe(value => { diff --git a/booklore-ui/src/app/settings/user-management/user-management.component.html b/booklore-ui/src/app/settings/user-management/user-management.component.html index 0ca82d8f8..61d14e229 100644 --- a/booklore-ui/src/app/settings/user-management/user-management.component.html +++ b/booklore-ui/src/app/settings/user-management/user-management.component.html @@ -15,12 +15,13 @@{{ currentChapter }}
Font Size: {{ fontSize }}%
-Font Size: {{ fontSize }}%
+ISBN 13: {{ metadata.isbn13 || '-' }}
Page Count: {{ metadata.pageCount || '-' }}
File Size: {{ getFileSizeInMB() }}
+Progress: {{ getProgressPercent() !== null ? getProgressPercent() + '%' : '-' }}
File Path: {{ book?.filePath }}
@@ -95,7 +107,7 @@