feat(api,web): support CBR — extraction RAR, scan et lecture d'albums
- api: cbr utilitaire (extraction RAR), scanner/métadonnées (+ tests), books, schéma - web: ReaderPage/locators (+ tests), mockData, types partagés - deps: pnpm-lock Refs: #17
This commit is contained in:
@ -59,7 +59,7 @@ export class DatabaseService implements OnModuleDestroy {
|
||||
language TEXT,
|
||||
publisher TEXT,
|
||||
published_date TEXT,
|
||||
format TEXT NOT NULL CHECK (format IN ('epub','pdf','cbz')),
|
||||
format TEXT NOT NULL CHECK (format IN ('epub','pdf','cbz','cbr')),
|
||||
file_path TEXT NOT NULL UNIQUE,
|
||||
cover_path TEXT,
|
||||
file_size INTEGER NOT NULL,
|
||||
@ -119,15 +119,15 @@ export class DatabaseService implements OnModuleDestroy {
|
||||
VALUES (new.id, new.title, new.author, new.description, new.isbn);
|
||||
END;
|
||||
`);
|
||||
this.ensureBooksSupportsCbz();
|
||||
this.ensureBooksSupportsComicArchives();
|
||||
this.sqlite.exec("INSERT INTO book_fts(book_fts) VALUES('rebuild')");
|
||||
}
|
||||
|
||||
private ensureBooksSupportsCbz(): void {
|
||||
private ensureBooksSupportsComicArchives(): void {
|
||||
const table = this.sqlite
|
||||
.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'books'")
|
||||
.get() as { sql?: string } | undefined;
|
||||
if (!table?.sql || table.sql.includes("'cbz'")) return;
|
||||
if (!table?.sql || (table.sql.includes("'cbz'") && table.sql.includes("'cbr'"))) return;
|
||||
|
||||
this.sqlite.exec(`
|
||||
PRAGMA foreign_keys = OFF;
|
||||
@ -149,7 +149,7 @@ export class DatabaseService implements OnModuleDestroy {
|
||||
language TEXT,
|
||||
publisher TEXT,
|
||||
published_date TEXT,
|
||||
format TEXT NOT NULL CHECK (format IN ('epub','pdf','cbz')),
|
||||
format TEXT NOT NULL CHECK (format IN ('epub','pdf','cbz','cbr')),
|
||||
file_path TEXT NOT NULL UNIQUE,
|
||||
cover_path TEXT,
|
||||
file_size INTEGER NOT NULL,
|
||||
|
||||
@ -37,7 +37,7 @@ export const books = sqliteTable(
|
||||
language: text("language"),
|
||||
publisher: text("publisher"),
|
||||
publishedDate: text("published_date"),
|
||||
format: text("format", { enum: ["epub", "pdf", "cbz"] }).notNull(),
|
||||
format: text("format", { enum: ["epub", "pdf", "cbz", "cbr"] }).notNull(),
|
||||
filePath: text("file_path").notNull(),
|
||||
coverPath: text("cover_path"),
|
||||
fileSize: integer("file_size").notNull(),
|
||||
|
||||
Reference in New Issue
Block a user