Skip to content

Add ZIP export and improve TeX distribution installation - #4

Merged
Francy2009 merged 2 commits into
mainfrom
claude/latex-distribution-download-error-cmhhbo
Aug 10, 2026
Merged

Add ZIP export and improve TeX distribution installation#4
Francy2009 merged 2 commits into
mainfrom
claude/latex-distribution-download-error-cmhhbo

Conversation

@Francy2009

Copy link
Copy Markdown
Owner

Summary

This PR enhances the application with ZIP export functionality for compiled outputs and improves the TeX distribution installation process with fallback URLs and additional package collections.

Key Changes

ZIP Export Feature

  • New desktop/zip.js module: Implements a minimal, dependency-free ZIP writer that packages multiple output files into a single downloadable archive

    • Includes CRC32 checksum calculation and DOS date/time encoding
    • Uses zlib's deflateRawSync for compression
    • Properly formats ZIP local file headers, central directory, and end-of-central-directory records
  • Updated output UI (desktop/renderer/app.js):

    • Groups compiled outputs by type (PDF/HTML) instead of showing individual save buttons
    • When multiple files of the same type exist, displays them in a scrollable list and offers a single "Download all (.zip)" button
    • Maintains individual preview buttons for HTML files
    • Cleaner UI that scales better with many compiled documents
  • New IPC handler (desktop/main.js):

    • Added salva-zip handler that creates ZIP archives and shows a save dialog
    • Converts base64-encoded file data back to buffers before zipping

TeX Distribution Installation Improvements

  • Fallback URL support (desktop/latex.js):

    • Changed TINYTEX_URL from single URLs to arrays of candidate URLs per platform
    • Added GitHub releases URLs (daily and latest) as primary sources, with yihui.org as fallback
    • Handles 404 errors gracefully by trying the next URL instead of failing immediately
  • New scaricaConFallback() function:

    • Iterates through candidate URLs, logging which sources are unavailable
    • Provides better resilience against stale redirects or renamed release files
  • Extended package installation (desktop/latex.js):

    • New COLLEZIONI_COMPLETE export containing 17 TeX Live collections covering LaTeX, fonts, math/science, graphics, bibliography, and European languages
    • installaPacchettiBase() now installs both base packages and complete collections
    • Collections installation is non-fatal (warnings logged if some fail)
    • Increased timeout for collection installation to 1 hour

UI/CSS Updates

  • Added .output-file-list styling for scrollable file lists in output cards
  • Updated button text to indicate ZIP download vs. single file save
  • Improved visual organization of multiple outputs

Implementation Details

  • The ZIP implementation follows the standard ZIP format specification with proper CRC32 checksums and DOS date encoding
  • Base64 data from the renderer is decoded back to buffers before compression
  • The fallback mechanism preserves the original error if all URLs fail, providing useful debugging information
  • Collection installation failures don't block the overall installation process, allowing partial success

https://claude.ai/code/session_01Wx82oS8KJJsa7jxJRx2xRi

claude added 2 commits August 10, 2026 05:56
The old yihui.org/tinytex/TinyTeX-1.zip link now 404s, so the LaTeX
engine could never be installed. Download now tries the GitHub
tinytex-releases assets first and falls back through a couple of
mirrors instead of giving up on the first failing source.

After the base install, tlmgr now also pulls in most TeX Live
collections (fonts, math/science, graphics, extra LaTeX, bibliography,
European languages, etc.), so the bundled distribution ships with
close to the full package set instead of just the ~30 base packages.
Compiling several .tex sources produced one output card per file, each
with its own "Salva con nome..." dialog -- with a batch of documents
that meant clicking through dozens of save dialogs one at a time.

Outputs are now grouped by type (PDF / HTML): each group gets a single
button that packs every file of that type into one ZIP and saves it in
one shot. Single-file compiles keep the plain "Salva con nome..." save,
and HTML files still get their individual preview button.

Adds a small dependency-free ZIP writer (desktop/zip.js) since the
project has no archiving library yet.
@Francy2009
Francy2009 merged commit c30c23c into main Aug 10, 2026
4 checks passed
@Francy2009 Francy2009 mentioned this pull request Aug 10, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants