feat(fuse,core,cli,gui): make folders available offline from the app

The daemon has kept recursive folder pins for a long time, but the app
offered "Available offline" for files only. The context menu, the
details pane and the selection bar now offer it for folders too, and a
pinned folder carries the offline badge in the browser and the launcher.

A folder pin used to download the whole subtree inside the control
request, so a large folder outlasted the client's 120 s read timeout,
and every pinned file was read into memory before it was cached. The
daemon now records the pin, answers at once and downloads on a
background thread as a job the tray and the app show, stopping when the
folder is unpinned or the daemon stops. Pins of files and folders both
go through fetch_content, which streams to disk and skips fresh blobs.
A folder pin is refused while offline instead of looking kept.

A file kept only because a folder above it is pinned has no pin of its
own, and unpinning it silently did nothing. ListDir now reports
pinned_by_folder; the app shows such an entry as available offline with
the toggle greyed out, and the daemon refuses the unpin with a message
naming the folder. Unpinning a folder no longer evicts files that are
pinned on their own.

Requested on Reddit.
This commit is contained in:
nvrl committed 2026-10-12 00:07:18 +02:00
1 parent e0442c56b9
commit d481dcc15c
24 files changed
+3353 -2856

No files matched your search

+8 -5
View File
@@ -172,17 +172,19 @@ enum Command {
/// Mountpoint; defaults to ~/ProtonDrive.
mountpoint: Option<PathBuf>,
},
/// Keep a file on this device (download + cache it). Needs a running mount.
/// Keep a file or folder on this device (download + cache it). A folder's
/// files download in the background; `pdfs transfers` shows the progress.
/// Needs a running mount.
Pin {
/// File path, inside the mountpoint or relative to it.
/// File or folder path, inside the mountpoint or relative to it.
path: PathBuf,
},
/// Stop keeping a file on this device, evicting its cached content.
/// Stop keeping a file or folder on this device, evicting its cached content.
Unpin {
/// File path, inside the mountpoint or relative to it.
/// File or folder path, inside the mountpoint or relative to it.
path: PathBuf,
},
/// List files pinned to this device.
/// List files and folders pinned to this device.
Pins,
/// List a directory via the running daemon (in-app browser backend).
Ls {
@@ -3793,6 +3795,7 @@ mod login_wait_tests {
size: 1,
modified: 0,
pinned: false,
pinned_by_folder: false,
cached: false,
uid: "vol~link".into(),
path: String::new(),