English
Cross-Module Interactions & Extension FAQ
Pagehaven prevents version drift across static pages, R2 objects, and browser SQLite queries through explicit build fingerprints and clean package boundaries.
Anti-Drift Handoff Chain
@gallery/platform→generated/:build:configvalidatessite.config.yamland synchronizes platform files (pnpm run checkfails if committed generated templates drift).build:manifest→out/manifest.json: ComputessourceSha256 = galleryFingerprint(gallery)over all series, issues, chapters, pages, and text boxes withdb: null.build:db→@gallery/core/db: Reloadsmanifest.json, verifies live fingerprint match, buildsgallery-<version>.sqlite(FTS5 trigram) and 64 KiB.chunks.json, and patches onlymanifest.db.build:site→@gallery/site: Verifies matchingversion,site.domain, andsourceSha256before writingpackages/site/src/generated/(gallery.json,site-config.json, chaptertext/*.json) and runningastro build.publish:r2→deploy:*→release:activate: Uploads immutableimg/*,db/gallery-<version>.sqlite, andmanifest-<version>.json; deploys proof-checked static sites bound to that fixedgallery.searchDb; atomically updates sharedmanifest.jsonviaIf-Match: <etag>only when all targets report matching(version, fingerprint)receipts.
Runtime Module Coordination
Lazy Pinned Search Loading
On /search/, title, author and tag filters use the catalog index. Dialogue search loads resources on demand.
- If
chapters === 0orwithText === 0 || boxes === 0, renders an empty-state message with zero DB downloads; - If folded, lowercased input has fewer than two Unicode code points, the form shows a local hint.
- The first valid query loads the SQLite runtime and OpenCC dictionary, then searches the version pinned by
config.db.release. Whole-file downloads verify the database digest. Range reads verify the chunk manifest and each block SQLite reads.
Standard Reader vs Opt-In @yui540/comimi Enhancement
EnhancedReader (features.comimi_reader) delegates URL hashes (#p<n>, #p<n>b<i>), progress persistence, bookmarks (gallery:favorites:*), and long-strip/text-layer accuracy back to reader.galleryReader. Entering long-strip mode, checking "show text", or landing on a #p<n>b<i> search anchor automatically pauses the enhanced viewer and restores it cleanly when leaving those modes.
Theme & Color-Scheme Synchronization
Base.astro runs initializeColorScheme inline before first paint to resolve system / light / dark and emit pagehaven:color-scheme-change. day-night-control.js binds the interactive day-night widget to that shared state store without hiding the fallback three-state radio control.
Extension FAQ
Can I use node:fs or node:path in @gallery/core or @gallery/search? No. scripts/check.mjs strictly forbids node:* imports in packages/core/, packages/search/, and packages/site/. Keep filesystem/CLI code in scripts/ or packages/platform/.
How do I customize colors and headings safely? Set appearance.theme (paper, ocean, plum), hex accent, and font (sans or serif) in site.config.yaml or via pnpm run customize. site-appearance.js auto-computes WCAG contrast (>= 4.5) for links and foreground button text.
How do I enable Range-based SQLite paging? Enable features.range_search in site.config.yaml and rebuild to read verified SQLite blocks on demand in a dedicated worker. The CDN must serve 206 responses and expose Content-Range to cross-origin clients.