Skip to content

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

Open
JFWooten4 wants to merge 1 commit into
mainfrom
feature/drag-drop-local-file-inputs-20261026
Open

JFWooten4 wants to merge 1 commit 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

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>
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