Docs / Advanced & Developer Hub / Extension & Client Architecture

Extension & Client Architecture

Internal architecture, build pipelines, and protocol specifications for the Browser Importer and Mihon Android extension.

Preview Content
Please note that the details on this page are pre-content drafts. More detailed technical specifications, architectural breakdowns, and updated guides will be added soon.

1. Browser Web Importer Architecture & Build

The XianScan Browser Importer (extensions/xianscan-importer) is built with TypeScript and esbuild, targeting Manifest V3:

  • Chromium vs Firefox Bundling: build.js outputs two distinct packages:
    • dist/: Targets Chromium (Chrome, Edge, Brave, Opera) with a Manifest V3 background service worker (background.service_worker: "background.js").
    • dist-firefox/: Targets Gecko (Firefox, Floorp) with a Manifest V3 event page (background.scripts: ["background.js"]) and browser_specific_settings.gecko ID.
  • 4-Tier Smart Reader Scanner (content.ts):
    • High-priority DOM element analysis inspecting data-src, data-original, data-lazy-src, srcset, and currentSrc.
    • CSS background-image container parsing.
    • Embedded JSON state tree extraction (script[type="application/json"]) when fewer than 3 DOM images are mounted.
    • Virtual-scrolling mutation observer queueing placeholders for off-screen canvas rendering.

Compiling the Importer from Source:

bash
# 1. Navigate to the importer extension directory
cd extensions/xianscan-importer

# 2. Install dependencies and build both Chromium and Firefox bundles
yarn install
yarn build

2. Mihon Android Protocol & APK Build

The XianScan Mihon Extension (extensions/xianscan-mihon) implements the native Tachiyomi / Mihon Kotlin extension specification (eu.kanade.tachiyomi.extension.all.xianscan):

Server-Side Protocol Endpoints:

The SvelteKit server implements the following Mihon source routes on port 8124:

EndpointPurpose
GET /api/mihon/library?page=N&status=&genre=Recent-first library with status and genre filtering
GET /api/mihon/search?q=&page=N&status=&genre=Full-text library search with category tags
GET /api/mihon/genresDistinct string array of active book genre tags
GET /api/mihon/manga/Series metadata, author, artist, status, and cover URL
GET /api/mihon/manga//chaptersOrdered chapter index
GET /api/mihon/chapters//pagesOrdered page stream URLs
GET /api/covers//file?w=512Cover thumbnails with dynamic image resizing

Compiling the Extension APK from Source:

bash
cd extensions/xianscan-mihon

# Build debug APK (requires Android SDK + JDK 17):
./gradlew :app:assembleDebug

# Build signed release APK:
./gradlew :app:assembleRelease