Merge pull request #569 from adityachandelgit/develop

Merge Develop into Master for Release
This commit is contained in:
Aditya Chandel
2025-06-24 14:23:05 -06:00
committed by GitHub
18 changed files with 287 additions and 118 deletions
+2
View File
@@ -3,6 +3,7 @@
![License](https://img.shields.io/github/license/adityachandelgit/BookLore)
![Issues](https://img.shields.io/github/issues/adityachandelgit/BookLore)
![Stars](https://img.shields.io/github/stars/adityachandelgit/BookLore?style=social)
[![Join us on Discord](https://img.shields.io/badge/Chat-Discord-blue?logo=discord&style=flat)](https://discord.gg/yXdkBNCK)
BookLore is a self-hosted web app for organizing and managing your personal book collection. It provides an intuitive interface to browse, read, and track your progress across PDFs and eBooks. With robust metadata management, multi-user support, and a sleek, modern UI, BookLore makes it easy to build and explore your personal library.
@@ -144,6 +145,7 @@ Example implementations:
- 🐞 Found a bug? [Open an issue](https://github.com/adityachandelgit/BookLore/issues)
- ✨ Want to contribute? [Check out CONTRIBUTING.md](https://github.com/adityachandelgit/BookLore/blob/master/CONTRIBUTING.md)
- 💬 Ask questions or share feedback: [Discussions](https://github.com/adityachandelgit/BookLore/discussions)
- 💬 **Join our Discord**: [Click here to chat with the community](https://discord.gg/yXdkBNCK)
## 👨‍💻 Contributors & Developers
@@ -56,6 +56,10 @@ public class SecurityConfig {
"/api/v1/pdf/*/pages/*"
};
private static final String[] COMMON_UNAUTHENTICATED_ENDPOINTS = {
"/api/v1/opds/search.opds"
};
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
@@ -64,11 +68,16 @@ public class SecurityConfig {
@Bean
@Order(1)
public SecurityFilterChain opdsBasicAuthSecurityChain(HttpSecurity http) throws Exception {
List<String> unauthenticatedEndpoints = new ArrayList<>(Arrays.asList(COMMON_UNAUTHENTICATED_ENDPOINTS));
http
.securityMatcher("/api/v1/opds/**")
.csrf(AbstractHttpConfigurer::disable)
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests(auth -> auth.anyRequest().authenticated())
.authorizeHttpRequests(auth -> auth
.requestMatchers(unauthenticatedEndpoints.toArray(new String[0])).permitAll()
.anyRequest().authenticated()
)
.httpBasic(basic -> basic
.realmName("Booklore OPDS")
.authenticationEntryPoint((request, response, authException) -> {
@@ -129,4 +138,4 @@ public class SecurityConfig {
return source;
}
}
}
@@ -28,6 +28,22 @@ public class OpdsController {
.contentType(MediaType.parseMediaType("application/atom+xml;profile=opds-catalog"))
.body(feed);
}
@GetMapping(value = "/search", produces = "application/atom+xml;profile=opds-catalog")
public ResponseEntity<String> search(HttpServletRequest request) {
String feed = opdsService.generateSearchResults(request, request.getParameter("q"));
return ResponseEntity.ok()
.contentType(MediaType.parseMediaType("application/atom+xml;profile=opds-catalog"))
.body(feed);
}
@GetMapping(value = "/search.opds", produces = "application/atom+xml;profile=opds-catalog")
public ResponseEntity<String> searchDescription(HttpServletRequest request) {
String feed = opdsService.generateSearchDescription(request);
return ResponseEntity.ok()
.contentType(MediaType.parseMediaType("application/atom+xml;profile=opds-catalog"))
.body(feed);
}
@GetMapping("/{bookId}/download")
public ResponseEntity<Resource> downloadBook(@PathVariable("bookId") Long bookId) {
@@ -43,4 +59,4 @@ public class OpdsController {
.header(HttpHeaders.CONTENT_DISPOSITION, "inline; filename=\"" + coverImage.getFilename() + "\"")
.body(coverImage);
}
}
}
@@ -56,5 +56,20 @@ public interface BookRepository extends JpaRepository<BookEntity, Long>, JpaSpec
LEFT JOIN FETCH b.shelves
""")
List<BookEntity> findAllFullBooks();
@Query("""
SELECT DISTINCT b FROM BookEntity b
LEFT JOIN FETCH b.metadata m
LEFT JOIN FETCH m.authors a
LEFT JOIN FETCH m.categories
WHERE LOWER(m.title) LIKE LOWER(CONCAT('%', :text, '%'))
OR LOWER(m.subtitle) LIKE LOWER(CONCAT('%', :text, '%'))
OR LOWER(m.description) LIKE LOWER(CONCAT('%', :text, '%'))
OR LOWER(m.seriesName) LIKE LOWER(CONCAT('%', :text, '%'))
OR LOWER(a.name) LIKE LOWER(CONCAT('%', :text, '%'))
ORDER BY m.title ASC
""")
List<BookEntity> findBooksContainingMetadata(@Param("text") String text);
}
@@ -51,6 +51,10 @@ public class BookQueryService {
public List<BookEntity> getAllFullBookEntities() {
return bookRepository.findAllFullBooks();
}
public List<BookEntity> getBooksContainingMetadata(String text) {
return bookRepository.findBooksContainingMetadata(text);
}
public void saveAll(List<BookEntity> books) {
bookRepository.saveAll(books);
@@ -27,11 +27,49 @@ public class OpdsService {
};
}
public String generateSearchResults(HttpServletRequest request, String queryParam) {
List<BookEntity> books = List.of();
if (queryParam != null) {
books = bookQueryService.getBooksContainingMetadata(queryParam);
} else {
books = bookQueryService.getAllFullBookEntities();
}
var feedVersion = extractVersionFromAcceptHeader(request);
return switch (feedVersion) {
case "2.0" -> generateOpdsV2Feed(books);
default -> generateOpdsV1Feed(books);
};
}
public String generateSearchDescription(HttpServletRequest request) {
var feedVersion = extractVersionFromAcceptHeader(request);
return switch (feedVersion) {
case "2.0" -> generateOpdsV2SearchDescription();
default -> generateOpdsV1SearchDescription();
};
}
private String extractVersionFromAcceptHeader(HttpServletRequest request) {
var acceptHeader = request.getHeader("Accept");
return (acceptHeader != null && acceptHeader.contains("version=2.0")) ? "2.0" : "1.2";
}
private String generateOpdsV1SearchDescription() {
return """
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<LongName>Booklore catalog</LongName>
<Description>Search the Booklore ebook catalog.</Description>
<Url type="application/atom+xml;profile=opds-catalog" template="/api/v1/opds/search?q={searchTerms}"/>
<Language>en-us</Language>
<OutputEncoding>UTF-8</OutputEncoding>
<InputEncoding>UTF-8</InputEncoding>
</OpenSearchDescription>
""";
}
private String generateOpdsV1Feed(List<BookEntity> books) {
var feed = new StringBuilder("""
<?xml version="1.0" encoding="UTF-8"?>
@@ -39,6 +77,7 @@ public class OpdsService {
<title>Booklore Catalog</title>
<id>urn:booklore:catalog</id>
<updated>%s</updated>
<link rel="search" type="application/opensearchdescription+xml" title="Booklore Search" href="/api/v1/opds/search.opds"/>
""".formatted(now()));
books.forEach(book -> appendBookEntryV1(feed, book));
@@ -109,6 +148,12 @@ public class OpdsService {
// Placeholder for OPDS v2.0 feed implementation (similar structure as v1)
return "OPDS v2.0 Feed is under construction";
}
private String generateOpdsV2SearchDescription() {
// Placeholder for OPDS v2.0 feed implementation (similar structure as v1)
return "OPDS v2.0 Feed is under construction";
}
private String now() {
return DateTimeFormatter.ISO_INSTANT.format(java.time.Instant.now());
@@ -130,4 +175,4 @@ public class OpdsService {
.replace("\"", "&quot;")
.replace("'", "&apos;");
}
}
}
@@ -1,12 +1,21 @@
<div class="rounded-xl overflow-hidden">
<p-tabs [value]="tab" lazy="true">
<p-tablist>
<p-tab value="view">Book Details</p-tab>
<p-tab value="view">
<i [class]="'pi pi-book'"></i>
Book Details
</p-tab>
@if (admin || canEditMetadata) {
<p-tab value="edit">Edit Metadata</p-tab>
<p-tab value="edit">
<i [class]="'pi pi-pencil'"></i>
Edit Metadata
</p-tab>
}
@if (admin || canEditMetadata) {
<p-tab value="match">Search Metadata</p-tab>
<p-tab value="match">
<i [class]="'pi pi-search'"></i>
Search Metadata
</p-tab>
}
</p-tablist>
<p-tabpanels class="overflow-auto" style="height: calc(100vh - 10rem);">
@@ -55,7 +55,7 @@
</div>
</div>
<div class="flex flex-col flex-grow pl-2">
<!-- Title and Subtitle -->
<div class="flex flex-row w-full gap-4 pb-1">
<div class="flex flex-col gap-1 w-2/3">
<label for="title">Title</label>
@@ -82,12 +82,14 @@
</div>
</div>
</div>
<!-- Authors and Publisher -->
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
<div class="flex flex-col gap-1 w-2/3">
<div class="flex flex-col gap-1 basis-[71%]">
<label for="authors">Authors</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="authors" formControlName="authors" class="w-full"/>
<div class="w-full">
<p-chips formControlName="authors" addOnBlur="true"></p-chips>
</div>
@if (!book.metadata!['authorsLocked']) {
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('authors')" severity="success"></p-button>
}
@@ -96,7 +98,7 @@
}
</div>
</div>
<div class="flex flex-col gap-1 w-1/3">
<div class="flex flex-col gap-1 basis-[20%]">
<label for="publisher">Publisher</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="publisher" formControlName="publisher" class="w-full"/>
@@ -108,34 +110,7 @@
}
</div>
</div>
</div>
<!-- Categories and Published Date -->
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
<div class="flex flex-col gap-1 w-3/4">
<label for="categories">Categories</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="categories" formControlName="categories" class="w-full"/>
@if (!book.metadata!['categoriesLocked']) {
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('categories')" severity="success"></p-button>
}
@if (book.metadata!['categoriesLocked']) {
<p-button icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('categories')" severity="warn"></p-button>
}
</div>
</div>
<div class="flex flex-col gap-1 w-1/8">
<label for="publishedDate">Publish Date</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="publishedDate" formControlName="publishedDate" class="w-full"/>
@if (!book.metadata!['publishedDateLocked']) {
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('publishedDate')" severity="success"></p-button>
}
@if (book.metadata!['publishedDateLocked']) {
<p-button icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('publishedDate')" severity="warn"></p-button>
}
</div>
</div>
<div class="flex flex-col gap-1 w-1/8">
<div class="flex flex-col gap-1 basis-[14%]">
<label for="language">Language</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="language" formControlName="language" class="w-full"/>
@@ -148,11 +123,28 @@
</div>
</div>
</div>
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
<div class="flex flex-col gap-1 basis-3/4">
<div class="flex flex-col gap-1 w-full">
<label for="categories">Categories</label>
<div class="flex justify-between items-center gap-2">
<div class="w-full">
<p-chips formControlName="categories" addOnBlur="true"></p-chips>
</div>
@if (!book.metadata!['categoriesLocked']) {
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('categories')" severity="success"></p-button>
}
@if (book.metadata!['categoriesLocked']) {
<p-button icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('categories')" severity="warn"></p-button>
}
</div>
</div>
</div>
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
<div class="flex flex-col gap-1 basis-[75%]">
<label for="seriesName">Series Name</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="seriesName" formControlName="seriesName" class="w-full"/>
<input pInputText id="seriesName" formControlName="seriesName" class="w-full" />
@if (!book.metadata!['seriesNameLocked']) {
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesName')" severity="success"></p-button>
}
@@ -161,10 +153,11 @@
}
</div>
</div>
<div class="flex flex-col gap-1 basis-1/8">
<label for="seriesNumber">Book Number</label>
<div class="flex flex-col gap-1 basis-[10%]">
<label for="seriesNumber">Book #</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="seriesNumber" formControlName="seriesNumber" class="w-full"/>
<input pInputText id="seriesNumber" formControlName="seriesNumber" class="w-full" />
@if (!book.metadata!['seriesNumberLocked']) {
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesNumber')" severity="success"></p-button>
}
@@ -173,10 +166,11 @@
}
</div>
</div>
<div class="flex flex-col gap-1 basis-1/8">
<label for="seriesTotal">Books in Series</label>
<div class="flex flex-col gap-1 basis-[10%]">
<label for="seriesTotal">Total Books</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="seriesTotal" formControlName="seriesTotal" class="w-full"/>
<input pInputText id="seriesTotal" formControlName="seriesTotal" class="w-full" />
@if (!book.metadata!['seriesTotalLocked']) {
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesTotal')" severity="success"></p-button>
}
@@ -185,8 +179,21 @@
}
</div>
</div>
<div class="flex flex-col gap-1 basis-[15%]">
<label for="publishedDate">Publish Date</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="publishedDate" formControlName="publishedDate" class="w-full" />
@if (!book.metadata!['publishedDateLocked']) {
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('publishedDate')" severity="success"></p-button>
}
@if (book.metadata!['publishedDateLocked']) {
<p-button icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('publishedDate')" severity="warn"></p-button>
}
</div>
</div>
</div>
<!-- ISBN, ASIN, Language -->
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
<div class="flex flex-col gap-1 w-1/6">
<label for="isbn10">ISBN 10</label>
@@ -261,7 +268,7 @@
</div>
</div>
</div>
<!-- Ratings and Reviews -->
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
<div class="flex flex-col gap-1 w-1/6">
<label for="goodreadsId">Goodreads ID</label>
@@ -21,6 +21,7 @@ import {DialogService} from 'primeng/dynamicdialog';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {MetadataRefreshRequest} from '../../model/request/metadata-refresh-request.model';
import {MetadataRefreshType} from '../../model/request/metadata-refresh-type.enum';
import {Chips} from 'primeng/chips';
@Component({
selector: 'app-metadata-editor',
@@ -43,7 +44,8 @@ import {MetadataRefreshType} from '../../model/request/metadata-refresh-type.enu
TabList,
Tab,
TabPanels,
TabPanel
TabPanel,
Chips
]
})
export class MetadataEditorComponent implements OnInit {
@@ -167,8 +169,8 @@ export class MetadataEditorComponent implements OnInit {
this.metadataForm.patchValue({
title: metadata.title ?? null,
subtitle: metadata.subtitle ?? null,
authors: (metadata.authors ?? []).sort().join(', '),
categories: (metadata.categories ?? []).sort().join(', '),
authors: [...(metadata.authors ?? [])].sort(),
categories: [...(metadata.categories ?? [])].sort(),
publisher: metadata.publisher ?? null,
publishedDate: metadata.publishedDate ?? null,
isbn10: metadata.isbn10 ?? null,
@@ -330,8 +332,8 @@ export class MetadataEditorComponent implements OnInit {
bookId: this.currentBookId,
title: this.metadataForm.get('title')?.value,
subtitle: this.metadataForm.get('subtitle')?.value,
authors: this.metadataForm.get('authors')?.value.split(',').map((author: string) => author.trim()),
categories: this.metadataForm.get('categories')?.value.split(',').map((category: string) => category.trim()),
authors: this.metadataForm.get('authors')?.value ?? [],
categories: this.metadataForm.get('categories')?.value ?? [],
publisher: this.metadataForm.get('publisher')?.value,
publishedDate: this.metadataForm.get('publishedDate')?.value,
isbn10: this.metadataForm.get('isbn10')?.value,
@@ -9,14 +9,14 @@
[ngStyle]="{'padding-left': '2rem', 'padding-right': '0.5rem'}"
[outlined]="true"
pTooltip="Move all missing fields" tooltipPosition="bottom"
(onClick)="copyMissing()"></p-button>
(onClick)="copyMissing()"></p-button>
<p-button
severity="info"
icon='pi pi-angle-double-left'
[ngStyle]="{'padding-left': '0.5rem', 'padding-right': '2rem'}"
[outlined]="true"
pTooltip="Move all fields" tooltipPosition="bottom"
(onClick)="copyAll()"></p-button>
(onClick)="copyAll()"></p-button>
<p class="text-lg">Fetched Metadata</p>
</div>
<div class="form-row">
@@ -33,12 +33,12 @@
<p-button
[icon]="isValueSaved('thumbnailUrl') ? 'pi pi-check' : (hoveredFields['thumbnailUrl'] && isValueCopied('thumbnailUrl') ? 'pi pi-times' : 'pi pi-arrow-left')"
[outlined]="true"
[ngClass]="
{
'green-outlined-button': isValueSaved('thumbnailUrl'),
'yellow-outlined-button': isValueCopied('thumbnailUrl') && !hoveredFields['thumbnailUrl'],
'red-outlined-button': isValueCopied('thumbnailUrl') && hoveredFields['thumbnailUrl']
}"
[ngClass]="
{
'green-outlined-button': isValueSaved('thumbnailUrl'),
'yellow-outlined-button': isValueCopied('thumbnailUrl') && !hoveredFields['thumbnailUrl'],
'red-outlined-button': isValueCopied('thumbnailUrl') && hoveredFields['thumbnailUrl']
}"
class="arrow-button"
(click)="hoveredFields['thumbnailUrl'] && isValueCopied('thumbnailUrl') ? resetField('thumbnailUrl') : copyFetchedToCurrent('thumbnailUrl')"
(mouseenter)="onMouseEnter('thumbnailUrl')"
@@ -61,12 +61,12 @@
<p-button
[icon]="isValueSaved(field.controlName) ? 'pi pi-check' : (hoveredFields[field.controlName] && isValueCopied(field.controlName) ? 'pi pi-times' : 'pi pi-arrow-left')"
[outlined]="true"
[ngClass]="
{
'green-outlined-button': isValueSaved(field.controlName),
'yellow-outlined-button': isValueCopied(field.controlName) && !hoveredFields[field.controlName],
'red-outlined-button': isValueCopied(field.controlName) && hoveredFields[field.controlName]
}"
[ngClass]="
{
'green-outlined-button': isValueSaved(field.controlName),
'yellow-outlined-button': isValueCopied(field.controlName) && !hoveredFields[field.controlName],
'red-outlined-button': isValueCopied(field.controlName) && hoveredFields[field.controlName]
}"
class="arrow-button"
(click)="hoveredFields[field.controlName] && isValueCopied(field.controlName) ? resetField(field.controlName) : copyFetchedToCurrent(field.controlName)"
(mouseenter)="onMouseEnter(field.controlName)"
@@ -75,6 +75,43 @@
</div>
</div>
}
@for (field of metadataChips; track field) {
<div class="form-row">
<label for="{{field.controlName}}" class="label">{{ field.label }}</label>
<div class="input-container">
@if (!book.metadata![field.lockedKey]) {
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock(field.controlName)" severity="success"></p-button>
}
@if (book.metadata![field.lockedKey]) {
<p-button icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock(field.controlName)" severity="warn"></p-button>
}
<div class="w-full px-2">
<p-chips formControlName="{{field.controlName}}" addOnBlur="true"></p-chips>
</div>
<p-button
[icon]="isValueSaved(field.controlName) ? 'pi pi-check' : (hoveredFields[field.controlName] && isValueCopied(field.controlName) ? 'pi pi-times' : 'pi pi-arrow-left')"
[outlined]="true"
[ngClass]="
{
'green-outlined-button': isValueSaved(field.controlName),
'yellow-outlined-button': isValueCopied(field.controlName) && !hoveredFields[field.controlName],
'red-outlined-button': isValueCopied(field.controlName) && hoveredFields[field.controlName]
}"
class="arrow-button"
(click)="hoveredFields[field.controlName] && isValueCopied(field.controlName) ? resetField(field.controlName) : copyFetchedToCurrent(field.controlName)"
(mouseenter)="onMouseEnter(field.controlName)"
(mouseleave)="onMouseLeave(field.controlName)"/>
<div class="w-full px-2">
<p-chips
[ngModel]="fetchedMetadata[field.fetchedKey] ?? []"
[ngModelOptions]="{ standalone: true }"
[disabled]="true">
</p-chips>
</div>
</div>
</div>
}
@for (field of metadataDescription; track field) {
<div class="form-row">
<label for="{{field.controlName}}" class="label">{{ field.label }}</label>
@@ -89,12 +126,12 @@
<p-button
[icon]="isValueSaved(field.controlName) ? 'pi pi-check' : (hoveredFields[field.controlName] && isValueCopied(field.controlName) ? 'pi pi-times' : 'pi pi-arrow-left')"
[outlined]="true"
[ngClass]="
{
'green-outlined-button': isValueSaved(field.controlName),
'yellow-outlined-button': isValueCopied(field.controlName) && !hoveredFields[field.controlName],
'red-outlined-button': isValueCopied(field.controlName) && hoveredFields[field.controlName]
}"
[ngClass]="
{
'green-outlined-button': isValueSaved(field.controlName),
'yellow-outlined-button': isValueCopied(field.controlName) && !hoveredFields[field.controlName],
'red-outlined-button': isValueCopied(field.controlName) && hoveredFields[field.controlName]
}"
class="arrow-button"
(click)="hoveredFields[field.controlName] && isValueCopied(field.controlName) ? resetField(field.controlName) : copyFetchedToCurrent(field.controlName)"
(mouseenter)="onMouseEnter(field.controlName)"
@@ -117,12 +154,12 @@
<p-button
[icon]="isValueSaved(field.controlName) ? 'pi pi-check' : (hoveredFields[field.controlName] && isValueCopied(field.controlName) ? 'pi pi-times' : 'pi pi-arrow-left')"
[outlined]="true"
[ngClass]="
{
'green-outlined-button': isValueSaved(field.controlName),
'yellow-outlined-button': isValueCopied(field.controlName) && !hoveredFields[field.controlName],
'red-outlined-button': isValueCopied(field.controlName) && hoveredFields[field.controlName]
}"
[ngClass]="
{
'green-outlined-button': isValueSaved(field.controlName),
'yellow-outlined-button': isValueCopied(field.controlName) && !hoveredFields[field.controlName],
'red-outlined-button': isValueCopied(field.controlName) && hoveredFields[field.controlName]
}"
class="arrow-button"
(click)="hoveredFields[field.controlName] && isValueCopied(field.controlName) ? resetField(field.controlName) : copyFetchedToCurrent(field.controlName)"
(mouseenter)="onMouseEnter(field.controlName)"
@@ -139,14 +176,14 @@
[ngStyle]="{'padding-left': '2rem', 'padding-right': '0.5rem'}"
[outlined]="true"
pTooltip="Move all missing fields" tooltipPosition="bottom"
(onClick)="copyMissing()"></p-button>
(onClick)="copyMissing()"></p-button>
<p-button
severity="info"
icon='pi pi-angle-double-left'
[ngStyle]="{'padding-left': '0.5rem', 'padding-right': '2rem'}"
[outlined]="true"
pTooltip="Move all fields" tooltipPosition="bottom"
(onClick)="copyAll()"></p-button>
(onClick)="copyAll()"></p-button>
<p class="text-lg">Fetched Metadata</p>
</div>
</div>
@@ -13,6 +13,7 @@ import {BookService} from '../../../service/book.service';
import {Textarea} from 'primeng/textarea';
import {filter, map} from 'rxjs/operators';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {Chips} from 'primeng/chips';
@Component({
selector: 'app-metadata-picker',
@@ -29,19 +30,21 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
NgStyle,
Tooltip,
AsyncPipe,
Textarea
Textarea,
Chips
]
})
export class MetadataPickerComponent implements OnInit {
metadataFieldsTop = [
{label: 'Title', controlName: 'title', lockedKey: 'titleLocked', fetchedKey: 'title'},
{label: 'Authors', controlName: 'authors', lockedKey: 'authorsLocked', fetchedKey: 'authors'},
{label: 'Categories', controlName: 'categories', lockedKey: 'categoriesLocked', fetchedKey: 'categories'},
{label: 'Publisher', controlName: 'publisher', lockedKey: 'publisherLocked', fetchedKey: 'publisher'},
{label: 'Published', controlName: 'publishedDate', lockedKey: 'publishedDateLocked', fetchedKey: 'publishedDate'},
{label: 'ISBN-10', controlName: 'isbn10', lockedKey: 'isbn10Locked', fetchedKey: 'isbn10'},
{label: 'Language', controlName: 'language', lockedKey: 'languageLocked', fetchedKey: 'language'}
{label: 'Published', controlName: 'publishedDate', lockedKey: 'publishedDateLocked', fetchedKey: 'publishedDate'}
];
metadataChips = [
{label: 'Authors', controlName: 'authors', lockedKey: 'authorsLocked', fetchedKey: 'authors'},
{label: 'Categories', controlName: 'categories', lockedKey: 'categoriesLocked', fetchedKey: 'categories'}
];
metadataDescription = [
@@ -52,6 +55,8 @@ export class MetadataPickerComponent implements OnInit {
{label: 'Series', controlName: 'seriesName', lockedKey: 'seriesNameLocked', fetchedKey: 'seriesName'},
{label: 'Book #', controlName: 'seriesNumber', lockedKey: 'seriesNumberLocked', fetchedKey: 'seriesNumber'},
{label: 'Total Books', controlName: 'seriesTotal', lockedKey: 'seriesTotalLocked', fetchedKey: 'seriesTotal'},
{label: 'Language', controlName: 'language', lockedKey: 'languageLocked', fetchedKey: 'language'},
{label: 'ISBN-10', controlName: 'isbn10', lockedKey: 'isbn10Locked', fetchedKey: 'isbn10'},
{label: 'ISBN-13', controlName: 'isbn13', lockedKey: 'isbn13Locked', fetchedKey: 'isbn13'},
{label: 'Amazon ID (ASIN)', controlName: 'asin', lockedKey: 'asinLocked', fetchedKey: 'asin'},
{label: 'Amazon Reviews', controlName: 'amazonReviewCount', lockedKey: 'amazonReviewCountLocked', fetchedKey: 'amazonReviewCount'},
@@ -144,8 +149,7 @@ export class MetadataPickerComponent implements OnInit {
filter((book): book is Book => !!book && !!book.metadata),
map(book => book.metadata),
takeUntilDestroyed(this.destroyRef)
).
subscribe((metadata) => {
).subscribe((metadata) => {
if (metadata) {
this.originalMetadata = metadata;
this.originalMetadata.thumbnailUrl = this.urlHelper.getCoverUrl(metadata.bookId, metadata.coverUpdatedOn);
@@ -153,8 +157,8 @@ export class MetadataPickerComponent implements OnInit {
this.metadataForm.patchValue({
title: metadata.title || null,
subtitle: metadata.subtitle || null,
authors: (metadata.authors || []).sort().join(', '),
categories: (metadata.categories || []).sort().join(', '),
authors: [...(metadata.authors ?? [])].sort(),
categories: [...(metadata.categories ?? [])].sort(),
publisher: metadata.publisher || null,
publishedDate: metadata.publishedDate || null,
isbn10: metadata.isbn10 || null,
@@ -80,3 +80,7 @@
z-index: 3;
}
::ng-deep .p-inputchips {
width: 100%;
}
@@ -30,7 +30,7 @@
@if (oidcEnabled) {
<div>
<p-divider></p-divider>
<p-button fluid severity="info" type="button" label="Login with OIDC" icon="pi pi-id-card" (click)="loginWithOidc()"></p-button>
<p-button fluid severity="info" type="button" label="Login with {{oidcName}}" icon="pi pi-id-card" (click)="loginWithOidc()"></p-button>
</div>
}
</div>
@@ -36,6 +36,7 @@ export class LoginComponent implements OnInit {
password = '';
errorMessage = '';
oidcEnabled = false;
oidcName = 'OIDC';
private authService = inject(AuthService);
private oAuthService = inject(OAuthService);
@@ -51,7 +52,8 @@ export class LoginComponent implements OnInit {
take(1)
)
.subscribe(settings => {
this.oidcEnabled = settings?.oidcEnabled;
this.oidcEnabled = settings!.oidcEnabled;
this.oidcName = settings!.oidcProviderDetails?.providerName || 'OIDC';
});
}
@@ -29,7 +29,7 @@
[queryParams]="item.queryParams"
[attr.target]="item.target" tabindex="0" pRipple>
<i [ngClass]="item.icon" class="layout-menuitem-icon"></i>
<span class="layout-menuitem-text w-full">
<span class="layout-menuitem-text w-full truncate">
{{ item.label }}
</span>
@if (item.items) {
@@ -50,7 +50,6 @@
[rounded]="true"
[label]="hovered ? '' : (item.bookCount$ | async)?.toString() || ''"
[icon]="hovered ? 'pi pi-ellipsis-v' : ''"
[style.width]="'30px'"
[style.height]="'30px'"
[style.display]="'flex'">
</p-button>
@@ -58,7 +57,7 @@
<p-menu #entitymenu [model]="item.menu" [popup]="true" appendTo="body"></p-menu>
}
@if (item.type === 'Library' && (!admin && !canManipulateLibrary) || item.type === 'All Books' || item.label === 'Unshelved') {
<p class="text-[var(--primary-color)] pr-1">
<p class="text-[var(--primary-color)] pr-3">
{{ (item.bookCount$ | async)?.toString() || '0' }}
</p>
}
@@ -24,9 +24,8 @@
@if (userService.userState$ | async; as userData) {
<li>
@if (userData.permissions.canManipulateLibrary || userData.permissions.admin) {
<a class="topbar-item">
<i class="pi pi-plus-circle text-surface-700 dark:text-surface-100" (click)="openLibraryCreatorDialog()"
pTooltip="Create New Library" tooltipPosition="top"></i>
<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>
}
</li>
@@ -34,17 +33,15 @@
@if (userService.userState$ | async; as userData) {
<li>
@if (userData.permissions.canManipulateLibrary || userData.permissions.admin) {
<a class="topbar-item">
<i class="pi pi-upload text-surface-700 dark:text-surface-100" (click)="openFileUploadDialog()"
pTooltip="Upload Book" tooltipPosition="top"></i>
<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>
}
</li>
}
<li>
<a class="topbar-item">
<i class="pi pi-cog text-surface-700 dark:text-surface-100" (click)="navigateToSettings()"
pTooltip="Settings" tooltipPosition="top"></i>
<a class="topbar-item" (click)="navigateToSettings()" pTooltip="Settings" tooltipPosition="top">
<i class="pi pi-cog text-surface-700 dark:text-surface-100"></i>
</a>
</li>
</div>
@@ -67,14 +64,14 @@
<p-divider layout="vertical"/>
<div class="flex gap-6">
<li class="relative group overflow-hidden !border-transparent topbar-item" (click)="openGithubSupportDialog()">
<div class="flex gap-6" pTooltip="Love BookLore?" tooltipPosition="top" (click)="openGithubSupportDialog()">
<li class="relative group overflow-hidden !border-transparent topbar-item">
<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">
</span>
<span style="inset: 1px; border-radius: 4px" class="absolute z-2 bg-surface-0 dark:bg-surface-900 transition-all"></span>
<i class="pi pi-thumbs-up z-10" pTooltip="Love BookLore?" tooltipPosition="top"></i>
<i class="pi pi-thumbs-up z-10"></i>
</li>
<li class="relative">
<button type="button"
@@ -3,14 +3,28 @@
<div class="rounded-xl overflow-hidden">
<p-tabs [(value)]="activeTab" scrollable>
<p-tablist>
<p-tab [value]="SettingsTab.ReaderSettings">Reader Preferences</p-tab>
<p-tab [value]="SettingsTab.ViewPreferences">View Preferences</p-tab>
<p-tab [value]="SettingsTab.ReaderSettings">
<i class="pi pi-book"></i> Reader Preferences
</p-tab>
<p-tab [value]="SettingsTab.ViewPreferences">
<i class="pi pi-desktop"></i> View Preferences
</p-tab>
@if (userData.permissions.admin) {
<p-tab [value]="SettingsTab.MetadataSettings">Metadata Settings</p-tab>
<p-tab [value]="SettingsTab.ApplicationSettings">Application Settings</p-tab>
<p-tab [value]="SettingsTab.UserManagement">User Management</p-tab>
<p-tab [value]="SettingsTab.EmailSettings">Email Settings</p-tab>
<p-tab [value]="SettingsTab.AuthenticationSettings">Authentication</p-tab>
<p-tab [value]="SettingsTab.MetadataSettings">
<i class="pi pi-sliders-h"></i> Metadata Settings
</p-tab>
<p-tab [value]="SettingsTab.ApplicationSettings">
<i class="pi pi-cog"></i> Application Settings
</p-tab>
<p-tab [value]="SettingsTab.UserManagement">
<i class="pi pi-users"></i> User Management
</p-tab>
<p-tab [value]="SettingsTab.EmailSettings">
<i class="pi pi-envelope"></i> Email Settings
</p-tab>
<p-tab [value]="SettingsTab.AuthenticationSettings">
<i class="pi pi-lock"></i> Authentication
</p-tab>
}
</p-tablist>
<p-tabpanels>
@@ -13,7 +13,10 @@
transition: transform variables.$transitionDuration, left variables.$transitionDuration;
background-color: var(--card-background);
border-radius: variables.$borderRadius;
padding: 0.5rem 1.35rem;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
padding-left: 1.35rem;
padding-right: 0.8rem;
box-shadow: 0px 3px 5px rgba(0, 0, 0, .02), 0px 0px 2px rgba(0, 0, 0, .05), 0px 1px 4px rgba(0, 0, 0, .08);
}