feat: download .wpress backups from cloud storage URLs#52
Conversation
Build Artifacts
Built from f326e8e. Artifacts expire after 90 days. |
Code ReviewThanks for the PR - the feature is well-organized and the signal/slot wiring is clean. However, all 4 substantive CI checks are failing (Linux/macOS/Windows builds + Code Style), and there are correctness issues that need to be addressed before this can merge. I also checked the branch out and reproduced the failures locally. Blockers1. Lines 40-43 (the Every other string in the file uses straight quotes correctly. Fix is mechanical: replace the curly-quote delimiters with 2. clang-format violations (Code Style check) The project's formatter was not run.
Fix per find src tests \( -name '*.cpp' -o -name '*.h' \) ! -name 'moc_*' | xargs clang-format -i3. PR description contradicts the implementation The description says "Note on Mega: ... not supported in this PR." but the branch HEAD ( Correctness4. Mega AES key is likely used without un-mangling. Mega file links embed a 256-bit key; the real 128-bit AES key is the XOR of the two 16-byte halves ( 5. Mega multi-part ( 6. FTP is claimed but not supported in Qt 6. Bugs7. Temp files leak.
Centralize cleanup: remove the temp file in 8. 9. No content validation of the downloaded file. Google Drive's Test coverageNo tests added. Code quality
SecurityThe user-initiated-only network model is reasonable, and the
RecommendationRequest changes. Fix the build (item 1), formatting (item 2), and description (item 3) blockers, plus the temp-file leaks (item 7) and tests (item 9). For Mega: given the unverified key handling (item 4) and multi-part gap (item 5), I'd suggest splitting Mega into a separate follow-up PR with proper test vectors, and landing the simpler, well-understood provider normalization (Drive/Dropbox/OneDrive/Box/pCloud/S3) first - that part looks solid. |
Add CloudDownloader (src/clouddownloader.{h,cpp}) which downloads a
.wpress file from a remote HTTPS URL to a temp file. Normalizes share
links from Google Drive, Dropbox, OneDrive, Box, and pCloud into direct
download URLs. Mega (mega.nz) is handled via a two-step flow: parse the
AES-128-CTR key from the URL fragment (never sent to any server), call
the Mega public API for a CDN URL, then decrypt the stream on-the-fly
with OpenSSL EVP_aes_128_ctr().
Drop overlay (dropoverlay.{h,cpp}): accept remote URLs in addition to
local .wpress files. Two-path drag handling — text/uri-list primary,
text/plain fallback — so cloud web-UI drags work and Mega #KEY fragments
are preserved (text/uri-list strips fragments per RFC 2483).
URL dialog (urlopendialog.{h,cpp}): File → Open from URL (Ctrl+Shift+O)
lets the user paste any cloud share link or direct URL.
MainWindow wiring: urlDropped signal → openBackupFromUrl slot, download
progress bar with indeterminate mode (setRange(0,0)) when Content-Length
is unknown, re-entrancy guard (m_downloading flag), temp file cleanup on
clear/re-download.
Tests: 24 new test cases in tst_clouddownloader.cpp covering isRemoteUrl,
normalizeUrl (per provider), and parseMegaUrl (key derivation, legacy
format, edge cases). All 121 tests pass.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6784c3a to
8c3119c
Compare
The .ui file already defines a File menu (menu_File). The previous code
created a second File menu via menuBar()->addMenu("&File"), which on
macOS gets silently merged/hidden — making "Open from URL…" invisible.
Fix: insert the action into ui->menu_File (after "Open backup", before
"Clear file") instead of creating a duplicate menu.
Also update the drop zone hint text from "Drop .wpress file here" to
"Drop .wpress file or cloud link here" to hint at URL drop support.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Could you split |
f9a3e18 to
b38af16
Compare
Add an "Open URL..." button in the bottom button row, between "Open backup..." and "Clear", so the cloud-storage feature is immediately discoverable without needing the File menu or keyboard shortcut. The button is wired to openFromUrl() via the .ui file and is disabled during downloads (same as the other buttons). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
src/clouddownloader.{h,cpp}): downloads .wpress files from remote HTTPS URLs to a temp file viaQNetworkAccessManager. Normalizes share links from Google Drive, Dropbox, OneDrive, Box, and pCloud into direct download URLs. Mega (mega.nz) uses a two-step flow: parse the AES-128-CTR key from the URL fragment (never sent to any server), call the Mega public API for a CDN URL, then decrypt the encrypted stream on-the-fly with OpenSSLEVP_aes_128_ctr().src/dropoverlay.{h,cpp}): accepts remote URLs in addition to local .wpress files. Two-path drag handling —text/uri-listprimary,text/plainfallback — so cloud web-UI drags work and Mega#KEYfragments are preserved (text/uri-liststrips fragments per RFC 2483).src/urlopendialog.{h,cpp}): File → Open from URL… (⌘⇧O / Ctrl+Shift+O) lets the user paste any cloud share link or direct URL.urlDropped→openBackupFromUrl, download progress bar with indeterminate mode when Content-Length is unknown, re-entrancy guard, temp file cleanup on clear/re-download.tst_clouddownloader.cppcoveringisRemoteUrl,normalizeUrl(per provider), andparseMegaUrl(key derivation, legacy format, edge cases). All 121 tests pass.Supported providers
/file/d/{ID}/viewand/open?id={ID}→/uc?export=download&id={ID}&confirm=tdl=0→dl=1download=1/s/{code}→/shared/static/{code}publink/show?code=X→publink/code?code=X&forcedownload=1Security notes
QNetworkAccessManageris only used when the user explicitly provides a URL.QTemporaryFilein the system temp dir and are cleaned up on clear or re-download.QNetworkAccessManager.Test plan
.wpressfile — still works as beforedl=1.wpressctest --output-on-failure— all 121 tests pass (97 existing + 24 new)clang-format --dry-run --Werror— no violations🤖 Generated with Claude Code