Skip to content

feat: resumable downloads with cache, abort dialog, and Range-error recovery - #197

Closed
AvengerAnubis wants to merge 3 commits into
ElyPrismLauncher:developfrom
AvengerAnubis:feature/download-resume-cache
Closed

feat: resumable downloads with cache, abort dialog, and Range-error recovery#197
AvengerAnubis wants to merge 3 commits into
ElyPrismLauncher:developfrom
AvengerAnubis:feature/download-resume-cache

Conversation

@AvengerAnubis

Copy link
Copy Markdown

This PR adds three related features to the download system:

1. Resumable downloads with partial file support

  • introduced ResumingFileSink — a new sink that downloads to a .part file,
    sets Range and Accept-Ranges headers so interrupted downloads can resume
  • added DownloadCache — stores completed downloads keyed by URL hash,
    promotePart() copies the final file to the cache directory on success,
    serveFromCache() restores it on re-download with validator checksum verification
  • cache hits skip the download entirely; if validators fail, it falls through to
    a fresh download

2. Abort confirmation dialog

  • when the user clicks "Abort" during a download, a QMessageBox asks whether
    to delete the cached .part file (Yes/No)
  • NetJob::deleteCachedDownloads() cleans up all cached artifacts for the job

3. Range-error recovery (404/416 on resumed downloads)

  • Some CDNs (CloudFront + S3) return 404 or 416 when a Range request
    refers to a stale or invalid offset
  • NetRequest::downloadError() now detects these status codes on resumable
    downloads, deletes the stale .part via deleteCache(), and retries once
    from scratch without Range

Files changed

  • launcher/net/ResumingFileSink.{h,cpp} — new sink, cache-hit validation,
    hasUsedRange() detection, deleteCache()
  • launcher/net/DownloadCache.{h,cpp} — cache storage, promotePart(),
    serveFromCache(), metadata management
  • launcher/net/NetRequest.{h,cpp}deleteCachedDownload(), 404/416 retry
  • launcher/net/NetJob.{h,cpp}deleteCachedDownloads() iterates all subtasks
  • launcher/net/Download.{h,cpp} — wire up cache in existing downloads
  • launcher/net/ApiDownload.cpp — pass cache through
  • launcher/ui/dialogs/ProgressDialog.cpp — abort confirmation dialog
  • launcher/ui/pages/global/LauncherPage.{cpp,ui} — cache settings UI
  • launcher/Application.{h,cpp}, launcher/CMakeLists.txt — wiring
  • .gitignore — ignore local project files

@herakl1209

Copy link
Copy Markdown

Question, why are you submitting this here? This is just a fork of Prism Launcher. Usually, it doesn't add "big" features on it's own. Maybe you should submit this at the Prism Launcher PRs?

@AvengerAnubis

Copy link
Copy Markdown
Author

I'll try it maybe one day, gonna need to fork the original though. Forked this launcher for my own sake, and added this feature cause I wasn't able to download any large modpacks, poor internet connection hits hard, and thought why not pull request it.
Thanks for the suggestion, have a nice day

@AvengerAnubis
AvengerAnubis force-pushed the feature/download-resume-cache branch from d4190f7 to 23124a2 Compare July 10, 2026 11:07
Signed-off-by: Avenger Anubis (Ilya) <avenger.anubis@gmail.com>

Assisted-by: opencode:deepseek-v4-flash-free
Signed-off-by: Avenger Anubis (Ilya) <avenger.anubis@gmail.com>

Assisted-by: opencode:deepseek-v4-flash-free
…retry 404/416 on ranged requests

Signed-off-by: Avenger Anubis (Ilya) <avenger.anubis@gmail.com>

Assisted-by: opencode:deepseek-v4-flash-free
@AvengerAnubis
AvengerAnubis force-pushed the feature/download-resume-cache branch from 23124a2 to dac33a6 Compare July 10, 2026 11:39
@AvengerAnubis

AvengerAnubis commented Jul 10, 2026

Copy link
Copy Markdown
Author

made a pull request to PrismLauncher, may as well close this one

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