add allowedFormats to mobile library endpoint and fix thumbnail classpath fallback

This commit is contained in:
acx10
2026-02-28 12:59:20 -07:00
committed by acx10
parent 9f6cd24a17
commit d19fe22d50
3 changed files with 6 additions and 2 deletions
@@ -5,6 +5,9 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.booklore.model.enums.BookFileType;
import java.util.List;
@Data
@Builder
@@ -16,4 +19,5 @@ public class MobileLibrarySummary {
private String name;
private String icon;
private long bookCount;
private List<BookFileType> allowedFormats;
}
@@ -283,6 +283,7 @@ public interface MobileBookMapper {
.name(library.getName())
.icon(library.getIcon())
.bookCount(bookCount)
.allowedFormats(library.getAllowedFormats())
.build();
}
@@ -252,8 +252,7 @@ public class BookService {
if (Files.exists(thumbnailPath)) {
return new UrlResource(thumbnailPath.toUri());
} else {
Path defaultCover = Paths.get("static/images/missing-cover.jpg");
return new UrlResource(defaultCover.toUri());
return new ClassPathResource("static/images/missing-cover.jpg");
}
} catch (MalformedURLException e) {
throw new RuntimeException("Failed to load book cover for bookId=" + bookId, e);