Automated PWA deployment of Koodo Reader to GitHub Pages at https://sloth-os.github.io/koodo-reader/.
A GitHub Actions workflow checks out upstream koodo-reader/koodo-reader@dev,
applies this repo's patches and overlay, builds with vite, and deploys the
result. It runs weekly (to track upstream), on every push to main, and
manually via workflow_dispatch.
- Installable PWA —
manifest.json, theme color, app icons (including maskable), and a hand-rolled service worker:
- precaches the app shell (index.html + built assets + the vendored
lib/scripts) with a per-deploy revision so new deploys activate cleanly and old caches are dropped- runtime cache-first for on-demand same-scope assets (wasm, pdf cmaps, standard fonts, locale chunks, workers)
- offline fallback page; navigations fall back to the cached shell
- OS file handling —
file_handlersin the manifest registers Koodo for all ~30 supported formats; alaunchQueueconsumer imports launched files through the app's ownimportBookFuncpipeline (waiting for the manager page to mount if the launch lands elsewhere). - Subpath fixes — the app is served under
/koodo-reader/, but some upstream code builds root-absolute/lib/...URLs that 404 under a subpath. Patches make these resolve relative todocument.baseURI.
overlay/— files copied into the upstream tree before building:manifest.json(PWA metadata + file_handlers + shortcuts)sw.js(service worker template; revision/precache list substituted at build time)offline.html(offline fallback document)icons/(generated from upstream's app icon)file-handling.ts(launchQueue consumer module)
patches/— unified diffs applied to the upstream tree (ordered by name):0001-entry-file-handling.patch— wireinitFileHandling()into the app entrypoint0003-tesseract-subpath.patch— tesseract worker URL resolves againstdocument.baseURI
scripts/build.mjs— the whole pipeline: sanity checks → patches → overlay → kookit bundle subpatch (exact-string, asserted) → vite build → inject PWA tags intoindex.html→ generate SW precache manifest → write version-stampedsw.js.github/workflows/deploy.yml— CI/CD
# clone upstream next to this repo (or anywhere) and install deps
git clone https://github.com/koodo-reader/koodo-reader.git ~/software/koodo-reader
cd ~/software/koodo-reader && yarn install --ignore-scripts
# build with the overlay applied
node scripts/build.mjs --upstream ~/software/koodo-reader
# serve the build under the production subpath to verify
mkdir -p /tmp/pages/koodo-reader
cp -r ~/software/koodo-reader/build/* /tmp/pages/koodo-reader/
cd /tmp/pages && python3 -m http.server 8123
# open http://127.0.0.1:8123/koodo-reader/PWA_BASE_PATH (default /koodo-reader/) controls the scope prefix the
service worker treats as in-scope.
The patches and the kookit exact-string replacements are asserted at build time: if upstream refactors the relevant lines, the build fails loudly instead of silently producing a broken PWA. When that happens, regenerate the patch against the new tree (see the patch headers for target files).
Upstream license: Apache-2.0 (see the LICENSE shipped in the build output).