Skip to content

🖌️ Add drag-and-drop file selection to PDF Magic - #13

Merged
JFWooten4 merged 2 commits into
mainfrom
feature/drag-drop-local-file-inputs-20261026
Nov 17, 2026
Merged

JFWooten4 merged 2 commits into
mainfrom
feature/drag-drop-local-file-inputs-20261026

Conversation

@JFWooten4

Copy link
Copy Markdown
Member

Overview

Replace manual source-file path entry with accessible drag-and-drop / click-to-select inputs for OCR, local AI review, and PDF compression. The existing Google Books ID field and editable output filenames remain unchanged.

Changes

  • Use native file pickers inside dark/light theme-aware drop zones for PDF, JSON tagging reports, and JSONL review input.
  • Stream selected inputs to a locally ignored .pdfmagic-uploads/ staging directory without altering the original, and inject the resulting path into the existing copyable Terminal command.
  • Replace the static npm run serve Python HTTP server with a localhost-only Python server offering /api/upload and /api/status. Guard uploads with allowed extensions, same-origin verification, allowed Host values, and unique filenames.
  • Update the double-click Mac launcher to identify the new backend and explain when a stale static server is occupying the port.
  • Document file selection, local-only security, static-hosting limitations, and staging-file cleanup.
  • Add automated unit and server-level regression tests and run them in frontend CI.

Behavior and constraints

Selecting files does not automatically run OCR, Playwright, compression, or Ollama. The browser cannot learn an OS source path; instead, the server streams a working copy to a local path suitable for the generated command. Hosted static sites such as Netlify display the interface but cannot stage local files without a backend.

Testing

  • npm test (frontend command-builder, launcher syntax, input specifications, and themes)
  • python3 -m unittest discover -s tests -p 'test_local_server.py' -v (local endpoint, upload bytes, duplicate name handling, cross-site protection, path traversal, rejected file types)
  • GitHub Actions: PDF Magic web UI

Builds on the dark-mode and one-click launcher change: d3923ac

JFWooten4 and others added 2 commits October 26, 2026 14:11
Replace manually typed PDF, JSON, and JSONL source paths with click-to-select and drag-and-drop inputs. Stage uploaded files through a localhost-only streaming endpoint, build commands with the staged paths, update the macOS launcher and documentation, and cover the server and frontend workflows with regression tests.

Co-authored-by: Codex Web <noreply@openai.com>
Resolve the .gitignore conflict for PR #13 while preserving main's Internet Archive browser and Python virtual-environment exclusions alongside the new .pdfmagic-uploads/ staging ignore.

Combine drag-and-drop upload guidance with main's Internet Archive documentation. Retain the existing file-upload implementation, local server, and regression tests.

Co-authored-by: ChatGPT 6 <noreply@openai.com>
@JFWooten4
JFWooten4 merged commit 5472da5 into main Nov 17, 2026
1 check passed
@JFWooten4
JFWooten4 deleted the feature/drag-drop-local-file-inputs-20261026 branch November 17, 2026 14:43
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.

1 participant