Feature/999 add high resolution cover support upload storage and search (#1006)
* Add high-resolution cover support: upload, storage, and search * Disable tests until fixed
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
'loaded': isImageLoaded
|
||||
}">
|
||||
<img
|
||||
[src]="urlHelper.getCoverUrl(book.id, book.metadata?.coverUpdatedOn)"
|
||||
[src]="urlHelper.getThumbnailUrl(book.id, book.metadata?.coverUpdatedOn)"
|
||||
class="book-cover"
|
||||
[class.loaded]="isImageLoaded"
|
||||
alt="Cover of {{ book.metadata?.title }}"
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@
|
||||
</p-button>
|
||||
</td>
|
||||
<td (click)="openMetadataCenter(book.id)" class="cursor-pointer">
|
||||
<img [attr.src]="urlHelper.getCoverUrl(metadata.bookId, metadata.coverUpdatedOn)" alt="Book Cover" class="size-7"/>
|
||||
<img [attr.src]="urlHelper.getThumbnailUrl(metadata.bookId, metadata.coverUpdatedOn)" alt="Book Cover" class="size-7"/>
|
||||
</td>
|
||||
|
||||
@for (col of visibleColumns; track col.field) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="book-cover-wrapper" (mouseenter)="isHovered = true" (mouseleave)="isHovered = false">
|
||||
<img
|
||||
[src]="urlHelper.getCoverUrl(book.id, book.metadata?.coverUpdatedOn)"
|
||||
[src]="urlHelper.getThumbnailUrl(book.id, book.metadata?.coverUpdatedOn)"
|
||||
class="book-cover"
|
||||
alt="Cover of {{ book.metadata?.title }}"
|
||||
loading="lazy"/>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<div class="search-dropdown-item flex flex-col" (click)="onBookClick(book)">
|
||||
<div class="flex flex-row w-full p-2">
|
||||
<img
|
||||
[attr.src]="urlHelper.getCoverUrl(book.id, book.metadata?.coverUpdatedOn)"
|
||||
[attr.src]="urlHelper.getThumbnailUrl(book.id, book.metadata?.coverUpdatedOn)"
|
||||
alt="Book Cover"
|
||||
class="search-book-cover"
|
||||
/>
|
||||
|
||||
+33
-28
@@ -19,11 +19,11 @@
|
||||
pInputText
|
||||
class="w-full"
|
||||
[(ngModel)]="chosenLibraryName"
|
||||
placeholder="Enter library name..." />
|
||||
placeholder="Enter library name..."/>
|
||||
|
||||
<label class="self-center">Library Icon</label>
|
||||
@if (!selectedIcon) {
|
||||
<p-button label="Select Icon" icon="pi pi-search" (onClick)="openIconPicker()" />
|
||||
<p-button label="Select Icon" icon="pi pi-search" (onClick)="openIconPicker()"/>
|
||||
} @else {
|
||||
<div class="flex items-center gap-2">
|
||||
<i [class]="selectedIcon" class="text-3xl"></i>
|
||||
@@ -33,44 +33,49 @@
|
||||
[rounded]="true"
|
||||
[text]="true"
|
||||
[outlined]="true"
|
||||
severity="danger" />
|
||||
severity="danger"/>
|
||||
</div>
|
||||
}
|
||||
|
||||
<label class="self-center">Scan Mode</label>
|
||||
<label class="self-center">Import Mode</label>
|
||||
<div class="flex items-center gap-2">
|
||||
<p-select
|
||||
[(ngModel)]="scanMode"
|
||||
[options]="scanModeOptions"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select scan mode"
|
||||
class="w-full" />
|
||||
placeholder="Choose how to scan books"
|
||||
class="w-full"/>
|
||||
<i
|
||||
class="pi pi-info-circle text-sky-600 cursor-pointer"
|
||||
pTooltip="File as Book: Each file is a separate book. Folder as Book: Each folder contains one book in multiple formats."
|
||||
pTooltip="Select how BookLore interprets your files during import:
|
||||
• File as Book: Each file becomes a separate book.
|
||||
• Folder as Book: Each folder is imported as a single book, including multiple formats or extra files.
|
||||
If you are unsure, choose 'File as Book'."
|
||||
tooltipPosition="right"></i>
|
||||
</div>
|
||||
|
||||
<label class="self-center">Default Format</label>
|
||||
<div class="flex items-center gap-2">
|
||||
<p-select
|
||||
[(ngModel)]="defaultBookFormat"
|
||||
[options]="bookFormatOptions"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select default format"
|
||||
class="w-full"
|
||||
[disabled]="scanMode !== 'FOLDER_AS_BOOK'" />
|
||||
<i
|
||||
class="pi pi-info-circle text-sky-600 cursor-pointer"
|
||||
pTooltip="When a folder contains multiple book formats, this format will be used as the primary book file. Only applicable in 'Folder as Book' mode."
|
||||
tooltipPosition="right"></i>
|
||||
</div>
|
||||
@if (scanMode == 'FOLDER_AS_BOOK') {
|
||||
<label class="self-center">Preferred Format</label>
|
||||
<div class="flex items-center gap-2">
|
||||
<p-select
|
||||
[(ngModel)]="defaultBookFormat"
|
||||
[options]="bookFormatOptions"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select preferred format"
|
||||
class="w-full"
|
||||
appendTo="body"/>
|
||||
<i
|
||||
class="pi pi-info-circle text-sky-600 cursor-pointer"
|
||||
pTooltip="If a folder contains books in multiple formats, this setting determines which format BookLore will use as the primary file."
|
||||
tooltipPosition="right"></i>
|
||||
</div>
|
||||
}
|
||||
|
||||
<label class="self-center">Monitor Folders</label>
|
||||
<div class="flex items-center gap-2">
|
||||
<p-toggleswitch [(ngModel)]="watch" />
|
||||
<p-toggleswitch [(ngModel)]="watch"/>
|
||||
<i
|
||||
class="pi pi-info-circle text-sky-600 cursor-pointer"
|
||||
pTooltip="Watches for file changes and auto-adds/removes books."
|
||||
@@ -85,7 +90,7 @@
|
||||
icon="pi pi-arrow-right"
|
||||
iconPos="right"
|
||||
(onClick)="validateLibraryNameAndProceed(activateCallback)"
|
||||
[disabled]="!isLibraryDetailsValid()" />
|
||||
[disabled]="!isLibraryDetailsValid()"/>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
@@ -104,7 +109,7 @@
|
||||
icon="pi pi-folder-open"
|
||||
[outlined]="true"
|
||||
severity="info"
|
||||
(onClick)="openDirectoryPicker()" />
|
||||
(onClick)="openDirectoryPicker()"/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-2 max-h-70 overflow-y-auto">
|
||||
@@ -122,7 +127,7 @@
|
||||
outlined
|
||||
size="small"
|
||||
severity="danger"
|
||||
(onClick)="removeFolder(folders.indexOf(folder))" />
|
||||
(onClick)="removeFolder(folders.indexOf(folder))"/>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -132,8 +137,8 @@
|
||||
</div>
|
||||
|
||||
<div class="flex justify-between pt-6">
|
||||
<p-button label="Back" icon="pi pi-arrow-left" iconPos="left" (onClick)="activateCallback(1)" />
|
||||
<p-button label="Save" icon="pi pi-save" severity="success" [disabled]="!isDirectorySelectionValid()" (onClick)="createOrUpdateLibrary()" />
|
||||
<p-button label="Back" icon="pi pi-arrow-left" iconPos="left" (onClick)="activateCallback(1)"/>
|
||||
<p-button label="Save" icon="pi pi-save" severity="success" [disabled]="!isDirectorySelectionValid()" (onClick)="createOrUpdateLibrary()"/>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
@@ -12,7 +12,7 @@ import {InputText} from 'primeng/inputtext';
|
||||
import {Library, LibraryScanMode, BookFileType} from '../../model/library.model';
|
||||
import {ToggleSwitch} from 'primeng/toggleswitch';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import { IconPickerService } from '../../../utilities/services/icon-picker.service';
|
||||
import {IconPickerService} from '../../../utilities/services/icon-picker.service';
|
||||
import {Select} from 'primeng/select';
|
||||
|
||||
@Component({
|
||||
@@ -36,8 +36,8 @@ export class LibraryCreatorComponent implements OnInit {
|
||||
defaultBookFormat: BookFileType | undefined = undefined;
|
||||
|
||||
readonly scanModeOptions = [
|
||||
{label: 'Each file is a separate book', value: 'FILE_AS_BOOK'},
|
||||
{label: 'Each folder is a book', value: 'FOLDER_AS_BOOK'}
|
||||
{label: 'Each file is a book', value: 'FILE_AS_BOOK'},
|
||||
{label: 'Each folder is a book with extras', value: 'FOLDER_AS_BOOK'}
|
||||
];
|
||||
|
||||
readonly bookFormatOptions = [
|
||||
@@ -47,13 +47,13 @@ export class LibraryCreatorComponent implements OnInit {
|
||||
{label: 'CBX/CBZ/CBR', value: 'CBX'}
|
||||
];
|
||||
|
||||
private dialogService = inject(DialogService);
|
||||
private dynamicDialogRef = inject(DynamicDialogRef);
|
||||
private dialogService = inject(DialogService);
|
||||
private dynamicDialogRef = inject(DynamicDialogRef);
|
||||
private dynamicDialogConfig = inject(DynamicDialogConfig);
|
||||
private libraryService = inject(LibraryService);
|
||||
private messageService = inject(MessageService);
|
||||
private router = inject(Router);
|
||||
private iconPicker = inject(IconPickerService);
|
||||
private libraryService = inject(LibraryService);
|
||||
private messageService = inject(MessageService);
|
||||
private router = inject(Router);
|
||||
private iconPicker = inject(IconPickerService);
|
||||
|
||||
ngOnInit(): void {
|
||||
const data = this.dynamicDialogConfig?.data;
|
||||
|
||||
@@ -1,19 +1,30 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {API_CONFIG} from '../../config/api-config';
|
||||
import {AuthService} from '../../core/service/auth.service';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class CbxReaderService {
|
||||
|
||||
private readonly url = `${API_CONFIG.BASE_URL}/api/v1/cbx`;
|
||||
private readonly pagesUrl = `${API_CONFIG.BASE_URL}/api/v1/cbx`;
|
||||
private readonly imageUrl = `${API_CONFIG.BASE_URL}/api/v1/media/book`;
|
||||
private authService = inject(AuthService);
|
||||
private http = inject(HttpClient);
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
private getToken(): string | null {
|
||||
return this.authService.getOidcAccessToken() || this.authService.getInternalAccessToken();
|
||||
}
|
||||
|
||||
private appendToken(url: string): string {
|
||||
const token = this.getToken();
|
||||
return token ? `${url}${url.includes('?') ? '&' : '?'}token=${token}` : url;
|
||||
}
|
||||
|
||||
getAvailablePages(bookId: number) {
|
||||
return this.http.get<number[]>(`${this.url}/${bookId}/pages`);
|
||||
return this.http.get<number[]>(this.appendToken(`${this.pagesUrl}/${bookId}/pages`));
|
||||
}
|
||||
|
||||
getPageImageUrl(bookId: number, page: number): string {
|
||||
return `${this.url}/${bookId}/pages/${page}`;
|
||||
return this.appendToken(`${this.imageUrl}/${bookId}/cbx/pages/${page}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,32 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {API_CONFIG} from '../../config/api-config';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {AuthService} from '../../core/service/auth.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class NewPdfReaderService {
|
||||
|
||||
private readonly url = `${API_CONFIG.BASE_URL}/api/v1/pdf`;
|
||||
private readonly pagesUrl = `${API_CONFIG.BASE_URL}/api/v1/pdf`;
|
||||
private readonly imageUrl = `${API_CONFIG.BASE_URL}/api/v1/media/book`;
|
||||
private authService = inject(AuthService);
|
||||
private http = inject(HttpClient);
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
private getToken(): string | null {
|
||||
return this.authService.getOidcAccessToken() || this.authService.getInternalAccessToken();
|
||||
}
|
||||
|
||||
private appendToken(url: string): string {
|
||||
const token = this.getToken();
|
||||
return token ? `${url}${url.includes('?') ? '&' : '?'}token=${token}` : url;
|
||||
}
|
||||
|
||||
getAvailablePages(bookId: number) {
|
||||
return this.http.get<number[]>(`${this.url}/${bookId}/pages`);
|
||||
return this.http.get<number[]>(this.appendToken(`${this.pagesUrl}/${bookId}/pages`));
|
||||
}
|
||||
|
||||
getPageImageUrl(bookId: number, page: number): string {
|
||||
return `${this.url}/${bookId}/pages/${page}`;
|
||||
return this.appendToken(`${this.imageUrl}/${bookId}/pdf/pages/${page}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user