Merge pull request #142 from adityachandelgit/develop

Merge Develop into Master – Stable Release Update
This commit is contained in:
Aditya Chandel
2025-04-19 15:00:45 -06:00
committed by GitHub
40 changed files with 666 additions and 180 deletions
+22 -4
View File
@@ -41,14 +41,32 @@ jobs:
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
id: determine_bump id: determine_bump
run: | run: |
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name' || echo "") # Step 1: Check if the PR has a label (priority over commit message)
if echo "$labels" | grep -q 'breaking-change'; then pr_number=$(gh pr list --state merged --base master --limit 1 --json number --jq '.[0].number')
echo "PR Number: $pr_number"
labels=$(gh pr view "$pr_number" --json labels --jq '.labels[].name' || echo "")
if echo "$labels" | grep -q 'major'; then
bump="major" bump="major"
elif echo "$labels" | grep -q 'feature\|enhancement'; then elif echo "$labels" | grep -q 'minor'; then
bump="minor" bump="minor"
else elif echo "$labels" | grep -q 'patch'; then
bump="patch" bump="patch"
fi fi
# Step 2: If no label, fallback to commit message keywords
if [ -z "$bump" ]; then
last_commit_msg=$(git log -1 --pretty=%B)
echo "Last commit message: $last_commit_msg"
if echo "$last_commit_msg" | grep -iq '#major'; then
bump="major"
elif echo "$last_commit_msg" | grep -iq '#minor'; then
bump="minor"
elif echo "$last_commit_msg" | grep -iq '#patch'; then
bump="patch"
else
bump="patch" # Default to patch if no keyword or label
fi
fi
echo "bump=$bump" >> $GITHUB_ENV echo "bump=$bump" >> $GITHUB_ENV
echo "Version bump type: $bump" echo "Version bump type: $bump"
env: env:
+57 -12
View File
@@ -1,15 +1,19 @@
# BookLore # BookLore
![GitHub release (latest by date)](https://img.shields.io/github/v/release/adityachandelgit/BookLore)
![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)
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. 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.
![BookLore Screenshot](assets/booklore-screenshot.jpg) ![BookLore Demo](assets/demo.gif)
> ⚠️ **Warning:** > ⚠️ **Warning:**
> This project is in early development by a sole developer. Expect bugs, missing features, and frequent changes. > This project is in early development by a sole developer. Expect bugs, missing features, and frequent changes.
> **Data Loss Risk:** Non-backwards compatible database changes may result in loss of metadata, such as book titles, authors, and reading progress. Your actual book files (PDFs and ePubs) are unlikely to be affected, but it's always a good idea to keep a backup of both your database and your book files. > **Data Loss Risk:** Non-backwards compatible database changes may result in loss of metadata, such as book titles, authors, and reading progress. Your actual book files (PDFs and ePubs) are unlikely to be affected, but it's always a good idea to keep a backup of both your database and your book files.
> **Limited Support:** As this is a one-person project, support may be slow, and features could be experimental or incomplete. Contributions and feedback are welcome! > **Limited Support:** As this is a one-person project, support may be slow, and features could be experimental or incomplete. Contributions and feedback are welcome!
## Key Features ## ✨ Key Features
- **Modern, Responsive UI** – A sleek, highly reactive, and fluent interface for a seamless reading experience. - **Modern, Responsive UI** – A sleek, highly reactive, and fluent interface for a seamless reading experience.
- **Organized Book Management** – Categorize books using Libraries and Shelves for better organization. - **Organized Book Management** – Categorize books using Libraries and Shelves for better organization.
- **Smart Metadata Handling** – Automatically fetch book details from sources like Goodreads, Amazon, and Google Books, or edit them manually. - **Smart Metadata Handling** – Automatically fetch book details from sources like Goodreads, Amazon, and Google Books, or edit them manually.
@@ -19,7 +23,7 @@ BookLore is a self-hosted web app for organizing and managing your personal book
BookLore is perfect for self-hosters who want complete control over their digital library. Stay tuned for updates! BookLore is perfect for self-hosters who want complete control over their digital library. Stay tuned for updates!
## Video Guides & Tutorials ## 🎥 Video Guides & Tutorials
For a step-by-step walkthrough, check out the official BookLore video guides on YouTube: For a step-by-step walkthrough, check out the official BookLore video guides on YouTube:
@@ -27,7 +31,7 @@ For a step-by-step walkthrough, check out the official BookLore video guides on
These videos cover deployment, configuration, and feature highlights to help you get started quickly. These videos cover deployment, configuration, and feature highlights to help you get started quickly.
## Deploy with Docker ## 🐳 Deploy with Docker
You can quickly set up and run BookLore using Docker. You can quickly set up and run BookLore using Docker.
@@ -48,7 +52,9 @@ services:
- PUID=1000 - PUID=1000
- PGID=1000 - PGID=1000
- TZ=Etc/UTC - TZ=Etc/UTC
- MYSQL_ROOT_PASSWORD=your_secure_password # Use a strong password; must match the one in the mariadb service - DATABASE_URL=jdbc:mariadb://mariadb:3306/booklore # Only modify this if you're familiar with JDBC and your database setup
- DATABASE_USERNAME=booklore # Must match MYSQL_USER defined in the mariadb container
- DATABASE_PASSWORD=your_secure_password # Use a strong password; must match MYSQL_PASSWORD defined in the mariadb container
depends_on: depends_on:
mariadb: mariadb:
condition: service_healthy condition: service_healthy
@@ -66,7 +72,10 @@ services:
- PUID=1000 - PUID=1000
- PGID=1000 - PGID=1000
- TZ=Etc/UTC - TZ=Etc/UTC
- MYSQL_ROOT_PASSWORD=your_secure_password # Use a strong password; must match the one in the booklore service - MYSQL_ROOT_PASSWORD=super_secure_password # Use a strong password for the database's root user, should be different from MYSQL_PASSWORD
- MYSQL_DATABASE=booklore
- MYSQL_USER=booklore # Must match DATABASE_USERNAME defined in the booklore container
- MYSQL_PASSWORD=your_secure_password # Use a strong password; must match DATABASE_PASSWORD defined in the booklore container
volumes: volumes:
- /your/local/path/to/mariadb/config:/config - /your/local/path/to/mariadb/config:/config
restart: unless-stopped restart: unless-stopped
@@ -107,14 +116,50 @@ Password: admin123
> ⚠️ **Important:** > ⚠️ **Important:**
> You’ll be prompted to change the default password upon your first login to ensure better security. > You’ll be prompted to change the default password upon your first login to ensure better security.
## Tech Stack ## 🔧 Configuration
- **Backend:** Spring Boot (Java) The following environment variables can be configured:
- **Frontend:** Angular (TypeScript)
- **Database:** MariaDB
- **Containerization:** Docker & Docker Compose
## License | Variable Name | Description | Default Value |
|-------------------|---------------------------|---------------------------------------------------------------------|
| DATABASE_URL | JDBC connection URL | `jdbc:mariadb://${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}` |
| DATABASE_HOST | Database hostname | `mariadb` |
| DATABASE_PORT | Database port | `3306` |
| DATABASE_NAME | Database name | `booklore` |
| DATABASE_USERNAME | Database username for app | `root` |
| DATABASE_PASSWORD | Database password for app | **required** |
## 🤝 Community & Support
- 🐞 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)
## 👨‍💻 Contributors & Developers
Thanks to all the amazing people who contribute to Booklore.
[![Contributors List](https://contrib.rocks/image?repo=adityachandelgit/BookLore)](https://github.com/adityachandelgit/BookLore/graphs/contributors)
## ⭐ Star History
[![Star History Chart](https://api.star-history.com/svg?repos=adityachandelgit/BookLore&type=Date&theme=dark)](https://star-history.com/#adityachandelgit/BookLore&Date&theme=dark)
## 💖 Support the Project
If you find BookLore helpful, consider ⭐ starring the repo!
## 🧰 Tech Stack
<p align="left">
<img src="https://img.shields.io/badge/Spring%20Boot-6DB33F?style=for-the-badge&logo=springboot&logoColor=white" alt="Spring Boot" style="margin-right: 10px;"/>
<img src="https://img.shields.io/badge/Angular-DD0031?style=for-the-badge&logo=angular&logoColor=white" alt="Angular" style="margin-right: 10px;"/>
<img src="https://img.shields.io/badge/MariaDB-003545?style=for-the-badge&logo=mariadb&logoColor=white" alt="MariaDB" style="margin-right: 10px;"/>
<img src="https://img.shields.io/badge/Docker-2496ED?style=for-the-badge&logo=docker&logoColor=white" alt="Docker" style="margin-right: 10px;"/>
</p>
## ⚖️ License
* [GNU GPL v3](http://www.gnu.org/licenses/gpl.html) * [GNU GPL v3](http://www.gnu.org/licenses/gpl.html)
* Copyright 2024-2025 * Copyright 2024-2025
Binary file not shown.

Before

Width:  |  Height:  |  Size: 612 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 10 MiB

@@ -10,6 +10,5 @@ import org.springframework.stereotype.Component;
@Getter @Getter
@Setter @Setter
public class AppProperties { public class AppProperties {
private String pathBook;
private String pathConfig; private String pathConfig;
} }
@@ -1,46 +1,30 @@
package com.adityachandel.booklore.controller; package com.adityachandel.booklore.controller;
import com.adityachandel.booklore.model.dto.ReleaseNote;
import com.adityachandel.booklore.model.dto.VersionInfo; import com.adityachandel.booklore.model.dto.VersionInfo;
import com.fasterxml.jackson.databind.JsonNode; import com.adityachandel.booklore.service.VersionService;
import com.fasterxml.jackson.databind.ObjectMapper; import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestClient;
import java.util.List;
@AllArgsConstructor
@RestController @RestController
@RequestMapping("/api/v1/version") @RequestMapping("/api/v1/version")
public class VersionController { public class VersionController {
@Value("${app.version:unknown}") private final VersionService versionService;
private String appVersion;
@GetMapping @GetMapping
public ResponseEntity<VersionInfo> getVersions() { public ResponseEntity<VersionInfo> getVersionInfo() {
String latestVersion = fetchLatestGitHubReleaseVersion(); return ResponseEntity.ok(versionService.getVersionInfo());
return ResponseEntity.ok(new VersionInfo(appVersion, latestVersion));
} }
private String fetchLatestGitHubReleaseVersion() { @GetMapping("/changelog")
try { public ResponseEntity<List<ReleaseNote>> getChangelogSinceCurrent() {
RestClient restClient = RestClient.builder() return ResponseEntity.ok(versionService.getChangelogSinceCurrentVersion());
.defaultHeader("Accept", "application/vnd.github+json")
.defaultHeader("User-Agent", "BookLore-Version-Checker")
.build();
String response = restClient.get()
.uri("https://api.github.com/repos/adityachandelgit/BookLore/releases/latest")
.retrieve()
.body(String.class);
ObjectMapper objectMapper = new ObjectMapper();
JsonNode root = objectMapper.readTree(response);
return root.has("tag_name") ? root.get("tag_name").asText() : "unknown";
} catch (Exception e) {
return "unknown";
}
} }
} }
@@ -29,6 +29,10 @@ public class BookMetadata {
private Double rating; private Double rating;
private Integer ratingCount; private Integer ratingCount;
private Integer reviewCount; private Integer reviewCount;
private Double amazonRating;
private Integer amazonReviewCount;
private Double goodreadsRating;
private Integer goodreadsReviewCount;
private Instant coverUpdatedOn; private Instant coverUpdatedOn;
private List<String> authors; private List<String> authors;
private List<String> categories; private List<String> categories;
@@ -53,6 +57,10 @@ public class BookMetadata {
private Boolean languageLocked; private Boolean languageLocked;
private Boolean ratingLocked; private Boolean ratingLocked;
private Boolean reviewCountLocked; private Boolean reviewCountLocked;
private Boolean amazonRatingLocked;
private Boolean amazonReviewCountLocked;
private Boolean goodreadsRatingLocked;
private Boolean goodreadsReviewCountLocked;
private Boolean coverLocked; private Boolean coverLocked;
private Boolean authorsLocked; private Boolean authorsLocked;
private Boolean categoriesLocked; private Boolean categoriesLocked;
@@ -0,0 +1,4 @@
package com.adityachandel.booklore.model.dto;
public record ReleaseNote(String version, String name, String changelog, String url) {
}
@@ -1,11 +1,5 @@
package com.adityachandel.booklore.model.dto; package com.adityachandel.booklore.model.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data public record VersionInfo(String current, String latest) {
@AllArgsConstructor
public class VersionInfo {
private String current;
private String latest;
} }
@@ -69,6 +69,18 @@ public class BookMetadataEntity {
@Column(name = "cover_updated_on") @Column(name = "cover_updated_on")
private Instant coverUpdatedOn; private Instant coverUpdatedOn;
@Column(name = "amazon_rating")
private Double amazonRating;
@Column(name = "amazon_review_count")
private Integer amazonReviewCount;
@Column(name = "goodreads_rating")
private Double goodreadsRating;
@Column(name = "goodreads_review_count")
private Integer goodreadsReviewCount;
// Locking fields // Locking fields
@Column(name = "all_fields_locked") @Column(name = "all_fields_locked")
private Boolean allFieldsLocked = Boolean.FALSE; private Boolean allFieldsLocked = Boolean.FALSE;
@@ -109,6 +121,18 @@ public class BookMetadataEntity {
@Column(name = "review_count_locked") @Column(name = "review_count_locked")
private Boolean reviewCountLocked = Boolean.FALSE; private Boolean reviewCountLocked = Boolean.FALSE;
@Column(name = "amazon_rating_locked")
private Boolean amazonRatingLocked = Boolean.FALSE;
@Column(name = "amazon_review_count_locked")
private Boolean amazonReviewCountLocked = Boolean.FALSE;
@Column(name = "goodreads_rating_locked")
private Boolean goodreadsRatingLocked = Boolean.FALSE;
@Column(name = "goodreads_review_count_locked")
private Boolean goodreadsReviewCountLocked = Boolean.FALSE;
@Column(name = "cover_locked") @Column(name = "cover_locked")
private Boolean coverLocked = Boolean.FALSE; private Boolean coverLocked = Boolean.FALSE;
@@ -151,7 +175,6 @@ public class BookMetadataEntity {
@OneToMany(fetch = FetchType.LAZY, mappedBy = "book") @OneToMany(fetch = FetchType.LAZY, mappedBy = "book")
private List<BookAwardEntity> awards; private List<BookAwardEntity> awards;
public void applyLockToAllFields(boolean lock) { public void applyLockToAllFields(boolean lock) {
this.allFieldsLocked = lock; this.allFieldsLocked = lock;
this.titleLocked = lock; this.titleLocked = lock;
@@ -172,5 +195,9 @@ public class BookMetadataEntity {
this.seriesTotalLocked = lock; this.seriesTotalLocked = lock;
this.authorsLocked = lock; this.authorsLocked = lock;
this.categoriesLocked = lock; this.categoriesLocked = lock;
this.amazonRatingLocked = lock;
this.amazonReviewCountLocked = lock;
this.goodreadsRatingLocked = lock;
this.goodreadsReviewCountLocked = lock;
} }
} }
@@ -80,12 +80,20 @@ public class BookMetadataUpdater {
metadata.setPageCount(newMetadata.getPageCount()); metadata.setPageCount(newMetadata.getPageCount());
} }
if ((metadata.getRatingLocked() == null || !metadata.getRatingLocked()) && newMetadata.getRating() != null) { if ((metadata.getAmazonRatingLocked() == null || !metadata.getAmazonRatingLocked()) && newMetadata.getAmazonRating() != null) {
metadata.setRating(newMetadata.getRating()); metadata.setAmazonRating(newMetadata.getAmazonRating());
} }
if ((metadata.getReviewCountLocked() == null || !metadata.getReviewCountLocked()) && newMetadata.getReviewCount() != null) { if ((metadata.getAmazonReviewCountLocked() == null || !metadata.getAmazonReviewCountLocked()) && newMetadata.getAmazonReviewCount() != null) {
metadata.setReviewCount(newMetadata.getReviewCount()); metadata.setAmazonReviewCount(newMetadata.getAmazonReviewCount());
}
if ((metadata.getGoodreadsRatingLocked() == null || !metadata.getGoodreadsRatingLocked()) && newMetadata.getGoodreadsRating() != null) {
metadata.setGoodreadsRating(newMetadata.getGoodreadsRating());
}
if ((metadata.getGoodreadsReviewCountLocked() == null || !metadata.getGoodreadsReviewCountLocked()) && newMetadata.getGoodreadsReviewCount() != null) {
metadata.setGoodreadsReviewCount(newMetadata.getGoodreadsReviewCount());
} }
if ((metadata.getSeriesNameLocked() == null || !metadata.getSeriesNameLocked()) && newMetadata.getSeriesName() != null) { if ((metadata.getSeriesNameLocked() == null || !metadata.getSeriesNameLocked()) && newMetadata.getSeriesName() != null) {
@@ -214,11 +222,17 @@ public class BookMetadataUpdater {
if (newMetadata.getLanguageLocked() != null) { if (newMetadata.getLanguageLocked() != null) {
metadata.setLanguageLocked(newMetadata.getLanguageLocked()); metadata.setLanguageLocked(newMetadata.getLanguageLocked());
} }
if (newMetadata.getRatingLocked() != null) { if (newMetadata.getAmazonRatingLocked() != null) {
metadata.setRatingLocked(newMetadata.getRatingLocked()); metadata.setAmazonRatingLocked(newMetadata.getAmazonRatingLocked());
} }
if (newMetadata.getReviewCountLocked() != null) { if (newMetadata.getAmazonReviewCountLocked() != null) {
metadata.setReviewCountLocked(newMetadata.getReviewCountLocked()); metadata.setAmazonReviewCountLocked(newMetadata.getAmazonReviewCountLocked());
}
if (newMetadata.getGoodreadsRatingLocked() != null) {
metadata.setGoodreadsRatingLocked(newMetadata.getGoodreadsRatingLocked());
}
if (newMetadata.getGoodreadsReviewCountLocked() != null) {
metadata.setGoodreadsReviewCountLocked(newMetadata.getGoodreadsReviewCountLocked());
} }
if (newMetadata.getSeriesNameLocked() != null) { if (newMetadata.getSeriesNameLocked() != null) {
metadata.setSeriesNameLocked(newMetadata.getSeriesNameLocked()); metadata.setSeriesNameLocked(newMetadata.getSeriesNameLocked());
@@ -55,14 +55,14 @@ public class FileUploadService {
} }
try { try {
file.transferTo(storageFile); file.transferTo(storagePath); // storagePath here is required for windows, otherwise it will be resoled relative to Tomcat FS
log.info("File uploaded successfully: {}", storageFile.getAbsolutePath()); log.info("File uploaded successfully: {}", storageFile.getAbsolutePath());
Book book = processFile(file, libraryEntity, libraryPathEntity, storageFile); Book book = processFile(file, libraryEntity, libraryPathEntity, storageFile);
notificationService.sendMessage(Topic.BOOK_ADD, book); notificationService.sendMessage(Topic.BOOK_ADD, book);
log.info("Book processed successfully: {}", book.getMetadata().getTitle()); log.info("Book processed successfully: {}", book.getMetadata().getTitle());
return book; return book;
} catch (IOException e) { } catch (IOException e) {
log.error("Error saving file: {}", e.getMessage()); log.error("Error saving file", e);
throw ApiError.FILE_READ_ERROR.createException(e.getMessage()); throw ApiError.FILE_READ_ERROR.createException(e.getMessage());
} }
} }
@@ -0,0 +1,103 @@
package com.adityachandel.booklore.service;
import com.adityachandel.booklore.model.dto.ReleaseNote;
import com.adityachandel.booklore.model.dto.VersionInfo;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClient;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Service
public class VersionService {
@Value("${app.version:unknown}")
private String appVersion;
private static final String GITHUB_REPO = "adityachandelgit/BookLore";
public VersionInfo getVersionInfo() {
String latestVersion = fetchLatestGitHubReleaseVersion();
return new VersionInfo(appVersion, latestVersion);
}
public List<ReleaseNote> getChangelogSinceCurrentVersion() {
return fetchReleaseNotesSince(appVersion);
}
private String fetchLatestGitHubReleaseVersion() {
try {
RestClient restClient = RestClient.builder()
.defaultHeader("Accept", "application/vnd.github+json")
.defaultHeader("User-Agent", "BookLore-Version-Checker")
.build();
String response = restClient.get()
.uri("https://api.github.com/repos/" + GITHUB_REPO + "/releases/latest")
.retrieve()
.body(String.class);
JsonNode root = new ObjectMapper().readTree(response);
return root.has("tag_name") ? root.get("tag_name").asText() : "unknown";
} catch (Exception e) {
log.error("Failed to fetch latest release version", e);
return "unknown";
}
}
private List<ReleaseNote> fetchReleaseNotesSince(String currentVersion) {
List<ReleaseNote> updates = new ArrayList<>();
try {
RestClient restClient = RestClient.builder()
.defaultHeader("Accept", "application/vnd.github+json")
.defaultHeader("User-Agent", "BookLore-Version-Checker")
.build();
String response = restClient.get()
.uri("https://api.github.com/repos/" + GITHUB_REPO + "/releases")
.retrieve()
.body(String.class);
ObjectMapper mapper = new ObjectMapper();
JsonNode releases = mapper.readTree(response);
for (JsonNode release : releases) {
String tag = release.get("tag_name").asText();
if (isVersionGreater(tag, currentVersion)) {
String url = "https://github.com/" + GITHUB_REPO + "/releases/tag/" + tag;
updates.add(new ReleaseNote(
tag,
release.get("name").asText(),
release.get("body").asText(),
url
));
}
}
} catch (Exception e) {
log.error("Failed to fetch release notes", e);
}
return updates;
}
private boolean isVersionGreater(String version1, String version2) {
try {
String[] v1 = version1.replace("v", "").split("\\.");
String[] v2 = version2.replace("v", "").split("\\.");
for (int i = 0; i < Math.max(v1.length, v2.length); i++) {
int num1 = i < v1.length ? Integer.parseInt(v1[i]) : 0;
int num2 = i < v2.length ? Integer.parseInt(v2[i]) : 0;
if (num1 > num2) return true;
if (num1 < num2) return false;
}
} catch (Exception e) {
log.error("Version comparison failed", e);
}
return false;
}
}
@@ -1,9 +1,8 @@
package com.adityachandel.booklore.service.fileprocessor; package com.adityachandel.booklore.service.fileprocessor;
import com.adityachandel.booklore.config.AppProperties;
import com.adityachandel.booklore.model.entity.BookMetadataEntity; import com.adityachandel.booklore.model.entity.BookMetadataEntity;
import com.adityachandel.booklore.repository.BookRepository;
import com.adityachandel.booklore.service.AppSettingService; import com.adityachandel.booklore.service.AppSettingService;
import com.adityachandel.booklore.util.FileService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -26,24 +25,22 @@ import java.util.stream.Stream;
@Slf4j @Slf4j
public class FileProcessingUtils { public class FileProcessingUtils {
private final AppProperties appProperties; private final FileService fileService;
private final AppSettingService appSettingService; private final AppSettingService appSettingService;
public void setBookCoverPath(long bookId, BookMetadataEntity bookMetadataEntity) { public void setBookCoverPath(long bookId, BookMetadataEntity bookMetadataEntity) {
bookMetadataEntity.setThumbnail(appProperties.getPathConfig() + "/thumbs/" + bookId + "/f.jpg"); bookMetadataEntity.setThumbnail(fileService.getThumbnailPath(bookId) + "/f.jpg");
bookMetadataEntity.setCoverUpdatedOn(Instant.now()); bookMetadataEntity.setCoverUpdatedOn(Instant.now());
} }
public boolean saveCoverImage(BufferedImage coverImage, long bookId) throws IOException { public boolean saveCoverImage(BufferedImage coverImage, long bookId) throws IOException {
File coverDirectory = new File(appProperties.getPathConfig() + "/thumbs");
String resolution = appSettingService.getAppSettings().getCoverSettings().getResolution(); String resolution = appSettingService.getAppSettings().getCoverSettings().getResolution();
String[] split = resolution.split("x"); String[] split = resolution.split("x");
int x = Integer.parseInt(split[0]); int x = Integer.parseInt(split[0]);
int y = Integer.parseInt(split[1]); int y = Integer.parseInt(split[1]);
BufferedImage resizedImage = resizeImage(coverImage, x, y); BufferedImage resizedImage = resizeImage(coverImage, x, y);
File bookDirectory = new File(coverDirectory, String.valueOf(bookId)); File bookDirectory = new File(fileService.getThumbnailPath(bookId));
if (!bookDirectory.exists()) { if (!bookDirectory.exists()) {
if (!bookDirectory.mkdirs()) { if (!bookDirectory.mkdirs()) {
throw new IOException("Failed to create directory: " + bookDirectory.getAbsolutePath()); throw new IOException("Failed to create directory: " + bookDirectory.getAbsolutePath());
@@ -65,7 +62,7 @@ public class FileProcessingUtils {
public void deleteBookCovers(Set<Long> bookIds) { public void deleteBookCovers(Set<Long> bookIds) {
for (Long bookId : bookIds) { for (Long bookId : bookIds) {
String bookCoverFolder = appProperties.getPathConfig() + "/thumbs/" + bookId; String bookCoverFolder = fileService.getThumbnailPath(bookId);
Path folderPath = Paths.get(bookCoverFolder); Path folderPath = Paths.get(bookCoverFolder);
try { try {
if (Files.exists(folderPath) && Files.isDirectory(folderPath)) { if (Files.exists(folderPath) && Files.isDirectory(folderPath)) {
@@ -137,8 +137,8 @@ public class AmazonBookParser implements BookParser {
.language(getLanguage(doc)) .language(getLanguage(doc))
.pageCount(getPageCount(doc)) .pageCount(getPageCount(doc))
.thumbnailUrl(getThumbnail(doc)) .thumbnailUrl(getThumbnail(doc))
.rating(getRating(doc)) .amazonRating(getRating(doc))
.reviewCount(getReviewCount(doc)) .amazonReviewCount(getReviewCount(doc))
.build(); .build();
} }
@@ -153,9 +153,8 @@ public class GoodReadsParser implements BookParser {
if (workJson != null) { if (workJson != null) {
JSONObject statsJson = workJson.optJSONObject("stats"); JSONObject statsJson = workJson.optJSONObject("stats");
if (statsJson != null) { if (statsJson != null) {
builder.rating(parseDouble(statsJson.optString("averageRating"))) builder.goodreadsRating(parseDouble(statsJson.optString("averageRating")))
.ratingCount(parseInteger(statsJson.optString("ratingsCount"))) .goodreadsReviewCount(parseInteger(statsJson.optString("ratingsCount")));
.reviewCount(parseInteger(statsJson.optString("textReviewsCount")));
} }
JSONObject detailsJson = workJson.optJSONObject("details"); JSONObject detailsJson = workJson.optJSONObject("details");
@@ -1,7 +1,6 @@
app: app:
path-book: '/app/books'
path-config: '/app/data' path-config: '/app/data'
version: 'development' version: 'v0.0.40'
spring: spring:
servlet: servlet:
@@ -15,12 +14,10 @@ spring:
application: application:
name: booklore-api name: booklore-api
datasource: datasource:
driver-class-name: org.mariadb.jdbc.Driver url: ${DATABASE_URL:jdbc:mariadb://${DATABASE_HOST:${DB_HOST:mariadb}}:${DATABASE_PORT:3306}/${DATABASE_NAME:booklore}?createDatabaseIfNotExist=true}
url: jdbc:mariadb://${DB_HOST:mariadb}:3306/booklore?createDatabaseIfNotExist=true username: ${DATABASE_USERNAME:root}
username: root password: ${DATABASE_PASSWORD:${MYSQL_ROOT_PASSWORD}}
password: ${MYSQL_ROOT_PASSWORD}
jpa: jpa:
database-platform: org.hibernate.dialect.MariaDBDialect
hibernate: hibernate:
naming: naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
@@ -0,0 +1,9 @@
ALTER TABLE book_metadata
ADD COLUMN amazon_rating FLOAT,
ADD COLUMN amazon_review_count INT,
ADD COLUMN goodreads_rating FLOAT,
ADD COLUMN goodreads_review_count INT,
ADD COLUMN amazon_rating_locked BOOLEAN DEFAULT FALSE,
ADD COLUMN amazon_review_count_locked BOOLEAN DEFAULT FALSE,
ADD COLUMN goodreads_rating_locked BOOLEAN DEFAULT FALSE,
ADD COLUMN goodreads_review_count_locked BOOLEAN DEFAULT FALSE;
+2 -1
View File
@@ -131,6 +131,7 @@
"cli": { "cli": {
"schematicCollections": [ "schematicCollections": [
"angular-eslint" "angular-eslint"
] ],
"analytics": false
} }
} }
+83 -4
View File
@@ -30,6 +30,7 @@
"primeng": "19.0.10", "primeng": "19.0.10",
"quill": "2.0.3", "quill": "2.0.3",
"rxjs": "7.8.2", "rxjs": "7.8.2",
"showdown": "^2.1.0",
"tailwindcss-primeui": "0.6.1", "tailwindcss-primeui": "0.6.1",
"tslib": "2.8.1", "tslib": "2.8.1",
"ws": "8.18.1", "ws": "8.18.1",
@@ -39,7 +40,9 @@
"@angular-devkit/build-angular": "19.2.7", "@angular-devkit/build-angular": "19.2.7",
"@angular/cli": "19.2.7", "@angular/cli": "19.2.7",
"@angular/compiler-cli": "19.2.6", "@angular/compiler-cli": "19.2.6",
"@tailwindcss/typography": "^0.5.16",
"@types/jasmine": "5.1.7", "@types/jasmine": "5.1.7",
"@types/showdown": "^2.0.6",
"angular-eslint": "19.3.0", "angular-eslint": "19.3.0",
"autoprefixer": "10.4.21", "autoprefixer": "10.4.21",
"eslint": "9.24.0", "eslint": "9.24.0",
@@ -5981,6 +5984,36 @@
"integrity": "sha512-1ZIUqtPITFbv/DxRmDr5/agPqJwF69d24m9qmM1939TJehgY539CtzeZRjbLt5G6fSy/7YqqYsfvoTEw9xUI2A==", "integrity": "sha512-1ZIUqtPITFbv/DxRmDr5/agPqJwF69d24m9qmM1939TJehgY539CtzeZRjbLt5G6fSy/7YqqYsfvoTEw9xUI2A==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@tailwindcss/typography": {
"version": "0.5.16",
"resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.16.tgz",
"integrity": "sha512-0wDLwCVF5V3x3b1SGXPCDcdsbDHMBe+lkFzBRaHeLvNi+nrrnZ1lA18u+OTWO8iSWU2GxUOCvlXtDuqftc1oiA==",
"dev": true,
"license": "MIT",
"dependencies": {
"lodash.castarray": "^4.4.0",
"lodash.isplainobject": "^4.0.6",
"lodash.merge": "^4.6.2",
"postcss-selector-parser": "6.0.10"
},
"peerDependencies": {
"tailwindcss": ">=3.0.0 || insiders || >=4.0.0-alpha.20 || >=4.0.0-beta.1"
}
},
"node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser": {
"version": "6.0.10",
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz",
"integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==",
"dev": true,
"license": "MIT",
"dependencies": {
"cssesc": "^3.0.0",
"util-deprecate": "^1.0.2"
},
"engines": {
"node": ">=4"
}
},
"node_modules/@tufjs/canonical-json": { "node_modules/@tufjs/canonical-json": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-2.0.0.tgz", "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-2.0.0.tgz",
@@ -6287,6 +6320,13 @@
"@types/send": "*" "@types/send": "*"
} }
}, },
"node_modules/@types/showdown": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/@types/showdown/-/showdown-2.0.6.tgz",
"integrity": "sha512-pTvD/0CIeqe4x23+YJWlX2gArHa8G0J0Oh6GKaVXV7TAeickpkkZiNOgFcFcmLQ5lB/K0qBJL1FtRYltBfbGCQ==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/sockjs": { "node_modules/@types/sockjs": {
"version": "0.3.36", "version": "0.3.36",
"resolved": "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.36.tgz", "resolved": "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.36.tgz",
@@ -11867,6 +11907,13 @@
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/lodash.castarray": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.castarray/-/lodash.castarray-4.4.0.tgz",
"integrity": "sha512-aVx8ztPv7/2ULbArGJ2Y42bG1mEQ5mGjpdvrbJcJFU3TbYybe+QlLS4pst9zV52ymy2in1KpFPiZnAOATxD4+Q==",
"dev": true,
"license": "MIT"
},
"node_modules/lodash.clonedeep": { "node_modules/lodash.clonedeep": {
"version": "4.5.0", "version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
@@ -11886,6 +11933,13 @@
"integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/lodash.isplainobject": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
"integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==",
"dev": true,
"license": "MIT"
},
"node_modules/lodash.merge": { "node_modules/lodash.merge": {
"version": "4.6.2", "version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
@@ -15217,6 +15271,31 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/showdown": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/showdown/-/showdown-2.1.0.tgz",
"integrity": "sha512-/6NVYu4U819R2pUIk79n67SYgJHWCce0a5xTP979WbNp0FL9MN1I1QK662IDU1b6JzKTvmhgI7T7JYIxBi3kMQ==",
"license": "MIT",
"dependencies": {
"commander": "^9.0.0"
},
"bin": {
"showdown": "bin/showdown.js"
},
"funding": {
"type": "individual",
"url": "https://www.paypal.me/tiviesantos"
}
},
"node_modules/showdown/node_modules/commander": {
"version": "9.5.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
"license": "MIT",
"engines": {
"node": "^12.20.0 || >=14"
}
},
"node_modules/side-channel": { "node_modules/side-channel": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz",
@@ -16938,9 +17017,9 @@
} }
}, },
"node_modules/uuid": { "node_modules/uuid": {
"version": "9.0.1", "version": "11.1.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz",
"integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==",
"funding": [ "funding": [
"https://github.com/sponsors/broofa", "https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan" "https://github.com/sponsors/ctavan"
@@ -16948,7 +17027,7 @@
"license": "MIT", "license": "MIT",
"peer": true, "peer": true,
"bin": { "bin": {
"uuid": "dist/bin/uuid" "uuid": "dist/esm/bin/uuid"
} }
}, },
"node_modules/validate-npm-package-license": { "node_modules/validate-npm-package-license": {
+4
View File
@@ -5,6 +5,7 @@
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
"build": "ng build", "build": "ng build",
"dev": "ng serve --open --watch --configuration development",
"watch": "ng build --watch --configuration development", "watch": "ng build --watch --configuration development",
"test": "ng test", "test": "ng test",
"lint": "ng lint" "lint": "ng lint"
@@ -33,6 +34,7 @@
"primeng": "19.0.10", "primeng": "19.0.10",
"quill": "2.0.3", "quill": "2.0.3",
"rxjs": "7.8.2", "rxjs": "7.8.2",
"showdown": "^2.1.0",
"tailwindcss-primeui": "0.6.1", "tailwindcss-primeui": "0.6.1",
"tslib": "2.8.1", "tslib": "2.8.1",
"ws": "8.18.1", "ws": "8.18.1",
@@ -42,7 +44,9 @@
"@angular-devkit/build-angular": "19.2.7", "@angular-devkit/build-angular": "19.2.7",
"@angular/cli": "19.2.7", "@angular/cli": "19.2.7",
"@angular/compiler-cli": "19.2.6", "@angular/compiler-cli": "19.2.6",
"@tailwindcss/typography": "^0.5.16",
"@types/jasmine": "5.1.7", "@types/jasmine": "5.1.7",
"@types/showdown": "^2.0.6",
"angular-eslint": "19.3.0", "angular-eslint": "19.3.0",
"autoprefixer": "10.4.21", "autoprefixer": "10.4.21",
"eslint": "9.24.0", "eslint": "9.24.0",
@@ -32,6 +32,10 @@ export interface BookMetadata {
language?: string; language?: string;
rating?: number | null; rating?: number | null;
reviewCount?: number | null; reviewCount?: number | null;
amazonRating?: number | null;
amazonReviewCount?: number | null;
goodreadsRating?: number | null;
goodreadsReviewCount?: number | null;
coverUpdatedOn?: string; coverUpdatedOn?: string;
authors: string[]; authors: string[];
categories: string[]; categories: string[];
@@ -56,6 +60,10 @@ export interface BookMetadata {
languageLocked?: boolean; languageLocked?: boolean;
ratingLocked?: boolean; ratingLocked?: boolean;
reviewCountLocked?: boolean; reviewCountLocked?: boolean;
amazonRatingLocked?: boolean;
amazonReviewCountLocked?: boolean;
goodreadsRatingLocked?: boolean;
goodreadsReviewCountLocked?: boolean;
coverUpdatedOnLocked?: boolean; coverUpdatedOnLocked?: boolean;
authorsLocked?: boolean; authorsLocked?: boolean;
categoriesLocked?: boolean; categoriesLocked?: boolean;
@@ -3,7 +3,7 @@
<p-card class="change-password-card p-fluid"> <p-card class="change-password-card p-fluid">
<ng-template pTemplate="content"> <ng-template pTemplate="content">
<form #changePasswordForm="ngForm"> <form #changePasswordForm="ngForm" (ngSubmit)="changePassword()">
<div class="p-field"> <div class="p-field">
<label for="currentPassword">Current Password</label> <label for="currentPassword">Current Password</label>
<p-password id="currentPassword" [(ngModel)]="currentPassword" name="currentPassword" [feedback]="false" required fluid></p-password> <p-password id="currentPassword" [(ngModel)]="currentPassword" name="currentPassword" [feedback]="false" required fluid></p-password>
@@ -20,7 +20,7 @@
<p-message *ngIf="!passwordsMatch && confirmNewPassword" severity="error" text="New passwords do not match."></p-message> <p-message *ngIf="!passwordsMatch && confirmNewPassword" severity="error" text="New passwords do not match."></p-message>
</div> </div>
<p-button label="Change Password" icon="pi pi-key" (click)="changePassword()" class="p-fluid"></p-button> <p-button type="submit" label="Change Password" icon="pi pi-key" class="p-fluid"></p-button>
<p-message *ngIf="errorMessage" severity="error" text="{{ errorMessage }}"></p-message> <p-message *ngIf="errorMessage" severity="error" text="{{ errorMessage }}"></p-message>
<p-message *ngIf="successMessage" severity="success" text="{{ successMessage }}"></p-message> <p-message *ngIf="successMessage" severity="success" text="{{ successMessage }}"></p-message>
@@ -5,7 +5,7 @@
<ng-template pTemplate="title">Login</ng-template> <ng-template pTemplate="title">Login</ng-template>
<ng-template pTemplate="content"> <ng-template pTemplate="content">
<form #loginForm="ngForm"> <form #loginForm="ngForm" (ngSubmit)="login()">
<div class="p-field"> <div class="p-field">
<label for="username">Username</label> <label for="username">Username</label>
<input pInputText id="username" [(ngModel)]="username" name="username" required fluid/> <input pInputText id="username" [(ngModel)]="username" name="username" required fluid/>
@@ -17,7 +17,7 @@
</div> </div>
<div class="p-mt-3"> <div class="p-mt-3">
<p-button label="Login" icon="pi pi-sign-in" (click)="login()" class="p-fluid"></p-button> <p-button type="submit" label="Login" icon="pi pi-sign-in" class="p-fluid"></p-button>
</div> </div>
<p-message *ngIf="errorMessage" severity="error" text="{{ errorMessage }}"></p-message> <p-message *ngIf="errorMessage" severity="error" text="{{ errorMessage }}"></p-message>
@@ -8,6 +8,13 @@ export interface AppVersion {
latest: string; latest: string;
} }
export interface ReleaseNote {
version: string;
name: string;
changelog: string;
url: string;
}
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
@@ -19,4 +26,8 @@ export class VersionService {
getVersion(): Observable<AppVersion> { getVersion(): Observable<AppVersion> {
return this.http.get<AppVersion>(this.versionUrl); return this.http.get<AppVersion>(this.versionUrl);
} }
getChangelog(): Observable<ReleaseNote[]> {
return this.http.get<ReleaseNote[]>(`${this.versionUrl}/changelog`);
}
} }
@@ -42,10 +42,8 @@
</div> </div>
<div *ngIf="versionInfo.latest && versionInfo.latest !== versionInfo.current"> <div *ngIf="versionInfo.latest && versionInfo.latest !== versionInfo.current">
<a <a
[href]="getVersionUrl(versionInfo.latest)" (click)="openChangelogDialog()"
target="_blank" class="cursor-pointer text-orange-400 hover:underline hover:text-orange-300 text-xs"
rel="noopener noreferrer"
class="text-orange-400 hover:underline hover:text-orange-300 text-xs"
> >
(Update) (Update)
</a> </a>
@@ -9,6 +9,8 @@ import {ShelfService} from '../../../book/service/shelf.service';
import {BookService} from '../../../book/service/book.service'; import {BookService} from '../../../book/service/book.service';
import {LibraryShelfMenuService} from '../../../book/service/library-shelf-menu.service'; import {LibraryShelfMenuService} from '../../../book/service/library-shelf-menu.service';
import {AppVersion, VersionService} from '../../../core/service/version.service'; import {AppVersion, VersionService} from '../../../core/service/version.service';
import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog';
import {VersionChangelogDialogComponent} from './version-changelog-dialog/version-changelog-dialog.component';
@Component({ @Component({
selector: 'app-menu', selector: 'app-menu',
@@ -21,12 +23,15 @@ export class AppMenuComponent implements OnInit {
homeMenu$: Observable<any> | undefined; homeMenu$: Observable<any> | undefined;
versionInfo: AppVersion | null = null; versionInfo: AppVersion | null = null;
dynamicDialogRef: DynamicDialogRef | undefined;
private libraryService = inject(LibraryService); private libraryService = inject(LibraryService);
private shelfService = inject(ShelfService); private shelfService = inject(ShelfService);
private bookService = inject(BookService); private bookService = inject(BookService);
private versionService = inject(VersionService); private versionService = inject(VersionService);
private libraryShelfMenuService = inject(LibraryShelfMenuService); private libraryShelfMenuService = inject(LibraryShelfMenuService);
private dialogService = inject(DialogService);
ngOnInit(): void { ngOnInit(): void {
@@ -94,6 +99,20 @@ export class AppMenuComponent implements OnInit {
); );
} }
openChangelogDialog() {
this.dynamicDialogRef = this.dialogService.open(VersionChangelogDialogComponent, {
header: 'What’s New',
modal: true,
closable: true,
style: {
position: 'absolute',
top: '10%',
bottom: '10%',
minWidth: '800px',
},
});
}
getVersionUrl(version: string | undefined): string { getVersionUrl(version: string | undefined): string {
if (!version) return '#'; if (!version) return '#';
if (version.startsWith('v')) { if (version.startsWith('v')) {
@@ -0,0 +1,18 @@
<div *ngIf="loading" class="p-4 text-center text-gray-400">
Loading changelog...
</div>
<div *ngIf="!loading && changelog.length === 0" class="p-4 text-center text-gray-400">
No updates available.
</div>
<div *ngIf="!loading && changelog.length > 0" class="space-y-6 p-4 max-h-[70vh] overflow-auto">
<div *ngFor="let release of changelog" class="border-b pb-4">
<p class="font-bold text-2xl pb-2">
<a [href]="release.url" target="_blank" rel="noopener noreferrer" class="text-blue-400 hover:underline">
{{ release.name }}
</a>
</p>
<div [innerHTML]="markdownToHtml(release.changelog)" class="prose prose-invert w-full max-w-full"></div>
</div>
</div>
@@ -0,0 +1,3 @@
:host ::ng-deep .prose h3 {
margin-top: 0px;
}
@@ -0,0 +1,41 @@
import { Component, inject, OnInit } from '@angular/core';
import { ReleaseNote, VersionService } from '../../../../core/service/version.service';
import { NgForOf, NgIf } from '@angular/common';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import showdown from 'showdown';
@Component({
selector: 'app-version-changelog-dialog',
standalone: true,
imports: [NgIf, NgForOf],
templateUrl: './version-changelog-dialog.component.html',
styleUrl: './version-changelog-dialog.component.scss'
})
export class VersionChangelogDialogComponent implements OnInit {
private versionService = inject(VersionService);
private sanitizer = inject(DomSanitizer);
changelog: ReleaseNote[] = [];
loading = true;
private converter = new showdown.Converter({ tables: true, emoji: true });
ngOnInit(): void {
this.versionService.getChangelog().subscribe({
next: (data) => {
this.changelog = data;
this.loading = false;
},
error: () => {
this.loading = false;
}
});
}
markdownToHtml(markdown: string): SafeHtml {
let html = this.converter.makeHtml(markdown);
html = html.replace(/<h2\b([^>]*)>/g, '<h3$1>').replace(/<\/h2>/g, '</h3>');
return this.sanitizer.bypassSecurityTrustHtml(html);
}
}
@@ -115,37 +115,37 @@
</div> </div>
</div> </div>
<!-- Series -->
<div class="flex flex-row w-full gap-4 mt-2 pb-1"> <div class="flex flex-row w-full gap-4 mt-2 pb-1">
<div class="flex flex-col gap-1 w-1/3">
<label for="language">Series</label> <div class="flex flex-col gap-1 basis-2/6">
<label for="seriesName">Series Name</label>
<div class="flex justify-between items-center gap-2"> <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"/>
<p-button *ngIf="!metadata['seriesNameLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesName')" severity="success"></p-button> <p-button *ngIf="!metadata['seriesNameLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesName')" severity="success"></p-button>
<p-button *ngIf="metadata['seriesNameLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('seriesName')" severity="warn"></p-button> <p-button *ngIf="metadata['seriesNameLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('seriesName')" severity="warn"></p-button>
</div> </div>
</div> </div>
<div class="flex flex-col gap-1 w-1/3">
<label for="isbn10">Book Number</label> <div class="flex flex-col gap-1 basis-1/6">
<label for="seriesNumber">Book Number</label>
<div class="flex justify-between items-center gap-2"> <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"/>
<p-button *ngIf="!metadata['seriesNumberLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesNumber')" severity="success"></p-button> <p-button *ngIf="!metadata['seriesNumberLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesNumber')" severity="success"></p-button>
<p-button *ngIf="metadata['seriesNumberLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('seriesNumber')" severity="warn"></p-button> <p-button *ngIf="metadata['seriesNumberLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('seriesNumber')" severity="warn"></p-button>
</div> </div>
</div> </div>
<div class="flex flex-col gap-1 w-1/3">
<label for="isbn13">Books in Series</label> <div class="flex flex-col gap-1 basis-1/6">
<label for="seriesTotal">Books in Series</label>
<div class="flex justify-between items-center gap-2"> <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"/>
<p-button *ngIf="!metadata['seriesTotalLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesTotal')" severity="success"></p-button> <p-button *ngIf="!metadata['seriesTotalLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesTotal')" severity="success"></p-button>
<p-button *ngIf="metadata['seriesTotalLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('seriesTotal')" severity="warn"></p-button> <p-button *ngIf="metadata['seriesTotalLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('seriesTotal')" severity="warn"></p-button>
</div> </div>
</div> </div>
</div>
<!-- ISBN, Language, Review Count --> <div class="flex flex-col gap-1 basis-1/6">
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
<div class="flex flex-col gap-1 w-1/3">
<label for="language">Language</label> <label for="language">Language</label>
<div class="flex justify-between items-center gap-2"> <div class="flex justify-between items-center gap-2">
<input pInputText id="language" formControlName="language" class="w-full"/> <input pInputText id="language" formControlName="language" class="w-full"/>
@@ -153,7 +153,20 @@
<p-button *ngIf="metadata['languageLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('language')" severity="warn"></p-button> <p-button *ngIf="metadata['languageLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('language')" severity="warn"></p-button>
</div> </div>
</div> </div>
<div class="flex flex-col gap-1 w-1/3">
<div class="flex flex-col gap-1 basis-1/6">
<label for="pageCount">Page Count</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="pageCount" formControlName="pageCount" class="w-full"/>
<p-button *ngIf="!metadata['pageCountLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('pageCount')" severity="success"></p-button>
<p-button *ngIf="metadata['pageCountLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('pageCount')" severity="warn"></p-button>
</div>
</div>
</div>
<!-- ISBN, Language, Review Count -->
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
<div class="flex flex-col gap-1 w-1/4">
<label for="isbn10">ISBN 10</label> <label for="isbn10">ISBN 10</label>
<div class="flex justify-between items-center gap-2"> <div class="flex justify-between items-center gap-2">
<input pInputText id="isbn10" formControlName="isbn10" class="w-full"/> <input pInputText id="isbn10" formControlName="isbn10" class="w-full"/>
@@ -161,7 +174,7 @@
<p-button *ngIf="metadata['isbn10Locked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('isbn10')" severity="warn"></p-button> <p-button *ngIf="metadata['isbn10Locked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('isbn10')" severity="warn"></p-button>
</div> </div>
</div> </div>
<div class="flex flex-col gap-1 w-1/3"> <div class="flex flex-col gap-1 w-1/4">
<label for="isbn13">ISBN 13</label> <label for="isbn13">ISBN 13</label>
<div class="flex justify-between items-center gap-2"> <div class="flex justify-between items-center gap-2">
<input pInputText id="isbn13" formControlName="isbn13" class="w-full"/> <input pInputText id="isbn13" formControlName="isbn13" class="w-full"/>
@@ -169,32 +182,56 @@
<p-button *ngIf="metadata['isbn13Locked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('isbn13')" severity="warn"></p-button> <p-button *ngIf="metadata['isbn13Locked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('isbn13')" severity="warn"></p-button>
</div> </div>
</div> </div>
<div class="flex flex-col gap-1 w-1/4">
<label for="reviewCount">Rating Count (Legacy)</label>
<div class="flex justify-between items-center gap-2">
<input [disabled]="true" pInputText id="reviewCount" formControlName="reviewCount" class="w-full"/>
<p-button disabled *ngIf="!metadata['reviewCountLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('reviewCount')" severity="success"></p-button>
<p-button disabled *ngIf="metadata['reviewCountLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('reviewCount')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 w-1/4">
<label for="rating">Rating (Legacy)</label>
<div class="flex justify-between items-center gap-2">
<input [disabled]="true" pInputText id="rating" formControlName="rating" class="w-full"/>
<p-button disabled *ngIf="!metadata['ratingLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('rating')" severity="success"></p-button>
<p-button disabled *ngIf="metadata['ratingLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('rating')" severity="warn"></p-button>
</div>
</div>
</div> </div>
<!-- Review Count, Rating, Page Count --> <!-- Review Count, Rating, Page Count -->
<div class="flex flex-row w-full gap-4 mt-2 pb-1"> <div class="flex flex-row w-full gap-4 mt-2 pb-1">
<div class="flex flex-col gap-1 w-1/3"> <div class="flex flex-col gap-1 w-1/4">
<label for="reviewCount">Review Count</label> <label for="amazonRatingCount">Amazon Rating Count</label>
<div class="flex justify-between items-center gap-2"> <div class="flex justify-between items-center gap-2">
<input pInputText id="reviewCount" formControlName="reviewCount" class="w-full"/> <input pInputText id="amazonRatingCount" formControlName="amazonReviewCount" class="w-full"/>
<p-button *ngIf="!metadata['reviewCountLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('reviewCount')" severity="success"></p-button> <p-button *ngIf="!metadata['amazonReviewCountLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('amazonReviewCount')" severity="success"></p-button>
<p-button *ngIf="metadata['reviewCountLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('reviewCount')" severity="warn"></p-button> <p-button *ngIf="metadata['amazonReviewCountLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('amazonReviewCount')" severity="warn"></p-button>
</div> </div>
</div> </div>
<div class="flex flex-col gap-1 w-1/3"> <div class="flex flex-col gap-1 w-1/4">
<label for="rating">Rating</label> <label for="amazonRating">Amazon Rating</label>
<div class="flex justify-between items-center gap-2"> <div class="flex justify-between items-center gap-2">
<input pInputText id="rating" formControlName="rating" class="w-full"/> <input pInputText id="amazonRating" formControlName="amazonRating" class="w-full"/>
<p-button *ngIf="!metadata['ratingLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('rating')" severity="success"></p-button> <p-button *ngIf="!metadata['amazonRatingLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('amazonRating')" severity="success"></p-button>
<p-button *ngIf="metadata['ratingLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('rating')" severity="warn"></p-button> <p-button *ngIf="metadata['amazonRatingLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('amazonRating')" severity="warn"></p-button>
</div> </div>
</div> </div>
<div class="flex flex-col gap-1 w-1/3"> <div class="flex flex-col gap-1 w-1/4">
<label for="pageCount">Page Count</label> <label for="goodreadsReviewCount">Goodreads Rating Count</label>
<div class="flex justify-between items-center gap-2"> <div class="flex justify-between items-center gap-2">
<input pInputText id="pageCount" formControlName="pageCount" class="w-full"/> <input pInputText id="goodreadsReviewCount" formControlName="goodreadsReviewCount" class="w-full"/>
<p-button *ngIf="!metadata['pageCountLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('pageCount')" severity="success"></p-button> <p-button *ngIf="!metadata['goodreadsReviewCountLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('goodreadsReviewCount')" severity="success"></p-button>
<p-button *ngIf="metadata['pageCountLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('pageCount')" severity="warn"></p-button> <p-button *ngIf="metadata['goodreadsReviewCountLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('goodreadsReviewCount')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 w-1/4">
<label for="goodreadsRating">Goodreads Rating</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="goodreadsRating" formControlName="goodreadsRating" class="w-full"/>
<p-button *ngIf="!metadata['goodreadsRatingLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('goodreadsRating')" severity="success"></p-button>
<p-button *ngIf="metadata['goodreadsRatingLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('goodreadsRating')" severity="warn"></p-button>
</div> </div>
</div> </div>
</div> </div>
@@ -64,6 +64,10 @@ export class MetadataEditorComponent implements OnInit {
language: new FormControl(''), language: new FormControl(''),
rating: new FormControl(''), rating: new FormControl(''),
reviewCount: new FormControl(''), reviewCount: new FormControl(''),
amazonRating: new FormControl(''),
amazonReviewCount: new FormControl(''),
goodreadsRating: new FormControl(''),
goodreadsReviewCount: new FormControl(''),
seriesName: new FormControl(''), seriesName: new FormControl(''),
seriesNumber: new FormControl(''), seriesNumber: new FormControl(''),
seriesTotal: new FormControl(''), seriesTotal: new FormControl(''),
@@ -81,6 +85,10 @@ export class MetadataEditorComponent implements OnInit {
languageLocked: new FormControl(false), languageLocked: new FormControl(false),
ratingLocked: new FormControl(false), ratingLocked: new FormControl(false),
reviewCountLocked: new FormControl(false), reviewCountLocked: new FormControl(false),
amazonRatingLocked: new FormControl(false),
amazonReviewCountLocked: new FormControl(false),
goodreadsRatingLocked: new FormControl(false),
goodreadsReviewCountLocked: new FormControl(false),
seriesNameLocked: new FormControl(false), seriesNameLocked: new FormControl(false),
seriesNumberLocked: new FormControl(false), seriesNumberLocked: new FormControl(false),
seriesTotalLocked: new FormControl(false), seriesTotalLocked: new FormControl(false),
@@ -107,6 +115,10 @@ export class MetadataEditorComponent implements OnInit {
language: metadata.language || null, language: metadata.language || null,
rating: metadata.rating || null, rating: metadata.rating || null,
reviewCount: metadata.reviewCount || null, reviewCount: metadata.reviewCount || null,
amazonRating: metadata.amazonRating || null,
amazonReviewCount: metadata.amazonReviewCount || null,
goodreadsRating: metadata.goodreadsRating || null,
goodreadsReviewCount: metadata.goodreadsReviewCount || null,
seriesName: metadata.seriesName || null, seriesName: metadata.seriesName || null,
seriesNumber: metadata.seriesNumber || null, seriesNumber: metadata.seriesNumber || null,
seriesTotal: metadata.seriesTotal || null, seriesTotal: metadata.seriesTotal || null,
@@ -124,6 +136,10 @@ export class MetadataEditorComponent implements OnInit {
languageLocked: metadata.languageLocked || false, languageLocked: metadata.languageLocked || false,
ratingLocked: metadata.ratingLocked || false, ratingLocked: metadata.ratingLocked || false,
reviewCountLocked: metadata.reviewCountLocked || false, reviewCountLocked: metadata.reviewCountLocked || false,
amazonRatingLocked: metadata.amazonRatingLocked || false,
amazonReviewCountLocked: metadata.amazonReviewCountLocked || false,
goodreadsRatingLocked: metadata.goodreadsRatingLocked || false,
goodreadsReviewCountLocked: metadata.goodreadsReviewCountLocked || false,
seriesNameLocked: metadata.seriesNameLocked || false, seriesNameLocked: metadata.seriesNameLocked || false,
seriesNumberLocked: metadata.seriesNumberLocked || false, seriesNumberLocked: metadata.seriesNumberLocked || false,
seriesTotalLocked: metadata.seriesTotalLocked || false, seriesTotalLocked: metadata.seriesTotalLocked || false,
@@ -139,8 +155,12 @@ export class MetadataEditorComponent implements OnInit {
if (metadata.languageLocked) this.metadataForm.get('language')?.disable(); if (metadata.languageLocked) this.metadataForm.get('language')?.disable();
if (metadata.isbn10Locked) this.metadataForm.get('isbn10')?.disable(); if (metadata.isbn10Locked) this.metadataForm.get('isbn10')?.disable();
if (metadata.isbn13Locked) this.metadataForm.get('isbn13')?.disable(); if (metadata.isbn13Locked) this.metadataForm.get('isbn13')?.disable();
if (metadata.reviewCountLocked) this.metadataForm.get('reviewCount')?.disable(); this.metadataForm.get('reviewCount')?.disable();
if (metadata.ratingLocked) this.metadataForm.get('rating')?.disable(); this.metadataForm.get('rating')?.disable();
if (metadata.amazonReviewCountLocked) this.metadataForm.get('amazonReviewCount')?.disable();
if (metadata.amazonRatingLocked) this.metadataForm.get('amazonRating')?.disable();
if (metadata.goodreadsReviewCountLocked) this.metadataForm.get('goodreadsReviewCount')?.disable();
if (metadata.goodreadsRatingLocked) this.metadataForm.get('goodreadsRating')?.disable();
if (metadata.pageCountLocked) this.metadataForm.get('pageCount')?.disable(); if (metadata.pageCountLocked) this.metadataForm.get('pageCount')?.disable();
if (metadata.descriptionLocked) this.metadataForm.get('description')?.disable(); if (metadata.descriptionLocked) this.metadataForm.get('description')?.disable();
if (metadata.seriesNameLocked) this.metadataForm.get('seriesName')?.disable(); if (metadata.seriesNameLocked) this.metadataForm.get('seriesName')?.disable();
@@ -211,6 +231,10 @@ export class MetadataEditorComponent implements OnInit {
pageCount: this.metadataForm.get('pageCount')?.value, pageCount: this.metadataForm.get('pageCount')?.value,
rating: this.metadataForm.get('rating')?.value, rating: this.metadataForm.get('rating')?.value,
reviewCount: this.metadataForm.get('reviewCount')?.value, reviewCount: this.metadataForm.get('reviewCount')?.value,
amazonRating: this.metadataForm.get('amazonRating')?.value,
amazonReviewCount: this.metadataForm.get('amazonReviewCount')?.value,
goodreadsRating: this.metadataForm.get('goodreadsRating')?.value,
goodreadsReviewCount: this.metadataForm.get('goodreadsReviewCount')?.value,
language: this.metadataForm.get('language')?.value, language: this.metadataForm.get('language')?.value,
seriesName: this.metadataForm.get('seriesName')?.value, seriesName: this.metadataForm.get('seriesName')?.value,
seriesNumber: this.metadataForm.get('seriesNumber')?.value, seriesNumber: this.metadataForm.get('seriesNumber')?.value,
@@ -229,6 +253,10 @@ export class MetadataEditorComponent implements OnInit {
languageLocked: this.metadataForm.get('languageLocked')?.value, languageLocked: this.metadataForm.get('languageLocked')?.value,
ratingLocked: this.metadataForm.get('ratingLocked')?.value, ratingLocked: this.metadataForm.get('ratingLocked')?.value,
reviewCountLocked: this.metadataForm.get('reviewCountLocked')?.value, reviewCountLocked: this.metadataForm.get('reviewCountLocked')?.value,
amazonRatingLocked: this.metadataForm.get('amazonRatingLocked')?.value,
amazonReviewCountLocked: this.metadataForm.get('amazonReviewCountLocked')?.value,
goodreadsRatingLocked: this.metadataForm.get('goodreadsRatingLocked')?.value,
goodreadsReviewCountLocked: this.metadataForm.get('goodreadsReviewCountLocked')?.value,
seriesNameLocked: this.metadataForm.get('seriesNameLocked')?.value, seriesNameLocked: this.metadataForm.get('seriesNameLocked')?.value,
seriesNumberLocked: this.metadataForm.get('seriesNumberLocked')?.value, seriesNumberLocked: this.metadataForm.get('seriesNumberLocked')?.value,
seriesTotalLocked: this.metadataForm.get('seriesTotalLocked')?.value, seriesTotalLocked: this.metadataForm.get('seriesTotalLocked')?.value,
@@ -54,8 +54,10 @@ export class MetadataPickerComponent implements OnInit {
{label: 'Book #', controlName: 'seriesNumber', lockedKey: 'seriesNumberLocked', fetchedKey: 'seriesNumber'}, {label: 'Book #', controlName: 'seriesNumber', lockedKey: 'seriesNumberLocked', fetchedKey: 'seriesNumber'},
{label: 'Total Books', controlName: 'seriesTotal', lockedKey: 'seriesTotalLocked', fetchedKey: 'seriesTotal'}, {label: 'Total Books', controlName: 'seriesTotal', lockedKey: 'seriesTotalLocked', fetchedKey: 'seriesTotal'},
{label: 'ISBN-13', controlName: 'isbn13', lockedKey: 'isbn13Locked', fetchedKey: 'isbn13'}, {label: 'ISBN-13', controlName: 'isbn13', lockedKey: 'isbn13Locked', fetchedKey: 'isbn13'},
{label: 'Rating', controlName: 'rating', lockedKey: 'ratingLocked', fetchedKey: 'rating'}, {label: 'Amazon Reviews', controlName: 'amazonReviewCount', lockedKey: 'amazonReviewCountLocked', fetchedKey: 'amazonReviewCount'},
{label: 'Reviews', controlName: 'reviewCount', lockedKey: 'reviewCountLocked', fetchedKey: 'reviewCount'}, {label: 'Amazon Rating', controlName: 'amazonRating', lockedKey: 'amazonRatingLocked', fetchedKey: 'amazonRating'},
{label: 'Goodreads Reviews', controlName: 'goodreadsReviewCount', lockedKey: 'goodreadsReviewCountLocked', fetchedKey: 'goodreadsReviewCount'},
{label: 'Goodreads Rating', controlName: 'goodreadsRating', lockedKey: 'goodreadsRatingLocked', fetchedKey: 'goodreadsRating'},
{label: 'Pages', controlName: 'pageCount', lockedKey: 'pageCountLocked', fetchedKey: 'pageCount'} {label: 'Pages', controlName: 'pageCount', lockedKey: 'pageCountLocked', fetchedKey: 'pageCount'}
]; ];
@@ -88,8 +90,10 @@ export class MetadataPickerComponent implements OnInit {
description: new FormControl(''), description: new FormControl(''),
pageCount: new FormControl(''), pageCount: new FormControl(''),
language: new FormControl(''), language: new FormControl(''),
rating: new FormControl(''), amazonRating: new FormControl(''),
reviewCount: new FormControl(''), amazonReviewCount: new FormControl(''),
goodreadsRating: new FormControl(''),
goodreadsReviewCount: new FormControl(''),
seriesName: new FormControl(''), seriesName: new FormControl(''),
seriesNumber: new FormControl(''), seriesNumber: new FormControl(''),
seriesTotal: new FormControl(''), seriesTotal: new FormControl(''),
@@ -106,8 +110,10 @@ export class MetadataPickerComponent implements OnInit {
descriptionLocked: new FormControl(false), descriptionLocked: new FormControl(false),
pageCountLocked: new FormControl(false), pageCountLocked: new FormControl(false),
languageLocked: new FormControl(false), languageLocked: new FormControl(false),
ratingLocked: new FormControl(false), amazonRatingLocked: new FormControl(false),
reviewCountLocked: new FormControl(false), amazonReviewCountLocked: new FormControl(false),
goodreadsRatingLocked: new FormControl(false),
goodreadsReviewCountLocked: new FormControl(false),
seriesNameLocked: new FormControl(false), seriesNameLocked: new FormControl(false),
seriesNumberLocked: new FormControl(false), seriesNumberLocked: new FormControl(false),
seriesTotalLocked: new FormControl(false), seriesTotalLocked: new FormControl(false),
@@ -122,22 +128,24 @@ export class MetadataPickerComponent implements OnInit {
this.originalMetadata.thumbnailUrl = this.urlHelper.getCoverUrl(metadata.bookId, metadata.coverUpdatedOn); this.originalMetadata.thumbnailUrl = this.urlHelper.getCoverUrl(metadata.bookId, metadata.coverUpdatedOn);
this.currentBookId = metadata.bookId; this.currentBookId = metadata.bookId;
this.metadataForm.patchValue({ this.metadataForm.patchValue({
title: metadata.title || '', title: metadata.title || null,
subtitle: metadata.subtitle || '', subtitle: metadata.subtitle || null,
authors: (metadata.authors || []).sort().join(', '), authors: (metadata.authors || []).sort().join(', '),
categories: (metadata.categories || []).sort().join(', '), categories: (metadata.categories || []).sort().join(', '),
publisher: metadata.publisher || '', publisher: metadata.publisher || null,
publishedDate: metadata.publishedDate || '', publishedDate: metadata.publishedDate || null,
isbn10: metadata.isbn10 || '', isbn10: metadata.isbn10 || null,
isbn13: metadata.isbn13 || '', isbn13: metadata.isbn13 || null,
description: metadata.description || '', description: metadata.description || null,
pageCount: metadata.pageCount || '', pageCount: metadata.pageCount || null,
language: metadata.language || '', language: metadata.language || null,
rating: metadata.rating || '', amazonRating: metadata.amazonRating || null,
reviewCount: metadata.reviewCount || '', amazonReviewCount: metadata.amazonReviewCount || null,
seriesName: metadata.seriesName || '', goodreadsRating: metadata.goodreadsRating || null,
seriesNumber: metadata.seriesNumber || '', goodreadsReviewCount: metadata.goodreadsReviewCount || null,
seriesTotal: metadata.seriesTotal || '', seriesName: metadata.seriesName || null,
seriesNumber: metadata.seriesNumber || null,
seriesTotal: metadata.seriesTotal || null,
thumbnailUrl: this.urlHelper.getCoverUrl(metadata.bookId, metadata.coverUpdatedOn), thumbnailUrl: this.urlHelper.getCoverUrl(metadata.bookId, metadata.coverUpdatedOn),
titleLocked: metadata.titleLocked || false, titleLocked: metadata.titleLocked || false,
@@ -151,8 +159,10 @@ export class MetadataPickerComponent implements OnInit {
descriptionLocked: metadata.descriptionLocked || false, descriptionLocked: metadata.descriptionLocked || false,
pageCountLocked: metadata.pageCountLocked || false, pageCountLocked: metadata.pageCountLocked || false,
languageLocked: metadata.languageLocked || false, languageLocked: metadata.languageLocked || false,
ratingLocked: metadata.ratingLocked || false, amazonRatingLocked: metadata.amazonRatingLocked || false,
reviewCountLocked: metadata.reviewCountLocked || false, amazonReviewCountLocked: metadata.amazonReviewCountLocked || false,
goodreadsRatingLocked: metadata.goodreadsRatingLocked || false,
goodreadsReviewCountLocked: metadata.goodreadsReviewCountLocked || false,
seriesNameLocked: metadata.seriesNameLocked || false, seriesNameLocked: metadata.seriesNameLocked || false,
seriesNumberLocked: metadata.seriesNumberLocked || false, seriesNumberLocked: metadata.seriesNumberLocked || false,
seriesTotalLocked: metadata.seriesTotalLocked || false, seriesTotalLocked: metadata.seriesTotalLocked || false,
@@ -168,8 +178,10 @@ export class MetadataPickerComponent implements OnInit {
if (metadata.languageLocked) this.metadataForm.get('language')?.disable(); if (metadata.languageLocked) this.metadataForm.get('language')?.disable();
if (metadata.isbn10Locked) this.metadataForm.get('isbn10')?.disable(); if (metadata.isbn10Locked) this.metadataForm.get('isbn10')?.disable();
if (metadata.isbn13Locked) this.metadataForm.get('isbn13')?.disable(); if (metadata.isbn13Locked) this.metadataForm.get('isbn13')?.disable();
if (metadata.reviewCountLocked) this.metadataForm.get('reviewCount')?.disable(); if (metadata.amazonReviewCountLocked) this.metadataForm.get('amazonReviewCount')?.disable();
if (metadata.ratingLocked) this.metadataForm.get('rating')?.disable(); if (metadata.amazonRatingLocked) this.metadataForm.get('amazonRating')?.disable();
if (metadata.goodreadsReviewCountLocked) this.metadataForm.get('goodreadsReviewCount')?.disable();
if (metadata.goodreadsRatingLocked) this.metadataForm.get('goodreadsRating')?.disable();
if (metadata.pageCountLocked) this.metadataForm.get('pageCount')?.disable(); if (metadata.pageCountLocked) this.metadataForm.get('pageCount')?.disable();
if (metadata.descriptionLocked) this.metadataForm.get('description')?.disable(); if (metadata.descriptionLocked) this.metadataForm.get('description')?.disable();
if (metadata.seriesNameLocked) this.metadataForm.get('seriesName')?.disable(); if (metadata.seriesNameLocked) this.metadataForm.get('seriesName')?.disable();
@@ -211,8 +223,10 @@ export class MetadataPickerComponent implements OnInit {
description: this.metadataForm.get('description')?.value || this.copiedFields['description'] ? this.getValueOrCopied('description') : '', description: this.metadataForm.get('description')?.value || this.copiedFields['description'] ? this.getValueOrCopied('description') : '',
pageCount: this.metadataForm.get('pageCount')?.value || this.copiedFields['pageCount'] ? this.getPageCountOrCopied() : null, pageCount: this.metadataForm.get('pageCount')?.value || this.copiedFields['pageCount'] ? this.getPageCountOrCopied() : null,
language: this.metadataForm.get('language')?.value || this.copiedFields['language'] ? this.getValueOrCopied('language') : '', language: this.metadataForm.get('language')?.value || this.copiedFields['language'] ? this.getValueOrCopied('language') : '',
rating: this.metadataForm.get('rating')?.value || this.copiedFields['rating'] ? this.getNumberOrCopied('rating') : null, amazonRating: this.metadataForm.get('amazonRating')?.value || this.copiedFields['amazonRating'] ? this.getNumberOrCopied('amazonRating') : null,
reviewCount: this.metadataForm.get('reviewCount')?.value || this.copiedFields['reviewCount'] ? this.getNumberOrCopied('reviewCount') : null, amazonReviewCount: this.metadataForm.get('amazonReviewCount')?.value || this.copiedFields['amazonReviewCount'] ? this.getNumberOrCopied('amazonReviewCount') : null,
goodreadsRating: this.metadataForm.get('goodreadsRating')?.value || this.copiedFields['goodreadsRating'] ? this.getNumberOrCopied('goodreadsRating') : null,
goodreadsReviewCount: this.metadataForm.get('goodreadsReviewCount')?.value || this.copiedFields['goodreadsReviewCount'] ? this.getNumberOrCopied('goodreadsReviewCount') : null,
seriesName: this.metadataForm.get('seriesName')?.value || this.copiedFields['seriesName'] ? this.getValueOrCopied('seriesName') : '', seriesName: this.metadataForm.get('seriesName')?.value || this.copiedFields['seriesName'] ? this.getValueOrCopied('seriesName') : '',
seriesNumber: this.metadataForm.get('seriesNumber')?.value || this.copiedFields['seriesNumber'] ? this.getNumberOrCopied('seriesNumber') : null, seriesNumber: this.metadataForm.get('seriesNumber')?.value || this.copiedFields['seriesNumber'] ? this.getNumberOrCopied('seriesNumber') : null,
seriesTotal: this.metadataForm.get('seriesTotal')?.value || this.copiedFields['seriesTotal'] ? this.getNumberOrCopied('seriesTotal') : null, seriesTotal: this.metadataForm.get('seriesTotal')?.value || this.copiedFields['seriesTotal'] ? this.getNumberOrCopied('seriesTotal') : null,
@@ -229,8 +243,10 @@ export class MetadataPickerComponent implements OnInit {
descriptionLocked: this.metadataForm.get('descriptionLocked')?.value, descriptionLocked: this.metadataForm.get('descriptionLocked')?.value,
pageCountLocked: this.metadataForm.get('pageCountLocked')?.value, pageCountLocked: this.metadataForm.get('pageCountLocked')?.value,
languageLocked: this.metadataForm.get('languageLocked')?.value, languageLocked: this.metadataForm.get('languageLocked')?.value,
ratingLocked: this.metadataForm.get('ratingLocked')?.value, amazonRatingLocked: this.metadataForm.get('amazonRatingLocked')?.value,
reviewCountLocked: this.metadataForm.get('reviewCountLocked')?.value, amazonReviewCountLocked: this.metadataForm.get('amazonReviewCountLocked')?.value,
goodreadsRatingLocked: this.metadataForm.get('goodreadsRatingLocked')?.value,
goodreadsReviewCountLocked: this.metadataForm.get('goodreadsReviewCountLocked')?.value,
seriesNameLocked: this.metadataForm.get('seriesNameLocked')?.value, seriesNameLocked: this.metadataForm.get('seriesNameLocked')?.value,
seriesNumberLocked: this.metadataForm.get('seriesNumberLocked')?.value, seriesNumberLocked: this.metadataForm.get('seriesNumberLocked')?.value,
seriesTotalLocked: this.metadataForm.get('seriesTotalLocked')?.value, seriesTotalLocked: this.metadataForm.get('seriesTotalLocked')?.value,
@@ -28,9 +28,23 @@
</div> </div>
</div> </div>
<div class="flex items-center gap-4 pt-2"> <div class="flex items-center gap-2 pt-2">
<p-rating [(ngModel)]="metadata.rating" readonly stars="5"></p-rating> <ng-container *ngIf="metadata.amazonRating || metadata.goodreadsRating; else legacyRating">
<p class="font-semibold">({{ metadata.reviewCount || 0 }} Reviews)</p> <p *ngIf="metadata.amazonRating" class="font-semibold">Amazon: {{ metadata.amazonRating }}</p>
<p-rating *ngIf="metadata.amazonRating" [(ngModel)]="metadata.amazonRating" readonly stars="5"></p-rating>
<p *ngIf="metadata.amazonRating" class="font-semibold"> ({{ metadata.amazonReviewCount | number:'1.0-0' }})</p>
<p *ngIf="metadata.amazonRating && metadata.goodreadsRating">|</p>
<p *ngIf="metadata.goodreadsRating" class="font-semibold">Goodreads: {{ metadata.goodreadsRating }}</p>
<p-rating *ngIf="metadata.goodreadsRating" [(ngModel)]="metadata.goodreadsRating" readonly stars="5"></p-rating>
<p *ngIf="metadata.goodreadsRating" class="font-semibold"> ({{ metadata.goodreadsReviewCount | number:'1.0-0' }})</p>
</ng-container>
<ng-template #legacyRating>
<p-rating [(ngModel)]="metadata.rating" readonly stars="5"></p-rating>
<p class="font-semibold">({{ metadata.reviewCount | number:'1.0-0' }} Ratings)</p>
</ng-template>
</div> </div>
<div class="flex gap-2 pt-4 overflow-x-auto scrollbar-hide"> <div class="flex gap-2 pt-4 overflow-x-auto scrollbar-hide">
@@ -54,7 +68,8 @@
<p-button label="Read" icon="pi pi-book" severity="info" (onClick)="read(metadata.bookId)"></p-button> <p-button label="Read" icon="pi pi-book" severity="info" (onClick)="read(metadata.bookId)"></p-button>
<p-button label="Assign Shelf" icon="pi pi-folder" severity="info" outlined (onClick)="assignShelf(metadata.bookId)"></p-button> <p-button label="Assign Shelf" icon="pi pi-folder" severity="info" outlined (onClick)="assignShelf(metadata.bookId)"></p-button>
<p-button *ngIf="userData.permissions.canDownload" label="Download" icon="pi pi-download" severity="info" outlined (onClick)="download(metadata.bookId)"></p-button> <p-button *ngIf="userData.permissions.canDownload" label="Download" icon="pi pi-download" severity="info" outlined (onClick)="download(metadata.bookId)"></p-button>
<p-splitbutton *ngIf="userData.permissions.canEmailBook" label="Quick Send" icon="pi pi-send" [model]="items" (onClick)="quickSend(metadata.bookId)" outlined severity="info"/> <p-splitbutton *ngIf="userData.permissions.canEmailBook" label="Quick Send" icon="pi pi-send" [model]="items" (onClick)="quickSend(metadata.bookId)" outlined
severity="info"/>
<!--<p-button <!--<p-button
outlined outlined
[label]="metadata.allFieldsLocked ? 'Unlock Metadata' : 'Lock Metadata'" [label]="metadata.allFieldsLocked ? 'Unlock Metadata' : 'Lock Metadata'"
@@ -1,6 +1,6 @@
import {Component, inject, Input, OnInit} from '@angular/core'; import {Component, inject, Input, OnInit} from '@angular/core';
import {Button} from 'primeng/button'; import {Button} from 'primeng/button';
import {AsyncPipe, NgClass, NgForOf, NgIf} from '@angular/common'; import {AsyncPipe, DecimalPipe, NgClass, NgForOf, NgIf} from '@angular/common';
import {first, Observable} from 'rxjs'; import {first, Observable} from 'rxjs';
import {BookService} from '../../../book/service/book.service'; import {BookService} from '../../../book/service/book.service';
import {BookMetadataCenterService} from '../book-metadata-center.service'; import {BookMetadataCenterService} from '../book-metadata-center.service';
@@ -24,7 +24,7 @@ import {Tooltip} from 'primeng/tooltip';
standalone: true, standalone: true,
templateUrl: './metadata-viewer.component.html', templateUrl: './metadata-viewer.component.html',
styleUrl: './metadata-viewer.component.scss', styleUrl: './metadata-viewer.component.scss',
imports: [Button, NgForOf, NgIf, AsyncPipe, Rating, FormsModule, Tag, Divider, SplitButton, NgClass, Tooltip] imports: [Button, NgForOf, NgIf, AsyncPipe, Rating, FormsModule, Tag, Divider, SplitButton, NgClass, Tooltip, DecimalPipe]
}) })
export class MetadataViewerComponent implements OnInit { export class MetadataViewerComponent implements OnInit {
+2 -2
View File
@@ -1,7 +1,7 @@
export const environment = { export const environment = {
production: false, production: false,
API_CONFIG: { API_CONFIG: {
BASE_URL: 'http://localhost:7050', BASE_URL: 'http://localhost:8080',
BROKER_URL: 'ws://localhost:7050/ws', BROKER_URL: 'ws://localhost:8080/ws',
}, },
}; };
+14 -14
View File
@@ -1,18 +1,18 @@
import { provideHttpClient, withInterceptors } from '@angular/common/http'; import {provideHttpClient, withInterceptors} from '@angular/common/http';
import { DialogService } from 'primeng/dynamicdialog'; import {DialogService} from 'primeng/dynamicdialog';
import { ConfirmationService, MessageService } from 'primeng/api'; import {ConfirmationService, MessageService} from 'primeng/api';
import { RxStompService } from './app/shared/websocket/rx-stomp.service'; import {RxStompService} from './app/shared/websocket/rx-stomp.service';
import { rxStompServiceFactory } from './app/shared/websocket/rx-stomp-service-factory'; import {rxStompServiceFactory} from './app/shared/websocket/rx-stomp-service-factory';
import { provideRouter, RouteReuseStrategy } from '@angular/router'; import {provideRouter, RouteReuseStrategy} from '@angular/router';
import { CustomReuseStrategy } from './app/custom-reuse-strategy'; import {CustomReuseStrategy} from './app/custom-reuse-strategy';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async'; import {provideAnimationsAsync} from '@angular/platform-browser/animations/async';
import { providePrimeNG } from 'primeng/config'; import {providePrimeNG} from 'primeng/config';
import { bootstrapApplication } from '@angular/platform-browser'; import {bootstrapApplication} from '@angular/platform-browser';
import { AppComponent } from './app/app.component'; import {AppComponent} from './app/app.component';
import Aura from '@primeng/themes/aura'; import Aura from '@primeng/themes/aura';
import { routes } from './app/app.routes'; import {routes} from './app/app.routes';
import { AuthInterceptorService } from './app/auth-interceptor.service'; import {AuthInterceptorService} from './app/auth-interceptor.service';
import { AuthService } from './app/core/service/auth.service'; import {AuthService} from './app/core/service/auth.service';
bootstrapApplication(AppComponent, { bootstrapApplication(AppComponent, {
providers: [ providers: [
+4 -1
View File
@@ -6,6 +6,9 @@ module.exports = {
theme: { theme: {
extend: {}, extend: {},
}, },
plugins: [require('tailwindcss-primeui')] plugins: [
require('tailwindcss-primeui'),
require('@tailwindcss/typography')
]
} }
+4 -1
View File
@@ -12,7 +12,10 @@ TZ=Etc/UTC # Change this to your timezone (e.g., America/New_York, Asia/Kolk
# Database Credentials (Replace with a secure password) # Database Credentials (Replace with a secure password)
# This password is used by MariaDB. Make sure to keep it secure. # This password is used by MariaDB. Make sure to keep it secure.
MYSQL_ROOT_PASSWORD=your_secure_password MYSQL_ROOT_PASSWORD=super_secure_password
MYSQL_DATABASE=booklore
MYSQL_USER=booklore
MYSQL_PASSWORD=your_secure_password
# Paths for Docker Volumes (Update these paths as per your system) # Paths for Docker Volumes (Update these paths as per your system)
# These paths store persistent data for Booklore and MariaDB. # These paths store persistent data for Booklore and MariaDB.
+5 -1
View File
@@ -5,6 +5,10 @@ services:
container_name: booklore_server container_name: booklore_server
env_file: env_file:
- .env - .env
environment:
- DATABASE_URL=jdbc:mariadb://mariadb:3306/${MYSQL_DATABASE}
- DATABASE_USERNAME=${MYSQL_USER}
- DATABASE_PASSWORD=${MYSQL_PASSWORD}
depends_on: depends_on:
mariadb: mariadb:
condition: service_healthy condition: service_healthy
@@ -15,7 +19,7 @@ services:
- ${BOOKLORE_BOOKS_PATH}:/books - ${BOOKLORE_BOOKS_PATH}:/books
mariadb: mariadb:
image: lscr.io/linuxserver/mariadb:11.4.5 image: lscr.io/linuxserver/mariadb:11.4
container_name: booklore_mariadb container_name: booklore_mariadb
env_file: env_file:
- .env - .env