refactor: Remove duplicate ReaderMetadata interfaces from format parsers

- Remove duplicate ReaderMetadata interface from comic/image-parser.ts
- Remove duplicate ReaderMetadata interface from pdf/pdfjs-wrapper.ts
- Use centralized interface from types/reader.d.ts instead
- Reduces code duplication and ensures type consistency across formats

This change ensures all format parsers use the same canonical
ReaderMetadata interface, making the codebase easier to maintain
and preventing type drift between different file formats.

Related to: Type system unification
This commit is contained in:
2026-04-11 00:52:07 -04:00
parent c432d5d36d
commit 486fa1313d
2 changed files with 1 additions and 24 deletions
@@ -1,15 +1,5 @@
// Comic/Manga Reader - Image-based pages
// Handles CBZ, comic archives, image directories
interface ReaderMetadata {
media_item_id: string;
title: string;
author: string;
cover_image_path: string;
library_type: "ebook" | "comic" | "manga" | "pdf";
mime_type: string;
file_path: string;
total_pages?: number;
}
interface ComicReader {
type: "comic";
images: Blob[];
+1 -14
View File
@@ -9,9 +9,6 @@ import * as pdfjsLib from "pdfjs-dist";
export function configurePDFJS(): void {
pdfjsLib.GlobalWorkerOptions.workerSrc = "/static/js/pdf.worker.min.mjs";
pdfjsLib.GlobalWorkerOptions.standardFontDataUrl = "/static/standard_fonts/";
pdfjsLib.GlobalWorkerOptions.cMapUrl = "/static/cmaps/";
pdfjsLib.GlobalWorkerOptions.cMapPacked = true;
}
// ============================================================
@@ -98,16 +95,6 @@ export async function getPDFPage(
// ============================================================
// Reader Initialization
// ============================================================
interface ReaderMetadata {
media_item_id: string;
title: string;
author: string;
cover_image_path: string;
library_type: "ebook" | "comic" | "manga" | "pdf";
mime_type: string;
file_path: string;
total_pages?: number;
}
interface PDFReader {
type: "pdf";
doc: any;
@@ -119,7 +106,7 @@ export async function initializePDFReader(
configurePDFJS();
const response = await fetch(metadata.file_path);
const pdfBlob = await response.blob();
const pdfMetadata = await loadPDFDocument(pdfBlob);
await loadPDFDocument(pdfBlob);
return {
type: "pdf",
doc: pdfState.doc,