Merge pull request #766 from adityachandelgit/develop

Merge Develop into Master for release
This commit is contained in:
Aditya Chandel
2025-07-21 23:38:16 -06:00
committed by GitHub
21 changed files with 371 additions and 232 deletions
+1 -1
View File
@@ -147,7 +147,7 @@ git checkout -b fix/my-fix
- Follow code conventions, keep PRs focused and scoped
- Link the relevant issue in your PR
- Test your changes
- Target the `master` branch when opening PRs
- Target the `develop` branch when opening PRs
---
+18 -38
View File
@@ -11,22 +11,27 @@ BookLore is a self-hosted web app for organizing and managing your personal book
## ✨ Key Features
- 📚 **Organized Book Management** - Categorize books with **Libraries** and **Shelves** for easy discovery and structured organization.
- 🧠 **Smart Metadata Handling** - Automatically fetch book details from **Goodreads**, **Amazon**, and **Google Books**, or edit them manually with fine-grained control.
- 👥 **Multi-User Support** - Admins can create accounts, assign libraries, and manage permissions for metadata edits, uploads, and downloads.
- 📖 **Built-in PDF & ePub Reader** - A fast, feature-rich reader for PDFs and ePubs, with customizable reading settings and a clean UI.
- 🌐 **OPDS 1.2 Support** - Browse and download books through the **Open Publication Distribution System** – compatible with many reading apps.
- 🔐 **Optional OIDC Authentication** - Secure access with **OpenID Connect**, supporting both local JWT authentication and external providers like **Authentik**.
- 📤 **Multi-Book Uploads** - Upload multiple books at once with metadata auto-detection and file organization.
- 📧 **Send Books via Email** - Share books directly with others by sending them via email – quick and easy.
- 🚀 **Continuous Improvements** - Frequent updates with new features, performance enhancements, and UI improvements. BookLore is perfect for self-hosters who want complete control over their digital library. Stay tuned for updates!
## 🎥 Video Guides & Tutorials
- 📚 **Powerful Book Organization**: Keep your library tidy with **Libraries** and **Shelves**. Whether you're sorting by genre, author, or mood, finding the right book is effortless.
- 🧠 **Intelligent Metadata Management**: Instantly fetch rich metadata from **Goodreads**, **Amazon**, **Google Books**, **Hardcover**, and more, or fine-tune every detail yourself with our advanced editor.
- 👥 **Multi-User Access with Permissions**: Add users, assign libraries, and control who can edit, upload, or download. Perfect for families, friends, or teams.
- 📖 **Built-in PDF, ePub, and CBX Reader**: Enjoy a smooth, distraction-free reading experience directly in your browser. Supports themes and adjustable settings.
- 🌐 **OPDS 1.2 Integration**: Connect BookLore to your favorite reading apps with full **OPDS** support for seamless downloads.
- 🔐 **Flexible Authentication**: Secure your library with optional **OIDC login** via providers like **Authentik** and **Pocket ID**, or stick with local **JWT**, the choice is yours.
- 📤 **Smart Batch Upload with BookDrop Folder**: Drop dozens of books into the **BookDrop Folder**, and BookLore will automatically scan, organize, and fetch metadata for all of them, hands-free and efficient.
- 📧 **Send Books by Email**: Seamlessly share books with friends or your own devices by sending them directly via email from within BookLore. Just one click, and it’s delivered.
- 📱 **Mobile-Optimized UI**: Sleek, responsive design tailored for phones and tablets. Manage your library from anywhere, effortlessly.
- 🔄 **Open Source & Self-Hosted**: Take full control of your digital library with BookLore’s open-source, self-hosted design.
- 🚀 **Active Development**: BookLore is under continuous improvement with regular updates to features, UI, and performance.
For a step-by-step walkthrough, check out the official BookLore video guides on YouTube:
## 🚀 Getting Started with BookLore
📺 [BookLore Tutorials – YouTube](https://www.youtube.com/watch?v=UMrn_fIeFRo&list=PLi0fq0zaM7lqY7dX0R66jQtKW64z4_Tdz)
Kick off your BookLore journey with our official documentation and helpful video guides.
These videos cover deployment, configuration, and feature highlights to help you get started quickly.
📘 [BookLore Documentation: Getting Started](https://adityachandelgit.github.io/booklore-docs/docs/getting-started)
Our up-to-date docs walk you through installation, setup, configuration, and key features, everything you need to get up and running smoothly.
🎥 [BookLore Tutorials: YouTube](https://www.youtube.com/watch?v=UMrn_fIeFRo&list=PLi0fq0zaM7lqY7dX0R66jQtKW64z4_Tdz)
These older videos provide useful walkthroughs and visual guidance, but note that some content may be outdated compared to the current docs.
## 🐳 Deploy with Docker
@@ -141,31 +146,6 @@ For detailed instructions on setting up OIDC authentication:
- 📺 [YouTube video on configuring Authentik with BookLore](https://www.youtube.com/watch?v=r6Ufh9ldF9M)
- 📘 [Step-by-step setup guide for Pocket ID](docs/OIDC-Setup-With-PocketID.md)
## 🔐 Remote Authentication (Trusted Header SSO, Forward Auth)
If you run BookLore behind a reverse proxy with remote authentication (middleware),
you can enable automatic login by setting `REMOTE_AUTH_ENABLED` to `true`.
This allows you to use your existing authentication system (e.g., OAuth, SAML) to log in to BookLore.
The following remote auth environment variables can be configured:
| Variable Name | Description | Default Value |
|------------------------------|-----------------------------------------|---------------------------------------------------------------------|
| REMOTE_AUTH_ENABLED | Enable remote authentication | `false` |
| REMOTE_AUTH_CREATE_NEW_USERS | Auto-create users from remote auth | `true` |
| REMOTE_AUTH_HEADER_NAME | HTTP header containing user's name | `Remote-Name` |
| REMOTE_AUTH_HEADER_USER | HTTP header containing username | `Remote-User` |
| REMOTE_AUTH_HEADER_EMAIL | HTTP header containing user's email | `Remote-Email` |
| REMOTE_AUTH_HEADER_GROUPS | HTTP header containing user's groups | `Remote-Groups` |
| REMOTE_AUTH_ADMIN_GROUP | Group name that grants admin privileges | - |
Example implementations:
- https://www.authelia.com/integration/trusted-header-sso/introduction/
- https://caddyserver.com/docs/caddyfile/directives/forward_auth
- https://doc.traefik.io/traefik/middlewares/http/forwardauth/
- https://github.com/sevensolutions/traefik-oidc-auth (Traefik OIDC Auth)
## 🤝 Community & Support
- 🐞 Found a bug? [Open an issue](https://github.com/adityachandelgit/BookLore/issues)
@@ -20,6 +20,7 @@ import com.adityachandel.booklore.util.FileUtils;
import com.adityachandel.booklore.util.PathPatternResolver;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FilenameUtils;
import org.springframework.core.io.PathResource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
@@ -105,7 +106,7 @@ public class BookDropService {
filePattern += "{currentFilename}";
}
String relativePath = PathPatternResolver.resolvePattern(metadata, filePattern, bookdropFile.getFilePath());
String relativePath = PathPatternResolver.resolvePattern(metadata, filePattern, FilenameUtils.getName(bookdropFile.getFilePath()));
Path source = Path.of(bookdropFile.getFilePath());
Path target = Paths.get(path.getPath(), relativePath);
File targetFile = target.toFile();
@@ -190,6 +190,11 @@ public class LibraryService {
return libraryMapper.toLibrary(libraryEntity);
}
public List<Library> getAllLibraries() {
List<LibraryEntity> libraries = libraryRepository.findAll();
return libraries.stream().map(libraryMapper::toLibrary).toList();
}
public List<Library> getLibraries() {
BookLoreUser user = authenticationService.getAuthenticatedUser();
BookLoreUserEntity userEntity = userRepository.findById(user.getId()).orElseThrow(() -> new UsernameNotFoundException("User not found"));
@@ -17,7 +17,7 @@ public class LibraryRescanScheduler {
@Scheduled(cron = "0 0 0 * * *") // At 00:00 every day
public void rescanLibraries() {
log.info("Starting scheduled library rescan at midnight");
for (Library library : libraryService.getLibraries()) {
for (Library library : libraryService.getAllLibraries()) {
try {
libraryService.rescanLibrary(library.getId());
log.info("Rescanned library '{}'", library.getName());
@@ -22,14 +22,22 @@ import com.adityachandel.booklore.util.FileUtils;
import com.adityachandel.booklore.util.PathPatternResolver;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.GroupPrincipal;
import java.nio.file.attribute.PosixFileAttributeView;
import java.nio.file.attribute.UserPrincipal;
import java.nio.file.attribute.UserPrincipalLookupService;
import java.util.Objects;
@RequiredArgsConstructor
@@ -47,6 +55,12 @@ public class FileUploadService {
private final EpubMetadataExtractor epubMetadataExtractor;
private final MonitoringService monitoringService;
@Value("${PUID:0}")
private String userId;
@Value("${GUID:0}")
private String groupId;
public Book uploadFile(MultipartFile file, long libraryId, long pathId) throws IOException {
validateFile(file);
@@ -70,6 +84,8 @@ public class FileUploadService {
try {
file.transferTo(tempPath);
setTemporaryFileOwnership(tempPath);
BookFileExtension fileExt = BookFileExtension.fromFileName(file.getOriginalFilename()).orElseThrow(() -> ApiError.INVALID_FILE_FORMAT.createException("Unsupported file extension"));
@@ -138,6 +154,19 @@ public class FileUploadService {
}
}
private void setTemporaryFileOwnership(Path tempPath) throws IOException {
UserPrincipalLookupService lookupService = FileSystems.getDefault()
.getUserPrincipalLookupService();
if (!userId.equals("0")) {
UserPrincipal user = lookupService.lookupPrincipalByName(userId);
Files.getFileAttributeView(tempPath, PosixFileAttributeView.class, LinkOption.NOFOLLOW_LINKS).setOwner(user);
}
if (!groupId.equals("0")) {
GroupPrincipal group = lookupService.lookupPrincipalByGroupName(groupId);
Files.getFileAttributeView(tempPath, PosixFileAttributeView.class, LinkOption.NOFOLLOW_LINKS).setGroup(group);
}
}
private Book processFile(String fileName, LibraryEntity libraryEntity, LibraryPathEntity libraryPathEntity, File storageFile, BookFileType fileType) {
String subPath = FileUtils.getRelativeSubPath(libraryPathEntity.getPath(), storageFile.toPath());
@@ -50,6 +50,13 @@
border-width: 1px 1px 0px 1px;
}
@media (max-width: 768px) {
.book-browser-footer {
left: 0%;
right: 0%;
}
}
.topbar-item {
display: inline-flex;
align-items: center;
@@ -275,7 +275,7 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
this.entityViewPreferences = user.userSettings?.entityViewPreferences;
const globalPrefs = this.entityViewPreferences?.global;
const currentEntityTypeStr = this.entityType ? this.entityType.toString().toUpperCase() : undefined;
this.coverScalePreferenceService.initScaleValue(user?.userSettings?.entityViewPreferences?.global?.coverSize);
this.coverScalePreferenceService.initScaleValue(this.coverScalePreferenceService.scaleFactor);
this.filterSortPreferenceService.initValue(user?.userSettings?.filterSortingMode);
this.columnPreferenceService.initPreferences(user.userSettings?.tableColumnPreference);
this.visibleColumns = this.columnPreferenceService.visibleColumns;
@@ -1,8 +1,8 @@
import {Injectable, inject} from '@angular/core';
import {inject, Injectable} from '@angular/core';
import {Subject} from 'rxjs';
import {debounceTime} from 'rxjs/operators';
import {MessageService} from 'primeng/api';
import {UserService} from '../../../settings/user-management/user.service';
import {LocalStorageService} from '../../../core/service/local-storage-service';
@Injectable({
providedIn: 'root'
@@ -12,9 +12,10 @@ export class CoverScalePreferenceService {
private readonly BASE_WIDTH = 135;
private readonly BASE_HEIGHT = 220;
private readonly DEBOUNCE_MS = 1000;
private readonly STORAGE_KEY = 'coverScalePreference';
private readonly messageService = inject(MessageService);
private readonly userService = inject(UserService);
private readonly localStorageService = inject(LocalStorageService);
private readonly scaleChangeSubject = new Subject<number>();
readonly scaleChange$ = this.scaleChangeSubject.asObservable();
@@ -22,6 +23,8 @@ export class CoverScalePreferenceService {
scaleFactor = 1.0;
constructor() {
this.loadScaleFromStorage();
this.scaleChange$
.pipe(debounceTime(this.DEBOUNCE_MS))
.subscribe(scale => this.saveScalePreference(scale));
@@ -48,19 +51,28 @@ export class CoverScalePreferenceService {
}
private saveScalePreference(scale: number): void {
const user = this.userService.getCurrentUser();
const prefs = user?.userSettings?.entityViewPreferences;
try {
this.localStorageService.set(this.STORAGE_KEY, scale);
this.messageService.add({
severity: 'success',
summary: 'Cover Size Saved',
detail: `Cover size set to ${scale.toFixed(2)}x.`,
life: 1500
});
} catch (e) {
this.messageService.add({
severity: 'error',
summary: 'Save Failed',
detail: 'Could not save cover size preference locally.',
life: 3000
});
}
}
if (!user || !prefs) return;
prefs.global = {...prefs.global, coverSize: scale};
this.userService.updateUserSetting(user.id, 'entityViewPreferences', prefs);
this.messageService.add({
severity: 'success',
summary: 'Cover Size Saved',
detail: `Cover size set to ${scale.toFixed(2)}x.`,
life: 1500
});
private loadScaleFromStorage(): void {
const saved = this.localStorageService.get<number>(this.STORAGE_KEY);
if (saved !== null && !isNaN(saved)) {
this.scaleFactor = saved;
}
}
}
@@ -0,0 +1,25 @@
import {Injectable} from '@angular/core';
@Injectable({providedIn: 'root'})
export class LocalStorageService {
get<T>(key: string): T | null {
try {
const value = localStorage.getItem(key);
return value ? JSON.parse(value) as T : null;
} catch {
return null;
}
}
set<T>(key: string, value: T): void {
try {
localStorage.setItem(key, JSON.stringify(value));
} catch {
}
}
remove(key: string): void {
localStorage.removeItem(key);
}
}
@@ -1,6 +1,6 @@
import {Component, inject, OnInit} from '@angular/core';
import {AppMenuitemComponent} from './app.menuitem.component';
import { AsyncPipe } from '@angular/common';
import {AsyncPipe} from '@angular/common';
import {MenuModule} from 'primeng/menu';
import {LibraryService} from '../../../book/service/library.service';
import {Observable, of} from 'rxjs';
@@ -141,6 +141,7 @@ export class AppMenuComponent implements OnInit {
}
openChangelogDialog() {
const isMobile = window.innerWidth <= 768;
this.dynamicDialogRef = this.dialogService.open(VersionChangelogDialogComponent, {
header: 'What’s New',
modal: true,
@@ -149,8 +150,9 @@ export class AppMenuComponent implements OnInit {
position: 'absolute',
top: '10%',
bottom: '10%',
minWidth: '800px',
maxWidth: '800px',
width: isMobile ? '90vw' : '800px',
maxWidth: isMobile ? '90vw' : '800px',
minWidth: isMobile ? '90vw' : '800px',
},
});
}
@@ -32,8 +32,8 @@
@if (userService.userState$ | async; as userData) {
<li>
@if (userData.permissions.canManipulateLibrary || userData.permissions.admin) {
<a class="topbar-item" (click)="openLibraryCreatorDialog()" pTooltip="Create New Library" tooltipPosition="top">
<i class="pi pi-plus-circle text-surface-700 dark:text-surface-100"></i>
<a class="topbar-item" (click)="openLibraryCreatorDialog()" pTooltip="Create New Library" tooltipPosition="bottom">
<i class="pi pi-plus-circle text-surface-100"></i>
</a>
}
</li>
@@ -41,50 +41,49 @@
@if (userService.userState$ | async; as userData) {
<li>
@if (userData.permissions.canManipulateLibrary || userData.permissions.admin) {
<a class="topbar-item" (click)="openFileUploadDialog()" pTooltip="Upload Book" tooltipPosition="top">
<i class="pi pi-upload text-surface-700 dark:text-surface-100"></i>
<a class="topbar-item" (click)="openFileUploadDialog()" pTooltip="Upload Book" tooltipPosition="bottom">
<i class="pi pi-upload text-surface-100"></i>
</a>
}
</li>
}
<li>
<a class="topbar-item" (click)="navigateToSettings()" pTooltip="Settings" tooltipPosition="top">
<i class="pi pi-cog text-surface-700 dark:text-surface-100"></i>
<a class="topbar-item" (click)="navigateToSettings()" pTooltip="Settings" tooltipPosition="bottom">
<i class="pi pi-cog text-surface-100"></i>
</a>
</li>
</div>
<p-divider layout="vertical"/>
<li class="relative">
<button
type="button"
class="topbar-item"
(click)="notificationPopover.toggle($event)"
>
<i
class="pi"
[ngClass]="iconClass"
[ngStyle]="{ color: iconColor }"
style="font-size: 1.25rem"
[class.pulsating]="iconPulsating"
aria-label="Unified Notification Icon"
></i>
</button>
@if (shouldShowNotificationBadge) {
<span class="notification-badge">{{ completedTaskCount }}</span>
}
<p-popover #notificationPopover>
<app-unified-notification-popover-component></app-unified-notification-popover-component>
</p-popover>
</li>
<p-divider layout="vertical"/>
<div class="flex gap-6">
<li class="relative group overflow-hidden !border-transparent topbar-item" pTooltip="Love BookLore?" tooltipPosition="top" (click)="openGithubSupportDialog()">
<li class="relative">
<button
type="button"
class="topbar-item"
(click)="notificationPopover.toggle($event)"
>
<i
class="pi"
[ngClass]="iconClass"
[ngStyle]="{ color: iconColor }"
style="font-size: 1.25rem"
[class.pulsating]="iconPulsating"
aria-label="Unified Notification Icon"
></i>
</button>
@if (shouldShowNotificationBadge) {
<span class="notification-badge">{{ completedTaskCount }}</span>
}
<p-popover #notificationPopover>
<app-unified-notification-popover-component></app-unified-notification-popover-component>
</p-popover>
</li>
<li class="relative group overflow-hidden !border-transparent topbar-item" pTooltip="Love BookLore?" tooltipPosition="bottom" (click)="openGithubSupportDialog()">
<span
style="animation-duration: 2s; background: conic-gradient(from 90deg, #f97316, #f59e0b, #eab308, #84cc16, #22c55e, #10b981, #14a8a6, #06b6d4, #0ea5e9, #3b82f6, #6366f1, #8b5cf6, #a855f7, #d946ef, #ec4899, #f43f5e)"
class="absolute -top-5 -left-5 w-20 h-20 animate-spin">
@@ -108,13 +107,23 @@
<p-divider layout="vertical"/>
<div class="flex gap-6">
<li>
<button class="topbar-item" (click)="openUserProfileDialog()" pTooltip="Profile" tooltipPosition="top">
<i class="pi pi-user text-surface-700 dark:text-surface-100"></i>
<a class="topbar-item"
href="https://adityachandelgit.github.io/booklore-docs/docs/getting-started/"
target="_blank"
rel="noopener noreferrer"
pTooltip="Documentation"
tooltipPosition="bottom">
<i class="pi pi-info-circle text-surface-100"></i>
</a>
</li>
<li>
<button class="topbar-item" (click)="openUserProfileDialog()" pTooltip="Profile" tooltipPosition="bottom">
<i class="pi pi-user text-surface-100"></i>
</button>
</li>
<li>
<button class="topbar-item" (click)="logout()" pTooltip="Logout" tooltipPosition="top">
<i class="pi pi-sign-out text-surface-700 dark:text-surface-100"></i>
<button class="topbar-item" (click)="logout()" pTooltip="Logout" tooltipPosition="left">
<i class="pi pi-sign-out text-surface-100"></i>
</button>
</li>
</div>
@@ -135,7 +144,7 @@
class="flex items-center gap-2 w-full text-left p-2 hover:bg-surface-200 dark:hover:bg-surface-700 rounded"
(click)="openLibraryCreatorDialog(); mobileMenu.hide()"
>
<i class="pi pi-plus-circle text-surface-700 dark:text-surface-100"></i>
<i class="pi pi-plus-circle text-surface-100"></i>
Create Library
</button>
</li>
@@ -144,7 +153,7 @@
class="flex items-center gap-2 w-full text-left p-2 hover:bg-surface-200 dark:hover:bg-surface-700 rounded"
(click)="openFileUploadDialog(); mobileMenu.hide()"
>
<i class="pi pi-upload text-surface-700 dark:text-surface-100"></i>
<i class="pi pi-upload text-surface-100"></i>
Upload Book
</button>
</li>
@@ -155,16 +164,26 @@
class="flex items-center gap-2 w-full text-left p-2 hover:bg-surface-200 dark:hover:bg-surface-700 rounded"
(click)="navigateToSettings(); mobileMenu.hide()"
>
<i class="pi pi-cog text-surface-700 dark:text-surface-100"></i>
<i class="pi pi-cog text-surface-100"></i>
Settings
</button>
</li>
<li>
<a
class="flex items-center gap-2 w-full text-left p-2 hover:bg-surface-200 dark:hover:bg-surface-700 rounded"
href="https://adityachandelgit.github.io/booklore-docs/docs/getting-started/"
target="_blank"
rel="noopener noreferrer">
<i class="pi pi-info-circle text-surface-100"></i>
Documentation
</a>
</li>
<li>
<button
class="flex items-center gap-2 w-full text-left p-2 hover:bg-surface-200 dark:hover:bg-surface-700 rounded"
(click)="openGithubSupportDialog(); mobileMenu.hide()"
>
<i class="pi pi-thumbs-up text-surface-700 dark:text-surface-100"></i>
<i class="pi pi-thumbs-up text-surface-100"></i>
Support BookLore
</button>
</li>
@@ -173,7 +192,7 @@
class="flex items-center gap-2 w-full text-left p-2 hover:bg-surface-200 dark:hover:bg-surface-700 rounded"
(click)="openUserProfileDialog(); mobileMenu.hide()"
>
<i class="pi pi-user text-surface-700 dark:text-surface-100"></i>
<i class="pi pi-user text-surface-100"></i>
Profile
</button>
</li>
@@ -182,7 +201,7 @@
class="flex items-center gap-2 w-full text-left p-2 hover:bg-surface-200 dark:hover:bg-surface-700 rounded"
(click)="logout(); mobileMenu.hide()"
>
<i class="pi pi-sign-out text-surface-700 dark:text-surface-100"></i>
<i class="pi pi-sign-out text-surface-100"></i>
Logout
</button>
</li>
@@ -140,11 +140,20 @@ export class AppTopBarComponent implements OnDestroy {
}
private openDialog(component: any, header: string, top: string) {
const isMobile = window.innerWidth <= 768;
this.ref = this.dialogService.open(component, {
header,
modal: true,
closable: true,
style: { position: 'absolute', top },
style: {
position: 'absolute',
top,
...(isMobile && {
width: '90vw',
maxWidth: '90vw',
minWidth: '90vw',
}),
},
});
}
@@ -1,9 +1,9 @@
.tabpanels-responsive {
height: calc(100vh - 9.7rem);
height: calc(100dvh - 9.7rem);
}
@media (max-width: 768px) {
.tabpanels-responsive {
height: calc(100vh - 8.5rem);
height: calc(100dvh - 8.5rem);
}
}
@@ -12,9 +12,8 @@
<img
[attr.src]="urlHelper.getCoverUrl(book.id, book.metadata?.coverUpdatedOn)"
alt="Image"
width="250"
[ngClass]="{ 'brightness-50': isUploading }"
class="transition-all duration-300 ease-in-out"/>
class="w-[200px] md:w-[250px] transition-all duration-300 ease-in-out"/>
@if (isUploading) {
<p-progressSpinner
class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-10">
@@ -54,7 +53,7 @@
}
</div>
</div>
<div class="flex flex-col flex-grow pl-2">
<div class="flex flex-col flex-grow md:pl-2">
<div class="flex flex-col md:flex-row w-full gap-4 pb-1">
<div class="flex flex-col gap-1 md:w-2/3">
@@ -426,7 +425,7 @@
</div>
<div class="mt-auto">
<p-divider></p-divider>
<div class="flex flex-col gap-2 px-2 pt-4 md:pb-4 z-10">
<div class="flex flex-col gap-2 px-0 md:px-2 pt-4 md:pb-4 z-10">
<!-- Desktop Buttons -->
<div class="hidden sm:flex justify-between w-full gap-4">
@@ -473,24 +472,57 @@
</div>
}
<div class="flex gap-4 items-center flex-wrap ml-auto">
<p-button
icon="pi pi-bolt"
[outlined]="true"
severity="info"
(onClick)="autoFetch(book.id)"
[disabled]="isAutoFetching"
pTooltip="Auto Fetch"
tooltipPosition="top">
</p-button>
<div class="flex justify-between items-center w-full gap-4">
<div class="flex gap-4">
<p-button
icon="pi pi-bolt"
[outlined]="true"
severity="info"
(onClick)="autoFetch(book.id)"
[disabled]="isAutoFetching"
pTooltip="Auto Fetch"
tooltipPosition="top">
</p-button>
@if (book.bookType === 'PDF' || book.bookType === 'EPUB') {
<p-button icon="pi pi-refresh" [outlined]="true" severity="danger" (onClick)="restoreMetadata()" pTooltip="Restore" tooltipPosition="top"></p-button>
}
<p-button icon="pi pi-lock-open" [outlined]="true" severity="success" (onClick)="unlockAll()" pTooltip="Unlock All" tooltipPosition="top"></p-button>
<p-button icon="pi pi-lock" [outlined]="true" severity="warn" (onClick)="lockAll()" pTooltip="Lock All" tooltipPosition="top"></p-button>
<p-divider layout="vertical" />
<p-button label="Save" icon="pi pi-check" [loading]="isSaving" [disabled]="isSaving" type="submit"></p-button>
@if (book.bookType === 'PDF' || book.bookType === 'EPUB') {
<p-button
icon="pi pi-refresh"
[outlined]="true"
severity="danger"
(onClick)="restoreMetadata()"
pTooltip="Restore"
tooltipPosition="top">
</p-button>
}
<p-button
icon="pi pi-lock-open"
[outlined]="true"
severity="success"
(onClick)="unlockAll()"
pTooltip="Unlock All"
tooltipPosition="top">
</p-button>
<p-button
icon="pi pi-lock"
[outlined]="true"
severity="warn"
(onClick)="lockAll()"
pTooltip="Lock All"
tooltipPosition="top">
</p-button>
</div>
<div>
<p-button
label="Save"
icon="pi pi-check"
[loading]="isSaving"
[disabled]="isSaving"
type="submit">
</p-button>
</div>
</div>
</div>
@@ -9,7 +9,7 @@
} @else {
<form class="flex flex-col w-full h-full pt-2 min-w-full md:min-w-[60rem] pr-0 md:pr-2 pl-0 md:pl-2" [formGroup]="form" (ngSubmit)="onSubmit()">
<div class="grid grid-cols-1 md:flex md:flex-row w-full gap-4 md:items-end">
<div class="grid grid-cols-1 md:flex md:flex-row w-full gap-2 md:gap-4 md:items-end">
<div class="flex flex-col gap-1 w-full max-w-full md:w-3/12">
<label for="provider">Providers</label>
@@ -50,40 +50,56 @@
</div>
@if (loading) {
<div class="flex justify-center items-center mt-8">
<p-progress-spinner ariaLabel="loading"/>
<div class="flex justify-center items-center flex-col gap-4 h-[40dvh] md:h-[70dvh] text-center">
<p-progress-spinner ariaLabel="Loading metadata..."/>
<p class="text-gray-300">
Fetching metadata from your selected sources.<br/>
This may take a few moments...
</p>
</div>
}
@if (!loading) {
<div class="mt-4 md:mt-8 flex-1 overflow-y-auto">
@for (metadata of allFetchedMetadata; track metadata) {
<div class="book-item flex flex-col w-full">
<div class="flex flex-row w-full book-item-content cursor-pointer" (click)="onBookClick(metadata)">
<img [src]="metadata.thumbnailUrl || 'assets/images/missing-cover.jpg'" alt="Image" class="img-fixed-dimensions pr-0 md:pr-2 md:py-3 self-center md:self-start"/>
<div class="flex flex-col w-full m-2">
<div class="flex flex-col md:flex-row gap-2 md:gap-4 justify-between">
<p class="font-bold">{{ truncateText(metadata['title']!, 90) }}</p>
<div class="flex flex-wrap gap-2 text-sm">
<p>ISBN: {{ metadata['isbn10'] || metadata['asin'] }}</p>
<span class="hidden md:inline">|</span>
<p>Published: {{ metadata['publishedDate'] }}</p>
@if (searchTriggered && allFetchedMetadata.length === 0) {
<div class="flex flex-col items-center justify-center h-[50dvh] md:h-[70dvh] text-center">
<p class="text-gray-300">No metadata results found.<br/>Try adjusting your search criteria.</p>
</div>
}
@if (!searchTriggered && allFetchedMetadata.length === 0) {
<div class="flex flex-col items-center justify-center h-[50dvh] md:h-[70dvh] text-center">
<p class="text-gray-300">Start by searching for metadata using the search bar above.</p>
</div>
}
@if (allFetchedMetadata.length > 0) {
<div class="mt-4 md:mt-8 flex-1 overflow-y-auto">
@for (metadata of allFetchedMetadata; track metadata) {
<div class="book-item flex flex-col w-full">
<div class="flex flex-row w-full book-item-content cursor-pointer" (click)="onBookClick(metadata)">
<img [src]="metadata.thumbnailUrl || 'assets/images/missing-cover.jpg'" alt="Image" class="img-fixed-dimensions pr-0 md:pr-2 md:py-3 self-center md:self-start"/>
<div class="flex flex-col w-full m-2">
<div class="flex flex-col md:flex-row gap-2 md:gap-4 justify-between">
<p class="font-bold">{{ truncateText(metadata['title']!, 90) }}</p>
<div class="flex flex-wrap gap-2 text-sm">
<p>ISBN: {{ metadata['isbn10'] || metadata['asin'] }}</p>
<span class="hidden md:inline">|</span>
<p>Published: {{ metadata['publishedDate'] }}</p>
</div>
</div>
<div class="flex flex-wrap gap-2 text-sm">
<p>by {{ truncateText(metadata['authors']!.join(', '), 70) }}</p>
<span class="hidden md:inline">|</span>
<p>Source: <span [innerHTML]="buildProviderLink(metadata)"></span></p>
</div>
<p class="mt-4 truncate-text p-secondary">
{{ sanitizeHtml(metadata['description']) }}
</p>
</div>
<div class="flex flex-wrap gap-2 text-sm">
<p>by {{ truncateText(metadata['authors']!.join(', '), 70) }}</p>
<span class="hidden md:inline">|</span>
<p>Source: <span [innerHTML]="buildProviderLink(metadata)"></span></p>
</div>
<p class="mt-4 truncate-text p-secondary">
{{ sanitizeHtml(metadata['description']) }}
</p>
</div>
<p-divider></p-divider>
</div>
<p-divider></p-divider>
</div>
}
</div>
}
</div>
}
}
</form>
}
@@ -40,6 +40,7 @@ export class MetadataSearcherComponent implements OnInit, OnDestroy {
allFetchedMetadata: BookMetadata[] = [];
bookId!: number;
loading: boolean = false;
searchTriggered = false;
@Input() book$!: Observable<Book | null>;
@@ -120,6 +121,7 @@ export class MetadataSearcherComponent implements OnInit, OnDestroy {
}
onSubmit(): void {
this.searchTriggered = true;
if (this.form.valid) {
const providerKeys = this.form.get('provider')?.value;
if (!providerKeys) return;
@@ -187,96 +187,98 @@
</div>
}
<div class="grid md:grid-cols-3 gap-y-2.5 text-sm pt-2 md:pt-4 text-gray-700 dark:text-gray-300 max-w-6xl">
<p class="whitespace-nowrap max-w-[250px] overflow-hidden text-ellipsis">
<span class="font-bold">Publisher: </span>
@if (book?.metadata?.publisher) {
<span class="underline hover:opacity-80 cursor-pointer" (click)="goToPublisher(book?.metadata?.publisher!)">
<div class="px-1 md:px-0">
<div class="grid md:grid-cols-3 gap-y-2.5 text-sm pt-2 md:pt-4 pb-2 text-gray-300 max-w-6xl">
<p class="whitespace-nowrap max-w-[250px] overflow-hidden text-ellipsis">
<span class="font-bold">Publisher: </span>
@if (book?.metadata?.publisher) {
<span class="underline hover:opacity-80 cursor-pointer" (click)="goToPublisher(book?.metadata?.publisher!)">
{{ book?.metadata?.publisher }}
</span>
} @else {
<span>-</span>
}
</p>
<p><strong>Published:</strong> {{ book?.metadata!.publishedDate || '-' }}</p>
<p><strong>Language:</strong> {{ book?.metadata!.language || '-' }}</p>
<p class="whitespace-nowrap flex items-center gap-2">
<span class="font-bold">File Type:</span>
<span
class="inline-block px-2 py-0.5 rounded-lg text-xs font-bold text-gray-200"
[ngClass]="getFileTypeColorClass(getFileExtension(book?.filePath))">
} @else {
<span>-</span>
}
</p>
<p><strong>Published:</strong> {{ book?.metadata!.publishedDate || '-' }}</p>
<p><strong>Language:</strong> {{ book?.metadata!.language || '-' }}</p>
<p class="whitespace-nowrap flex items-center gap-2">
<span class="font-bold">File Type:</span>
<span
class="inline-block px-2 py-0.5 rounded-lg text-xs font-bold text-gray-200"
[ngClass]="getFileTypeColorClass(getFileExtension(book?.filePath))">
{{ getFileExtension(book?.filePath) || '-' }}
</span>
</p>
<p><strong>File Size:</strong> {{ getFileSizeInMB(book) }}</p>
<p>
<strong>ISBN:</strong>
@if (book?.metadata?.isbn13 || book?.metadata?.isbn10) {
{{ book.metadata!.isbn13 }}
@if (book?.metadata?.isbn13 && book?.metadata?.isbn10) {
/
</p>
<p><strong>File Size:</strong> {{ getFileSizeInMB(book) }}</p>
<p>
<strong>ISBN:</strong>
@if (book?.metadata?.isbn13 || book?.metadata?.isbn10) {
{{ book.metadata!.isbn13 }}
@if (book?.metadata?.isbn13 && book?.metadata?.isbn10) {
/
}
{{ book.metadata!.isbn10 }}
} @else {
<span>-</span>
}
{{ book.metadata!.isbn10 }}
} @else {
<span>-</span>
}
</p>
<p class="whitespace-nowrap flex items-center gap-2">
<span class="font-bold">Read Status:</span>
<span
class="inline-block px-2 py-0.5 rounded-full text-xs font-bold text-white cursor-pointer"
[ngClass]="getStatusSeverityClass(selectedReadStatus)"
(click)="menu.toggle($event)">
</p>
<p class="whitespace-nowrap flex items-center gap-2">
<span class="font-bold">Read Status:</span>
<span
class="inline-block px-2 py-0.5 rounded-full text-xs font-bold text-white cursor-pointer"
[ngClass]="getStatusSeverityClass(selectedReadStatus)"
(click)="menu.toggle($event)">
{{ getStatusLabel(selectedReadStatus) }}
</span>
<p-menu #menu [popup]="true" [model]="readStatusMenuItems"></p-menu>
</p>
<p class="whitespace-nowrap flex items-center">
<span class="font-bold mr-2">Progress:</span>
<span class="inline-flex items-center">
<p-menu #menu [popup]="true" [model]="readStatusMenuItems"></p-menu>
</p>
<p class="whitespace-nowrap flex items-center">
<span class="font-bold mr-2">Progress:</span>
<span class="inline-flex items-center">
<span
class="inline-block px-2 py-0.5 rounded-full text-xs font-bold text-white"
[ngClass]="getProgressColorClass(getProgressPercent(book))">
{{ getProgressPercent(book) !== null ? getProgressPercent(book) + '%' : 'N/A' }}
</span>
@if (getProgressPercent(book) !== null) {
<p-button
pTooltip="Reset progress"
tooltipPosition="bottom"
icon="pi pi-refresh"
size="small"
severity="danger"
text
class="ml-1 custom-button-padding"
(onClick)="resetProgress(book)">
@if (getProgressPercent(book) !== null) {
<p-button
pTooltip="Reset progress"
tooltipPosition="bottom"
icon="pi pi-refresh"
size="small"
severity="danger"
text
class="ml-1 custom-button-padding"
(onClick)="resetProgress(book)">
</p-button>
}
}
</span>
</p>
<p class="whitespace-nowrap flex items-center gap-2">
<span class="font-bold">Metadata Match:</span>
@if (book?.metadataMatchScore != null) {
<span
class="inline-block px-2 py-0.5 rounded-lg text-xs font-bold text-gray-200 border"
[ngClass]="getMatchScoreColorClass(book?.metadataMatchScore!)">
</p>
<p class="whitespace-nowrap flex items-center gap-2">
<span class="font-bold">Metadata Match:</span>
@if (book?.metadataMatchScore != null) {
<span
class="inline-block px-2 py-0.5 rounded-lg text-xs font-bold text-gray-200 border"
[ngClass]="getMatchScoreColorClass(book?.metadataMatchScore!)">
{{ (book?.metadataMatchScore! * 100) | number:'1.0-0' }}%
</span>
} @else {
<span>-</span>
}
</p>
</div>
} @else {
<span>-</span>
}
</p>
</div>
<div class="flex items-center gap-2">
<span class="font-semibold text-sm">File Path:</span>
<i
class="pi cursor-pointer text-sm"
[ngClass]="showFilePath ? 'pi-eye-slash' : 'pi-eye'"
(click)="showFilePath = !showFilePath"
></i>
@if (showFilePath) {
<code class="text-xs font-mono truncate text-gray-300">{{ book?.filePath }}</code>
}
<div class="flex items-center gap-2">
<span class="font-semibold text-sm">File Path:</span>
<i
class="pi cursor-pointer text-sm"
[ngClass]="showFilePath ? 'pi-eye-slash' : 'pi-eye'"
(click)="showFilePath = !showFilePath"
></i>
@if (showFilePath) {
<code class="text-xs font-mono truncate text-gray-300">{{ book?.filePath }}</code>
}
</div>
</div>
</div>
@@ -15,7 +15,6 @@ import {BookService} from '../../book/service/book.service';
import {AppSettingKey, AppSettings} from '../../core/model/app-settings.model';
import {filter, take} from 'rxjs/operators';
import {FileUploadPatternComponent} from './file-upload-pattern/file-upload-pattern.component';
import {OpdsSettingsComponent} from './opds-settings/opds-settings.component';
import {InputText} from 'primeng/inputtext';
@Component({
@@ -30,7 +29,6 @@ import {InputText} from 'primeng/inputtext';
ToggleSwitch,
FormsModule,
FileUploadPatternComponent,
OpdsSettingsComponent,
InputText
],
templateUrl: './global-preferences.component.html',
@@ -3,7 +3,7 @@
<div class="min-w-[300px] md:min-w-[500px]">
<section>
<div class="flex flex-col gap-4">
<div class="flex flex-col gap-4 py-4">
<h2 class="text-xl font-semibold">User Profile</h2>
<div class="px-4 py-2">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
@@ -1,4 +1,4 @@
:root[class="p-dark"] {
:root[class~="p-dark"] {
--primary-text-color: var(--p-primary-400);
--primary-text-color-dark: var(--p-primary-900);
--primary-color: var(--p-primary-color);