The website for OpenDocument Reader: the homepage, a privacy policy, a demo
that renders a dropped document in the browser, and /web, the same viewer as
an installable web app. The renderer is
@opendocument/odr-core,
the apps' C++ engine compiled to WebAssembly. Nothing is uploaded.
Node 22.12+ (see .nvmrc).
npm install
npm run dev # http://localhost:4321
npm run build && npm run preview # needed to test the viewer and /webThe viewer does not work under npm run dev. Vite will not serve the
renderer's files from public/odr/ as a module, so the demo reports that the
renderer could not be loaded. The service worker for /web is also only
registered in a build.
| Path | What |
|---|---|
src/pages/ |
index (homepage), privacy, tryit (full-window viewer), web (the PWA) |
src/scripts/viewer.ts |
the viewer, shared by every page that shows it |
src/scripts/frame-bridge.js |
the script injected into the document frame; talks to viewer.ts over postMessage |
src/scripts/web-app.ts |
PWA features: launched files, install button, updates, recent files |
src/components/viewer/ |
viewer markup shared by the pages |
src/data/links.ts |
every outbound URL |
src/styles/global.css |
design tokens (the Android app's Material 3 colours) |
public/samples/ |
one sample document per supported format |
scripts/sync-odr.mjs |
copies the renderer into public/odr/<version>/ before dev and build |
scripts/build-web-sw.mjs |
writes the service worker into dist/ after the build |
- The renderer is not bundled. It is copied to
public/odr/<version>/and imported at runtime, because the emscripten glue finds its.wasmthroughimport.meta.url. The version is a directory, not a?v=query, so the glue and the wasm can never come from different releases.public/odr/is generated and gitignored. - The renderer loads on first use, never on page load: it is about 6.5 MB.
- The document frame is sandboxed with
allow-scriptsand noallow-same-origin. A dropped file's scripts run in an opaque origin and cannot reach the page. The page cannot reach into the frame either, so everything goes throughframe-bridge.js. That script is inlined as a string and must never contain a closing</script>tag. - The CSP in
firebase.jsonneeds'wasm-unsafe-eval'and'unsafe-inline'. The renderer writes its editor scripts inline into the frame, and a frame with an opaque origin cannot load hashed or'self'scripts. - Caching:
/_astro/**and/odr/<version>/**are immutable;/odr/index.js(a forwarder to the current version) isno-store; the service worker and manifest areno-cache. /app-ads.txtmust stay at the domain root. It carries the AdMob publisher line for the free apps.- Store IDs differ by platform.
at.tomtasche.readeris the free app on Android but the paid app on iOS. Pick links by edition and platform; seesrc/data/links.ts. - The format list comes from
odr.fileTypes(), not the store listing. If they disagree, fix the store listing.
How editing, saving, annotation and the rest of the viewer behave is described in the code and in core's editing design doc.
Pushes to main deploy to Firebase Hosting (project admob-app-id-9025061963)
via .github/workflows/deploy.yml. Pull requests get a preview channel for 14
days. The workflow needs one secret, FIREBASE_SERVICE_ACCOUNT: the JSON key
of a service account with the Firebase Hosting Admin role.
The old site lived in
OpenDocument.fx, which
should be archived: a firebase deploy from it would overwrite this site.