Skip to content

1.16 part 5/18: Reader, offline use and the debug log in the browser - #176

Closed
epheterson wants to merge 1 commit into
line/1.16.0-04-homefrom
line/1.16.0-05-reader-offline
Closed

epheterson wants to merge 1 commit into
line/1.16.0-04-homefrom
line/1.16.0-05-reader-offline

Conversation

@epheterson

@epheterson epheterson commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Part 5 of 18 of Zimi 1.16.0: Reader, offline use and the debug log in the browser. Base: line/1.16.0-04-home (part 4); the diff shows only this part's files. The PR carries the not-a-release label and the version stays 1.15.7, so merging it cuts no release. Merge in order (1 to 17, then 18) with a merge commit, not a squash.

What this is

The readers, the service worker and the pages that open inside the reader, in the browser. A kept app opens offline with its stylesheet, big PDFs and split or main-page-less books open or say why they cannot, the debug log has its browser half, and Create offers a one-tap install where a capability is missing. Most of the change is in sw.js, debuglog.js and create.js; the rest is small edits to the readers and app pages.

What changes

  • zimi/static/sw.js: keepShellAssets keeps the stylesheets and scripts the kept shell names, tries three times, and fails the install when one is still missing, so a worker in charge never serves the header alone offline. refreshShell no longer replaces the kept shell with a shell of another build (it asks the worker to update instead).
  • zimi/static/sw.js, keepOwnAhead: the games and the Almanac are kept ahead of time, only after the page says it is idle and the connection is fine (keep-own-ahead message), only with 150 MB of room (OWN_KEEP_HEADROOM_BYTES), and nothing is evicted. Keeping on first opening a game now happens only for a page load (_isPageLoad), not for a picture from the games ZIM.
  • zimi/static/sw.js: /almanac-view joins NETWORK_ONLY_PREFIXES, the routes the worker never answers from cache.
  • zimi/static/debuglog.js (new): fetched only while the server keeps a debug log. Records taps (a control's id, class and visible text, never an input's value), views, errors, rejections, slow frames and navigation, and posts them to /debuglog every 4 s and on leaving by sendBeacon. Queue capped at 500 events.
  • zimi/static/create.js: where a capability is missing (Browser, SingleFile, video, alive), an admin whose server can add it gets a Get button beside the command (_createFillAddonSlots, _createMissingAddons); the Beta tag on the failing-site link is gone.
  • zimi/static/pdfreader.js, pdfreader.css: bars stay up while reading or turning pages and only a middle tap moves them; a PDF that will not open shows the missing-page card, and a 413 says it is too large to open because it is stored compressed.
  • zimi/static/wiki-reader.js: the map entry for an article with coordinates uses the shared map flow (_mapHere): open the installed map that covers the place or offer the right one.
  • zimi/static/readaloud.js: a wiki main page laid out as a table of headings and lists is read (_ttsLayoutTable).
  • zimi/static/books.html, dictionary.html, tube.html, wiki.html, fieldguide.html: section labels take the shared rule from tokens.css (part 4); the Bookshelf's place goes into the address and a reload opens it.
  • Tests: browser files and the node and Python files for the above.

How to review

  • Read keepShellAssets and the install handler in sw.js first. A mistake here leaves installed apps without a working shell or makes every install fail; check the retry and the failure path, and that refreshShell's build check cannot loop (registration.update()).
  • Then keepOwnAhead: the storage check, the idle gate and that a refused write stops quietly.
  • Risk: debuglog.js privacy. Check describe() takes words only from controls, and that nothing typed or password-like is recorded.
  • Risk: NETWORK_ONLY_PREFIXES in sw.js: a per-account route missing from it could be answered from cache (/me and /userdata are listed).
  • Risk: pdfreader.js tap zones (TAP_EDGE) on a phone, which share the screen with scrolling and pinch.
  • Skip: the five app pages' CSS lines (mechanical, covered by tests/test_apps_css.py).
  • Rides here: tests/test_phone_search_field.py and tests/test_debuglog_flush.cjs pass first at this tip (the first reads the bar after the readers change, the second reads debuglog.js).

Tests

  • Offline: tests/test_pwa_offline_after_deploy_browser.py, tests/test_sw_offline.py (scripted network), tests/test_own_zims_offline_browser.py, tests/test_sw_route_classification.py.
  • Readers: tests/test_big_pdf_live.py, tests/test_pdf_reader.py, tests/test_no_main_page_live.py, tests/test_reader_view_address.py, tests/test_wiki_reader.py, tests/test_readaloud_main_page_live.py, tests/test_reader_menu_red_live.py.
  • Reload and language: tests/test_reload_state_browser.py, tests/test_apps_follow_language.py.
  • Debug log: tests/test_debuglog_browser.py, tests/test_debuglog_flush.cjs.
  • Create and library: tests/test_create_share_link_browser.py, tests/test_creator_made_download.cjs, tests/test_deep_check_live.py, tests/test_split_missing_live.py.
  • Most of these need a browser and run in the whole matrix; the .cjs and some Python files run in this PR's quick tier.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@epheterson epheterson added the not-a-release Ships nothing; CI skips the version check label Nov 23, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Sorry @epheterson, your pull request is larger than the review limit of 150,000 diff characters

@epheterson epheterson mentioned this pull request Nov 23, 2026
@epheterson
epheterson force-pushed the line/1.16.0-05-reader-offline branch from 8d887d4 to f2b5371 Compare November 23, 2026 10:07
@epheterson
epheterson force-pushed the line/1.16.0-05-reader-offline branch from f2b5371 to a580fe5 Compare November 23, 2026 10:51
@epheterson
epheterson force-pushed the line/1.16.0-05-reader-offline branch from a580fe5 to 7099487 Compare November 23, 2026 16:37
@epheterson
epheterson force-pushed the line/1.16.0-05-reader-offline branch from 7099487 to f6877ee Compare November 23, 2026 16:44
@epheterson

Copy link
Copy Markdown
Owner Author

Reviewed here; included in the release PR #189.

@epheterson epheterson closed this Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

not-a-release Ships nothing; CI skips the version check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant