mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-22 18:33:31 +01:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b5d6f2436 | ||
|
|
2c4c95812f | ||
|
|
2bf1622793 | ||
|
|
2ea189f1d9 | ||
|
|
8af671d8ed | ||
|
|
9047bdd741 | ||
|
|
61b992cb48 |
No files matched your search
Generated
+7
-6
@@ -3952,9 +3952,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proton-drive-rs"
|
name = "proton-drive-rs"
|
||||||
version = "0.12.2"
|
version = "0.12.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bdeb7ee7495bc34198c78d7ec569f6371ad01a88f188b5eee418b013b082626a"
|
checksum = "e9f7e67c864033e2d13ff48f9e0738f22ae6401cc47131b266b90c23e0dcc381"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"base64 0.23.1",
|
"base64 0.23.1",
|
||||||
@@ -4022,15 +4022,16 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proton-gallery-rs"
|
name = "proton-gallery-rs"
|
||||||
version = "0.1.1"
|
version = "0.1.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dc9c9bbb76a5fba4071ee90de4aada71c292c0e408024ddfb04a12869291404a"
|
checksum = "e374d2053de5df0e6b0797df65d0d024dbce35f7aedfefd4a656896a0495dc9b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes-gcm 0.11.1",
|
"aes-gcm 0.11.1",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"getrandom 0.4.3",
|
"getrandom 0.4.3",
|
||||||
"hex",
|
"hex",
|
||||||
"kamadak-exif",
|
"kamadak-exif",
|
||||||
|
"proton-base-rs",
|
||||||
"rusqlite",
|
"rusqlite",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -4059,9 +4060,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proton-sdk"
|
name = "proton-sdk"
|
||||||
version = "0.12.2"
|
version = "0.12.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3189873dcdf0bc0a3d0fa5619cea80594085252d1d66a57459ec6adfd1f35ac1"
|
checksum = "a443d600225687a92724b455c025a049b8668fe9da52fbf7cb46583a8e4970a7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes-gcm 0.11.1",
|
"aes-gcm 0.11.1",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
|||||||
+3
-3
@@ -15,10 +15,10 @@ keywords = ["proton", "drive", "fuse", "sync", "linux"]
|
|||||||
categories = ["filesystem", "command-line-utilities"]
|
categories = ["filesystem", "command-line-utilities"]
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
proton-sdk = { version = "0.12.2" }
|
proton-sdk = { version = "0.12.3" }
|
||||||
proton-drive-rs = { version = "0.12.2" }
|
proton-drive-rs = { version = "0.12.3" }
|
||||||
proton-gallery-app-rs = "0.1.0"
|
proton-gallery-app-rs = "0.1.0"
|
||||||
proton-gallery-rs = "0.1.1"
|
proton-gallery-rs = "0.1.5"
|
||||||
chrono = { version = "0.4", default-features = false, features = ["std"] }
|
chrono = { version = "0.4", default-features = false, features = ["std"] }
|
||||||
|
|
||||||
# Internal crates.
|
# Internal crates.
|
||||||
|
|||||||
+102
-5
@@ -158,8 +158,12 @@ enum Command {
|
|||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
forget: bool,
|
forget: bool,
|
||||||
},
|
},
|
||||||
/// Forget the stored session.
|
/// Forget the stored session. Asks first while changes are still queued.
|
||||||
Logout,
|
Logout {
|
||||||
|
/// Do not ask first.
|
||||||
|
#[arg(long)]
|
||||||
|
yes: bool,
|
||||||
|
},
|
||||||
/// Show account login state, and mount status if a daemon is running.
|
/// Show account login state, and mount status if a daemon is running.
|
||||||
Status,
|
Status,
|
||||||
/// List every local Proton Drive location.
|
/// List every local Proton Drive location.
|
||||||
@@ -857,6 +861,13 @@ enum SyncCmd {
|
|||||||
},
|
},
|
||||||
/// List uploads and changes not yet on Proton Drive.
|
/// List uploads and changes not yet on Proton Drive.
|
||||||
Queue,
|
Queue,
|
||||||
|
/// Wait until every queued change is on Proton Drive. Exits 0 once nothing
|
||||||
|
/// is left, 3 when what is left needs you (see `sync issues`), 4 on timeout.
|
||||||
|
Flush {
|
||||||
|
/// Give up after this many seconds.
|
||||||
|
#[arg(long)]
|
||||||
|
timeout: Option<u64>,
|
||||||
|
},
|
||||||
/// List queued changes Proton Drive refused or that keep failing, and what to do.
|
/// List queued changes Proton Drive refused or that keep failing, and what to do.
|
||||||
Issues,
|
Issues,
|
||||||
/// Save the content of a queued upload (by id from `sync queue`) to a file.
|
/// Save the content of a queued upload (by id from `sync queue`) to a file.
|
||||||
@@ -1047,7 +1058,7 @@ fn main() -> Result<()> {
|
|||||||
cli.command,
|
cli.command,
|
||||||
Command::Login { .. }
|
Command::Login { .. }
|
||||||
| Command::Unlock { .. }
|
| Command::Unlock { .. }
|
||||||
| Command::Logout
|
| Command::Logout { .. }
|
||||||
| Command::Mount { .. }
|
| Command::Mount { .. }
|
||||||
| Command::Daemon { .. }
|
| Command::Daemon { .. }
|
||||||
) {
|
) {
|
||||||
@@ -1057,7 +1068,7 @@ fn main() -> Result<()> {
|
|||||||
Command::Login { username, remember } => cmd_login(username, remember),
|
Command::Login { username, remember } => cmd_login(username, remember),
|
||||||
Command::Unlock { remember } => cmd_unlock(remember),
|
Command::Unlock { remember } => cmd_unlock(remember),
|
||||||
Command::Lock { forget } => cmd_lock(forget),
|
Command::Lock { forget } => cmd_lock(forget),
|
||||||
Command::Logout => cmd_logout(),
|
Command::Logout { yes } => cmd_logout(yes),
|
||||||
Command::Status => cmd_status(),
|
Command::Status => cmd_status(),
|
||||||
Command::Locations => cmd_locations(),
|
Command::Locations => cmd_locations(),
|
||||||
Command::Mount { mountpoint } => cmd_mount(mountpoint),
|
Command::Mount { mountpoint } => cmd_mount(mountpoint),
|
||||||
@@ -1362,6 +1373,7 @@ fn cmd_sync(action: SyncCmd) -> Result<()> {
|
|||||||
})?)?
|
})?)?
|
||||||
}
|
}
|
||||||
SyncCmd::Queue => return cmd_sync_queue(),
|
SyncCmd::Queue => return cmd_sync_queue(),
|
||||||
|
SyncCmd::Flush { timeout } => return cmd_sync_flush(timeout),
|
||||||
SyncCmd::Issues => return cmd_sync_issues(),
|
SyncCmd::Issues => return cmd_sync_issues(),
|
||||||
SyncCmd::Export { id, dest } => return cmd_sync_export(id, &dest),
|
SyncCmd::Export { id, dest } => return cmd_sync_export(id, &dest),
|
||||||
SyncCmd::Limit { up, down } => return cmd_sync_limit(up, down),
|
SyncCmd::Limit { up, down } => return cmd_sync_limit(up, down),
|
||||||
@@ -1465,6 +1477,71 @@ fn cmd_sync_queue() -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `pdfs sync flush`: wait for the queue to drain.
|
||||||
|
///
|
||||||
|
/// Failed changes are retried at once rather than after their backoff. The
|
||||||
|
/// wait ends early, with exit code 3, when everything left is waiting on the
|
||||||
|
/// user: refused by Drive, failing again and again, or a temporary file
|
||||||
|
/// waiting for its final name. Paused or offline, it keeps waiting and says
|
||||||
|
/// why.
|
||||||
|
fn cmd_sync_flush(timeout: Option<u64>) -> Result<()> {
|
||||||
|
const POLL: std::time::Duration = std::time::Duration::from_secs(1);
|
||||||
|
let deadline =
|
||||||
|
timeout.map(|secs| std::time::Instant::now() + std::time::Duration::from_secs(secs));
|
||||||
|
ok_or_bail(control_request(CtlRequest::RetryPendingOp { id: None })?)?;
|
||||||
|
let mut last_line = String::new();
|
||||||
|
loop {
|
||||||
|
let items = match control_request(CtlRequest::ListPendingOps)? {
|
||||||
|
CtlResponse::PendingOps { items } => items,
|
||||||
|
CtlResponse::Error { message, kind } => bail!("{}", cli_error(kind, &message)),
|
||||||
|
other => bail!("unexpected response: {other:?}"),
|
||||||
|
};
|
||||||
|
let waiting = items
|
||||||
|
.iter()
|
||||||
|
.filter(|op| !op.parked && !op.failing && op.issue.is_none())
|
||||||
|
.count();
|
||||||
|
if items.is_empty() {
|
||||||
|
finish_line(&last_line);
|
||||||
|
println!("Everything is on Proton Drive.");
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
if waiting == 0 {
|
||||||
|
finish_line(&last_line);
|
||||||
|
eprintln!(
|
||||||
|
"{} queued change(s) need you before they can be sent. See `pdfs sync issues`.",
|
||||||
|
items.len()
|
||||||
|
);
|
||||||
|
std::process::exit(3);
|
||||||
|
}
|
||||||
|
let reason = match control_request(CtlRequest::Status)? {
|
||||||
|
CtlResponse::Status { paused: true, .. } => " (sync is paused; `pdfs sync resume`)",
|
||||||
|
CtlResponse::Status { online: false, .. } => " (offline; waiting for Proton Drive)",
|
||||||
|
_ => "",
|
||||||
|
};
|
||||||
|
let line = format!("{waiting} change(s) left to send{reason}");
|
||||||
|
if line != last_line {
|
||||||
|
if !last_line.is_empty() {
|
||||||
|
print!("\r\x1b[2K");
|
||||||
|
}
|
||||||
|
print!("{line}");
|
||||||
|
last_line = line;
|
||||||
|
}
|
||||||
|
if deadline.is_some_and(|deadline| std::time::Instant::now() >= deadline) {
|
||||||
|
finish_line(&last_line);
|
||||||
|
eprintln!("Timed out with {waiting} change(s) still queued.");
|
||||||
|
std::process::exit(4);
|
||||||
|
}
|
||||||
|
std::thread::sleep(POLL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// End a progress line so the next message starts on its own.
|
||||||
|
fn finish_line(last_line: &str) {
|
||||||
|
if !last_line.is_empty() {
|
||||||
|
println!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// `pdfs sync issues`: the queued changes that need the user, and what to do.
|
/// `pdfs sync issues`: the queued changes that need the user, and what to do.
|
||||||
fn cmd_sync_issues() -> Result<()> {
|
fn cmd_sync_issues() -> Result<()> {
|
||||||
let response = control_request(CtlRequest::ListPendingOps)?;
|
let response = control_request(CtlRequest::ListPendingOps)?;
|
||||||
@@ -2298,7 +2375,27 @@ fn key_state_name() -> &'static str {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cmd_logout() -> Result<()> {
|
fn cmd_logout(yes: bool) -> Result<()> {
|
||||||
|
// Queued changes stay staged on this computer and are sent after the next
|
||||||
|
// sign-in, but until then they exist nowhere else. Without a running
|
||||||
|
// daemon there is no count to show.
|
||||||
|
if !yes
|
||||||
|
&& let Ok(CtlResponse::Status {
|
||||||
|
pending_uploads,
|
||||||
|
pending_changes,
|
||||||
|
parked_uploads,
|
||||||
|
..
|
||||||
|
}) = control_request(CtlRequest::Status)
|
||||||
|
{
|
||||||
|
let queued = pending_uploads + pending_changes + parked_uploads;
|
||||||
|
if queued > 0 {
|
||||||
|
println!(
|
||||||
|
"{queued} change(s) are not on Proton Drive yet. They stay on this computer and are \
|
||||||
|
sent after you sign in again. Run `pdfs sync flush` first to send them now."
|
||||||
|
);
|
||||||
|
confirm("Sign out anyway?")?;
|
||||||
|
}
|
||||||
|
}
|
||||||
if auth::logout()? {
|
if auth::logout()? {
|
||||||
println!("Signed out: the session is ended on Proton and cleared here.");
|
println!("Signed out: the session is ended on Proton and cleared here.");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,129 @@
|
|||||||
|
//! Hold off a shutdown while queued changes exist only on this computer.
|
||||||
|
//!
|
||||||
|
//! A change made through the mount is staged here and sent by the drain. Until
|
||||||
|
//! it lands, this computer has the only copy, so powering off then risks it
|
||||||
|
//! more than the user expects (`docs/BUGS.md` B66). While the queue holds work
|
||||||
|
//! the drain can still send, the daemon takes a logind shutdown inhibitor
|
||||||
|
//! through `systemd-inhibit`, which desktops show in their power-off dialog
|
||||||
|
//! with the reason. It is let go as soon as the queue empties.
|
||||||
|
//!
|
||||||
|
//! Work that cannot drain on its own — a temporary file waiting for its final
|
||||||
|
//! name, or a change Drive refused or that keeps failing — never holds the
|
||||||
|
//! lock, or a shutdown would be held up for something that is not coming.
|
||||||
|
//! Without `systemd-inhibit` nothing happens.
|
||||||
|
|
||||||
|
use std::process::{Child, Command, Stdio};
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use pdfs_core::db::PendingCounts;
|
||||||
|
use tracing::{debug, warn};
|
||||||
|
|
||||||
|
use super::Core;
|
||||||
|
|
||||||
|
/// How often the queue is looked at.
|
||||||
|
const CHECK_EVERY: Duration = Duration::from_secs(5);
|
||||||
|
|
||||||
|
/// Changes the drain can still send by itself.
|
||||||
|
fn sendable(counts: &PendingCounts) -> i64 {
|
||||||
|
(counts.uploads + counts.changes - counts.parked - counts.failing).max(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Run until the daemon stops, holding the inhibitor while changes wait.
|
||||||
|
pub(crate) fn run(core: Core) {
|
||||||
|
let mut held: Option<Child> = None;
|
||||||
|
loop {
|
||||||
|
let waiting = core
|
||||||
|
.db
|
||||||
|
.pending_op_counts()
|
||||||
|
.map(|counts| sendable(&counts))
|
||||||
|
.unwrap_or(0);
|
||||||
|
// The helper can go away (logind restarted, or it was killed); the
|
||||||
|
// lock is then taken again on the next round.
|
||||||
|
if let Some(child) = &mut held
|
||||||
|
&& !matches!(child.try_wait(), Ok(None))
|
||||||
|
{
|
||||||
|
held = None;
|
||||||
|
}
|
||||||
|
match (&mut held, waiting > 0) {
|
||||||
|
(None, true) => held = take(waiting),
|
||||||
|
(Some(child), false) => {
|
||||||
|
release(child);
|
||||||
|
held = None;
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
if !core.shutdown.sleep(CHECK_EVERY) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Some(mut child) = held {
|
||||||
|
release(&mut child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn take(waiting: i64) -> Option<Child> {
|
||||||
|
let why = if waiting == 1 {
|
||||||
|
"Sending 1 change to Proton Drive".to_string()
|
||||||
|
} else {
|
||||||
|
format!("Sending {waiting} changes to Proton Drive")
|
||||||
|
};
|
||||||
|
match Command::new("systemd-inhibit")
|
||||||
|
.args([
|
||||||
|
"--what=shutdown",
|
||||||
|
"--who=Proton Drive",
|
||||||
|
&format!("--why={why}"),
|
||||||
|
"--mode=block",
|
||||||
|
"sleep",
|
||||||
|
"infinity",
|
||||||
|
])
|
||||||
|
.stdin(Stdio::null())
|
||||||
|
.stdout(Stdio::null())
|
||||||
|
.stderr(Stdio::null())
|
||||||
|
.spawn()
|
||||||
|
{
|
||||||
|
Ok(child) => {
|
||||||
|
debug!(waiting, "holding off shutdown while changes are queued");
|
||||||
|
Some(child)
|
||||||
|
}
|
||||||
|
Err(error) if error.kind() == std::io::ErrorKind::NotFound => None,
|
||||||
|
Err(error) => {
|
||||||
|
warn!(%error, "taking the shutdown inhibitor failed");
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn release(child: &mut Child) {
|
||||||
|
let _ = child.kill();
|
||||||
|
let _ = child.wait();
|
||||||
|
debug!("queue drained; shutdown no longer held off");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
fn counts(uploads: i64, changes: i64, parked: i64, failing: i64) -> PendingCounts {
|
||||||
|
PendingCounts {
|
||||||
|
uploads,
|
||||||
|
changes,
|
||||||
|
parked,
|
||||||
|
failing,
|
||||||
|
last_error: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn only_work_the_drain_can_send_holds_off_a_shutdown() {
|
||||||
|
assert_eq!(sendable(&counts(0, 0, 0, 0)), 0);
|
||||||
|
assert_eq!(sendable(&counts(2, 1, 0, 0)), 3);
|
||||||
|
assert_eq!(sendable(&counts(1, 0, 1, 0)), 0);
|
||||||
|
assert_eq!(sendable(&counts(2, 0, 0, 2)), 0);
|
||||||
|
assert_eq!(sendable(&counts(3, 2, 1, 1)), 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn counts_that_overlap_never_go_negative() {
|
||||||
|
assert_eq!(sendable(&counts(1, 0, 1, 1)), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -92,6 +92,7 @@ use drive::{DriveApi, RevisionRead};
|
|||||||
mod events;
|
mod events;
|
||||||
mod filesystem;
|
mod filesystem;
|
||||||
mod gallery;
|
mod gallery;
|
||||||
|
mod inhibit;
|
||||||
mod keeper;
|
mod keeper;
|
||||||
mod link;
|
mod link;
|
||||||
pub use filesystem::ProtonFs;
|
pub use filesystem::ProtonFs;
|
||||||
|
|||||||
@@ -793,6 +793,17 @@ pub(crate) fn mount_with(
|
|||||||
warn!(%error, "start My Files share-id repair failed");
|
warn!(%error, "start My Files share-id repair failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Hold off a shutdown while changes exist only here (B66). Only the real
|
||||||
|
// daemon: a simulation's queue is not the user's data.
|
||||||
|
if matches!(host, Host::Daemon) {
|
||||||
|
let inhibit_core = core.clone();
|
||||||
|
if let Err(error) = std::thread::Builder::new()
|
||||||
|
.name("pdfs-inhibit".into())
|
||||||
|
.spawn(move || crate::inhibit::run(inhibit_core))
|
||||||
|
{
|
||||||
|
warn!(%error, "start the shutdown inhibitor failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Stop signals (SIGTERM from `systemctl --user stop`, SIGINT from Ctrl-C)
|
// Stop signals (SIGTERM from `systemctl --user stop`, SIGINT from Ctrl-C)
|
||||||
// are delivered onto the async runtime; bridge them onto a sync channel so
|
// are delivered onto the async runtime; bridge them onto a sync channel so
|
||||||
|
|||||||
@@ -675,15 +675,45 @@ fn verify_in_browser(
|
|||||||
/// Sign out, after a confirmation: disable+stop the mount service (so the
|
/// Sign out, after a confirmation: disable+stop the mount service (so the
|
||||||
/// daemon isn't left running without credentials), forget the stored session,
|
/// daemon isn't left running without credentials), forget the stored session,
|
||||||
/// and drop back to the login page.
|
/// and drop back to the login page.
|
||||||
|
///
|
||||||
|
/// Changes still queued are named first: they stay staged here and are sent
|
||||||
|
/// after the next sign-in, but until then they exist nowhere else.
|
||||||
pub(crate) fn sign_out(ui: &Rc<Ui>) {
|
pub(crate) fn sign_out(ui: &Rc<Ui>) {
|
||||||
|
let rx = spawn_request(ui.dirs.control_socket(), Request::Status);
|
||||||
|
let ui = ui.clone();
|
||||||
|
glib::spawn_future_local(async move {
|
||||||
|
let queued = match rx.recv().await {
|
||||||
|
Ok(Ok(Response::Status {
|
||||||
|
pending_uploads,
|
||||||
|
pending_changes,
|
||||||
|
parked_uploads,
|
||||||
|
..
|
||||||
|
})) => pending_uploads + pending_changes + parked_uploads,
|
||||||
|
_ => 0,
|
||||||
|
};
|
||||||
|
confirm_sign_out(&ui, queued);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fn confirm_sign_out(ui: &Rc<Ui>, queued: u64) {
|
||||||
let Some(window) = ui_window(ui) else { return };
|
let Some(window) = ui_window(ui) else { return };
|
||||||
let ui = ui.clone();
|
let ui = ui.clone();
|
||||||
|
let mut body = gettext(
|
||||||
|
"Proton Drive will disconnect and stop syncing until you sign in again. Files already on this computer stay where they are.",
|
||||||
|
);
|
||||||
|
if queued > 0 {
|
||||||
|
let warning = ngettext_f(
|
||||||
|
"{n} change is not on Proton Drive yet. It stays on this computer and is sent after you sign in again.",
|
||||||
|
"{n} changes are not on Proton Drive yet. They stay on this computer and are sent after you sign in again.",
|
||||||
|
queued,
|
||||||
|
&[],
|
||||||
|
);
|
||||||
|
body = format!("{warning}\n\n{body}");
|
||||||
|
}
|
||||||
confirm_destructive(
|
confirm_destructive(
|
||||||
&window,
|
&window,
|
||||||
&gettext("Sign Out?"),
|
&gettext("Sign Out?"),
|
||||||
&gettext(
|
&body,
|
||||||
"Proton Drive will disconnect and stop syncing until you sign in again. Files already on this computer stay where they are.",
|
|
||||||
),
|
|
||||||
&gettext("Sign Out"),
|
&gettext("Sign Out"),
|
||||||
move || {
|
move || {
|
||||||
let galleries = ui.drive_galleries.borrow().upgrade();
|
let galleries = ui.drive_galleries.borrow().upgrade();
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
//! a single photo opens it in its town, and photos taken on one spot, which
|
//! a single photo opens it in its town, and photos taken on one spot, which
|
||||||
//! never part, are listed to pick from.
|
//! never part, are listed to pick from.
|
||||||
|
|
||||||
|
// Markers merge the same way in every Proton gallery app.
|
||||||
|
use proton_gallery_rs::places::{Bubble, bubble_radius, cluster, compact_count};
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
@@ -137,13 +139,6 @@ fn parse_ring(line: &str) -> Option<Ring> {
|
|||||||
Some(Ring { points, min, max })
|
Some(Ring { points, min, max })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Radius in px of a marker holding `photos` photos: big enough to make the
|
|
||||||
/// photo out, and growing with the count, but slowly, so a home town with
|
|
||||||
/// thousands doesn't cover a continent.
|
|
||||||
fn bubble_radius(photos: usize) -> f64 {
|
|
||||||
18.0 + 2.0 * (photos.max(1) as f64).ln()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// What the map shows: which part of the world, at what size.
|
/// What the map shows: which part of the world, at what size.
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
struct View {
|
struct View {
|
||||||
@@ -195,17 +190,6 @@ struct Marker {
|
|||||||
target: Target,
|
target: Target,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// One marker as last drawn, standing for one or more [`Marker`]s: where, how
|
|
||||||
/// big, and which (indices into [`MapState::markers`], the one with the most
|
|
||||||
/// photos first).
|
|
||||||
struct Bubble {
|
|
||||||
x: f64,
|
|
||||||
y: f64,
|
|
||||||
radius: f64,
|
|
||||||
photos: usize,
|
|
||||||
members: Vec<usize>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A street-map tile ready to draw, and the names on it.
|
/// A street-map tile ready to draw, and the names on it.
|
||||||
struct CachedTile {
|
struct CachedTile {
|
||||||
surface: cairo::ImageSurface,
|
surface: cairo::ImageSurface,
|
||||||
@@ -1648,52 +1632,6 @@ fn spread(points: &[World]) -> f64 {
|
|||||||
span(&mut xs.into_iter()).max(span(&mut ys.into_iter()))
|
span(&mut xs.into_iter()).max(span(&mut ys.into_iter()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Merge markers whose circles would overlap on screen, the one with the
|
|
||||||
/// most photos claiming its neighbours (the first of equals, when counts
|
|
||||||
/// tie). Markers off screen are left out.
|
|
||||||
fn cluster(screen: &[(f64, f64)], counts: &[usize], width: f64, height: f64) -> Vec<Bubble> {
|
|
||||||
let mut order: Vec<usize> = (0..screen.len()).collect();
|
|
||||||
order.sort_by(|a, b| counts[*b].cmp(&counts[*a]));
|
|
||||||
let mut bubbles: Vec<Bubble> = Vec::new();
|
|
||||||
for index in order {
|
|
||||||
let (x, y) = screen[index];
|
|
||||||
let reach = bubble_radius(counts[index]);
|
|
||||||
if x < -reach || y < -reach || x > width + reach || y > height + reach {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
match bubbles
|
|
||||||
.iter_mut()
|
|
||||||
.find(|b| (b.x - x).hypot(b.y - y) < b.radius + reach * 0.5)
|
|
||||||
{
|
|
||||||
Some(bubble) => {
|
|
||||||
bubble.photos += counts[index];
|
|
||||||
bubble.radius = bubble_radius(bubble.photos);
|
|
||||||
bubble.members.push(index);
|
|
||||||
}
|
|
||||||
None => bubbles.push(Bubble {
|
|
||||||
x,
|
|
||||||
y,
|
|
||||||
radius: reach,
|
|
||||||
photos: counts[index],
|
|
||||||
members: vec![index],
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Smallest last, so a small marker next to a big one stays clickable.
|
|
||||||
bubbles.sort_by(|a, b| b.radius.total_cmp(&a.radius));
|
|
||||||
bubbles
|
|
||||||
}
|
|
||||||
|
|
||||||
/// "7", "840", "1.2k", "35k": short enough to fit a marker. Digits and the
|
|
||||||
/// "k" read the same in every language the app ships.
|
|
||||||
fn compact_count(n: usize) -> String {
|
|
||||||
match n {
|
|
||||||
0..1_000 => n.to_string(),
|
|
||||||
1_000..10_000 => format!("{:.1}k", n as f64 / 1_000.0),
|
|
||||||
_ => format!("{}k", n / 1_000),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn set_color(cr: &cairo::Context, color: >k4::gdk::RGBA, alpha: f32) {
|
fn set_color(cr: &cairo::Context, color: >k4::gdk::RGBA, alpha: f32) {
|
||||||
cr.set_source_rgba(
|
cr.set_source_rgba(
|
||||||
f64::from(color.red()),
|
f64::from(color.red()),
|
||||||
|
|||||||
+15
-2
@@ -74,7 +74,6 @@ original wording.
|
|||||||
| [B134](#b134--a-file-deleted-online-while-the-drain-checks-its-write-is-kept-as-a-conflict-copy) | A file deleted online while the drain checks its write is kept as a conflict copy | Only with `local_first` off |
|
| [B134](#b134--a-file-deleted-online-while-the-drain-checks-its-write-is-kept-as-a-conflict-copy) | A file deleted online while the drain checks its write is kept as a conflict copy | Only with `local_first` off |
|
||||||
| [B91](#b91--the-daemon-hung-overnight-and-nothing-could-say-what-it-was-waiting-on) | The daemon hung overnight, and nothing could say what it was waiting on | The cause is not diagnosed; the daemon now reports where it is stuck and is restarted |
|
| [B91](#b91--the-daemon-hung-overnight-and-nothing-could-say-what-it-was-waiting-on) | The daemon hung overnight, and nothing could say what it was waiting on | The cause is not diagnosed; the daemon now reports where it is stuck and is restarted |
|
||||||
| [B67](#b67--fresh-state-restore-can-silently-select-a-new-device-high-22) | Fresh-state restore can silently select a new device (HIGH-22) | An ambiguous device after a loss of local state is not asked about |
|
| [B67](#b67--fresh-state-restore-can-silently-select-a-new-device-high-22) | Fresh-state restore can silently select a new device (HIGH-22) | An ambiguous device after a loss of local state is not asked about |
|
||||||
| [B66](#b66--local-only-pending-data-is-not-protected-at-shutdown-high-21) | Local-only pending data is not protected at shutdown (HIGH-21) | No shutdown protection and no `pdfs sync flush` |
|
|
||||||
| [B65](#b65--release-artifacts-lack-supply-chain-verification-med-11) | Release artifacts lack supply-chain verification (MED-11) | No SBOM, provenance or checksums |
|
| [B65](#b65--release-artifacts-lack-supply-chain-verification-med-11) | Release artifacts lack supply-chain verification (MED-11) | No SBOM, provenance or checksums |
|
||||||
| [B15](#b15--an-empty-but-listed-folder-and-duplicated-folder-uids) | An empty-but-`listed` folder, and duplicated folder uids | Cause not attributed |
|
| [B15](#b15--an-empty-but-listed-folder-and-duplicated-folder-uids) | An empty-but-`listed` folder, and duplicated folder uids | Cause not attributed |
|
||||||
| [B10](#b10--glib-critical-when-the-launcher-closes-over-an-in-flight-open) | GLib critical when the launcher closes over an in-flight open | |
|
| [B10](#b10--glib-critical-when-the-launcher-closes-over-an-in-flight-open) | GLib critical when the launcher closes over an in-flight open | |
|
||||||
@@ -109,6 +108,7 @@ a live account since.
|
|||||||
|
|
||||||
| Entry | Title |
|
| Entry | Title |
|
||||||
|---|---|
|
|---|---|
|
||||||
|
| [B66](#b66--local-only-pending-data-is-not-protected-at-shutdown-high-21) | Local-only pending data is not protected at shutdown (HIGH-21) |
|
||||||
| [B291](#b291--on-fedora-45s-oo7-every-saved-sign-in-is-lost-at-the-next-reboot) | On Fedora 45's oo7, every saved sign-in is lost at the next reboot |
|
| [B291](#b291--on-fedora-45s-oo7-every-saved-sign-in-is-lost-at-the-next-reboot) | On Fedora 45's oo7, every saved sign-in is lost at the next reboot |
|
||||||
| [B289](#b289--the-takeout-import-mixes-in-other-services-and-drops-location-and-live-photos) | The Takeout import mixes in other services and drops location and live photos |
|
| [B289](#b289--the-takeout-import-mixes-in-other-services-and-drops-location-and-live-photos) | The Takeout import mixes in other services and drops location and live photos |
|
||||||
| [B288](#b288--an-interrupted-takeout-import-reads-as-finished-and-one-error-ends-it) | An interrupted Takeout import reads as finished, and one error ends it |
|
| [B288](#b288--an-interrupted-takeout-import-reads-as-finished-and-one-error-ends-it) | An interrupted Takeout import reads as finished, and one error ends it |
|
||||||
@@ -7475,7 +7475,7 @@ duplicates, renamed folders, multiple devices, and byte-identical restoration.
|
|||||||
|
|
||||||
### B66 — Local-only pending data is not protected at shutdown (HIGH-21)
|
### B66 — Local-only pending data is not protected at shutdown (HIGH-21)
|
||||||
|
|
||||||
**Status:** Open — 1.0 data-safety/UX blocker
|
**Status:** Fixed, unverified live
|
||||||
**Found:** 2026-07-22, 1.0 recovery audit
|
**Found:** 2026-07-22, 1.0 recovery audit
|
||||||
**Where:** shutdown, CLI/GUI status, logout/unregister workflows
|
**Where:** shutdown, CLI/GUI status, logout/unregister workflows
|
||||||
|
|
||||||
@@ -7488,6 +7488,19 @@ and last errors, and protect destructive lifecycle actions. Test offline stop,
|
|||||||
logout, unregister, reboot, retry exhaustion, and drain. Credential removal must
|
logout, unregister, reboot, retry exhaustion, and drain. Credential removal must
|
||||||
never delete staged bytes.
|
never delete staged bytes.
|
||||||
|
|
||||||
|
**Fix:** `crates/pdfs-fuse/src/inhibit.rs` takes a logind shutdown inhibitor
|
||||||
|
(`systemd-inhibit --what=shutdown --mode=block`) while the queue holds changes
|
||||||
|
the drain can send, and lets it go once they land. Parked transient files and
|
||||||
|
changes that need the user are left out, so they never hold a power-off up for
|
||||||
|
good. `pdfs sync flush` retries failed changes and waits for the queue, with
|
||||||
|
its own exit codes for "needs you" and timeout. `pdfs logout` and the app's
|
||||||
|
Sign Out dialog say how many changes are still queued and that they stay
|
||||||
|
staged. Credential removal never touched `staging/`.
|
||||||
|
|
||||||
|
**Verified:** unit tests for which work holds the lock; `systemd-inhibit` in
|
||||||
|
block mode taken by a user process on 2026-11-21. A power-off with a queued
|
||||||
|
upload is still owed.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### B65 — Release artifacts lack supply-chain verification (MED-11)
|
### B65 — Release artifacts lack supply-chain verification (MED-11)
|
||||||
|
|||||||
@@ -11,6 +11,16 @@ scratch (user data in `staging/` and `recovery/` is never touched by this).
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- `pdfs sync flush` waits until every queued change is on Proton Drive, retrying
|
||||||
|
failed ones at once. It exits 3 when what is left needs you and 4 on `--timeout`.
|
||||||
|
- While changes are queued that only this computer has, the daemon holds off a
|
||||||
|
shutdown through logind, and desktops show "Sending N changes to Proton Drive" in
|
||||||
|
their power-off dialog. Changes waiting on you never hold it up (B66).
|
||||||
|
- Signing out, in the app or with `pdfs logout`, says how many changes are not on
|
||||||
|
Proton Drive yet. They stay on this computer and are sent after the next sign-in.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Signing in runs through `proton_sdk::login` (proton-sdk 0.12.2), the sequence Proton
|
- Signing in runs through `proton_sdk::login` (proton-sdk 0.12.2), the sequence Proton
|
||||||
|
|||||||
+2
-1
@@ -70,7 +70,7 @@ The script runs `pdfs` from `PATH` on every Tab, so it keeps working after an up
|
|||||||
| `pdfs login [-u EMAIL] [--remember]` | Sign in (password, then a 2FA code if the account has one) and store the session in the system keyring. Restarts the service if it is running. `--remember` keeps a two-password account unlocked across logins. |
|
| `pdfs login [-u EMAIL] [--remember]` | Sign in (password, then a 2FA code if the account has one) and store the session in the system keyring. Restarts the service if it is running. `--remember` keeps a two-password account unlocked across logins. |
|
||||||
| `pdfs unlock [--remember]` | Enter the mailbox password of a two-password account, so the service can open your files. Needed once per login session, or once with `--remember`. |
|
| `pdfs unlock [--remember]` | Enter the mailbox password of a two-password account, so the service can open your files. Needed once per login session, or once with `--remember`. |
|
||||||
| `pdfs lock` | Forget the unlock held in memory; the account is locked again. |
|
| `pdfs lock` | Forget the unlock held in memory; the account is locked again. |
|
||||||
| `pdfs logout` | End the session on Proton and remove the stored session. |
|
| `pdfs logout [--yes]` | End the session on Proton and remove the stored session. Asks first while changes are still queued; they stay on this computer and are sent after the next sign-in. |
|
||||||
| `pdfs status` | Account, mount, queue and cache state. |
|
| `pdfs status` | Account, mount, queue and cache state. |
|
||||||
| `pdfs quota` | Storage used across all Proton products. |
|
| `pdfs quota` | Storage used across all Proton products. |
|
||||||
| `pdfs locations` | Every local place the service occupies: the Proton Drive folder and each synced folder, with mode and state. |
|
| `pdfs locations` | Every local place the service occupies: the Proton Drive folder and each synced folder, with mode and state. |
|
||||||
@@ -125,6 +125,7 @@ commands are for scripts and for cases where the mount is not available.
|
|||||||
| `pdfs sync ignore check PATH` | Say whether a file in a synced folder is synced, and which pattern decides. |
|
| `pdfs sync ignore check PATH` | Say whether a file in a synced folder is synced, and which pattern decides. |
|
||||||
| `pdfs sync limit [--up RATE] [--down RATE]` | Cap bandwidth, for example `500K` or `2M` per second. `0` removes a cap. Without options, prints the current caps. |
|
| `pdfs sync limit [--up RATE] [--down RATE]` | Cap bandwidth, for example `500K` or `2M` per second. `0` removes a cap. Without options, prints the current caps. |
|
||||||
| `pdfs sync queue` | List changes that have not reached Proton Drive yet. |
|
| `pdfs sync queue` | List changes that have not reached Proton Drive yet. |
|
||||||
|
| `pdfs sync flush [--timeout SECS]` | Retry failed changes now and wait until the queue is empty. Exits 0 when everything is on Proton Drive, 3 when what is left needs you (see `sync issues`), 4 on timeout. Says so while sync is paused or offline. |
|
||||||
| `pdfs sync issues` | List queued changes Proton Drive refused or that keep failing, and what to do. |
|
| `pdfs sync issues` | List queued changes Proton Drive refused or that keep failing, and what to do. |
|
||||||
| `pdfs sync export ID DEST` | Save a copy of a queued upload's content. `DEST` may be a folder; an existing file is never overwritten. The upload stays queued. |
|
| `pdfs sync export ID DEST` | Save a copy of a queued upload's content. `DEST` may be a folder; an existing file is never overwritten. The upload stays queued. |
|
||||||
| `pdfs sync discard ID [--yes]` | Drop a queued change and undo it here: a new file or folder goes, anything else goes back to what Proton Drive has. Content not exported first is lost. |
|
| `pdfs sync discard ID [--yes]` | Drop a queued change and undo it here: a new file or folder goes, anything else goes back to what Proton Drive has. Content not exported first is lost. |
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ them along.
|
|||||||
|
|
||||||
| Item | State | Notes |
|
| Item | State | Notes |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| Protect queued changes at shutdown | Not started | A systemd inhibitor lock while `staging/` holds unsent data, a warning when signing out, and a `pdfs sync flush` that waits for the queue. Today the queue is visible in `pdfs sync queue`, the tray and **Sync → Overview**, but nothing stops a shutdown (B66) |
|
| Protect queued changes at shutdown | Done, live check owed | The daemon holds a logind shutdown inhibitor while the queue holds changes it can send, signing out warns with the count, and `pdfs sync flush` waits for the queue (B66) |
|
||||||
| Restore pins from the machine profile | Not started | `profile.json` records pins; `pdfs sync restore` does not apply them yet |
|
| Restore pins from the machine profile | Not started | `profile.json` records pins; `pdfs sync restore` does not apply them yet |
|
||||||
| Profile backup health | Not started | A failed profile upload is a `WARN` in the log and nothing in the app (B68) |
|
| Profile backup health | Not started | A failed profile upload is a `WARN` in the log and nothing in the app (B68) |
|
||||||
| Rotated credentials survive a keyring failure | Open | Report and retry keyring write failures, so a rotated single-use refresh token is not lost (B61) |
|
| Rotated credentials survive a keyring failure | Open | Report and retry keyring write failures, so a rotated single-use refresh token is not lost (B61) |
|
||||||
|
|||||||
+371
-360
File diff suppressed because it is too large.
Load diff
+371
-360
File diff suppressed because it is too large.
Load diff
+371
-360
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user