From 9a74194391c3c1eec6b5c98ac35c376fda90d189 Mon Sep 17 00:00:00 2001 From: Ralph Plawetzki Date: Mon, 27 Oct 2025 05:33:35 +0100 Subject: [PATCH 001/100] Make SecretServiceKeychainAccess the default selection --- src/main/java/org/cryptomator/common/settings/Settings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/common/settings/Settings.java b/src/main/java/org/cryptomator/common/settings/Settings.java index a711e6536..dfa32e90d 100644 --- a/src/main/java/org/cryptomator/common/settings/Settings.java +++ b/src/main/java/org/cryptomator/common/settings/Settings.java @@ -46,7 +46,7 @@ public class Settings { @Deprecated // to be changed to "whatever is available" eventually static final String DEFAULT_KEYCHAIN_PROVIDER = SystemUtils.IS_OS_WINDOWS ? "org.cryptomator.windows.keychain.WindowsProtectedKeychainAccess" : // SystemUtils.IS_OS_MAC ? "org.cryptomator.macos.keychain.MacSystemKeychainAccess" : // - "org.cryptomator.linux.keychain.GnomeKeyringKeychainAccess"; + "org.cryptomator.linux.keychain.SecretServiceKeychainAccess"; static final String DEFAULT_QUICKACCESS_SERVICE = SystemUtils.IS_OS_WINDOWS ? "org.cryptomator.windows.quickaccess.ExplorerQuickAccessService" : // SystemUtils.IS_OS_LINUX ? "org.cryptomator.linux.quickaccess.NautilusBookmarks" : null; From 760e260eba0c89bc76f90aee083658c4099dd7cb Mon Sep 17 00:00:00 2001 From: Jan-Peter Klein Date: Wed, 17 Dec 2025 09:56:56 +0100 Subject: [PATCH 002/100] show archived vault dialog on unlock when Hub returns 410 --- .../org/cryptomator/ui/common/FxmlFile.java | 1 + .../hub/ArchivedVaultController.java | 34 +++++++++++++ .../keyloading/hub/HubKeyLoadingModule.java | 12 +++++ .../keyloading/hub/ReceiveKeyController.java | 26 ++++++++-- .../resources/fxml/hub_archived_vault.fxml | 51 +++++++++++++++++++ src/main/resources/i18n/strings.properties | 3 ++ 6 files changed, 124 insertions(+), 3 deletions(-) create mode 100644 src/main/java/org/cryptomator/ui/keyloading/hub/ArchivedVaultController.java create mode 100644 src/main/resources/fxml/hub_archived_vault.fxml diff --git a/src/main/java/org/cryptomator/ui/common/FxmlFile.java b/src/main/java/org/cryptomator/ui/common/FxmlFile.java index 68607808d..c3cd9c1ef 100644 --- a/src/main/java/org/cryptomator/ui/common/FxmlFile.java +++ b/src/main/java/org/cryptomator/ui/common/FxmlFile.java @@ -18,6 +18,7 @@ public enum FxmlFile { FORGET_PASSWORD("/fxml/forget_password.fxml"), // HEALTH_START("/fxml/health_start.fxml"), // HEALTH_CHECK_LIST("/fxml/health_check_list.fxml"), // + HUB_ARCHIVED_VAULT("/fxml/hub_archived_vault.fxml"), // HUB_NO_KEYCHAIN("/fxml/hub_no_keychain.fxml"), // HUB_AUTH_FLOW("/fxml/hub_auth_flow.fxml"), // HUB_INVALID_LICENSE("/fxml/hub_invalid_license.fxml"), // diff --git a/src/main/java/org/cryptomator/ui/keyloading/hub/ArchivedVaultController.java b/src/main/java/org/cryptomator/ui/keyloading/hub/ArchivedVaultController.java new file mode 100644 index 000000000..c952e1040 --- /dev/null +++ b/src/main/java/org/cryptomator/ui/keyloading/hub/ArchivedVaultController.java @@ -0,0 +1,34 @@ +package org.cryptomator.ui.keyloading.hub; + +import org.cryptomator.ui.common.FxController; +import org.cryptomator.ui.keyloading.KeyLoading; +import org.cryptomator.ui.keyloading.KeyLoadingScoped; + +import javax.inject.Inject; +import javafx.fxml.FXML; +import javafx.stage.Stage; +import javafx.stage.WindowEvent; +import java.util.concurrent.CompletableFuture; + +@KeyLoadingScoped +public class ArchivedVaultController implements FxController { + + private final Stage window; + private final CompletableFuture result; + + @Inject + public ArchivedVaultController(@KeyLoading Stage window, CompletableFuture result) { + this.window = window; + this.result = result; + this.window.addEventHandler(WindowEvent.WINDOW_HIDING, this::windowClosed); + } + + @FXML + public void close() { + window.close(); + } + + private void windowClosed(WindowEvent windowEvent) { + result.cancel(true); + } +} diff --git a/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingModule.java b/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingModule.java index f8710b8c0..806e99a0f 100644 --- a/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingModule.java +++ b/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingModule.java @@ -161,6 +161,13 @@ public abstract class HubKeyLoadingModule { return fxmlLoaders.createScene(FxmlFile.HUB_UNAUTHORIZED_DEVICE); } + @Provides + @FxmlScene(FxmlFile.HUB_ARCHIVED_VAULT) + @KeyLoadingScoped + static Scene provideHubArchivedVaultScene(@KeyLoading FxmlLoaderFactory fxmlLoaders) { + return fxmlLoaders.createScene(FxmlFile.HUB_ARCHIVED_VAULT); + } + @Provides @FxmlScene(FxmlFile.HUB_REQUIRE_ACCOUNT_INIT) @KeyLoadingScoped @@ -213,6 +220,11 @@ public abstract class HubKeyLoadingModule { @FxControllerKey(RegisterFailedController.class) abstract FxController bindRegisterFailedController(RegisterFailedController controller); + @Binds + @IntoMap + @FxControllerKey(ArchivedVaultController.class) + abstract FxController bindArchivedVaultController(ArchivedVaultController controller); + @Binds @IntoMap @FxControllerKey(UnauthorizedDeviceController.class) diff --git a/src/main/java/org/cryptomator/ui/keyloading/hub/ReceiveKeyController.java b/src/main/java/org/cryptomator/ui/keyloading/hub/ReceiveKeyController.java index f94d882fa..a93d942cb 100644 --- a/src/main/java/org/cryptomator/ui/keyloading/hub/ReceiveKeyController.java +++ b/src/main/java/org/cryptomator/ui/keyloading/hub/ReceiveKeyController.java @@ -54,12 +54,25 @@ public class ReceiveKeyController implements FxController { private final Lazy registerDeviceScene; private final Lazy legacyRegisterDeviceScene; private final Lazy unauthorizedScene; + private final Lazy archivedVaultScene; private final Lazy accountInitializationScene; private final Lazy invalidLicenseScene; private final HttpClient httpClient; @Inject - public ReceiveKeyController(@KeyLoading Vault vault, ExecutorService executor, @KeyLoading Stage window, HubConfig hubConfig, @Named("deviceId") String deviceId, @Named("bearerToken") AtomicReference tokenRef, CompletableFuture result, @FxmlScene(FxmlFile.HUB_REGISTER_DEVICE) Lazy registerDeviceScene, @FxmlScene(FxmlFile.HUB_LEGACY_REGISTER_DEVICE) Lazy legacyRegisterDeviceScene, @FxmlScene(FxmlFile.HUB_UNAUTHORIZED_DEVICE) Lazy unauthorizedScene, @FxmlScene(FxmlFile.HUB_REQUIRE_ACCOUNT_INIT) Lazy accountInitializationScene, @FxmlScene(FxmlFile.HUB_INVALID_LICENSE) Lazy invalidLicenseScene) { + public ReceiveKeyController(@KeyLoading Vault vault, + ExecutorService executor, + @KeyLoading Stage window, + HubConfig hubConfig, + @Named("deviceId") String deviceId, + @Named("bearerToken") AtomicReference tokenRef, + CompletableFuture result, + @FxmlScene(FxmlFile.HUB_REGISTER_DEVICE) Lazy registerDeviceScene, + @FxmlScene(FxmlFile.HUB_LEGACY_REGISTER_DEVICE) Lazy legacyRegisterDeviceScene, + @FxmlScene(FxmlFile.HUB_ARCHIVED_VAULT) Lazy archivedVaultScene, + @FxmlScene(FxmlFile.HUB_UNAUTHORIZED_DEVICE) Lazy unauthorizedScene, + @FxmlScene(FxmlFile.HUB_REQUIRE_ACCOUNT_INIT) Lazy accountInitializationScene, + @FxmlScene(FxmlFile.HUB_INVALID_LICENSE) Lazy invalidLicenseScene) { this.window = window; this.hubConfig = hubConfig; this.vaultId = extractVaultId(vault.getVaultConfigCache().getUnchecked().getKeyId()); // TODO: access vault config's JTI directly (requires changes in cryptofs) @@ -69,6 +82,7 @@ public class ReceiveKeyController implements FxController { this.registerDeviceScene = registerDeviceScene; this.legacyRegisterDeviceScene = legacyRegisterDeviceScene; this.unauthorizedScene = unauthorizedScene; + this.archivedVaultScene = archivedVaultScene; this.accountInitializationScene = accountInitializationScene; this.invalidLicenseScene = invalidLicenseScene; this.window.addEventHandler(WindowEvent.WINDOW_HIDING, this::windowClosed); @@ -184,7 +198,8 @@ public class ReceiveKeyController implements FxController { switch (response.statusCode()) { case 200 -> receivedBothEncryptedKeys(response.body(), encryptedUserKey); case 402 -> licenseExceeded(); - case 403, 410 -> accessNotGranted(); // or vault has been archived, effectively disallowing access - TODO: add specific dialog? + case 403 -> accessNotGranted(); + case 410 -> accessGoneVaultArchived(); case 449 -> accountInitializationRequired(); default -> throw new IllegalStateException("Unexpected response " + response.statusCode()); } @@ -228,7 +243,8 @@ public class ReceiveKeyController implements FxController { switch (response.statusCode()) { case 200 -> receivedLegacyAccessTokenSuccess(response.body()); case 402 -> licenseExceeded(); - case 403, 410 -> accessNotGranted(); // or vault has been archived, effectively disallowing access + case 403 -> accessNotGranted(); + case 410 -> accessGoneVaultArchived(); case 404 -> needsLegacyDeviceRegistration(); default -> throw new IOException("Unexpected response " + response.statusCode()); } @@ -261,6 +277,10 @@ public class ReceiveKeyController implements FxController { window.setScene(unauthorizedScene.get()); } + private void accessGoneVaultArchived() { + window.setScene(archivedVaultScene.get()); + } + private void accountInitializationRequired() { window.setScene(accountInitializationScene.get()); } diff --git a/src/main/resources/fxml/hub_archived_vault.fxml b/src/main/resources/fxml/hub_archived_vault.fxml new file mode 100644 index 000000000..99319e825 --- /dev/null +++ b/src/main/resources/fxml/hub_archived_vault.fxml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +