mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-16 17:51:59 +01:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9d6d4a907 | ||
|
|
6fa91e83f1 | ||
|
|
f239dffbcc | ||
|
|
e011a0d89f | ||
|
|
f2c4c05f27 | ||
|
|
8598aff7dd | ||
|
|
38a8db0e3e | ||
|
|
7d445bb02c |
No files matched your search
+136
-37
@@ -15,8 +15,8 @@ use pdfs_core::cache::ContentCache;
|
|||||||
use pdfs_core::config::AppDirs;
|
use pdfs_core::config::AppDirs;
|
||||||
use pdfs_core::control::{
|
use pdfs_core::control::{
|
||||||
ConflictKeep, ErrorKind, LinkChange, MountKind, RefreshScope, Request as CtlRequest,
|
ConflictKeep, ErrorKind, LinkChange, MountKind, RefreshScope, Request as CtlRequest,
|
||||||
Response as CtlResponse, RestoreItem as CtlRestoreItem, ShareEntryKind, SyncIssue, SyncPhase,
|
Response as CtlResponse, RestoreItem as CtlRestoreItem, ShareEntryKind, SyncFolderInfo,
|
||||||
daemon_outdated, pending_summary,
|
SyncIssue, SyncPhase, daemon_outdated, pending_summary,
|
||||||
};
|
};
|
||||||
use pdfs_core::db::Db;
|
use pdfs_core::db::Db;
|
||||||
use pdfs_core::service;
|
use pdfs_core::service;
|
||||||
@@ -752,20 +752,30 @@ enum ConflictCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// `pdfs sync ignore`: the patterns in `ignore_patterns`, for every synced
|
/// `pdfs sync ignore`: the patterns in `ignore_patterns`, for every synced
|
||||||
/// folder. A folder's own rules are in its `.pdfsignore`.
|
/// folder, or with `--folder` the ones in that folder's own `.pdfsignore`.
|
||||||
#[derive(Subcommand, Debug)]
|
#[derive(Subcommand, Debug)]
|
||||||
enum IgnoreCmd {
|
enum IgnoreCmd {
|
||||||
/// List the patterns every synced folder leaves out.
|
/// List the patterns every synced folder leaves out, or one folder's own.
|
||||||
List,
|
List {
|
||||||
|
/// List the own patterns of the synced folder holding this path.
|
||||||
|
#[arg(long, value_hint = ValueHint::DirPath)]
|
||||||
|
folder: Option<PathBuf>,
|
||||||
|
},
|
||||||
/// Leave out files matching a gitignore-style pattern, e.g. `*.db` or `build/`.
|
/// Leave out files matching a gitignore-style pattern, e.g. `*.db` or `build/`.
|
||||||
Add {
|
Add {
|
||||||
/// The pattern; end it with `/` to match folders only.
|
/// The pattern; end it with `/` to match folders only.
|
||||||
pattern: String,
|
pattern: String,
|
||||||
|
/// Add it only for the synced folder holding this path.
|
||||||
|
#[arg(long, value_hint = ValueHint::DirPath)]
|
||||||
|
folder: Option<PathBuf>,
|
||||||
},
|
},
|
||||||
/// Stop leaving out files matching a pattern.
|
/// Stop leaving out files matching a pattern.
|
||||||
Remove {
|
Remove {
|
||||||
/// The pattern, as `sync ignore list` shows it.
|
/// The pattern, as `sync ignore list` shows it.
|
||||||
pattern: String,
|
pattern: String,
|
||||||
|
/// Remove it from the own patterns of the synced folder holding this path.
|
||||||
|
#[arg(long, value_hint = ValueHint::DirPath)]
|
||||||
|
folder: Option<PathBuf>,
|
||||||
},
|
},
|
||||||
/// Go back to the built-in patterns.
|
/// Go back to the built-in patterns.
|
||||||
Reset,
|
Reset,
|
||||||
@@ -3733,27 +3743,26 @@ fn cmd_sync_limit(up: Option<u64>, down: Option<u64>) -> Result<()> {
|
|||||||
|
|
||||||
fn cmd_sync_ignore(action: IgnoreCmd) -> Result<()> {
|
fn cmd_sync_ignore(action: IgnoreCmd) -> Result<()> {
|
||||||
use pdfs_core::syncignore::{
|
use pdfs_core::syncignore::{
|
||||||
DEFAULT_IGNORE_PATTERNS, IgnoreRules, RuleSource, Verdict, check_pattern,
|
DEFAULT_IGNORE_PATTERNS, FolderRules, IgnoreRules, RuleSource, Verdict, add_folder_pattern,
|
||||||
|
check_pattern, remove_folder_pattern,
|
||||||
};
|
};
|
||||||
let dirs = AppDirs::new()?;
|
let dirs = AppDirs::new()?;
|
||||||
let defaults: Vec<String> = DEFAULT_IGNORE_PATTERNS
|
|
||||||
.iter()
|
|
||||||
.map(|p| (*p).to_string())
|
|
||||||
.collect();
|
|
||||||
// A list equal to the built-in one is stored as unset, so it follows the
|
|
||||||
// built-in list in later releases, as Preferences does.
|
|
||||||
let change = |edit: &dyn Fn(&mut Vec<String>)| -> Result<()> {
|
let change = |edit: &dyn Fn(&mut Vec<String>)| -> Result<()> {
|
||||||
dirs.update_config(|config| {
|
dirs.change_ignore_patterns(edit)?;
|
||||||
let mut list = config.resolved_ignore_patterns();
|
|
||||||
edit(&mut list);
|
|
||||||
config.ignore_patterns = (list != defaults).then_some(list);
|
|
||||||
})?;
|
|
||||||
// The next pass picks the change up anyway; this only hurries it.
|
// The next pass picks the change up anyway; this only hurries it.
|
||||||
let _ = control_request(CtlRequest::SyncNow { id: None });
|
let _ = control_request(CtlRequest::SyncNow { id: None });
|
||||||
Ok(())
|
Ok(())
|
||||||
};
|
};
|
||||||
|
let valid = |pattern: &str| -> Result<String> {
|
||||||
|
let pattern = pattern.trim();
|
||||||
|
if pattern.is_empty() || pattern.starts_with('#') {
|
||||||
|
bail!("not a pattern: `{pattern}`");
|
||||||
|
}
|
||||||
|
check_pattern(pattern).map_err(|e| anyhow!("not a valid pattern: {e}"))?;
|
||||||
|
Ok(pattern.to_string())
|
||||||
|
};
|
||||||
match action {
|
match action {
|
||||||
IgnoreCmd::List => {
|
IgnoreCmd::List { folder: None } => {
|
||||||
let config = dirs.load_config();
|
let config = dirs.load_config();
|
||||||
let list = config.resolved_ignore_patterns();
|
let list = config.resolved_ignore_patterns();
|
||||||
if list.is_empty() {
|
if list.is_empty() {
|
||||||
@@ -3767,39 +3776,80 @@ fn cmd_sync_ignore(action: IgnoreCmd) -> Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IgnoreCmd::Add { pattern } => {
|
IgnoreCmd::List {
|
||||||
let pattern = pattern.trim().to_string();
|
folder: Some(folder),
|
||||||
if let Err(e) = check_pattern(&pattern) {
|
} => {
|
||||||
bail!("not a valid pattern: {e}");
|
let (_, root) = mirror_folder_of(&folder)?;
|
||||||
|
let rules = FolderRules::read(&root)?;
|
||||||
|
let patterns = rules.patterns();
|
||||||
|
if patterns.is_empty() {
|
||||||
|
println!(
|
||||||
|
"{} has no own patterns; the ones for all synced folders apply.",
|
||||||
|
root.display()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
for pattern in patterns {
|
||||||
|
println!("{pattern}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IgnoreCmd::Add {
|
||||||
|
pattern,
|
||||||
|
folder: None,
|
||||||
|
} => {
|
||||||
|
let pattern = valid(&pattern)?;
|
||||||
change(&|list| {
|
change(&|list| {
|
||||||
if !list.contains(&pattern) {
|
if !list.contains(&pattern) {
|
||||||
list.push(pattern.clone());
|
list.push(pattern.clone());
|
||||||
}
|
}
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
IgnoreCmd::Remove { pattern } => {
|
IgnoreCmd::Add {
|
||||||
|
pattern,
|
||||||
|
folder: Some(folder),
|
||||||
|
} => {
|
||||||
|
let pattern = valid(&pattern)?;
|
||||||
|
let (id, root) = mirror_folder_of(&folder)?;
|
||||||
|
if add_folder_pattern(&root, &pattern)? {
|
||||||
|
let _ = control_request(CtlRequest::SyncNow { id: Some(id) });
|
||||||
|
} else {
|
||||||
|
println!("`{pattern}` is already in {}/.pdfsignore.", root.display());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IgnoreCmd::Remove {
|
||||||
|
pattern,
|
||||||
|
folder: None,
|
||||||
|
} => {
|
||||||
|
let pattern = pattern.trim().to_string();
|
||||||
let list = dirs.load_config().resolved_ignore_patterns();
|
let list = dirs.load_config().resolved_ignore_patterns();
|
||||||
if !list.contains(&pattern) {
|
if !list.contains(&pattern) {
|
||||||
bail!("`{pattern}` is not in the list; see `pdfs sync ignore list`");
|
bail!("`{pattern}` is not in the list; see `pdfs sync ignore list`");
|
||||||
}
|
}
|
||||||
change(&|list| list.retain(|p| *p != pattern))?;
|
change(&|list| list.retain(|p| *p != pattern))?;
|
||||||
}
|
}
|
||||||
IgnoreCmd::Reset => change(&|list| *list = defaults.clone())?,
|
IgnoreCmd::Remove {
|
||||||
|
pattern,
|
||||||
|
folder: Some(folder),
|
||||||
|
} => {
|
||||||
|
let (id, root) = mirror_folder_of(&folder)?;
|
||||||
|
if !remove_folder_pattern(&root, &pattern)? {
|
||||||
|
bail!(
|
||||||
|
"`{}` is not among the own patterns of {}; see `pdfs sync ignore list --folder {}`",
|
||||||
|
pattern.trim(),
|
||||||
|
root.display(),
|
||||||
|
root.display()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
let _ = control_request(CtlRequest::SyncNow { id: Some(id) });
|
||||||
|
}
|
||||||
|
IgnoreCmd::Reset => change(&|list| {
|
||||||
|
*list = DEFAULT_IGNORE_PATTERNS
|
||||||
|
.iter()
|
||||||
|
.map(|p| (*p).to_string())
|
||||||
|
.collect()
|
||||||
|
})?,
|
||||||
IgnoreCmd::Check { path } => {
|
IgnoreCmd::Check { path } => {
|
||||||
let path = std::path::absolute(&path)?;
|
let path = std::path::absolute(&path)?;
|
||||||
let folders = match control_request(CtlRequest::ListSyncFolders)? {
|
let folder = synced_folder_of(&path)?;
|
||||||
CtlResponse::SyncFolders { items } => items,
|
|
||||||
CtlResponse::Error { message, kind } => bail!("{}", cli_error(kind, &message)),
|
|
||||||
other => bail!("unexpected reply: {other:?}"),
|
|
||||||
};
|
|
||||||
let Some(folder) = folders
|
|
||||||
.iter()
|
|
||||||
.filter(|f| path.starts_with(&f.local_path))
|
|
||||||
.max_by_key(|f| f.local_path.len())
|
|
||||||
else {
|
|
||||||
bail!("{} is not in a synced folder", path.display());
|
|
||||||
};
|
|
||||||
if folder.mode != "mirror" {
|
if folder.mode != "mirror" {
|
||||||
println!(
|
println!(
|
||||||
"{} is online only; patterns apply only to folders kept on this computer.",
|
"{} is online only; patterns apply only to folders kept on this computer.",
|
||||||
@@ -3829,6 +3879,35 @@ fn cmd_sync_ignore(action: IgnoreCmd) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The synced folder holding `path`: the innermost one, as the daemon lists
|
||||||
|
/// them.
|
||||||
|
fn synced_folder_of(path: &Path) -> Result<SyncFolderInfo> {
|
||||||
|
let path = std::path::absolute(path)?;
|
||||||
|
let folders = match control_request(CtlRequest::ListSyncFolders)? {
|
||||||
|
CtlResponse::SyncFolders { items } => items,
|
||||||
|
CtlResponse::Error { message, kind } => bail!("{}", cli_error(kind, &message)),
|
||||||
|
other => bail!("unexpected reply: {other:?}"),
|
||||||
|
};
|
||||||
|
folders
|
||||||
|
.into_iter()
|
||||||
|
.filter(|f| path.starts_with(&f.local_path))
|
||||||
|
.max_by_key(|f| f.local_path.len())
|
||||||
|
.ok_or_else(|| anyhow!("{} is not in a synced folder", path.display()))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The id and root of the synced folder kept on this computer that holds
|
||||||
|
/// `path`. Own patterns mean nothing to an online-only folder.
|
||||||
|
fn mirror_folder_of(path: &Path) -> Result<(i64, PathBuf)> {
|
||||||
|
let folder = synced_folder_of(path)?;
|
||||||
|
if folder.mode != "mirror" {
|
||||||
|
bail!(
|
||||||
|
"{} is online only; patterns apply only to folders kept on this computer",
|
||||||
|
folder.local_path
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Ok((folder.id, PathBuf::from(folder.local_path)))
|
||||||
|
}
|
||||||
|
|
||||||
/// How long the oldest write may wait to upload before `diagnose` calls it
|
/// How long the oldest write may wait to upload before `diagnose` calls it
|
||||||
/// out. Under a day it is a slow link or a big file; past it, something is
|
/// out. Under a day it is a slow link or a big file; past it, something is
|
||||||
/// holding the queue.
|
/// holding the queue.
|
||||||
@@ -4785,12 +4864,32 @@ mod login_wait_tests {
|
|||||||
cli.command,
|
cli.command,
|
||||||
Command::Sync {
|
Command::Sync {
|
||||||
action: SyncCmd::Ignore {
|
action: SyncCmd::Ignore {
|
||||||
action: IgnoreCmd::Add { ref pattern }
|
action: IgnoreCmd::Add {
|
||||||
|
ref pattern,
|
||||||
|
folder: None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} if pattern == "-temp*"
|
} if pattern == "-temp*"
|
||||||
));
|
));
|
||||||
assert!(Cli::try_parse_from(["pdfs", "sync", "ignore", "add"]).is_err());
|
assert!(Cli::try_parse_from(["pdfs", "sync", "ignore", "add"]).is_err());
|
||||||
assert!(Cli::try_parse_from(["pdfs", "sync", "ignore", "reset"]).is_ok());
|
assert!(Cli::try_parse_from(["pdfs", "sync", "ignore", "reset"]).is_ok());
|
||||||
|
let cli =
|
||||||
|
Cli::try_parse_from(["pdfs", "sync", "ignore", "add", "*.db", "--folder", "Work"])
|
||||||
|
.unwrap();
|
||||||
|
assert!(matches!(
|
||||||
|
cli.command,
|
||||||
|
Command::Sync {
|
||||||
|
action: SyncCmd::Ignore {
|
||||||
|
action: IgnoreCmd::Add {
|
||||||
|
ref pattern,
|
||||||
|
folder: Some(ref folder)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} if pattern == "*.db" && folder == Path::new("Work")
|
||||||
|
));
|
||||||
|
assert!(
|
||||||
|
Cli::try_parse_from(["pdfs", "sync", "ignore", "list", "--folder", "Work"]).is_ok()
|
||||||
|
);
|
||||||
assert!(
|
assert!(
|
||||||
Cli::try_parse_from(["pdfs", "import-google-photos", "--resume", "a.zip"]).is_err()
|
Cli::try_parse_from(["pdfs", "import-google-photos", "--resume", "a.zip"]).is_err()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -391,6 +391,27 @@ impl AppConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Apply `edit` to the ignore patterns in effect in the config at `path`,
|
||||||
|
/// under the config lock, and return the saved config. A list equal to the
|
||||||
|
/// built-in one is stored as unset, so it follows the built-in list in later
|
||||||
|
/// releases.
|
||||||
|
pub fn change_ignore_patterns_at(
|
||||||
|
path: &Path,
|
||||||
|
edit: impl FnOnce(&mut Vec<String>),
|
||||||
|
) -> Result<AppConfig> {
|
||||||
|
update_config_at(path, |config| {
|
||||||
|
let mut list = config.resolved_ignore_patterns();
|
||||||
|
edit(&mut list);
|
||||||
|
let builtin = list.len() == DEFAULT_IGNORE_PATTERNS.len()
|
||||||
|
&& list
|
||||||
|
.iter()
|
||||||
|
.zip(DEFAULT_IGNORE_PATTERNS)
|
||||||
|
.all(|(a, b)| a == b);
|
||||||
|
config.ignore_patterns = (!builtin).then_some(list);
|
||||||
|
config.clone()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// Fail when the config file at `path` exists but does not parse, so that
|
/// Fail when the config file at `path` exists but does not parse, so that
|
||||||
/// [`AppDirs::save_config`] never writes over settings it could not read.
|
/// [`AppDirs::save_config`] never writes over settings it could not read.
|
||||||
fn refuse_to_replace_unreadable(path: &Path) -> Result<()> {
|
fn refuse_to_replace_unreadable(path: &Path) -> Result<()> {
|
||||||
@@ -565,6 +586,13 @@ impl AppDirs {
|
|||||||
update_config_at(&self.config_path(), change)
|
update_config_at(&self.config_path(), change)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Apply `edit` to the ignore patterns in effect for every synced folder
|
||||||
|
/// and save them, returning the saved config. See
|
||||||
|
/// [`change_ignore_patterns_at`].
|
||||||
|
pub fn change_ignore_patterns(&self, edit: impl FnOnce(&mut Vec<String>)) -> Result<AppConfig> {
|
||||||
|
change_ignore_patterns_at(&self.config_path(), edit)
|
||||||
|
}
|
||||||
|
|
||||||
/// This machine's id (e.g. ~/.config/proton-drive-linux/machine-id). See
|
/// This machine's id (e.g. ~/.config/proton-drive-linux/machine-id). See
|
||||||
/// [`machine_id`](Self::machine_id).
|
/// [`machine_id`](Self::machine_id).
|
||||||
pub fn machine_id_path(&self) -> PathBuf {
|
pub fn machine_id_path(&self) -> PathBuf {
|
||||||
@@ -798,6 +826,31 @@ mod tests {
|
|||||||
let _ = std::fs::remove_dir_all(&dir);
|
let _ = std::fs::remove_dir_all(&dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn ignore_patterns_back_at_the_built_in_list_are_stored_as_unset() {
|
||||||
|
let dir = std::env::temp_dir().join(format!(
|
||||||
|
"pdfs-cfg-ignore-{}-{:?}",
|
||||||
|
std::process::id(),
|
||||||
|
std::thread::current().id()
|
||||||
|
));
|
||||||
|
let _ = std::fs::remove_dir_all(&dir);
|
||||||
|
std::fs::create_dir_all(&dir).unwrap();
|
||||||
|
let path = dir.join("config.json");
|
||||||
|
|
||||||
|
let config = change_ignore_patterns_at(&path, |list| list.push("*.db".into())).unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
config.ignore_patterns.as_ref().unwrap().last().unwrap(),
|
||||||
|
"*.db"
|
||||||
|
);
|
||||||
|
let config = change_ignore_patterns_at(&path, |list| list.retain(|p| p != "*.db")).unwrap();
|
||||||
|
assert_eq!(config.ignore_patterns, None);
|
||||||
|
assert_eq!(load_config_at(&path).ignore_patterns, None);
|
||||||
|
// An empty list is a choice, not the built-in one.
|
||||||
|
let config = change_ignore_patterns_at(&path, Vec::clear).unwrap();
|
||||||
|
assert_eq!(config.ignore_patterns, Some(Vec::new()));
|
||||||
|
let _ = std::fs::remove_dir_all(&dir);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_change_is_never_applied_over_an_unreadable_config() {
|
fn a_change_is_never_applied_over_an_unreadable_config() {
|
||||||
let dir = std::env::temp_dir().join(format!(
|
let dir = std::env::temp_dir().join(format!(
|
||||||
|
|||||||
@@ -262,6 +262,82 @@ impl FolderRules {
|
|||||||
}
|
}
|
||||||
Ok(written?)
|
Ok(written?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The patterns in the rules: every line that is not blank or a comment,
|
||||||
|
/// trimmed of surrounding white space.
|
||||||
|
pub fn patterns(&self) -> Vec<&str> {
|
||||||
|
self.text
|
||||||
|
.as_deref()
|
||||||
|
.unwrap_or_default()
|
||||||
|
.lines()
|
||||||
|
.map(str::trim)
|
||||||
|
.filter(|line| !line.is_empty() && !line.starts_with('#'))
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// How often [`add_folder_pattern`] and [`remove_folder_pattern`] read the
|
||||||
|
/// rules again when they changed between the read and the write.
|
||||||
|
const RULES_RETRIES: usize = 3;
|
||||||
|
|
||||||
|
/// Add `pattern` at the end of the own rules of the folder at `root`, keeping
|
||||||
|
/// every other line and comment. Says whether it added it: a pattern already
|
||||||
|
/// there is left alone.
|
||||||
|
pub fn add_folder_pattern(root: &Path, pattern: &str) -> std::io::Result<bool> {
|
||||||
|
let pattern = pattern.trim();
|
||||||
|
edit_folder_rules(root, |rules| {
|
||||||
|
if rules.patterns().contains(&pattern) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let mut text = rules.text.clone().unwrap_or_default();
|
||||||
|
if !text.is_empty() && !text.ends_with('\n') {
|
||||||
|
text.push('\n');
|
||||||
|
}
|
||||||
|
text.push_str(pattern);
|
||||||
|
text.push('\n');
|
||||||
|
Some(text)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Remove every line that is `pattern` from the own rules of the folder at
|
||||||
|
/// `root`. Says whether there was one.
|
||||||
|
pub fn remove_folder_pattern(root: &Path, pattern: &str) -> std::io::Result<bool> {
|
||||||
|
let pattern = pattern.trim();
|
||||||
|
edit_folder_rules(root, |rules| {
|
||||||
|
if !rules.patterns().contains(&pattern) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let text = rules.text.as_deref().unwrap_or_default();
|
||||||
|
Some(
|
||||||
|
text.lines()
|
||||||
|
.filter(|line| line.trim() != pattern)
|
||||||
|
.map(|line| format!("{line}\n"))
|
||||||
|
.collect(),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Read the folder's rules, let `edit` return their new text (or `None` to
|
||||||
|
/// leave them), and write it. Rules that changed in between, such as by sync
|
||||||
|
/// bringing in an edit from another computer, are read again and edited anew.
|
||||||
|
fn edit_folder_rules(
|
||||||
|
root: &Path,
|
||||||
|
edit: impl Fn(&FolderRules) -> Option<String>,
|
||||||
|
) -> std::io::Result<bool> {
|
||||||
|
for _ in 0..RULES_RETRIES {
|
||||||
|
let rules = FolderRules::read(root)?;
|
||||||
|
let Some(text) = edit(&rules) else {
|
||||||
|
return Ok(false);
|
||||||
|
};
|
||||||
|
match rules.write(&text) {
|
||||||
|
Ok(()) => return Ok(true),
|
||||||
|
Err(WriteRulesError::Changed) => continue,
|
||||||
|
Err(WriteRulesError::Io(e)) => return Err(e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(std::io::Error::other(
|
||||||
|
"the rules kept changing while they were being saved",
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Where a rule that decided about a path came from.
|
/// Where a rule that decided about a path came from.
|
||||||
@@ -639,6 +715,44 @@ mod tests {
|
|||||||
assert!(matches!(rules.write("c/"), Err(WriteRulesError::Changed)));
|
assert!(matches!(rules.write("c/"), Err(WriteRulesError::Changed)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_pattern_added_to_a_folder_keeps_its_other_lines() {
|
||||||
|
let dir = TempDir::new();
|
||||||
|
assert!(add_folder_pattern(dir.path(), " *.db ").unwrap());
|
||||||
|
assert_eq!(
|
||||||
|
std::fs::read_to_string(dir.path().join(".pdfsignore")).unwrap(),
|
||||||
|
"*.db\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
write(dir.path(), ".pdfsignore", "# my notes\nbuild/");
|
||||||
|
assert!(add_folder_pattern(dir.path(), "*.db").unwrap());
|
||||||
|
assert!(!add_folder_pattern(dir.path(), "build/").unwrap());
|
||||||
|
assert_eq!(
|
||||||
|
std::fs::read_to_string(dir.path().join(".pdfsignore")).unwrap(),
|
||||||
|
"# my notes\nbuild/\n*.db\n"
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
FolderRules::read(dir.path()).unwrap().patterns(),
|
||||||
|
["build/", "*.db"]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn removing_a_folder_pattern_keeps_comments_and_drops_an_empty_file() {
|
||||||
|
let dir = TempDir::new();
|
||||||
|
write(dir.path(), ".pdfsignore", "# keep\nbuild/\n*.db\n");
|
||||||
|
assert!(remove_folder_pattern(dir.path(), "build/").unwrap());
|
||||||
|
assert!(!remove_folder_pattern(dir.path(), "build/").unwrap());
|
||||||
|
assert_eq!(
|
||||||
|
std::fs::read_to_string(dir.path().join(".pdfsignore")).unwrap(),
|
||||||
|
"# keep\n*.db\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
write(dir.path(), ".pdfsignore", "*.db\n");
|
||||||
|
assert!(remove_folder_pattern(dir.path(), "*.db").unwrap());
|
||||||
|
assert!(!dir.path().join(".pdfsignore").exists());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn no_rules_at_all_ignores_nothing() {
|
fn no_rules_at_all_ignores_nothing() {
|
||||||
let dir = TempDir::new();
|
let dir = TempDir::new();
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ use pages::preferences_sync::*;
|
|||||||
use pages::shared::*;
|
use pages::shared::*;
|
||||||
use pages::shared_by_me::*;
|
use pages::shared_by_me::*;
|
||||||
use pages::status::*;
|
use pages::status::*;
|
||||||
|
use pages::sync_exclusions::*;
|
||||||
use pages::takeout::*;
|
use pages::takeout::*;
|
||||||
use pages::trash::*;
|
use pages::trash::*;
|
||||||
use pages::verify::*;
|
use pages::verify::*;
|
||||||
@@ -681,6 +682,13 @@ fn build_window(app: &adw::Application) {
|
|||||||
views: locations_widgets.views.clone(),
|
views: locations_widgets.views.clone(),
|
||||||
banner: locations_widgets.banner.clone(),
|
banner: locations_widgets.banner.clone(),
|
||||||
failing: Cell::new(0),
|
failing: Cell::new(0),
|
||||||
|
exclusions: ExclusionsState {
|
||||||
|
group: locations_widgets.exclusions_group.clone(),
|
||||||
|
add: locations_widgets.add_pattern.clone(),
|
||||||
|
rows: RefCell::new(Vec::new()),
|
||||||
|
folders: RefCell::new(Vec::new()),
|
||||||
|
generation: Cell::new(0),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
activity: ActivityState {
|
activity: ActivityState {
|
||||||
content: activity_widgets.content.clone(),
|
content: activity_widgets.content.clone(),
|
||||||
@@ -764,6 +772,7 @@ fn build_window(app: &adw::Application) {
|
|||||||
wire_shared_by_me(&ui, &shared_by_me_widgets);
|
wire_shared_by_me(&ui, &shared_by_me_widgets);
|
||||||
wire_devices(&ui, &devices_widgets);
|
wire_devices(&ui, &devices_widgets);
|
||||||
wire_locations(&ui, &locations_widgets.retry, &locations_widgets.add_folder);
|
wire_locations(&ui, &locations_widgets.retry, &locations_widgets.add_folder);
|
||||||
|
wire_exclusions(&ui);
|
||||||
wire_activity(&ui, &activity_widgets);
|
wire_activity(&ui, &activity_widgets);
|
||||||
wire_takeout(&ui, &takeout_widgets);
|
wire_takeout(&ui, &takeout_widgets);
|
||||||
wire_retry(&ui);
|
wire_retry(&ui);
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ pub(crate) struct LocationsState {
|
|||||||
pub(crate) banner: adw::Banner,
|
pub(crate) banner: adw::Banner,
|
||||||
/// Changes the daemon failed to upload, from the last status.
|
/// Changes the daemon failed to upload, from the last status.
|
||||||
pub(crate) failing: Cell<u64>,
|
pub(crate) failing: Cell<u64>,
|
||||||
|
/// Excluded Files, under the folder list.
|
||||||
|
pub(crate) exclusions: ExclusionsState,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The status card heading the Sync page's Overview, and Pause/Resume in the
|
/// The status card heading the Sync page's Overview, and Pause/Resume in the
|
||||||
@@ -120,6 +122,8 @@ pub(crate) struct LocationsWidgets {
|
|||||||
pub(crate) conflicts_group: adw::PreferencesGroup,
|
pub(crate) conflicts_group: adw::PreferencesGroup,
|
||||||
pub(crate) views: adw::ViewStack,
|
pub(crate) views: adw::ViewStack,
|
||||||
pub(crate) banner: adw::Banner,
|
pub(crate) banner: adw::Banner,
|
||||||
|
pub(crate) exclusions_group: adw::PreferencesGroup,
|
||||||
|
pub(crate) add_pattern: gtk4::Button,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The Sync page: Overview (the status, conflicts, transfers and queue),
|
/// The Sync page: Overview (the status, conflicts, transfers and queue),
|
||||||
@@ -208,8 +212,14 @@ pub(crate) fn build_locations_page(history: >k4::Widget) -> (gtk4::Widget, Loc
|
|||||||
.child(&status)
|
.child(&status)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
// What the folders leave out, under them: the rules belong to the folders.
|
||||||
|
let (exclusions_group, add_pattern) = build_exclusions_group();
|
||||||
|
let folders = gtk4::Box::new(gtk4::Orientation::Vertical, 24);
|
||||||
|
folders.append(&group);
|
||||||
|
folders.append(&exclusions_group);
|
||||||
|
|
||||||
let content = gtk4::Stack::new();
|
let content = gtk4::Stack::new();
|
||||||
content.add_named(&scrolled_column(&group), Some("list"));
|
content.add_named(&scrolled_column(&folders), Some("list"));
|
||||||
content.add_named(&status_scroll, Some("status"));
|
content.add_named(&status_scroll, Some("status"));
|
||||||
|
|
||||||
let views = adw::ViewStack::new();
|
let views = adw::ViewStack::new();
|
||||||
@@ -267,6 +277,8 @@ pub(crate) fn build_locations_page(history: >k4::Widget) -> (gtk4::Widget, Loc
|
|||||||
conflicts_group,
|
conflicts_group,
|
||||||
views,
|
views,
|
||||||
banner,
|
banner,
|
||||||
|
exclusions_group,
|
||||||
|
add_pattern,
|
||||||
};
|
};
|
||||||
(frame.upcast(), widgets)
|
(frame.upcast(), widgets)
|
||||||
}
|
}
|
||||||
@@ -1243,6 +1255,7 @@ pub(crate) fn repaint_locations(ui: &Rc<Ui>, items: &[MountSpec]) {
|
|||||||
};
|
};
|
||||||
if !unchanged {
|
if !unchanged {
|
||||||
rebuild_locations(ui, items, keys);
|
rebuild_locations(ui, items, keys);
|
||||||
|
paint_exclusions(ui, items);
|
||||||
}
|
}
|
||||||
for (row, spec) in ui.locations.rows.borrow().iter().zip(items) {
|
for (row, spec) in ui.locations.rows.borrow().iter().zip(items) {
|
||||||
update_location_row(row, spec);
|
update_location_row(row, spec);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ pub(crate) mod preferences_sync;
|
|||||||
pub(crate) mod shared;
|
pub(crate) mod shared;
|
||||||
pub(crate) mod shared_by_me;
|
pub(crate) mod shared_by_me;
|
||||||
pub(crate) mod status;
|
pub(crate) mod status;
|
||||||
|
pub(crate) mod sync_exclusions;
|
||||||
pub(crate) mod takeout;
|
pub(crate) mod takeout;
|
||||||
pub(crate) mod trash;
|
pub(crate) mod trash;
|
||||||
pub(crate) mod verify;
|
pub(crate) mod verify;
|
||||||
@@ -85,6 +85,13 @@ pub(crate) fn wire_sync_prefs(ui: &Rc<Ui>, widgets: SyncPrefs) {
|
|||||||
let rows: Rc<RefCell<Vec<adw::PreferencesRow>>> = Rc::default();
|
let rows: Rc<RefCell<Vec<adw::PreferencesRow>>> = Rc::default();
|
||||||
let config = ui.dirs.load_config();
|
let config = ui.dirs.load_config();
|
||||||
paint_patterns(ui, &widgets, &rows, &config);
|
paint_patterns(ui, &widgets, &rows, &config);
|
||||||
|
// The Sync page and `pdfs sync ignore` change the patterns too: show the
|
||||||
|
// saved ones each time the page comes up.
|
||||||
|
let (ui_map, w_map, rows_map) = (ui.clone(), widgets.clone(), rows.clone());
|
||||||
|
widgets.page.connect_map(move |_| {
|
||||||
|
let config = ui_map.dirs.load_config();
|
||||||
|
paint_patterns(&ui_map, &w_map, &rows_map, &config);
|
||||||
|
});
|
||||||
|
|
||||||
let mode = config.conflict_sweep.unwrap_or_default();
|
let mode = config.conflict_sweep.unwrap_or_default();
|
||||||
let suppress = ui.status.settings_suppress.replace(true);
|
let suppress = ui.status.settings_suppress.replace(true);
|
||||||
@@ -184,22 +191,14 @@ fn default_patterns() -> Vec<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Apply `edit` to the patterns in effect and save them, then show them and
|
/// Apply `edit` to the patterns in effect and save them, then show them and
|
||||||
/// have every synced folder sync with them. A list equal to the built-in one
|
/// have every synced folder sync with them. Says whether it saved.
|
||||||
/// is saved as "unset", so it follows the built-in list in later releases.
|
|
||||||
/// Says whether it saved.
|
|
||||||
fn change_patterns(
|
fn change_patterns(
|
||||||
ui: &Rc<Ui>,
|
ui: &Rc<Ui>,
|
||||||
widgets: &Rc<SyncPrefs>,
|
widgets: &Rc<SyncPrefs>,
|
||||||
rows: &Rc<RefCell<Vec<adw::PreferencesRow>>>,
|
rows: &Rc<RefCell<Vec<adw::PreferencesRow>>>,
|
||||||
edit: impl FnOnce(&mut Vec<String>),
|
edit: impl FnOnce(&mut Vec<String>),
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let saved = ui.dirs.update_config(|config| {
|
match ui.dirs.change_ignore_patterns(edit) {
|
||||||
let mut list = config.resolved_ignore_patterns();
|
|
||||||
edit(&mut list);
|
|
||||||
config.ignore_patterns = (list != default_patterns()).then_some(list);
|
|
||||||
config.clone()
|
|
||||||
});
|
|
||||||
match saved {
|
|
||||||
Ok(config) => {
|
Ok(config) => {
|
||||||
paint_patterns(ui, widgets, rows, &config);
|
paint_patterns(ui, widgets, rows, &config);
|
||||||
// Best effort: the next pass picks the change up anyway.
|
// Best effort: the next pass picks the change up anyway.
|
||||||
|
|||||||
@@ -0,0 +1,426 @@
|
|||||||
|
//! The Excluded Files group on the Sync page's Folders view: what is left out
|
||||||
|
//! of every synced folder and of each one on its own, with how many patterns
|
||||||
|
//! each has, and an Add Pattern dialog that asks where a pattern goes.
|
||||||
|
//!
|
||||||
|
//! The rows open the editors that already exist: Preferences → Sync for the
|
||||||
|
//! patterns of all folders, the Excluded Files dialog for a folder's own
|
||||||
|
//! `.pdfsignore`. Only folders kept on this computer are listed; an
|
||||||
|
//! online-only folder has no local files for patterns to leave out. With none
|
||||||
|
//! of those, the group still shows, so the patterns can be found and set up
|
||||||
|
//! before a folder is switched to Synced, and says why they do nothing yet.
|
||||||
|
|
||||||
|
use crate::*;
|
||||||
|
use pdfs_core::syncignore::{FolderRules, add_folder_pattern, check_pattern};
|
||||||
|
|
||||||
|
pub(crate) struct ExclusionsState {
|
||||||
|
pub(crate) group: adw::PreferencesGroup,
|
||||||
|
pub(crate) add: gtk4::Button,
|
||||||
|
pub(crate) rows: RefCell<Vec<adw::ActionRow>>,
|
||||||
|
/// The synced folders kept on this computer the rows were built for, as
|
||||||
|
/// id and root.
|
||||||
|
pub(crate) folders: RefCell<Vec<(i64, PathBuf)>>,
|
||||||
|
/// Counts painted, so a slow read from an older paint does not land on
|
||||||
|
/// newer rows.
|
||||||
|
pub(crate) generation: Cell<u64>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn build_exclusions_group() -> (adw::PreferencesGroup, gtk4::Button) {
|
||||||
|
let add = gtk4::Button::builder()
|
||||||
|
.child(
|
||||||
|
&adw::ButtonContent::builder()
|
||||||
|
.label(gettext("Add Pattern"))
|
||||||
|
.icon_name("list-add-symbolic")
|
||||||
|
.build(),
|
||||||
|
)
|
||||||
|
.tooltip_text(gettext(
|
||||||
|
"Leave files matching a pattern out of all synced folders or one of them",
|
||||||
|
))
|
||||||
|
.valign(gtk4::Align::Center)
|
||||||
|
.build();
|
||||||
|
add.add_css_class("flat");
|
||||||
|
let group = adw::PreferencesGroup::builder()
|
||||||
|
.title(gettext("Excluded Files"))
|
||||||
|
.description(gettext(
|
||||||
|
"Files matching these patterns stay on this computer and are not synced. Excluding never deletes anything from Proton Drive.",
|
||||||
|
))
|
||||||
|
.header_suffix(&add)
|
||||||
|
.visible(false)
|
||||||
|
.build();
|
||||||
|
(group, add)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn wire_exclusions(ui: &Rc<Ui>) {
|
||||||
|
let ui_add = ui.clone();
|
||||||
|
ui.locations
|
||||||
|
.exclusions
|
||||||
|
.add
|
||||||
|
.connect_clicked(move |_| present_add_pattern_dialog(&ui_add, None));
|
||||||
|
// Preferences change the patterns of all folders; show the new count.
|
||||||
|
let ui_prefs = ui.clone();
|
||||||
|
ui.status
|
||||||
|
.prefs
|
||||||
|
.connect_closed(move |_| refresh_exclusions(&ui_prefs));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Rebuild the rows for the folders in `items` when the set of synced folders
|
||||||
|
/// kept on this computer changed, or on the first paint. The tick repaints the folder list every few
|
||||||
|
/// seconds; the rows and their counts stay as they are in between.
|
||||||
|
pub(crate) fn paint_exclusions(ui: &Rc<Ui>, items: &[MountSpec]) {
|
||||||
|
let folders: Vec<(i64, PathBuf)> = items
|
||||||
|
.iter()
|
||||||
|
.filter(|spec| spec.mode == MountMode::Mirror)
|
||||||
|
.filter_map(|spec| match spec.kind {
|
||||||
|
MountKind::Device { sync_folder_id } | MountKind::Attached { sync_folder_id } => {
|
||||||
|
Some((sync_folder_id, PathBuf::from(&spec.local_path)))
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
let state = &ui.locations.exclusions;
|
||||||
|
if *state.folders.borrow() == folders && !state.rows.borrow().is_empty() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*state.folders.borrow_mut() = folders;
|
||||||
|
refresh_exclusions(ui);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Build the rows again from the folders last painted, and read every count
|
||||||
|
/// anew: after a pattern was added or a list edited.
|
||||||
|
pub(crate) fn refresh_exclusions(ui: &Rc<Ui>) {
|
||||||
|
let state = &ui.locations.exclusions;
|
||||||
|
for row in state.rows.borrow_mut().drain(..) {
|
||||||
|
state.group.remove(&row);
|
||||||
|
}
|
||||||
|
let folders = state.folders.borrow().clone();
|
||||||
|
state.group.set_visible(true);
|
||||||
|
let generation = state.generation.get() + 1;
|
||||||
|
state.generation.set(generation);
|
||||||
|
|
||||||
|
let config = ui.dirs.load_config();
|
||||||
|
let all = adw::ActionRow::builder()
|
||||||
|
.title(gettext("All Synced Folders"))
|
||||||
|
.subtitle(glib::markup_escape_text(&all_folders_subtitle(&config)).as_str())
|
||||||
|
.activatable(true)
|
||||||
|
.build();
|
||||||
|
all.add_prefix(>k4::Image::from_icon_name("view-list-symbolic"));
|
||||||
|
all.add_suffix(>k4::Image::from_icon_name("go-next-symbolic"));
|
||||||
|
let ui_all = ui.clone();
|
||||||
|
all.connect_activated(move |_| {
|
||||||
|
let prefs = &ui_all.status.prefs;
|
||||||
|
prefs.set_visible_page_name("sync");
|
||||||
|
prefs.present(ui_window(&ui_all).as_ref());
|
||||||
|
});
|
||||||
|
state.group.add(&all);
|
||||||
|
let mut rows = vec![all];
|
||||||
|
if folders.is_empty() {
|
||||||
|
let none = adw::ActionRow::builder()
|
||||||
|
.title(gettext("No folder is set to Synced"))
|
||||||
|
.subtitle(gettext(
|
||||||
|
"Patterns apply only to folders kept on this computer. Online-only folders upload every file saved in them.",
|
||||||
|
))
|
||||||
|
.build();
|
||||||
|
none.add_prefix(>k4::Image::from_icon_name("info-outline-symbolic"));
|
||||||
|
state.group.add(&none);
|
||||||
|
rows.push(none);
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut counted = Vec::new();
|
||||||
|
for (id, root) in folders {
|
||||||
|
let name = root
|
||||||
|
.file_name()
|
||||||
|
.map(|name| name.to_string_lossy().into_owned())
|
||||||
|
.unwrap_or_else(|| root.display().to_string());
|
||||||
|
let row = adw::ActionRow::builder()
|
||||||
|
.title(glib::markup_escape_text(&name).as_str())
|
||||||
|
.tooltip_text(root.display().to_string())
|
||||||
|
.subtitle(glib::markup_escape_text(&tilde_path(&root.display().to_string())).as_str())
|
||||||
|
.subtitle_lines(1)
|
||||||
|
.activatable(true)
|
||||||
|
.build();
|
||||||
|
row.add_prefix(>k4::Image::from_icon_name("folder-symbolic"));
|
||||||
|
row.add_suffix(>k4::Image::from_icon_name("go-next-symbolic"));
|
||||||
|
let (ui_row, root_row) = (ui.clone(), root.clone());
|
||||||
|
row.connect_activated(move |_| present_ignore_dialog(&ui_row, id, root_row.clone()));
|
||||||
|
state.group.add(&row);
|
||||||
|
counted.push((row.clone(), root));
|
||||||
|
rows.push(row);
|
||||||
|
}
|
||||||
|
*state.rows.borrow_mut() = rows;
|
||||||
|
|
||||||
|
// A folder may sit on a slow or sleeping disk: count off the main thread.
|
||||||
|
let ui = ui.clone();
|
||||||
|
glib::spawn_future_local(async move {
|
||||||
|
let roots: Vec<PathBuf> = counted.iter().map(|(_, root)| root.clone()).collect();
|
||||||
|
let counts = gio::spawn_blocking(move || {
|
||||||
|
roots
|
||||||
|
.iter()
|
||||||
|
.map(|root| {
|
||||||
|
FolderRules::read(root)
|
||||||
|
.ok()
|
||||||
|
.map(|rules| rules.patterns().len())
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
.unwrap_or_default();
|
||||||
|
if ui.locations.exclusions.generation.get() != generation {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for ((row, root), count) in counted.iter().zip(counts) {
|
||||||
|
let state = match count {
|
||||||
|
Some(0) => gettext("no own patterns"),
|
||||||
|
// Translators: how many patterns a synced folder has of its own.
|
||||||
|
Some(n) => ngettext_f("{n} own pattern", "{n} own patterns", n as u64, &[]),
|
||||||
|
None => gettext("own patterns unreadable"),
|
||||||
|
};
|
||||||
|
// Translators: a synced folder's location and how many patterns of its own it has, such as "~/Projects · 2 own patterns".
|
||||||
|
let subtitle = gettext_f(
|
||||||
|
"{path} · {state}",
|
||||||
|
&[
|
||||||
|
("path", &tilde_path(&root.display().to_string())),
|
||||||
|
("state", &state),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
row.set_subtitle(glib::markup_escape_text(&subtitle).as_str());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// How many patterns apply to every synced folder, and whether they are the
|
||||||
|
/// built-in ones.
|
||||||
|
fn all_folders_subtitle(config: &pdfs_core::config::AppConfig) -> String {
|
||||||
|
let n = config.resolved_ignore_patterns().len() as u64;
|
||||||
|
match (&config.ignore_patterns, n) {
|
||||||
|
(_, 0) => gettext("No patterns: every file is synced"),
|
||||||
|
(None, n) => ngettext_f("{n} built-in pattern", "{n} built-in patterns", n, &[]),
|
||||||
|
(Some(_), n) => ngettext_f("{n} pattern", "{n} patterns", n, &[]),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Ask for a pattern and where it applies: every synced folder, or one of
|
||||||
|
/// them (`folder`, preselected when given).
|
||||||
|
pub(crate) fn present_add_pattern_dialog(ui: &Rc<Ui>, folder: Option<i64>) {
|
||||||
|
let folders = ui.locations.exclusions.folders.borrow().clone();
|
||||||
|
let pattern_row = adw::EntryRow::builder().title(gettext("Pattern")).build();
|
||||||
|
pattern_row.add_css_class("monospace");
|
||||||
|
let mut places = vec![gettext("All synced folders")];
|
||||||
|
places.extend(
|
||||||
|
folders
|
||||||
|
.iter()
|
||||||
|
.map(|(_, root)| tilde_path(&root.display().to_string())),
|
||||||
|
);
|
||||||
|
let places: Vec<&str> = places.iter().map(String::as_str).collect();
|
||||||
|
let scope_row = adw::ComboRow::builder()
|
||||||
|
.title(gettext("Apply To"))
|
||||||
|
.model(>k4::StringList::new(&places))
|
||||||
|
.build();
|
||||||
|
if let Some(at) = folder.and_then(|id| folders.iter().position(|(f, _)| *f == id)) {
|
||||||
|
scope_row.set_selected(at as u32 + 1);
|
||||||
|
}
|
||||||
|
let rows = adw::PreferencesGroup::new();
|
||||||
|
rows.add(&pattern_row);
|
||||||
|
rows.add(&scope_row);
|
||||||
|
|
||||||
|
let hint = gtk4::Label::builder()
|
||||||
|
.label(gettext(
|
||||||
|
"Use * for any characters, such as *.db, and end a pattern with / to match folders only, such as build/.",
|
||||||
|
))
|
||||||
|
.wrap(true)
|
||||||
|
.xalign(0.0)
|
||||||
|
.build();
|
||||||
|
hint.add_css_class("dim-label");
|
||||||
|
hint.add_css_class("caption");
|
||||||
|
let problem = gtk4::Label::builder()
|
||||||
|
.wrap(true)
|
||||||
|
.xalign(0.0)
|
||||||
|
.visible(false)
|
||||||
|
.build();
|
||||||
|
problem.add_css_class("error");
|
||||||
|
|
||||||
|
let body = gtk4::Box::new(gtk4::Orientation::Vertical, 12);
|
||||||
|
body.set_margin_top(12);
|
||||||
|
body.set_margin_bottom(18);
|
||||||
|
body.set_margin_start(18);
|
||||||
|
body.set_margin_end(18);
|
||||||
|
body.append(&rows);
|
||||||
|
body.append(&hint);
|
||||||
|
body.append(&problem);
|
||||||
|
|
||||||
|
let cancel = gtk4::Button::with_label(&gettext("Cancel"));
|
||||||
|
let add = gtk4::Button::with_label(&gettext("Add"));
|
||||||
|
add.add_css_class("suggested-action");
|
||||||
|
add.set_sensitive(false);
|
||||||
|
let header = adw::HeaderBar::builder()
|
||||||
|
.show_start_title_buttons(false)
|
||||||
|
.show_end_title_buttons(false)
|
||||||
|
.build();
|
||||||
|
header.pack_start(&cancel);
|
||||||
|
header.pack_end(&add);
|
||||||
|
let view = adw::ToolbarView::new();
|
||||||
|
view.add_top_bar(&header);
|
||||||
|
view.set_content(Some(&body));
|
||||||
|
let dialog = adw::Dialog::builder()
|
||||||
|
.title(gettext("Add Pattern"))
|
||||||
|
.content_width(460)
|
||||||
|
.child(&view)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let (add_check, problem_check) = (add.clone(), problem.clone());
|
||||||
|
pattern_row.connect_changed(move |row| {
|
||||||
|
let verdict = pattern_problem(&row.text());
|
||||||
|
match &verdict {
|
||||||
|
Some(message) if !row.text().trim().is_empty() => {
|
||||||
|
row.add_css_class("error");
|
||||||
|
problem_check.set_text(message);
|
||||||
|
problem_check.set_visible(true);
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
row.remove_css_class("error");
|
||||||
|
problem_check.set_visible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_check.set_sensitive(verdict.is_none());
|
||||||
|
});
|
||||||
|
let d = dialog.clone();
|
||||||
|
cancel.connect_clicked(move |_| {
|
||||||
|
d.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
let submit = {
|
||||||
|
let (ui, dialog, pattern_row, scope_row, add, problem) = (
|
||||||
|
ui.clone(),
|
||||||
|
dialog.clone(),
|
||||||
|
pattern_row.clone(),
|
||||||
|
scope_row.clone(),
|
||||||
|
add.clone(),
|
||||||
|
problem.clone(),
|
||||||
|
);
|
||||||
|
move || {
|
||||||
|
if !add.is_sensitive() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let pattern = pattern_row.text().trim().to_string();
|
||||||
|
let target = match scope_row.selected() {
|
||||||
|
0 => None,
|
||||||
|
at => folders.get(at as usize - 1).cloned(),
|
||||||
|
};
|
||||||
|
// One click, one save: the button comes back if the save fails.
|
||||||
|
add.set_sensitive(false);
|
||||||
|
add_pattern(&ui, &dialog, &add, &problem, pattern, target);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let submit_enter = submit.clone();
|
||||||
|
pattern_row.connect_entry_activated(move |_| submit_enter());
|
||||||
|
add.connect_clicked(move |_| submit());
|
||||||
|
|
||||||
|
dialog.present(ui_window(ui).as_ref());
|
||||||
|
pattern_row.grab_focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// What is wrong with `text` as a pattern to add, or `None` when it is one.
|
||||||
|
fn pattern_problem(text: &str) -> Option<String> {
|
||||||
|
let text = text.trim();
|
||||||
|
if text.is_empty() {
|
||||||
|
return Some(String::new());
|
||||||
|
}
|
||||||
|
if text.starts_with('#') {
|
||||||
|
return Some(gettext(
|
||||||
|
"A line starting with # is a comment, not a pattern.",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
check_pattern(text).err().map(|e| {
|
||||||
|
tracing::debug!(pattern = %text, error = %e, "not a valid ignore pattern");
|
||||||
|
// Translators: {pattern} is what the user typed as a pattern.
|
||||||
|
gettext_f("“{pattern}” isn't a valid pattern.", &[("pattern", text)])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Save `pattern` for every synced folder (`target` is `None`) or for the
|
||||||
|
/// folder `target`, then close `dialog`, say so and sync. A failure shows in
|
||||||
|
/// `problem`, in the dialog, which stays open.
|
||||||
|
fn add_pattern(
|
||||||
|
ui: &Rc<Ui>,
|
||||||
|
dialog: &adw::Dialog,
|
||||||
|
add: >k4::Button,
|
||||||
|
problem: >k4::Label,
|
||||||
|
pattern: String,
|
||||||
|
target: Option<(i64, PathBuf)>,
|
||||||
|
) {
|
||||||
|
let (ui, dialog, add, problem) = (ui.clone(), dialog.clone(), add.clone(), problem.clone());
|
||||||
|
glib::spawn_future_local(async move {
|
||||||
|
let (id, place) = match &target {
|
||||||
|
None => (None, gettext("all synced folders")),
|
||||||
|
Some((id, root)) => (Some(*id), tilde_path(&root.display().to_string())),
|
||||||
|
};
|
||||||
|
let added: Result<bool, String> = match target {
|
||||||
|
None => {
|
||||||
|
let mut added = false;
|
||||||
|
ui.dirs
|
||||||
|
.change_ignore_patterns(|list| {
|
||||||
|
if !list.contains(&pattern) {
|
||||||
|
list.push(pattern.clone());
|
||||||
|
added = true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(|_| added)
|
||||||
|
.map_err(|e| e.to_string())
|
||||||
|
}
|
||||||
|
Some((_, root)) => {
|
||||||
|
let p = pattern.clone();
|
||||||
|
gio::spawn_blocking(move || add_folder_pattern(&root, &p))
|
||||||
|
.await
|
||||||
|
.unwrap_or_else(|_| Err(std::io::Error::other("the save did not finish")))
|
||||||
|
.map_err(|e| e.to_string())
|
||||||
|
}
|
||||||
|
};
|
||||||
|
match added {
|
||||||
|
Ok(added) => {
|
||||||
|
dialog.close();
|
||||||
|
let message = if added {
|
||||||
|
// Translators: {pattern} is an ignore pattern, {place} "all synced folders" or a folder path.
|
||||||
|
gettext_f(
|
||||||
|
"“{pattern}” is now excluded in {place}",
|
||||||
|
&[("pattern", &pattern), ("place", &place)],
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
gettext_f(
|
||||||
|
"“{pattern}” was already excluded in {place}",
|
||||||
|
&[("pattern", &pattern), ("place", &place)],
|
||||||
|
)
|
||||||
|
};
|
||||||
|
toast(&ui, &message);
|
||||||
|
refresh_exclusions(&ui);
|
||||||
|
if added {
|
||||||
|
// Best effort: the next pass picks the change up anyway.
|
||||||
|
let _ = spawn_request(ui.dirs.control_socket(), Request::SyncNow { id });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
add.set_sensitive(true);
|
||||||
|
problem.set_text(&gettext_f(
|
||||||
|
"{what}: {detail}",
|
||||||
|
&[
|
||||||
|
("what", &gettext("Couldn't save the patterns")),
|
||||||
|
("detail", &e),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
problem.set_visible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn only_real_patterns_can_be_added() {
|
||||||
|
assert!(pattern_problem("*.db").is_none());
|
||||||
|
assert!(pattern_problem(" build/ ").is_none());
|
||||||
|
assert!(pattern_problem("").is_some());
|
||||||
|
assert!(pattern_problem(" ").is_some());
|
||||||
|
assert!(pattern_problem("# note").is_some());
|
||||||
|
assert!(pattern_problem("*.{jpg,png").is_some());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -238,6 +238,7 @@ fn write_rules(
|
|||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
dialog.close();
|
dialog.close();
|
||||||
toast(&ui, &gettext("Excluded files saved"));
|
toast(&ui, &gettext("Excluded files saved"));
|
||||||
|
refresh_exclusions(&ui);
|
||||||
let _ = spawn_request(ui.dirs.control_socket(), Request::SyncNow { id: Some(id) });
|
let _ = spawn_request(ui.dirs.control_socket(), Request::SyncNow { id: Some(id) });
|
||||||
}
|
}
|
||||||
Err(WriteRulesError::Changed) => {
|
Err(WriteRulesError::Changed) => {
|
||||||
|
|||||||
+7
-4
@@ -29,10 +29,13 @@ Existing folders stay device backups. Older builds cannot open the upgraded data
|
|||||||
- **Apps → Search Launcher**: whether `pdfs-prompt` opens its own window, your dmenu-style
|
- **Apps → Search Launcher**: whether `pdfs-prompt` opens its own window, your dmenu-style
|
||||||
launcher (rofi, wofi, fuzzel, bemenu) or fzf in a terminal.
|
launcher (rofi, wofi, fuzzel, bemenu) or fzf in a terminal.
|
||||||
|
|
||||||
Each synced folder kept on this computer has **Excluded Files…** in its menu on the Sync page,
|
The Sync page's Folders view lists **Excluded Files** under the folders: how many patterns
|
||||||
for its own `.pdfsignore`. It checks every line as you type, tells you whether a path is synced
|
apply to all of them and to each one, and **Add Pattern** to add one for all synced folders or
|
||||||
and which pattern decides, and asks before replacing rules that changed on another computer
|
for a single folder. A folder's own rules (its `.pdfsignore`) open in an editor, also from the
|
||||||
meanwhile. `pdfs sync ignore list|add|remove|reset|check` does the same from a terminal.
|
folder's menu. It checks every line as you type, tells you whether a path is synced and which
|
||||||
|
pattern decides, and asks before replacing rules that changed on another computer meanwhile.
|
||||||
|
`pdfs sync ignore list|add|remove|reset|check` does the same from a terminal, and `--folder`
|
||||||
|
picks a single folder.
|
||||||
`pdfs-app --page preferences-sync` (or `-apps`, `-storage`, plain `preferences`) opens
|
`pdfs-app --page preferences-sync` (or `-apps`, `-storage`, plain `preferences`) opens
|
||||||
Preferences at that page.
|
Preferences at that page.
|
||||||
- **More clutter left out of synced folders by default**: `desktop.ini`, `.directory`, trash
|
- **More clutter left out of synced folders by default**: `desktop.ini`, `.directory`, trash
|
||||||
|
|||||||
+2
-2
@@ -119,8 +119,8 @@ commands are for scripts and for cases where the mount is not available.
|
|||||||
| `pdfs sync reset ID` | Forget what a synced folder synced before and compare it with Proton Drive again. A file on one side only is copied to the other, and a file that differs keeps both versions. Nothing is deleted. |
|
| `pdfs sync reset ID` | Forget what a synced folder synced before and compare it with Proton Drive again. A file on one side only is copied to the other, and a file that differs keeps both versions. Nothing is deleted. |
|
||||||
| `pdfs sync pause [--for 1h] [--folder ID]` | Pause uploads and synced folders. Reading files keeps working. `--for` ends the pause by itself (`30m`, `1h`, `2d`). |
|
| `pdfs sync pause [--for 1h] [--folder ID]` | Pause uploads and synced folders. Reading files keeps working. `--for` ends the pause by itself (`30m`, `1h`, `2d`). |
|
||||||
| `pdfs sync resume [--folder ID]` | Resume after a pause. |
|
| `pdfs sync resume [--folder ID]` | Resume after a pause. |
|
||||||
| `pdfs sync ignore list` | Print the patterns every synced folder leaves out. Built-in ones are marked. |
|
| `pdfs sync ignore list [--folder PATH]` | Print the patterns every synced folder leaves out; built-in ones are marked. With `--folder`, the own patterns of the synced folder holding `PATH`. |
|
||||||
| `pdfs sync ignore add PATTERN` / `remove PATTERN` | Leave out, or stop leaving out, files matching a gitignore-style pattern such as `*.db` or `build/`. A pattern starting with `-` goes after `--`. |
|
| `pdfs sync ignore add PATTERN [--folder PATH]` / `remove PATTERN [--folder PATH]` | Leave out, or stop leaving out, files matching a gitignore-style pattern such as `*.db` or `build/`, in every synced folder or, with `--folder`, in that folder's `.pdfsignore` only. A pattern starting with `-` goes after `--`. |
|
||||||
| `pdfs sync ignore reset` | Use the built-in patterns again. |
|
| `pdfs sync ignore reset` | Use the built-in patterns again. |
|
||||||
| `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. |
|
||||||
|
|||||||
@@ -118,8 +118,8 @@ Gitignore-style rules applied to every synced folder, in addition to each folder
|
|||||||
".fuse_hidden*", ".nfs*", "*.part", "*.crdownload", "*.kate-swp", ".~lock.*#", "~$*"]
|
".fuse_hidden*", ".nfs*", "*.part", "*.crdownload", "*.kate-swp", ".~lock.*#", "~$*"]
|
||||||
```
|
```
|
||||||
|
|
||||||
Preferences → Sync → Excluded Files edits this list, and `pdfs sync ignore` does the same from
|
Preferences → Sync → Excluded Files edits this list, **Add Pattern** on the Sync page's Folders
|
||||||
a terminal. A list equal to the defaults is saved as absent, so it follows the defaults of later
|
view adds to it, and `pdfs sync ignore` does the same from a terminal. A list equal to the defaults is saved as absent, so it follows the defaults of later
|
||||||
releases. Set it to `[]` to turn the defaults off. See
|
releases. Set it to `[]` to turn the defaults off. See
|
||||||
[Synced folders](SYNCED_FOLDERS.md#excluding-files-with-pdfsignore) for how excluding behaves.
|
[Synced folders](SYNCED_FOLDERS.md#excluding-files-with-pdfsignore) for how excluding behaves.
|
||||||
|
|
||||||
|
|||||||
+11
-4
@@ -108,10 +108,15 @@ apply together:
|
|||||||
lock files, `.DS_Store`, `Thumbs.db`, `desktop.ini`, `.directory`, trash folders, `.nfs*` and
|
lock files, `.DS_Store`, `Thumbs.db`, `desktop.ini`, `.directory`, trash folders, `.nfs*` and
|
||||||
`.fuse_hidden*`). Each built-in pattern can be turned off on its own.
|
`.fuse_hidden*`). Each built-in pattern can be turned off on its own.
|
||||||
|
|
||||||
To edit a folder's own rules in the app, open the **Sync** page, then **Folders**, and pick
|
In the app, open the **Sync** page, then **Folders**. Under the folder list, **Excluded Files**
|
||||||
**Excluded Files…** in the folder's menu. It checks every line as you type, and **Check a path**
|
shows how many patterns apply to all synced folders and how many each folder has of its own:
|
||||||
tells you whether a file is synced and which pattern decides. If the file changed meanwhile, for
|
|
||||||
example on another computer, it asks before replacing that version.
|
- **Add Pattern** asks for a pattern and where it applies: all synced folders, or one of them.
|
||||||
|
- **All Synced Folders** opens Preferences → Sync, with every pattern and the built-in ones.
|
||||||
|
- A folder opens the editor for its own rules, which **Excluded Files…** in the folder's menu
|
||||||
|
opens too. It checks every line as you type, and **Check a path** tells you whether a file is
|
||||||
|
synced and which pattern decides. If the file changed meanwhile, for example on another
|
||||||
|
computer, it asks before replacing that version.
|
||||||
|
|
||||||
From a terminal:
|
From a terminal:
|
||||||
|
|
||||||
@@ -120,6 +125,8 @@ pdfs sync ignore list # the patterns for every synced folder
|
|||||||
pdfs sync ignore add '*.db' # leave out files ending in .db
|
pdfs sync ignore add '*.db' # leave out files ending in .db
|
||||||
pdfs sync ignore remove '*.db'
|
pdfs sync ignore remove '*.db'
|
||||||
pdfs sync ignore reset # back to the built-in patterns
|
pdfs sync ignore reset # back to the built-in patterns
|
||||||
|
pdfs sync ignore add 'cache/' --folder ~/Projects # only in ~/Projects/.pdfsignore
|
||||||
|
pdfs sync ignore list --folder ~/Projects
|
||||||
pdfs sync ignore check ~/Projects/app/node_modules
|
pdfs sync ignore check ~/Projects/app/node_modules
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
pkgbase = proton-drive-for-linux-bin
|
pkgbase = proton-drive-for-linux-bin
|
||||||
pkgdesc = Unofficial Proton Drive client: FUSE files-on-demand mount, CLI, GTK4 app, tray (binaries)
|
pkgdesc = Unofficial Proton Drive client: FUSE files-on-demand mount, CLI, GTK4 app, tray (binaries)
|
||||||
pkgver = 3.7.0
|
pkgver = 3.8.0
|
||||||
pkgrel = 1
|
pkgrel = 1
|
||||||
url = https://proton-drive.narl.io
|
url = https://proton-drive.narl.io
|
||||||
install = proton-drive.install
|
install = proton-drive.install
|
||||||
@@ -22,15 +22,15 @@ pkgbase = proton-drive-for-linux-bin
|
|||||||
optdepends = xdg-utils: "Open folder" action in the tray menu
|
optdepends = xdg-utils: "Open folder" action in the tray menu
|
||||||
optdepends = fzf: search-as-you-type launcher (pdfs-prompt --fzf)
|
optdepends = fzf: search-as-you-type launcher (pdfs-prompt --fzf)
|
||||||
optdepends = foot: terminal that hosts pdfs-prompt --fzf when started from a keybinding
|
optdepends = foot: terminal that hosts pdfs-prompt --fzf when started from a keybinding
|
||||||
provides = proton-drive-for-linux=3.7.0
|
provides = proton-drive-for-linux=3.8.0
|
||||||
provides = proton-drive-linux=3.7.0
|
provides = proton-drive-linux=3.8.0
|
||||||
provides = pdfs
|
provides = pdfs
|
||||||
conflicts = proton-drive-linux
|
conflicts = proton-drive-linux
|
||||||
conflicts = proton-drive-for-linux
|
conflicts = proton-drive-for-linux
|
||||||
conflicts = proton-drive-for-linux-git
|
conflicts = proton-drive-for-linux-git
|
||||||
options = !strip
|
options = !strip
|
||||||
options = !debug
|
options = !debug
|
||||||
source = proton-drive-linux-3.7.0-x86_64.tar.gz::https://github.com/narrrl/proton-drive-linux/releases/download/v3.7.0/proton-drive-linux-3.7.0-x86_64.tar.gz
|
source = proton-drive-linux-3.8.0-x86_64.tar.gz::https://github.com/narrrl/proton-drive-linux/releases/download/v3.8.0/proton-drive-linux-3.8.0-x86_64.tar.gz
|
||||||
sha256sums = SKIP
|
sha256sums = 99348fbf9121624701ae43e52776e5d1c469ff5cd5e52cd216bf8cb969e0bab2
|
||||||
|
|
||||||
pkgname = proton-drive-for-linux-bin
|
pkgname = proton-drive-for-linux-bin
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# Maintainer: Nils Pukropp <contact@narl.io>
|
# Maintainer: Nils Pukropp <contact@narl.io>
|
||||||
|
|
||||||
pkgname=proton-drive-for-linux-bin
|
pkgname=proton-drive-for-linux-bin
|
||||||
pkgver=3.7.0
|
pkgver=3.8.0
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Unofficial Proton Drive client: FUSE files-on-demand mount, CLI, GTK4 app, tray (binaries)"
|
pkgdesc="Unofficial Proton Drive client: FUSE files-on-demand mount, CLI, GTK4 app, tray (binaries)"
|
||||||
arch=('x86_64')
|
arch=('x86_64')
|
||||||
@@ -29,7 +29,7 @@ _tag="v$pkgver"
|
|||||||
# (desktop files, icon, user service, translations, completions) in a /usr-like
|
# (desktop files, icon, user service, translations, completions) in a /usr-like
|
||||||
# tree under one directory.
|
# tree under one directory.
|
||||||
source=("proton-drive-linux-$pkgver-x86_64.tar.gz::$_repo/releases/download/$_tag/proton-drive-linux-$pkgver-x86_64.tar.gz")
|
source=("proton-drive-linux-$pkgver-x86_64.tar.gz::$_repo/releases/download/$_tag/proton-drive-linux-$pkgver-x86_64.tar.gz")
|
||||||
sha256sums=('SKIP')
|
sha256sums=('99348fbf9121624701ae43e52776e5d1c469ff5cd5e52cd216bf8cb969e0bab2')
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
cd "$srcdir/proton-drive-linux-$pkgver-x86_64"
|
cd "$srcdir/proton-drive-linux-$pkgver-x86_64"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
pkgbase = proton-drive-for-linux-git
|
pkgbase = proton-drive-for-linux-git
|
||||||
pkgdesc = Unofficial Proton Drive client: FUSE files-on-demand mount, CLI, GTK4 app, tray (git)
|
pkgdesc = Unofficial Proton Drive client: FUSE files-on-demand mount, CLI, GTK4 app, tray (git)
|
||||||
pkgver = 3.7.0.r0.g7ab14bb
|
pkgver = 3.8.0.r0.g6fa91e8
|
||||||
pkgrel = 1
|
pkgrel = 1
|
||||||
url = https://proton-drive.narl.io
|
url = https://proton-drive.narl.io
|
||||||
install = proton-drive.install
|
install = proton-drive.install
|
||||||
@@ -25,8 +25,8 @@ pkgbase = proton-drive-for-linux-git
|
|||||||
optdepends = xdg-utils: "Open folder" action in the tray menu
|
optdepends = xdg-utils: "Open folder" action in the tray menu
|
||||||
optdepends = fzf: search-as-you-type launcher (pdfs-prompt --fzf)
|
optdepends = fzf: search-as-you-type launcher (pdfs-prompt --fzf)
|
||||||
optdepends = foot: terminal that hosts pdfs-prompt --fzf when started from a keybinding
|
optdepends = foot: terminal that hosts pdfs-prompt --fzf when started from a keybinding
|
||||||
provides = proton-drive-for-linux=3.7.0.r0.g7ab14bb
|
provides = proton-drive-for-linux=3.8.0.r0.g6fa91e8
|
||||||
provides = proton-drive-linux=3.7.0.r0.g7ab14bb
|
provides = proton-drive-linux=3.8.0.r0.g6fa91e8
|
||||||
provides = pdfs
|
provides = pdfs
|
||||||
conflicts = proton-drive-linux
|
conflicts = proton-drive-linux
|
||||||
conflicts = proton-drive-for-linux
|
conflicts = proton-drive-for-linux
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Maintainer: Nils Pukropp <contact@narl.io>
|
# Maintainer: Nils Pukropp <contact@narl.io>
|
||||||
|
|
||||||
pkgname=proton-drive-for-linux-git
|
pkgname=proton-drive-for-linux-git
|
||||||
pkgver=3.7.0.r0.g7ab14bb
|
pkgver=3.8.0.r0.g6fa91e8
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Unofficial Proton Drive client: FUSE files-on-demand mount, CLI, GTK4 app, tray (git)"
|
pkgdesc="Unofficial Proton Drive client: FUSE files-on-demand mount, CLI, GTK4 app, tray (git)"
|
||||||
arch=('x86_64')
|
arch=('x86_64')
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
pkgbase = proton-drive-for-linux
|
pkgbase = proton-drive-for-linux
|
||||||
pkgdesc = Unofficial Proton Drive client: files-on-demand FUSE mount, CLI, GTK4 app and tray
|
pkgdesc = Unofficial Proton Drive client: files-on-demand FUSE mount, CLI, GTK4 app and tray
|
||||||
pkgver = 3.7.0
|
pkgver = 3.8.0
|
||||||
pkgrel = 1
|
pkgrel = 1
|
||||||
url = https://proton-drive.narl.io
|
url = https://proton-drive.narl.io
|
||||||
install = proton-drive.install
|
install = proton-drive.install
|
||||||
@@ -24,13 +24,13 @@ pkgbase = proton-drive-for-linux
|
|||||||
optdepends = xdg-utils: "Open folder" action in the tray menu
|
optdepends = xdg-utils: "Open folder" action in the tray menu
|
||||||
optdepends = fzf: search-as-you-type launcher (pdfs-prompt --fzf)
|
optdepends = fzf: search-as-you-type launcher (pdfs-prompt --fzf)
|
||||||
optdepends = foot: terminal that hosts pdfs-prompt --fzf when started from a keybinding
|
optdepends = foot: terminal that hosts pdfs-prompt --fzf when started from a keybinding
|
||||||
provides = proton-drive-linux=3.7.0
|
provides = proton-drive-linux=3.8.0
|
||||||
provides = pdfs
|
provides = pdfs
|
||||||
conflicts = proton-drive-linux
|
conflicts = proton-drive-linux
|
||||||
conflicts = proton-drive-for-linux-bin
|
conflicts = proton-drive-for-linux-bin
|
||||||
conflicts = proton-drive-for-linux-git
|
conflicts = proton-drive-for-linux-git
|
||||||
options = !lto
|
options = !lto
|
||||||
source = proton-drive-for-linux-3.7.0.tar.gz::https://github.com/narrrl/proton-drive-linux/archive/refs/tags/v3.7.0.tar.gz
|
source = proton-drive-for-linux-3.8.0.tar.gz::https://github.com/narrrl/proton-drive-linux/archive/refs/tags/v3.8.0.tar.gz
|
||||||
sha256sums = 542c534976e335cde6658de127e1eefffade9057d5332fd33457bc371c7a2737
|
sha256sums = 095186fa108f27ff2b175188bb13466a94cc8ecfd71088df47a41d4d9baa58c1
|
||||||
|
|
||||||
pkgname = proton-drive-for-linux
|
pkgname = proton-drive-for-linux
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# Maintainer: Nils Pukropp <contact@narl.io>
|
# Maintainer: Nils Pukropp <contact@narl.io>
|
||||||
|
|
||||||
pkgname=proton-drive-for-linux
|
pkgname=proton-drive-for-linux
|
||||||
pkgver=3.7.0
|
pkgver=3.8.0
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Unofficial Proton Drive client: files-on-demand FUSE mount, CLI, GTK4 app and tray"
|
pkgdesc="Unofficial Proton Drive client: files-on-demand FUSE mount, CLI, GTK4 app and tray"
|
||||||
arch=('x86_64')
|
arch=('x86_64')
|
||||||
@@ -26,7 +26,7 @@ options=('!lto')
|
|||||||
# Stops the running daemon before removal, so the mount stops mirroring deletes.
|
# Stops the running daemon before removal, so the mount stops mirroring deletes.
|
||||||
install=proton-drive.install
|
install=proton-drive.install
|
||||||
source=("$pkgname-$pkgver.tar.gz::$_repo/archive/refs/tags/v$pkgver.tar.gz")
|
source=("$pkgname-$pkgver.tar.gz::$_repo/archive/refs/tags/v$pkgver.tar.gz")
|
||||||
sha256sums=('542c534976e335cde6658de127e1eefffade9057d5332fd33457bc371c7a2737')
|
sha256sums=('095186fa108f27ff2b175188bb13466a94cc8ecfd71088df47a41d4d9baa58c1')
|
||||||
|
|
||||||
_srcname="proton-drive-linux-$pkgver"
|
_srcname="proton-drive-linux-$pkgver"
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ crates/pdfs-gui/src/app/pages/preferences_sync.rs
|
|||||||
crates/pdfs-gui/src/app/pages/shared.rs
|
crates/pdfs-gui/src/app/pages/shared.rs
|
||||||
crates/pdfs-gui/src/app/pages/shared_by_me.rs
|
crates/pdfs-gui/src/app/pages/shared_by_me.rs
|
||||||
crates/pdfs-gui/src/app/pages/status.rs
|
crates/pdfs-gui/src/app/pages/status.rs
|
||||||
|
crates/pdfs-gui/src/app/pages/sync_exclusions.rs
|
||||||
crates/pdfs-gui/src/app/pages/takeout.rs
|
crates/pdfs-gui/src/app/pages/takeout.rs
|
||||||
crates/pdfs-gui/src/app/pages/trash.rs
|
crates/pdfs-gui/src/app/pages/trash.rs
|
||||||
crates/pdfs-gui/src/app/pages/verify.rs
|
crates/pdfs-gui/src/app/pages/verify.rs
|
||||||
|
|||||||
+465
-320
File diff suppressed because it is too large.
Load diff
+372
-261
File diff suppressed because it is too large.
Load diff
+426
-279
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user