Skip to content

Config, Data & Client Contracts ​

site.config.yaml serves as the single source of truth (SSOT), validated by @gallery/platform to drive data manifests, SQLite generation, Astro static builds, and hosting configuration outputs.

1. site.config.yaml Schema Summary ​

Top-Level KeyKey FieldsDefaults & ConstraintsRole
sitetitle, domain, lang, tagline, logodomain defaults to gallery.example.org (blocked in prod release)Title, HTML lang, canonical & sitemap base domain
appearancetheme, accent, font, show_search, show_librarytheme: paper | ocean | plum; font: sans | serifBounded semantic CSS variables without arbitrary CSS injection
imageshosts, prefix1–2 CDN hostnames; safe ASCII prefix (img/)WebP & DB CDN origins and path prefix
dbpage_size, chunk_size, prefix, whole_download_max_bytes4096, 65536, db/, 31457280 (30 MiB)SQLite alignment, chunk manifest size, and download safety cap
searchrequest_chunk_size, min_match_length, api_path4096, 3, /api/searchFTS5 starts at three normalized characters. Two use LIKE. The function path is reserved.
featuresrange_search, search_function, platform_config, text_layer, comimi_readerfalse, false, true, true, falseOptional Range search, reserved function search, host files, dialogue overlay and enhanced pagination
budgetsmax_files, max_file_bytes18000 files, 20971520 B (20 MiB)Static build file count and single-file guards
headers / redirectsHeader rules & redirect mapSources validated within output root via redirectOutputPathsEmits platform headers/redirects plus escaped metaRefresh HTML
seoindexnow_keynull or 8–128 [A-Za-z0-9-]+Writes dist/<key>.txt and enables push:search
deploycloudflare, edgeone, github, workers, esaProject identifiers & custom domainsSynced into packages/platform/generated/
  • GENERATED_FILES (copied to dist/ when features.platform_config: true): _headers, _redirects, edgeone.json.
  • DEPLOY_CONFIG_FILES (written to packages/platform/generated/ only, never copied to dist/): wrangler.jsonc, esa.jsonc.
text
data/
├── meta/
│   ├── <series>/series.yaml             # SeriesSchema (title, sort, authors, tags, cover key)
│   └── <series>/<issue>.yaml            # IssueSchema (number, chapters[], page dimensions & webp keys)
├── text/
│   └── <series>/<issue>/<chapter>.json  # ChapterTextSchema (boxes[]: normalized [0,1] x,y,w,h + text)
└── raw/
    ├── labelplus/<series>/<issue>/<chapter>.txt   # LabelPlus 1,0 script
    └── ocr/<series>/<issue>/<chapter>.json        # Reviewed OCR source

Key invariants enforced in packages/core/src/schema.js & object-path.js:

  • Slugs (series, issue, chapter) match safe ASCII IDs for deterministic URLs /<series>/<issue>/<chapter>/;
  • Text box coordinates (x, y, w, h) stay normalized within [0, 1];
  • Object keys (img/<series>/cover-<hash12>.webp, img/<series>/<issue>/<n>-<hash12>.webp) satisfy isSafeObjectKey.

3. Transcript Ingestion Contracts ​

LabelPlus (pnpm run ingest:labelplus) ​

Parses data/raw/labelplus/.../*.txt with strict delimiter matching (>>>>>>>>[filename]<<<<<<<< and ----------------[n]----------------[x,y,group]) so narrative dashes (————, >>>) remain intact, emits 1-based line warnings for malformed separator prefixes, and supports --dry-run, CHAPTERS=..., and LABELPLUS_PAGES=auto|number|sequence.

Re-import preserves existing box IDs only for unique exact text-and-geometry matches. New, changed, or ambiguous boxes get new IDs; removed pages retain their allocation cursor. Retired links fall back to the page. Do not delete the accepted transcript or reset nextBoxId. Reordering or replacing the actual comic pages is outside this automatic guarantee.

OCR Gate (pnpm run ingest:ocr) ​

Uses a two-step human-review gate:

  1. Default run requires CHAPTERS=... and outputs draft JSON + side-by-side HTML to OUT_DIR only (never touches data/text/).
  2. After manual review in data/raw/ocr/..., CHAPTERS=... pnpm run ingest:ocr -- --accept-reviewed promotes validated text into data/text/.
  • Search Page DOM IDs (/search/): #search-config, #search-form, #search-input, #search-series, #search-coverage, #search-status, #search-results, #search-more, plus catalog filter #meta-form / #meta-q / #meta-results reading /index/series.json.
  • Deep Links: /<series>/<issue>/<chapter>/#p<n> focuses page n; /<series>/<issue>/<chapter>/#p<n>b<i> highlights dialogue box with permanent ID i on page n (retired IDs fall back to the page).
  • Reading backup includes shelf status (gallery:library:*), progress (gallery:progress:*), bookmarks (gallery:favorites:*), and notes (gallery:bookmark-note:*, up to 200 characters each). Backups with positions within long images use v2. Page-only backups use v1. Reading mode and theme preferences are local to each device.