Which UI/hook layer still decides between local/browser mode and ZIP mode.
Which Next.js routes still proxy ZIP behavior.
Which Fly routes/services still implement ZIP assembly or ZIP SSE.
Which schema/service code exists only to support ZIP session persistence.
Which docs still describe ZIP as supported behavior.
Important:
Do not assume DownloadDialog.tsx contains the bulk of the ZIP logic. In the current repo, much of it lives in src/hooks/useDownloadRunner.ts.
Step 2: Verify Unsupported Browser Behavior
Inspect the current browser compatibility path and confirm there is no ZIP fallback.
Minimum files to inspect:
src/hooks/useDownloadRunner.ts.
src/lib/download/browser-compat.ts.
src/components/DownloadDialog.tsx.
src/components/DriveTable.tsx.
Expected result:
Unsupported browsers receive the existing compatibility error message.
The current code exits early instead of invoking ZIP download fallback behavior.
Report:
The exact file/function responsible for blocking unsupported browsers.
Whether any dormant ZIP fallback remains reachable from the UI.
Step 3: Identify the Removal Surface
Build a concrete delete/update list before editing.
At minimum, audit these files:
Next.js
src/app/api/rclone/download/route.ts.
src/app/api/rclone/download/events/route.ts.
src/hooks/useDownloadRunner.ts.
src/constants/download.ts.
src/constants/api-endpoints.ts.
src/constants/error-messages.ts.
src/components/DownloadDialog.tsx.
src/components/DriveTable.tsx.
Fly
fly-rclone/src/routes/downloadRoutes.js.
fly-rclone/server.js.
fly-rclone/src/constants.js.
fly-rclone/src/services/downloadSessionStore.js.
fly-rclone/src/services/operationStateDb.js.
fly-rclone/openapi.json.
fly-rclone/src/services/progressBus.js.
Database
src/lib/database/schema/jobs.ts.
drizzle/* migration state.
Tests/Docs
src/app/api/rclone/download/route.test.ts.
src/constants/__tests__/api-endpoints.test.ts.
src/components/__tests__/DownloadDialog.test.tsx.
ZIP references in README.md, public/docs/FILE_MANAGEMENT.md, public/docs/TESTING.md, public/docs/CODE_REVIEWS.md, public/docs/REFACTORING_GUIDES.md, public/docs/DEPLOYMENT.md, public/docs/RCLONE_SERVICE.md.
Before proceeding, summarize:
Files to delete
Files to rewrite
Files to archive
Risks or unknowns, especially around remaining SSE / multi-machine behavior
Phase 2: Code Removal
Execute only after verification is complete.
Step 1: Remove Next.js ZIP API Routes
Delete:
src/app/api/rclone/download/route.ts.
src/app/api/rclone/download/events/route.ts.
Then remove all upstream references:
INTERNAL_API.RCLONE.DOWNLOAD.
INTERNAL_API.RCLONE.DOWNLOAD_EVENTS.
tests that assert those endpoints exist.
Step 2: Remove ZIP Logic from the Download Runner
Primary file:
src/hooks/useDownloadRunner.ts.
Required changes:
Remove ZIP mode/state and any DownloadMode branch that still includes "zip".
Remove DEFAULT_ZIP_FILENAME usage and rename the remaining filename/default behavior appropriately.
Preserve browser-direct manifest resolution, folder selection, retries, error reporting, and unsupported browser handling.
Secondary audit:
src/components/DownloadDialog.tsx.
src/components/DriveTable.tsx.
Remove only ZIP-specific UI/state. Do not disturb current browser-direct UX.
Step 3: Remove ZIP Constants and Errors
Update:
src/constants/download.ts.
src/constants/error-messages.ts.
Remove ZIP-only constants such as:
DEFAULT_ZIP_FILENAME.
MAX_FILES_PER_ZIP.
MAX_ZIP_SIZE_BYTES.
ZIP-specific method/event/status constants if they are no longer used anywhere.
Preserve:
Browser-direct file timeout/retry constants.
Compatibility/error messages still used by browser-direct downloads.
Step 4: Remove Fly ZIP Handlers
Delete:
fly-rclone/src/routes/downloadRoutes.js.
fly-rclone/src/services/downloadSessionStore.js if it becomes ZIP-only and unused.
Update:
fly-rclone/server.js.
fly-rclone/src/constants.js.
fly-rclone/openapi.json.
Required changes:
Remove /api/download-zip, /api/download-zip/session, /api/download-zip/stream, and /api/download-zip/events*.
Remove any cleanup timer that exists only for ZIP download sessions.
Remove ZIP request/response models from OpenAPI.
Important:
progressBus is currently shared with other operation-progress flows. Do not delete it unless all remaining consumers are removed or replaced.
If progressBus remains because sync/operation SSE still uses it, document that explicitly in the final report.
Step 5: Remove ZIP Session Persistence
Update:
fly-rclone/src/services/operationStateDb.js.
src/lib/database/schema/jobs.ts.
Add a new migration that drops the ZIP-only table:
Drop download_sessions.
Remove related indexes.
Also remove ZIP-only DB helpers such as:
createDownloadSession.
consumeDownloadSession.
deleteDownloadSession.
cleanupExpiredDownloadSessions.
Do not touch active operation shared-state code unless it is genuinely ZIP-only.
Step 6: Remove or Rewrite Tests
Delete or rewrite tests that exist only for ZIP behavior, including:
src/app/api/rclone/download/route.test.ts.
ZIP-specific assertions in src/constants/__tests__/api-endpoints.test.ts.
any Fly ZIP session store tests.
Preserve and update tests that still validate browser-direct downloads, dialog UX, or non-ZIP constants.
Step 7: Update Documentation
Update the current docs to reflect one supported download architecture: