feat(books): include comics in non-audio requests

Keep books and comic archives under the existing ebook request kind so searches, ownership checks,
format preferences and release profiles agree without changing the API contract. Cover the combined
formats and library access rules with unit and end-to-end tests.

Ref #1748
This commit is contained in:
neon
2026-10-10 21:47:09 +00:00
parent e6c0275fdf
commit c91648eaac
14 changed files with 233 additions and 42 deletions
+7
View File
@@ -1,9 +1,16 @@
import type { BookRequestDownloadItem } from "./download-client";
import { AUDIO_FORMAT_LIST, COMIC_FORMAT_LIST, EBOOK_FORMAT_LIST } from "./book";
/** What a book can be requested as: an ebook or an audiobook, alone or as a pair. */
export const BOOK_REQUEST_MEDIA_KINDS = ["ebook", "audiobook"] as const;
export type BookRequestMediaKind = (typeof BOOK_REQUEST_MEDIA_KINDS)[number];
/** The `ebook` API kind covers readable books and comics; audio stays a separate request. */
export const BOOK_REQUEST_FORMATS_BY_MEDIA_KIND: Readonly<Record<BookRequestMediaKind, readonly string[]>> = {
ebook: [...EBOOK_FORMAT_LIST, ...COMIC_FORMAT_LIST],
audiobook: AUDIO_FORMAT_LIST,
};
/**
* A medium requests no longer offer, still carried by requests made before it was retired. Those
* rows keep loading, and can be cancelled, hidden or deleted; nothing creates one any more, and
+1 -1
View File
@@ -42,7 +42,7 @@ export function isContentBookFile(file: { format: string | null; role: string })
return (file.role === "content" || file.role === "primary") && isBookFormat(file.format);
}
/** What BookOrbit accepts as an ebook, and what an ebook tier may therefore ask for. */
/** Text and document formats, excluding comic archives and audio. */
export const EBOOK_FORMAT_LIST = ["epub", "kepub", "mobi", "azw3", "azw", "fb2", "pdf", "djvu"] as const;
export const READ_STATUSES = ["unread", "want_to_read", "reading", "on_hold", "rereading", "read", "skimmed", "abandoned"] as const;