@@ -606,6 +606,36 @@ mkdir -p /library/www/html/k2go-docs
606606/usr/local/bin/pdsm restart nginx
607607ok " K2Go docs module scaffold installed (hidden until docs are added)."
608608
609+ # -----------------------------
610+ # pdf.js viewer (ADFA-4708) — static module.
611+ # Serve Mozilla pdf.js so the portal WebView can render PDFs inline/offline. The prebuilt
612+ # dist is produced by static/pdfjs/fetch-pdfjs.sh (run at build time); here we install the
613+ # nginx conf and deploy the dist to the web root. Unlike k2go-docs this is always present.
614+ # -----------------------------
615+ log " Installing pdf.js viewer static module..."
616+ cp " ${K2GO_OPT_DIR} /static/pdfjs/pdfjs-nginx.conf" " /etc/nginx/conf.d/pdfjs-nginx.conf"
617+ mkdir -p /library/www/html/pdfjs
618+ # Produce the pinned pdf.js dist at build time (this is what actually downloads it).
619+ # dist/ is gitignored, so on a clean build it is absent and must be fetched here; if a
620+ # dist was pre-provided (e.g. vendored/cached) the fetch is skipped. Needs network +
621+ # curl/unzip in the build environment. pdf.js release cadence ~monthly (semver; majors
622+ # can break) -> the version is PINNED in fetch-pdfjs.sh; bump it deliberately, mainly on
623+ # a pdf.js security advisory, not on every release.
624+ if [ ! -d " ${K2GO_OPT_DIR} /static/pdfjs/dist/web" ]; then
625+ log " Fetching pinned pdf.js dist (build-time)..."
626+ if ! bash " ${K2GO_OPT_DIR} /static/pdfjs/fetch-pdfjs.sh" ; then
627+ warn " pdf.js fetch failed; viewer will 404 until the dist is provided."
628+ fi
629+ fi
630+ if [ -d " ${K2GO_OPT_DIR} /static/pdfjs/dist/web" ]; then
631+ cp -a " ${K2GO_OPT_DIR} /static/pdfjs/dist/." /library/www/html/pdfjs/
632+ ok " pdf.js dist deployed."
633+ else
634+ warn " pdf.js dist not found; viewer will 404 until deployed."
635+ fi
636+ /usr/local/bin/pdsm restart nginx
637+ ok " pdf.js viewer module installed."
638+
609639# Install demo content
610640if [ " $ENABLE_DEMO_CONTENTS " -eq 1 ]; then
611641 install_demo_contents
0 commit comments