From 33b378d0217859dcb8dc872fe9074cf77ede2bc1 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 23 Aug 2024 15:57:18 +0200 Subject: [PATCH 1/3] Simplify CheckAvailabillity method for quickAccess * only check for files * circumvent flatpak need of spawning host processes --- .../linux/quickaccess/DolphinPlaces.java | 4 +--- .../linux/quickaccess/NautilusBookmarks.java | 4 +--- .../cryptomator/linux/util/SupportUtil.java | 21 ------------------- 3 files changed, 2 insertions(+), 27 deletions(-) delete mode 100644 src/main/java/org/cryptomator/linux/util/SupportUtil.java diff --git a/src/main/java/org/cryptomator/linux/quickaccess/DolphinPlaces.java b/src/main/java/org/cryptomator/linux/quickaccess/DolphinPlaces.java index 8c127b5..16bdbba 100644 --- a/src/main/java/org/cryptomator/linux/quickaccess/DolphinPlaces.java +++ b/src/main/java/org/cryptomator/linux/quickaccess/DolphinPlaces.java @@ -6,7 +6,6 @@ import org.cryptomator.integrations.common.Priority; import org.cryptomator.integrations.quickaccess.QuickAccessService; import org.cryptomator.integrations.quickaccess.QuickAccessServiceException; -import org.cryptomator.linux.util.SupportUtil; import org.xml.sax.SAXException; import javax.xml.XMLConstants; @@ -23,7 +22,6 @@ import java.nio.file.StandardOpenOption; import java.util.List; import java.util.UUID; -import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -161,6 +159,6 @@ private int indexOfEntryOpeningTag(String placesContent, int idIndex) { @CheckAvailability public static boolean isSupported() { - return SupportUtil.commandExists("dolphin"); + return Files.exists(PLACES_FILE); } } diff --git a/src/main/java/org/cryptomator/linux/quickaccess/NautilusBookmarks.java b/src/main/java/org/cryptomator/linux/quickaccess/NautilusBookmarks.java index c05ed73..c3bfa89 100644 --- a/src/main/java/org/cryptomator/linux/quickaccess/NautilusBookmarks.java +++ b/src/main/java/org/cryptomator/linux/quickaccess/NautilusBookmarks.java @@ -6,7 +6,6 @@ import org.cryptomator.integrations.common.Priority; import org.cryptomator.integrations.quickaccess.QuickAccessService; import org.cryptomator.integrations.quickaccess.QuickAccessServiceException; -import org.cryptomator.linux.util.SupportUtil; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -14,7 +13,6 @@ import java.nio.file.Path; import java.nio.file.StandardCopyOption; import java.nio.file.StandardOpenOption; -import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantReadWriteLock; @@ -85,6 +83,6 @@ public void remove() throws QuickAccessServiceException { @CheckAvailability public static boolean isSupported() { - return SupportUtil.commandExists("nautilus"); + return Files.exists(BOOKMARKS_FILE); } } diff --git a/src/main/java/org/cryptomator/linux/util/SupportUtil.java b/src/main/java/org/cryptomator/linux/util/SupportUtil.java deleted file mode 100644 index 5c022d9..0000000 --- a/src/main/java/org/cryptomator/linux/util/SupportUtil.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.cryptomator.linux.util; - -import java.io.IOException; -import java.util.Objects; -import java.util.concurrent.TimeUnit; - -public class SupportUtil { - - public static boolean commandExists(String commandName) { - var shell = Objects.requireNonNullElse(System.getenv("SHELL"),"sh"); - try { - var cmdExistsProcess = new ProcessBuilder().command(shell, "-c", "command -v " + commandName).start(); - if (cmdExistsProcess.waitFor(5000, TimeUnit.MILLISECONDS)) { - return cmdExistsProcess.exitValue() == 0; - } - } catch (IOException | InterruptedException e) { - //NO-OP - } - return false; - } -} From df2061d0215f75c59acf8abd4a8fac1945c486f7 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 16 Sep 2024 16:34:54 +0200 Subject: [PATCH 2/3] bump integrations-api to 1.4.0 --- pom.xml | 2 +- .../org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java | 2 +- .../cryptomator/linux/keychain/SecretServiceKeychainAccess.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 3b81c7e..da270ef 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,7 @@ - 1.4.0-beta2 + 1.4.0 2.0.1-alpha 1.4.0 2.0.13 diff --git a/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java b/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java index 52e0771..3b3fd98 100644 --- a/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java +++ b/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java @@ -48,7 +48,7 @@ public boolean isLocked() { } @Override - public void storePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException { + public void storePassphrase(String key, String displayName, CharSequence passphrase, boolean ignored) throws KeychainAccessException { CheckUtil.checkState(wallet.isPresent(), "Keychain not supported."); wallet.get().storePassphrase(key, passphrase); } diff --git a/src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java b/src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java index 5fa423f..86c6734 100644 --- a/src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java +++ b/src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java @@ -48,7 +48,7 @@ public boolean isLocked() { } @Override - public void storePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException { + public void storePassphrase(String key, String displayName, CharSequence passphrase, boolean ignored) throws KeychainAccessException { try (SimpleCollection keyring = new SimpleCollection()) { List list = keyring.getItems(createAttributes(key)); if (list == null || list.isEmpty()) { From 18e2cd15246244ebe3638a050d3f76042dc551c5 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 16 Sep 2024 16:35:18 +0200 Subject: [PATCH 3/3] bump slf4j --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index da270ef..ca1f964 100644 --- a/pom.xml +++ b/pom.xml @@ -43,7 +43,7 @@ 1.4.0 2.0.1-alpha 1.4.0 - 2.0.13 + 2.0.16 1.4.1