From c19a86a3484407826d0ba41824f17bedf4e4b6bc Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 7 Feb 2023 15:23:04 +0100 Subject: [PATCH 1/9] add link to mounting documentation --- .../ui/preferences/VolumePreferencesController.java | 12 +++++++++++- src/main/resources/fxml/preferences_volume.fxml | 12 ++++++++++++ src/main/resources/i18n/strings.properties | 2 ++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/ui/preferences/VolumePreferencesController.java b/src/main/java/org/cryptomator/ui/preferences/VolumePreferencesController.java index 00e680d2d..4784efceb 100644 --- a/src/main/java/org/cryptomator/ui/preferences/VolumePreferencesController.java +++ b/src/main/java/org/cryptomator/ui/preferences/VolumePreferencesController.java @@ -1,5 +1,6 @@ package org.cryptomator.ui.preferences; +import dagger.Lazy; import org.cryptomator.common.ObservableUtil; import org.cryptomator.common.settings.Settings; import org.cryptomator.integrations.mount.MountCapability; @@ -7,6 +8,7 @@ import org.cryptomator.integrations.mount.MountService; import org.cryptomator.ui.common.FxController; import javax.inject.Inject; +import javafx.application.Application; import javafx.beans.binding.Bindings; import javafx.beans.binding.BooleanExpression; import javafx.beans.value.ObservableValue; @@ -21,6 +23,8 @@ import java.util.ResourceBundle; @PreferencesScoped public class VolumePreferencesController implements FxController { + private static final String DOCS_MOUNTING_URL = "https://docs.cryptomator.org/en/1.7/desktop/vault-mounting/"; + private final Settings settings; private final ObservableValue selectedMountService; private final ResourceBundle resourceBundle; @@ -29,14 +33,16 @@ public class VolumePreferencesController implements FxController { private final ObservableValue mountToDriveLetterSupported; private final ObservableValue mountFlagsSupported; private final ObservableValue readonlySupported; + private final Lazy application; private final List mountProviders; public ChoiceBox volumeTypeChoiceBox; public TextField loopbackPortField; public Button loopbackPortApplyButton; @Inject - VolumePreferencesController(Settings settings, List mountProviders, ResourceBundle resourceBundle) { + VolumePreferencesController(Settings settings, Lazy application, List mountProviders, ResourceBundle resourceBundle) { this.settings = settings; + this.application = application; this.mountProviders = mountProviders; this.resourceBundle = resourceBundle; @@ -141,4 +147,8 @@ public class VolumePreferencesController implements FxController { throw new UnsupportedOperationException(); } } + + public void openDocs() { + application.get().getHostServices().showDocument(DOCS_MOUNTING_URL); + } } diff --git a/src/main/resources/fxml/preferences_volume.fxml b/src/main/resources/fxml/preferences_volume.fxml index 92df77e3d..ed41a746b 100644 --- a/src/main/resources/fxml/preferences_volume.fxml +++ b/src/main/resources/fxml/preferences_volume.fxml @@ -5,6 +5,7 @@ + @@ -58,5 +59,16 @@ + + + + + diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index fbee45826..dafb573a9 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -278,6 +278,8 @@ preferences.interface.showTrayIcon=Show tray icon (requires restart) preferences.volume=Virtual Drive preferences.volume.type=Volume Type (requires restart) preferences.volume.type.automatic=Automatic +preferences.volume.docs.description=More information about the different volume types can be found in the user documentation. +preferences.volume.docs.linkText=Open Cryptomator Docs preferences.volume.tcp.port=TCP Port preferences.volume.supportedFeatures=The chosen volume type supports the following features: preferences.volume.feature.mountAuto=Automatic mount point selection From 202a2ea79f886ef969f8038e89970cad9f4274e9 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 8 Feb 2023 11:14:54 +0100 Subject: [PATCH 2/9] Load revealPathServiceProvider at app startup --- .../org/cryptomator/common/CommonsModule.java | 9 +++++ .../VaultDetailUnlockedController.java | 34 ++++++++----------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/cryptomator/common/CommonsModule.java b/src/main/java/org/cryptomator/common/CommonsModule.java index ddd782d35..8ecfa51b6 100644 --- a/src/main/java/org/cryptomator/common/CommonsModule.java +++ b/src/main/java/org/cryptomator/common/CommonsModule.java @@ -16,6 +16,7 @@ import org.cryptomator.common.settings.SettingsProvider; import org.cryptomator.common.vaults.VaultComponent; import org.cryptomator.common.vaults.VaultListModule; import org.cryptomator.cryptolib.common.MasterkeyFileAccess; +import org.cryptomator.integrations.revealpath.RevealPathService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,6 +27,7 @@ import java.net.InetSocketAddress; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.Comparator; +import java.util.Optional; import java.util.concurrent.ExecutorService; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.SynchronousQueue; @@ -83,6 +85,13 @@ public abstract class CommonsModule { return new SemVerComparator(); } + @Provides + @Singleton + static Optional provideRevealPathService() { + return RevealPathService.get().findFirst(); + } + + @Provides @Singleton static Settings provideSettings(SettingsProvider settingsProvider) { diff --git a/src/main/java/org/cryptomator/ui/mainwindow/VaultDetailUnlockedController.java b/src/main/java/org/cryptomator/ui/mainwindow/VaultDetailUnlockedController.java index 066debc12..0e19590a9 100644 --- a/src/main/java/org/cryptomator/ui/mainwindow/VaultDetailUnlockedController.java +++ b/src/main/java/org/cryptomator/ui/mainwindow/VaultDetailUnlockedController.java @@ -54,6 +54,7 @@ public class VaultDetailUnlockedController implements FxController { private final VaultService vaultService; private final WrongFileAlertComponent.Builder wrongFileAlert; private final Stage mainWindow; + private final Optional revealPathService; private final ResourceBundle resourceBundle; private final LoadingCache vaultStats; private final VaultStatisticsComponent.Builder vaultStatsBuilder; @@ -67,12 +68,13 @@ public class VaultDetailUnlockedController implements FxController { public Button dropZone; @Inject - public VaultDetailUnlockedController(ObjectProperty vault, FxApplicationWindows appWindows, VaultService vaultService, VaultStatisticsComponent.Builder vaultStatsBuilder, WrongFileAlertComponent.Builder wrongFileAlert, @MainWindow Stage mainWindow, ResourceBundle resourceBundle) { + public VaultDetailUnlockedController(ObjectProperty vault, FxApplicationWindows appWindows, VaultService vaultService, VaultStatisticsComponent.Builder vaultStatsBuilder, WrongFileAlertComponent.Builder wrongFileAlert, @MainWindow Stage mainWindow, Optional revealPathService, ResourceBundle resourceBundle) { this.vault = vault; this.appWindows = appWindows; this.vaultService = vaultService; this.wrongFileAlert = wrongFileAlert; this.mainWindow = mainWindow; + this.revealPathService = revealPathService; this.resourceBundle = resourceBundle; this.vaultStats = CacheBuilder.newBuilder().weakValues().build(CacheLoader.from(this::buildVaultStats)); this.vaultStatsBuilder = vaultStatsBuilder; @@ -177,29 +179,21 @@ public class VaultDetailUnlockedController implements FxController { } private void revealOrCopyPaths(List paths) { - if (!revealPaths(paths)) { + revealPathService.ifPresentOrElse(svc -> revealPaths(svc, paths), () -> { LOG.warn("No service provider to reveal files found."); copyPathsToClipboard(paths); - } + }); } - /** - * Reveals the paths over the {@link RevealPathService} in the file system - * - * @param paths List of Paths to reveal - * @return true, if at least one service provider was present, false otherwise - */ - private boolean revealPaths(List paths) { - return RevealPathService.get().findAny().map(s -> { - paths.forEach(path -> { - try { - s.reveal(path); - } catch (RevealFailedException e) { - LOG.error("Revealing ciphertext file failed.", e); - } - }); - return true; - }).orElse(false); + private void revealPaths(RevealPathService service, List paths) { + paths.forEach(path -> { + try { + LOG.debug("Revealing {}", path); + service.reveal(path); + } catch (RevealFailedException e) { + LOG.error("Revealing ciphertext file failed.", e); + } + }); } private void copyPathsToClipboard(List paths) { From ac43efe14989aa1e1e1e92a3ab43683601133dc8 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 8 Feb 2023 11:33:41 +0100 Subject: [PATCH 3/9] change UI to be not so clunky: * only use question mark icon * use tooltip at icon instead of explicit label * icon is the hyperlink --- .../ui/controls/FontAwesome5Icon.java | 1 + .../resources/fxml/preferences_volume.fxml | 20 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/controls/FontAwesome5Icon.java b/src/main/java/org/cryptomator/ui/controls/FontAwesome5Icon.java index 997bfa41f..60f37719b 100644 --- a/src/main/java/org/cryptomator/ui/controls/FontAwesome5Icon.java +++ b/src/main/java/org/cryptomator/ui/controls/FontAwesome5Icon.java @@ -42,6 +42,7 @@ public enum FontAwesome5Icon { PLUS("\uF067"), // PRINT("\uF02F"), // QUESTION("\uF128"), // + QUESTION_CIRCLE("\uf059"), // REDO("\uF01E"), // SEARCH("\uF002"), // SPINNER("\uF110"), // diff --git a/src/main/resources/fxml/preferences_volume.fxml b/src/main/resources/fxml/preferences_volume.fxml index ed41a746b..23aff9acf 100644 --- a/src/main/resources/fxml/preferences_volume.fxml +++ b/src/main/resources/fxml/preferences_volume.fxml @@ -10,6 +10,7 @@ + - - - - - From e35ed9af728bf3d132ca502c8db158b386631f65 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 8 Feb 2023 20:11:34 +0100 Subject: [PATCH 4/9] enable localization of tooltip --- src/main/resources/fxml/preferences_volume.fxml | 2 +- src/main/resources/i18n/strings.properties | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/resources/fxml/preferences_volume.fxml b/src/main/resources/fxml/preferences_volume.fxml index 23aff9acf..16ccc2b52 100644 --- a/src/main/resources/fxml/preferences_volume.fxml +++ b/src/main/resources/fxml/preferences_volume.fxml @@ -27,7 +27,7 @@ - + diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index dafb573a9..050a8473e 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -278,8 +278,7 @@ preferences.interface.showTrayIcon=Show tray icon (requires restart) preferences.volume=Virtual Drive preferences.volume.type=Volume Type (requires restart) preferences.volume.type.automatic=Automatic -preferences.volume.docs.description=More information about the different volume types can be found in the user documentation. -preferences.volume.docs.linkText=Open Cryptomator Docs +preferences.volume.docsTooltip=Open the documentation to learn more about the different volume types. preferences.volume.tcp.port=TCP Port preferences.volume.supportedFeatures=The chosen volume type supports the following features: preferences.volume.feature.mountAuto=Automatic mount point selection From 1ff7c40fd906bd917410ef18ea1e1240eb4bbb24 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 13 Feb 2023 10:42:17 +0100 Subject: [PATCH 5/9] Fixes #2672 and fixes #2668 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index fa2c734fa..63d42c578 100644 --- a/pom.xml +++ b/pom.xml @@ -31,9 +31,9 @@ 2.1.1 2.6.1 1.2.0-beta4 - 1.2.0-beta2 + 1.2.0-beta3 1.2.0-beta2 - 1.2.0-beta1 + 1.2.0-beta2 2.0.0-beta5 2.0.0-beta2 2.0.0-beta4 From 5b0bbf539b709ee045c029aa78d5b9eae79c6bb4 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 13 Feb 2023 23:34:43 +0100 Subject: [PATCH 6/9] improve FailOnRunningApp action --- dist/win/resources/main.wxs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/win/resources/main.wxs b/dist/win/resources/main.wxs index 1fb7b552d..a9ca9d9c4 100644 --- a/dist/win/resources/main.wxs +++ b/dist/win/resources/main.wxs @@ -143,11 +143,11 @@ CloseMessage="no" RebootPrompt="no" PromptToContinue="yes" - Description="A running instance of $(var.JpAppName) is found. Please close it to continue." + Description="A running instance of $(var.JpAppName) is found, using files marked for update. Please close it to continue." Property="FOUNDRUNNINGAPP" > - + @@ -182,7 +182,7 @@ FOUNDRUNNINGAPP - + NOT Installed OR REINSTALL NOT Installed OR REINSTALL From 3dff3a866479ff24b0d8c218fd04a06585d2b850 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 14 Feb 2023 11:12:33 +0100 Subject: [PATCH 7/9] Fixes #2682 * allow windows installer to remove same version * add revisionNumber to installer version --- .github/workflows/win-exe.yml | 2 +- dist/win/build.ps1 | 2 +- dist/win/resources/main.wxs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/win-exe.yml b/.github/workflows/win-exe.yml index e8709ac89..61841a0d8 100644 --- a/.github/workflows/win-exe.yml +++ b/.github/workflows/win-exe.yml @@ -156,7 +156,7 @@ jobs: --name Cryptomator --vendor "Skymatic GmbH" --copyright "(C) 2016 - 2023 Skymatic GmbH" - --app-version "${{ needs.get-version.outputs.semVerNum }}" + --app-version "${{ needs.get-version.outputs.semVerNum }}.${{ needs.get-version.outputs.revNum}}" --win-menu --win-dir-chooser --win-shortcut-prompt diff --git a/dist/win/build.ps1 b/dist/win/build.ps1 index 9973f5c12..d842423a1 100644 --- a/dist/win/build.ps1 +++ b/dist/win/build.ps1 @@ -129,7 +129,7 @@ $Env:JP_WIXWIZARD_RESOURCES = "$buildDir\resources" --name $AppName ` --vendor $Vendor ` --copyright $copyright ` - --app-version "$semVerNo" ` + --app-version "$semVerNo.$revisionNo" ` --win-menu ` --win-dir-chooser ` --win-shortcut-prompt ` diff --git a/dist/win/resources/main.wxs b/dist/win/resources/main.wxs index a9ca9d9c4..50edd6371 100644 --- a/dist/win/resources/main.wxs +++ b/dist/win/resources/main.wxs @@ -54,7 +54,7 @@ Property="JP_UPGRADABLE_FOUND" Maximum="$(var.JpAppVersion)" MigrateFeatures="yes" - IncludeMaximum="$(var.JpUpgradeVersionOnlyDetectUpgrade)" /> + IncludeMaximum="yes" /> Date: Tue, 14 Feb 2023 11:22:11 +0100 Subject: [PATCH 8/9] bump webdav-nio-adapter --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 63d42c578..374f4c5be 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ 1.2.0-beta2 2.0.0-beta5 2.0.0-beta2 - 2.0.0-beta4 + 2.0.0-beta5 3.12.0 From a7b2802f34dbf722732dcadc468ad8250393cada Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 14 Feb 2023 11:39:16 +0100 Subject: [PATCH 9/9] show correct error message when using custom mountpoint with webdav (Http address) --- .../java/org/cryptomator/common/mount/Mounter.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/cryptomator/common/mount/Mounter.java b/src/main/java/org/cryptomator/common/mount/Mounter.java index 325f13f56..0161268f3 100644 --- a/src/main/java/org/cryptomator/common/mount/Mounter.java +++ b/src/main/java/org/cryptomator/common/mount/Mounter.java @@ -14,7 +14,6 @@ import javafx.beans.value.ObservableValue; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Objects; import static org.cryptomator.integrations.mount.MountCapability.MOUNT_AS_DRIVE_LETTER; import static org.cryptomator.integrations.mount.MountCapability.MOUNT_TO_EXISTING_DIR; @@ -60,7 +59,7 @@ public class Mounter { case READ_ONLY -> builder.setReadOnly(vaultSettings.usesReadOnlyMode().get()); case MOUNT_FLAGS -> { var mountFlags = vaultSettings.mountFlags().get(); - if( mountFlags == null || mountFlags.isBlank()) { + if (mountFlags == null || mountFlags.isBlank()) { builder.setMountFlags(service.getDefaultMountFlags()); } else { builder.setMountFlags(mountFlags); @@ -81,9 +80,10 @@ public class Mounter { var canMountToDriveLetter = service.hasCapability(MOUNT_AS_DRIVE_LETTER); var canMountToParent = service.hasCapability(MOUNT_WITHIN_EXISTING_PARENT); var canMountToDir = service.hasCapability(MOUNT_TO_EXISTING_DIR); + var canMountToSystem = service.hasCapability(MOUNT_TO_SYSTEM_CHOSEN_PATH); if (userChosenMountPoint == null) { - if (service.hasCapability(MOUNT_TO_SYSTEM_CHOSEN_PATH)) { + if (canMountToSystem) { // no need to set a mount point } else if (canMountToDriveLetter) { builder.setMountpoint(driveLetters.getFirstDesiredAvailable().orElseThrow()); //TODO: catch exception and translate @@ -105,8 +105,11 @@ public class Mounter { } try { builder.setMountpoint(userChosenMountPoint); - } catch (IllegalArgumentException e) { - var configNotSupported = (!canMountToDriveLetter && mpIsDriveLetter) || (!canMountToDir && !mpIsDriveLetter) || (!canMountToParent && !mpIsDriveLetter); + } catch (IllegalArgumentException | UnsupportedOperationException e) { + var configNotSupported = (!canMountToDriveLetter && mpIsDriveLetter) //mounting as driveletter, albeit not supported + || (!canMountToDir && !mpIsDriveLetter) //mounting to directory, albeit not supported + || (!canMountToParent && !mpIsDriveLetter) // + || (!canMountToDir && !canMountToParent && !canMountToSystem && !canMountToDriveLetter); if (configNotSupported) { throw new MountPointNotSupportedException(e.getMessage()); } else if (canMountToDir && !canMountToParent && !Files.exists(userChosenMountPoint)) {