mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-03 16:41:26 +01:00
feat(cli,gui): sync with another computer's device
Two or more computers can now sync the same folders through one device in Proton Drive. `pdfs devices join UID` and "Sync With This Computer…" on another computer's row adopt that device as this machine's and then offer its folders for syncing here, like a restore. Unlike "Continue This Backup Here", the other computer goes on syncing, and the confirmation says that changes and deletions on one reach the other. Translated into every shipped language.
This commit is contained in:
1 parent
950056b48d
commit
7a0f1ebd6f
11 files changed
+1207
-747
No files matched your search
@@ -630,6 +630,16 @@ enum DeviceCmd {
|
||||
#[arg(long, conflicts_with = "uid")]
|
||||
clear: bool,
|
||||
},
|
||||
/// Sync the same folders as another computer: this machine continues that
|
||||
/// computer's device alongside it, and its folders are offered for syncing
|
||||
/// here. Both computers keep them in step.
|
||||
Join {
|
||||
/// Device uid (from `devices list`).
|
||||
uid: String,
|
||||
/// Skip the confirmation and accept every proposed local path.
|
||||
#[arg(long)]
|
||||
yes: bool,
|
||||
},
|
||||
/// Move another computer's folders into this computer's backup and sync
|
||||
/// them here. The other computer stays registered, without those folders.
|
||||
Migrate {
|
||||
@@ -992,6 +1002,26 @@ fn cmd_devices(action: DeviceCmd) -> Result<()> {
|
||||
let uid = if clear { None } else { uid };
|
||||
ok_or_bail(control_request(CtlRequest::AdoptDevice { uid })?)?
|
||||
}
|
||||
DeviceCmd::Join { uid, yes } => {
|
||||
if !yes {
|
||||
println!(
|
||||
"This computer syncs into that device alongside it. Its folders are kept\n\
|
||||
in step on both computers: an edit or a deletion on one reaches the other.\n\
|
||||
New synced folders here go under that device too. Folders already synced\n\
|
||||
here stay where they are."
|
||||
);
|
||||
confirm("Sync with it?")?;
|
||||
}
|
||||
let response = control_request(CtlRequest::AdoptDevice { uid: Some(uid) })?;
|
||||
// A script gets the one reply and runs `sync restore` itself.
|
||||
if emit_json(&response)? {
|
||||
return Ok(());
|
||||
}
|
||||
ok_or_bail(response)?;
|
||||
// The device is this machine's now, so the plain restore offers its
|
||||
// folders.
|
||||
cmd_sync_restore(yes, None)?
|
||||
}
|
||||
DeviceCmd::Migrate { uid, yes } => {
|
||||
if !yes {
|
||||
println!(
|
||||
|
||||
Reference in new issue
Block a user