Word (.docx) documents as sites, via docx-preview

A site whose path is a local .docx renders as pages in the kiosk instead
of Chromium offering a download. kiosk-app/docview.js maps the file URL
to docview.html (alongside slideshow.js, through main.js's new
resolveLocalSite) and pushes the file's bytes into the page from the main
process; the page renders them with docx-preview + jszip, both pure-JS
npm dependencies of kiosk-app (so online installs, Advanced -> Upgrade
and the offline bundle all pick them up - no LibreOffice).

- Scaled to the screen width (capped at 160%), scrolls normally.
- Re-checked every minute; a changed file re-renders from the top.
- Word's Symbol/Wingdings private-use bullet glyphs (U+F0B7 etc.), which
  render blank without Microsoft fonts, are mapped to Unicode (•, ▪, ...).
- Missing/unreadable/oversized (>50 MB) files and a missing library show
  a message instead of a blank page. .doc/.odt aren't supported.

Tested with the real main.js on Electron 44.5.1 under Xvfb + Openbox:
heading, coloured bold run, image, bordered table, bullets and a page
break rendered; wheel scrolling works; replacing the file while running
re-rendered the new document within the refresh. Offline bundle rebuilt
and contains docx-preview and jszip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cjz8a58eB5P9sUweqd3NHm
This commit is contained in:
Claude
2026-10-03 14:57:10 +00:00
parent d4b75ca1b9
commit c54ae352a1
6 changed files with 209 additions and 7 deletions
+2 -2
View File
@@ -137,8 +137,8 @@ action_add_page() {
echo " -1 = hidden (PIN-gated, F10 or 3-finger swipe)"
echo
echo "URL: a web address, or a path on this kiosk - a file (page, PDF,"
echo "image) like /home/kiosk/docs/menu.pdf, or a folder of images ending"
echo "in / like /home/kiosk/photos/ for a slideshow."
echo "image, Word .docx) like /home/kiosk/docs/menu.pdf, or a folder of"
echo "images ending in / like /home/kiosk/photos/ for a slideshow."
local raw_url url dur name needs_auth user pass
read -r -p "URL: " raw_url