From 36ed4554b226961615245b94b810ecb64cf37435 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 9 Dec 2022 15:12:04 +0100 Subject: [PATCH 01/76] Fixes #2570 Dabian build: Make libffi7 a runtime dependency and preload it. --- dist/linux/debian/control | 2 +- dist/linux/debian/cryptomator.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/linux/debian/control b/dist/linux/debian/control index b17454f40..92c91fdeb 100644 --- a/dist/linux/debian/control +++ b/dist/linux/debian/control @@ -12,7 +12,7 @@ Package: cryptomator Architecture: any Section: utils Priority: optional -Depends: ${shlibs:Depends}, ${misc:Depends}, libfuse2, xdg-utils, libjffi-jni +Depends: ${shlibs:Depends}, ${misc:Depends}, libfuse2, xdg-utils, libjffi-jni, libffi7 Recommends: gvfs-backends, gvfs-fuse, gnome-keyring XB-AppName: Cryptomator XB-Category: Utility;Security;FileTools; diff --git a/dist/linux/debian/cryptomator.sh b/dist/linux/debian/cryptomator.sh index 0d6453962..e79855a03 100644 --- a/dist/linux/debian/cryptomator.sh +++ b/dist/linux/debian/cryptomator.sh @@ -1,6 +1,6 @@ #!/bin/sh # fix for https://github.com/cryptomator/cryptomator/issues/1370 -export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/jni/libjffi-1.2.so +export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/jni/libjffi-1.2.so:/usr/lib/x86_64-linux-gnu/libffi.so.7.1.0 /usr/lib/cryptomator/bin/cryptomator $@ \ No newline at end of file From 433eecc6a81ef093c7783f58384f51c78ef2ac27 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 9 Dec 2022 16:41:31 +0100 Subject: [PATCH 02/76] adjust matching rules for version type detection (cherry picked from commit cd358916260e713d4119c20b1bcb5b448a017365) --- .github/workflows/get-version.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/get-version.yml b/.github/workflows/get-version.yml index e6131b835..5cffb56fb 100644 --- a/.github/workflows/get-version.yml +++ b/.github/workflows/get-version.yml @@ -58,13 +58,13 @@ jobs: SEM_VER_NUM=`echo ${SEM_VER_STR} | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/'` REVCOUNT=`git rev-list --count HEAD` TYPE="unknown" - if [[ $SEM_VER_STR =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then + if [[ $SEM_VER_STR =~ [0-9]+\.[0-9]+\.[0-9]+$ ]]; then TYPE="stable" - elif [[ $SEM_VER_STR =~ [0-9]+\.[0-9]+\.[0-9]+-alpha[1-9] ]]; then + elif [[ $SEM_VER_STR =~ [0-9]+\.[0-9]+\.[0-9]+-alpha[1-9]+$ ]]; then TYPE="alpha" - elif [[ $SEM_VER_STR =~ [0-9]+\.[0-9]+\.[0-9]+-beta[1-9] ]]; then + elif [[ $SEM_VER_STR =~ [0-9]+\.[0-9]+\.[0-9]+-beta[1-9]+$ ]]; then TYPE="beta" - elif [[ $SEM_VER_STR =~ [0-9]+\.[0-9]+\.[0-9]+-rc[1-9] ]]; then + elif [[ $SEM_VER_STR =~ [0-9]+\.[0-9]+\.[0-9]+-rc[1-9]$ ]]; then TYPE="rc" fi echo "semVerStr=${SEM_VER_STR}" >> $GITHUB_OUTPUT From 9dfd8adcced223b5c104c58a8059f5c4bea17124 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 9 Dec 2022 16:56:02 +0100 Subject: [PATCH 03/76] revert 0725a63b09922ec5dafd3ecd5c4953fedb023f25 and fix workflow --- .github/workflows/win-exe.yml | 22 +++++++++------------- .github/workflows/winget.yml | 5 +++++ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/win-exe.yml b/.github/workflows/win-exe.yml index f634abb87..a19056157 100644 --- a/.github/workflows/win-exe.yml +++ b/.github/workflows/win-exe.yml @@ -195,6 +195,15 @@ jobs: *.msi *.asc + call-winget-flow: + needs: [get-version, build-msi] + if: github.event.action == 'published' && needs.get-version.outputs.versionType == 'stable' + uses: ./.github/workflows/winget.yml + with: + releaseTag: ${{ github.event.release.tag_name }} + secrets: inherit + + build-exe: name: Build .exe installer runs-on: windows-latest @@ -299,19 +308,6 @@ jobs: files: | Cryptomator-*.exe Cryptomator-*.asc - - name: Slack Notification - if: ${{ needs.get-version.outputs.versionType == 'stable' }} - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} - SLACK_USERNAME: 'Cryptobot' - SLACK_ICON: false - SLACK_ICON_EMOJI: ':bot:' - SLACK_CHANNEL: 'cryptomator-desktop' - SLACK_TITLE: "Windows build of ${{ github.event.repository.name }} ${{ github.event.release.tag_name }} finished." - SLACK_MESSAGE: "Ready to ." - SLACK_FOOTER: false - MSG_MINIMAL: true allowlist: name: Anti Virus Allowlisting diff --git a/.github/workflows/winget.yml b/.github/workflows/winget.yml index 6d1475ef7..632b02de5 100644 --- a/.github/workflows/winget.yml +++ b/.github/workflows/winget.yml @@ -1,6 +1,11 @@ name: Release to Winget on: + workflow_call: + inputs: + releaseTag: + required: true + type: string workflow_dispatch: inputs: releaseTag: From 0d6d7b0dd6919ca6c2afb5fb1acc792a370acf2a Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 9 Dec 2022 16:56:45 +0100 Subject: [PATCH 04/76] directly use inputs object --- .github/workflows/appimage.yml | 2 +- .github/workflows/mac-dmg.yml | 2 +- .github/workflows/win-exe.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index a3502145a..de14f2f82 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -16,7 +16,7 @@ jobs: get-version: uses: ./.github/workflows/get-version.yml with: - version: ${{ github.event.inputs.version }} + version: ${{ inputs.version }} build: name: Build AppImage diff --git a/.github/workflows/mac-dmg.yml b/.github/workflows/mac-dmg.yml index 2b2a9c52b..bbb128c74 100644 --- a/.github/workflows/mac-dmg.yml +++ b/.github/workflows/mac-dmg.yml @@ -16,7 +16,7 @@ jobs: get-version: uses: ./.github/workflows/get-version.yml with: - version: ${{ github.event.inputs.version }} + version: ${{ inputs.version }} build: name: Build Cryptomator.app for ${{ matrix.output-suffix }} diff --git a/.github/workflows/win-exe.yml b/.github/workflows/win-exe.yml index a19056157..d28a1f95c 100644 --- a/.github/workflows/win-exe.yml +++ b/.github/workflows/win-exe.yml @@ -22,7 +22,7 @@ jobs: get-version: uses: ./.github/workflows/get-version.yml with: - version: ${{ github.event.inputs.version }} + version: ${{ inputs.version }} build-msi: name: Build .msi Installer From 980e2b184bf06e37c94c32526e0ded3a95821d71 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 13 Dec 2022 12:48:29 +0100 Subject: [PATCH 05/76] use correct tag name for gh release in debian workflow --- .github/workflows/debian.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml index 10bec996d..47549b76f 100644 --- a/.github/workflows/debian.yml +++ b/.github/workflows/debian.yml @@ -151,7 +151,7 @@ jobs: uses: softprops/action-gh-release@v1 with: fail_on_unmatched_files: true - tag_name: ${{ github.env.TAG_NAME }} + tag_name: ${{ inputs.ref }} token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }} files: | cryptomator_*_amd64.deb From 819fa803f31e74e6bade3d90b0b3daef56e70437 Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Wed, 14 Dec 2022 16:47:07 +0100 Subject: [PATCH 06/76] cleaned up tray icons --- .../ui/traymenu/TrayMenuBuilder.java | 2 +- src/main/resources/img/tray_icon.png | Bin 472 -> 1187 bytes src/main/resources/img/tray_icon_mac.png | Bin 376 -> 0 bytes 3 files changed, 1 insertion(+), 1 deletion(-) delete mode 100755 src/main/resources/img/tray_icon_mac.png diff --git a/src/main/java/org/cryptomator/ui/traymenu/TrayMenuBuilder.java b/src/main/java/org/cryptomator/ui/traymenu/TrayMenuBuilder.java index e96446143..db2f93a91 100644 --- a/src/main/java/org/cryptomator/ui/traymenu/TrayMenuBuilder.java +++ b/src/main/java/org/cryptomator/ui/traymenu/TrayMenuBuilder.java @@ -33,7 +33,7 @@ public class TrayMenuBuilder { private static final Logger LOG = LoggerFactory.getLogger(TrayMenuBuilder.class); private static final String TRAY_ICON_MAC = "/img/tray_icon_mac@2x.png"; - private static final String TRAY_ICON = "/img/window_icon_32.png"; + private static final String TRAY_ICON = "/img/tray_icon.png"; private final ResourceBundle resourceBundle; private final VaultService vaultService; diff --git a/src/main/resources/img/tray_icon.png b/src/main/resources/img/tray_icon.png index 6fa661d3c94d81d4f5e55dd0833d6dacd246ebef..0d14953d347af0057da51706a1488b76c41884d9 100644 GIT binary patch literal 1187 zcmV;U1YG-xP)j4>LbMe<{&Pd`*D(k9e1Oj5uyzn>P{v+wFE}^#;8B>g#yr^*3N%vJ_6I6V&!C zk+iSOiwQPHen~krxdj1K)YN0m+I1Y_A0ljTo1aGf)~C}$U6TjZ-PzC-<@?OlRe4a} zla1{1Vyy4)=MWzghwRM&Pg!j?^S5S{dY>$_4YXd`MTy`8UY4N>tS~!sT*- zYO3~TfR9?*I-oAkhw6@;1#Zh(2v8#UjnL#3z+f_iYNqy<`LP7@`4NZZ6Jv{d0)8O5)w*o{EKlW;Mo4R}ZK<{{~wG9tH_5{kRYEfQOhesZN5^uJ& zp{GxawvJ9-s2i!~2jaZlG94QmJ7{WZ>Jf{@(#=nAaapk3wgP>YK6KA@!)!HU+Bpqs z+sf^e&ME#4J##(KS#(%!Uk$t44sM^Dn`>b$*4*g;4u@mS`1m-e2sW3E7nmsZ!wsk& zsu69It(9{CjE;_iwODg!hx`CyBZ0}uN$|URorXnsiM;-Nu4Qw6XEw6-PKB^qtv?6@ zR18*%nxwp%hLktcMcW#Oo8Wf4eHyH}Q|2X=)kiela@$WUR<7DIF){HY7Z(i_1sNnh zmV)aeq8KDSmm1X0Q^RY3M&Jk5VolcG(eR(DGZ??;tyEp#w1U28*j;wfCyZ@Q^aY5& zD>QFew@!T`NJjA{G&vIAoY4 zqJ4M)lSVpgu_kM?hp0IvJdAF%4|vEuL=mc4=j@^jEv6w6ad#vwx(l3cC+oy`w7{?j zdu?x?OZ>%$3+>x~sneUD5xI~+L4TpB36DTzew=7qE$_ZK{Zf#DWSJB^|2M=&L%Jq7z*{qKfof+39@VVv@wkIMg#k7aVV=)3 z#QntnL;_vGuQ=Qeln#^yu7O?&BGj}7vV+$E?*JbDmbUgMNaHHj^=Qs`K8LZVFhDbR z^qBunTtIXXU`+InXKcf`cRPlJgYq%m-K*tVFQu&M(Vp>mHE+KT4kB(QE+oz(wt5AW zS-CKp&6sh{;O3E=7d5|Q^iJ@-(cROFto$NjfG<5B7kWHG-V59@OHhndsT|=kv3Tyq z7vXZdptWdGK3EYjK3Sk)(pi)?zB9ZwHozjY`pJ;JS z5?F0tgZ{Vs!K6P)NklE7@5#!_ z>JMYXM(#x4h1=10;9cx{oOp)2)2AmglufipR zt1x>f9O**_*<}WVVTx((30^tgJ+p$dzc0c$sY`PPeym?BGRQ6xKYaF5DKROjDL+5| zQV17PzbFHv`3xfXh;n3*Ma@D3dph0eJm?n~81y6l$FdTBC;S0#Uq2tpNM>03g$BFm zd_ZT?qvx-{#>E~Kla=NotE8xcrK1hdf1F-3?5<^fppT6R9X@di)U~wph(M|sfhmzw zRBAqU`rNER`j*uO{j@-6a<)#cKis_i>|o+9o<7lb&TikJ1{4jhj0XTZLLemPQilKl O0000AD5*FIH`KvRQWil@K_@NZQ0XQl{Tqsiipr(Iz!Lld*5ML3^a0|U9UPJ* z9BOK~rb6ln1PMx$O3q(H5gut<(0l$j2Ru^u-8&DJ{KcR(5fSmxF}vupBFg$jS-*I% z!;a30h=_=Yvv#ykQKxPe=o-Hv0 From cf2b236df5efc3fd01249f6a2d6a943e48e2408f Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Wed, 14 Dec 2022 17:28:59 +0100 Subject: [PATCH 07/76] added tray icons for unlocked state --- src/main/resources/img/tray_icon_unlocked.png | Bin 0 -> 1058 bytes .../resources/img/tray_icon_unlocked_mac@2x.png | Bin 0 -> 732 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/main/resources/img/tray_icon_unlocked.png create mode 100644 src/main/resources/img/tray_icon_unlocked_mac@2x.png diff --git a/src/main/resources/img/tray_icon_unlocked.png b/src/main/resources/img/tray_icon_unlocked.png new file mode 100644 index 0000000000000000000000000000000000000000..a0079584b72927736f7c5724fd8dac0c18490153 GIT binary patch literal 1058 zcmV+-1l{|IP)BKHDffBX)9fZl|+5=-A2Ls&CZz&sEP= zmt3o8AAIn^Gc=oiCD0!FoCeZe=el@n+8YXmkdv2>aT6wC{G`b!DlUN}Ng~YelzOg; z*CC~Fjk*nBt5!2g!=^2;e8ox;Vi&!6wu|3OTNdQz!P>MsEZwTWR=Y-7ackr1Fn6zl zDh=vj)#}wE#J60OM@)k>d4hK)=MO{AS28qjB?AkY!nf zXnZyUd^2svELa=VfTeR)qK;LM1gIPF8`-MYM1EnB2;e$f#qT6^>)E?}$QyAQ+Ei19 zU9fcFl+-L=4+Dn`Q+CJM3h*}lJwGRR|J?Ztz;{fYJ_G#*4o3aP&CsA}bMzlH1XHHX zz`O-Hm@#X%Sg8AW&0qBBX%*eHY14Hsm#e?u@1HAr@0a~p6kLo2{soxpn~S1A5!{j+ zJa&lSlw8Vh^L+D=>(BKr3oXkEm4oCmkRh4llRc?chZS%0aQf zG__dY5>3`Mjr?skU2~>Gehuv-IGs+2ck4>qu|jAUAJaF5?6gf~r}UE!5eNkSiVVjw!rWSve_7i9)&7&E#g+K@Bh2stXJ-PV>e~PWtq($q+{GJ_>Lz=x$ zXp>SFAgODbP7N@YpoVxy{G|T=Rz$Gz#|to#e>B`u)8TTvC-Hk7$7ZKyfUF!H-ZCZN zZCfI;3w4QVp^XIkSbXIIzK-{}T0JHc$gWwOy}n73q_4z~tKKDxSMrL2n%-}jg2c|L z;`7k}0fO?*CY4IB@*cOT$8rdit5v)j?GO(a?%UlAGDRJcCkQoH*U}6iM&O+qiGBF_ z28{s6ZLD`q^j`FxCfY+P~OLcN&(KCdUdcda<@HHhtpodN!m-pBLlRd7uDih>2aDx5DJS+uxYbB zZaYTw`~cw;?TsCU>!=+)K@ZX)f?%#(4FyF-@JJrC+t5xc05oi&=T%z>agH-3l?g{> z=#6;m{RE60GX`?0j2wRs8mw)2q5uJnwQy cvGApxE zURu288&^%3Fyc#ZYWi=$Ikx#zl;|~^>qj>FDg&I-d-j`CAN2Dw$SK`f53)-L7i~1p zMi(=yNgHa14hms)vRa+98mJYy%Dsxkhj7=*+MushMTYQ3ZO~`E>S>Q?Qm{gYorVnA zrPB%pO_q8}x94g>w%MZ3F=t(N$!YzzdD1#N9Q3`*hMo4UPi)aPGu#gRJ%iHE>#td1{D!MlfVaG@VWwq&EL_5O6_Gb>K%-tiy5+VX^i;YJJ`={xv%4a66IS|pn(bGQ zmV>?^goS!DpyQTX?znIQ^Zk;E7&1Q(+2D{chA%QHt)NwS1@8-C(q2oo_`rk^db7yI zE(qZ*3}>LrQs^R_5yD4l?uSA+lZEyr>D{=KfgaYZ*8bC(EVycGFR0{X|} zxzMoPc3~6}OR;1v7TV;l5IzOJ=g#@-6`+H{V6ovD*ORcL7J#EU(01)E=qk6bQu)bw zk7+ZM9`(yP(6!cCRKD0!xnmF5>tud(v>;zx Date: Wed, 14 Dec 2022 17:36:06 +0100 Subject: [PATCH 08/76] GCM is ready! --- .../ui/addvaultwizard/CreateNewVaultPasswordController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultPasswordController.java b/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultPasswordController.java index db35b5a11..11dfcadf1 100644 --- a/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultPasswordController.java +++ b/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultPasswordController.java @@ -176,7 +176,7 @@ public class CreateNewVaultPasswordController implements FxController { // 2. initialize vault: try { MasterkeyLoader loader = ignored -> masterkey.copy(); - CryptoFileSystemProperties fsProps = CryptoFileSystemProperties.cryptoFileSystemProperties().withCipherCombo(CryptorProvider.Scheme.SIV_CTRMAC).withKeyLoader(loader).build(); + CryptoFileSystemProperties fsProps = CryptoFileSystemProperties.cryptoFileSystemProperties().withKeyLoader(loader).build(); CryptoFileSystemProvider.initialize(path, fsProps, DEFAULT_KEY_ID); // 3. write vault-internal readme file: From 5a99c7bb617239ff2363cb98c7af6026806f37dc Mon Sep 17 00:00:00 2001 From: Vsevolod Golovanov Date: Mon, 12 Dec 2022 21:34:36 +0400 Subject: [PATCH 09/76] Unlocked status indicator in tray icon #2557 Now tracking unlockedness and updating the icon accordingly. --- pom.xml | 2 +- .../ui/traymenu/AwtTrayMenuController.java | 13 +++++++-- .../ui/traymenu/TrayMenuBuilder.java | 27 ++++++++++++++++--- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 6f34af07f..38ee64dc5 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ 2.5.3 - 1.2.0-beta1 + 1.2.0-beta3 1.1.2 1.1.2 1.1.0 diff --git a/src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java b/src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java index c82cea239..9e01e1ebf 100644 --- a/src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java +++ b/src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java @@ -39,8 +39,8 @@ public class AwtTrayMenuController implements TrayMenuController { } @Override - public void showTrayIcon(byte[] rawImageData, Runnable defaultAction, String tooltip) throws TrayMenuException { - var image = Toolkit.getDefaultToolkit().createImage(rawImageData); + public void showTrayIcon(byte[] imageData, Runnable defaultAction, String tooltip) throws TrayMenuException { + var image = Toolkit.getDefaultToolkit().createImage(imageData); trayIcon = new TrayIcon(image, tooltip, menu); trayIcon.setImageAutoSize(true); @@ -56,6 +56,15 @@ public class AwtTrayMenuController implements TrayMenuController { } } + @Override + public void updateTrayIcon(byte[] imageData) { + if (trayIcon == null) + throw new IllegalStateException("Failed to update the icon as it has not yet been added"); + + var image = Toolkit.getDefaultToolkit().createImage(imageData); + trayIcon.setImage(image); + } + @Override public void updateTrayMenu(List items) { menu.removeAll(); diff --git a/src/main/java/org/cryptomator/ui/traymenu/TrayMenuBuilder.java b/src/main/java/org/cryptomator/ui/traymenu/TrayMenuBuilder.java index db2f93a91..fd0a0d987 100644 --- a/src/main/java/org/cryptomator/ui/traymenu/TrayMenuBuilder.java +++ b/src/main/java/org/cryptomator/ui/traymenu/TrayMenuBuilder.java @@ -33,7 +33,9 @@ public class TrayMenuBuilder { private static final Logger LOG = LoggerFactory.getLogger(TrayMenuBuilder.class); private static final String TRAY_ICON_MAC = "/img/tray_icon_mac@2x.png"; + private static final String TRAY_ICON_UNLOCKED_MAC = "/img/tray_icon_unlocked_mac@2x.png"; private static final String TRAY_ICON = "/img/tray_icon.png"; + private static final String TRAY_ICON_UNLOCKED = "/img/tray_icon_unlocked.png"; private final ResourceBundle resourceBundle; private final VaultService vaultService; @@ -62,8 +64,8 @@ public class TrayMenuBuilder { v.displayNameProperty().addListener(this::vaultListChanged); }); - try (var image = getClass().getResourceAsStream(SystemUtils.IS_OS_MAC_OSX ? TRAY_ICON_MAC : TRAY_ICON)) { - trayMenu.showTrayIcon(image.readAllBytes(), this::showMainWindow, "Cryptomator"); + try { + trayMenu.showTrayIcon(getAppropriateTrayIconImage(), this::showMainWindow, "Cryptomator"); trayMenu.onBeforeOpenMenu(() -> { for (Vault vault : vaults) { VaultListManager.redetermineVaultState(vault); @@ -71,8 +73,6 @@ public class TrayMenuBuilder { }); rebuildMenu(); initialized = true; - } catch (IOException e) { - throw new UncheckedIOException("Failed to load embedded resource", e); } catch (TrayMenuException e) { LOG.error("Adding tray icon failed", e); } @@ -84,6 +84,7 @@ public class TrayMenuBuilder { private void vaultListChanged(@SuppressWarnings("unused") Observable observable) { assert Platform.isFxApplicationThread(); + trayMenu.updateTrayIcon(getAppropriateTrayIconImage()); rebuildMenu(); } @@ -154,4 +155,22 @@ public class TrayMenuBuilder { appWindows.showPreferencesWindow(SelectedPreferencesTab.ANY); } + private byte[] getAppropriateTrayIconImage() { + boolean isAnyVaultUnlocked = vaults.stream().anyMatch(Vault::isUnlocked); + + String resourceName; + if (SystemUtils.IS_OS_MAC_OSX) { + resourceName = isAnyVaultUnlocked ? TRAY_ICON_UNLOCKED_MAC : TRAY_ICON_MAC; + } else { + resourceName = isAnyVaultUnlocked ? TRAY_ICON_UNLOCKED : TRAY_ICON; + } + + try (var image = getClass().getResourceAsStream(resourceName)) { + assert image != null; + return image.readAllBytes(); + } catch (IOException e) { + throw new UncheckedIOException("Failed to load tray icon image: " + resourceName, e); + } + } + } From 975baf594c1b75654d54f7b89376f1de08d72eb5 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 14 Dec 2022 19:58:22 +0100 Subject: [PATCH 10/76] Fixes #2576 --- pom.xml | 9 ++++++++- .../java/org/cryptomator/common/settings/DeviceKey.java | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b2580b351..cd290d7c7 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.cryptomator cryptomator - 1.6.16 + 1.6.17 Cryptomator Desktop App @@ -27,6 +27,7 @@ com.github.serceman,com.github.jnr,org.ow2.asm,net.java.dev.jna,org.apache.jackrabbit,org.apache.httpcomponents,de.swiesend,org.purejava,com.github.hypfvieh + 2.1.1 2.5.3 1.2.0-beta1 1.1.2 @@ -63,6 +64,12 @@ + + + org.cryptomator + cryptolib + ${cryptomator.cryptolib.version} + org.cryptomator cryptofs diff --git a/src/main/java/org/cryptomator/common/settings/DeviceKey.java b/src/main/java/org/cryptomator/common/settings/DeviceKey.java index 04e9ebd0f..d3431440a 100644 --- a/src/main/java/org/cryptomator/common/settings/DeviceKey.java +++ b/src/main/java/org/cryptomator/common/settings/DeviceKey.java @@ -76,6 +76,11 @@ public class DeviceKey { private P384KeyPair createAndStoreNewKeyPair(char[] passphrase, Path p12File) throws IOException { var keyPair = P384KeyPair.generate(); + var tmpFile = p12File.resolveSibling(p12File.getFileName().toString() + ".tmp"); + if(Files.exists(tmpFile)) { + LOG.debug("Leftover from devicekey creation detected. Deleting {}", tmpFile); + Files.delete(tmpFile); + } LOG.debug("Store new device key to {}", p12File); keyPair.store(p12File, passphrase); return keyPair; From fd76c89393ca9b4f0a5e8bf64676f9458d3ad851 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 14 Dec 2022 20:02:12 +0100 Subject: [PATCH 11/76] update metainfo --- dist/linux/common/org.cryptomator.Cryptomator.metainfo.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/linux/common/org.cryptomator.Cryptomator.metainfo.xml b/dist/linux/common/org.cryptomator.Cryptomator.metainfo.xml index 9cb44d090..9797dd6a7 100644 --- a/dist/linux/common/org.cryptomator.Cryptomator.metainfo.xml +++ b/dist/linux/common/org.cryptomator.Cryptomator.metainfo.xml @@ -66,6 +66,7 @@ + From 8e902877a3a5a8ce685266b29de3f3afafdec550 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 7 Dec 2022 14:17:42 +0100 Subject: [PATCH 12/76] Update dependency-check plugin and exclude false positive (cherry picked from commit ebcd0adf78b12dd9883a2bab20a3a8349c12ca2d) --- pom.xml | 2 +- suppression.xml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index cd290d7c7..d9b09947d 100644 --- a/pom.xml +++ b/pom.xml @@ -58,7 +58,7 @@ 23.0.0 - 7.2.1 + 7.4.0 0.8.8 diff --git a/suppression.xml b/suppression.xml index ccd1a1cdf..75373c5cd 100644 --- a/suppression.xml +++ b/suppression.xml @@ -35,13 +35,15 @@ CVE-2022-25366 + ^commons\-cli:commons\-cli:.*$ cpe:/a:apache:james - + cpe:/a:spirit-project:spirit + cpe:/a:apache:commons_net \ No newline at end of file From eea568ca4e58cdc20f464a0c25aa3788ce1f4b2b Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Wed, 14 Dec 2022 22:27:34 +0100 Subject: [PATCH 13/76] GCM is explicitly ready! --- .../ui/addvaultwizard/CreateNewVaultPasswordController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultPasswordController.java b/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultPasswordController.java index 11dfcadf1..0148686f3 100644 --- a/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultPasswordController.java +++ b/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultPasswordController.java @@ -176,7 +176,7 @@ public class CreateNewVaultPasswordController implements FxController { // 2. initialize vault: try { MasterkeyLoader loader = ignored -> masterkey.copy(); - CryptoFileSystemProperties fsProps = CryptoFileSystemProperties.cryptoFileSystemProperties().withKeyLoader(loader).build(); + CryptoFileSystemProperties fsProps = CryptoFileSystemProperties.cryptoFileSystemProperties().withCipherCombo(CryptorProvider.Scheme.SIV_GCM).withKeyLoader(loader).build(); CryptoFileSystemProvider.initialize(path, fsProps, DEFAULT_KEY_ID); // 3. write vault-internal readme file: From 1e12590681dc9c25b2465d49d731cd798c7e1d4e Mon Sep 17 00:00:00 2001 From: VsevolodGolovanov Date: Thu, 15 Dec 2022 13:34:52 +0400 Subject: [PATCH 14/76] Update src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java Co-authored-by: Tobias Hagemann --- .../org/cryptomator/ui/traymenu/AwtTrayMenuController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java b/src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java index 9e01e1ebf..44593c6d6 100644 --- a/src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java +++ b/src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java @@ -58,9 +58,9 @@ public class AwtTrayMenuController implements TrayMenuController { @Override public void updateTrayIcon(byte[] imageData) { - if (trayIcon == null) + if (trayIcon == null) { throw new IllegalStateException("Failed to update the icon as it has not yet been added"); - + } var image = Toolkit.getDefaultToolkit().createImage(imageData); trayIcon.setImage(image); } From 690bd833e8ef2241eabcadfef54e0ff3c55c2ef2 Mon Sep 17 00:00:00 2001 From: Jacob Willden <67853915+jacob-willden@users.noreply.github.com> Date: Fri, 16 Dec 2022 13:28:57 -0700 Subject: [PATCH 15/76] Add more info to Migration Screen --- src/main/resources/fxml/migration_start.fxml | 54 +++++++++++++++++--- src/main/resources/i18n/strings.properties | 11 ++-- 2 files changed, 54 insertions(+), 11 deletions(-) diff --git a/src/main/resources/fxml/migration_start.fxml b/src/main/resources/fxml/migration_start.fxml index 6c10bcd8b..547bd7e26 100644 --- a/src/main/resources/fxml/migration_start.fxml +++ b/src/main/resources/fxml/migration_start.fxml @@ -6,16 +6,20 @@ + + + + + @@ -23,13 +27,47 @@ - - + + + + + - - - + + + + + diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index fd744a790..eea95351b 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -168,10 +168,15 @@ lock.fail.message=Locking vault failed lock.fail.description=Vault "%s" could not be locked. Ensure unsaved work is saved elsewhere and important Read/Write operations are finished. In order to close the vault, kill the Cryptomator process. # Migration -migration.title=Upgrade Vault +migration.title=Migrate Vault ## Start -migration.start.prompt=Your vault "%s" needs to be updated to a newer format. Before proceeding, make sure there is no pending synchronization affecting this vault. -migration.start.confirm=Yes, my vault is fully synced +migration.start.header=Migrate Vault +migration.start.text=In order to open your vault "%s" in this new version of Cryptomator, the vault needs to be migrated to a newer format. Before doing this, you should know the following: +migration.start.remarkUndone=This migration cannot be undone. +migration.start.remarkVersions=Older versions of Cryptomator will not be able to open the migrated vault. +migration.start.remarkCanRun=You must be sure that every device from which you access the vault can run this version of Cryptomator. +migration.start.remarkSynced=You must be sure that your vault is fully synced on this device, and on your other devices, before migrating it. +migration.start.confirm=I have read and understood the above information ## Run migration.run.enterPassword=Enter the password for "%s" migration.run.startMigrationBtn=Migrate Vault From 7147636428017e8707847136de2117c39357912a Mon Sep 17 00:00:00 2001 From: Jacob Willden <67853915+jacob-willden@users.noreply.github.com> Date: Wed, 21 Dec 2022 18:56:17 -0700 Subject: [PATCH 16/76] Switch term for new vault migration dialog --- src/main/resources/i18n/strings.properties | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index eea95351b..222ab868d 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -168,14 +168,14 @@ lock.fail.message=Locking vault failed lock.fail.description=Vault "%s" could not be locked. Ensure unsaved work is saved elsewhere and important Read/Write operations are finished. In order to close the vault, kill the Cryptomator process. # Migration -migration.title=Migrate Vault +migration.title=Upgrade Vault ## Start -migration.start.header=Migrate Vault -migration.start.text=In order to open your vault "%s" in this new version of Cryptomator, the vault needs to be migrated to a newer format. Before doing this, you should know the following: -migration.start.remarkUndone=This migration cannot be undone. -migration.start.remarkVersions=Older versions of Cryptomator will not be able to open the migrated vault. +migration.start.header=Upgrade Vault +migration.start.text=In order to open your vault "%s" in this new version of Cryptomator, the vault needs to be upgraded to a newer format. Before doing this, you should know the following: +migration.start.remarkUndone=This upgrade cannot be undone. +migration.start.remarkVersions=Older versions of Cryptomator will not be able to open the upgraded vault. migration.start.remarkCanRun=You must be sure that every device from which you access the vault can run this version of Cryptomator. -migration.start.remarkSynced=You must be sure that your vault is fully synced on this device, and on your other devices, before migrating it. +migration.start.remarkSynced=You must be sure that your vault is fully synced on this device, and on your other devices, before upgrading it. migration.start.confirm=I have read and understood the above information ## Run migration.run.enterPassword=Enter the password for "%s" From 5fcd53be184be0d938f26a0a0d3558878aa39602 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 29 Dec 2022 18:17:47 +0100 Subject: [PATCH 17/76] load device key before showing UI to prevent uncatched failure of UI loading --- .../cryptomator/ui/keyloading/hub/HubKeyLoadingStrategy.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingStrategy.java b/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingStrategy.java index dcb5722d2..a3c2ed820 100644 --- a/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingStrategy.java +++ b/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingStrategy.java @@ -48,9 +48,10 @@ public class HubKeyLoadingStrategy implements KeyLoadingStrategy { public Masterkey loadKey(URI keyId) throws MasterkeyLoadingFailedException { Preconditions.checkArgument(keyId.getScheme().startsWith(SCHEME_PREFIX)); try { + var keypair = deviceKey.get(); startAuthFlow(); var jwe = result.get(); - return JWEHelper.decrypt(jwe, deviceKey.get().getPrivate()); + return JWEHelper.decrypt(jwe, keypair.getPrivate()); } catch (DeviceKey.DeviceKeyRetrievalException e) { throw new MasterkeyLoadingFailedException("Failed to load keypair", e); } catch (CancellationException e) { From 9fefe8e4628d57018a46a4d78b6a93bd51c94ed0 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 29 Dec 2022 18:20:46 +0100 Subject: [PATCH 18/76] Show info dialog when keychain is deactivated --- .../org/cryptomator/ui/common/FxmlFile.java | 1 + .../keyloading/hub/HubKeyLoadingModule.java | 12 +++++ .../keyloading/hub/HubKeyLoadingStrategy.java | 20 +++++-- .../keyloading/hub/NoKeychainController.java | 23 ++++++++ src/main/resources/fxml/hub_no_keychain.fxml | 54 +++++++++++++++++++ src/main/resources/i18n/strings.properties | 2 + 6 files changed, 108 insertions(+), 4 deletions(-) create mode 100644 src/main/java/org/cryptomator/ui/keyloading/hub/NoKeychainController.java create mode 100644 src/main/resources/fxml/hub_no_keychain.fxml diff --git a/src/main/java/org/cryptomator/ui/common/FxmlFile.java b/src/main/java/org/cryptomator/ui/common/FxmlFile.java index 73e805273..eac58eb86 100644 --- a/src/main/java/org/cryptomator/ui/common/FxmlFile.java +++ b/src/main/java/org/cryptomator/ui/common/FxmlFile.java @@ -13,6 +13,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_NO_KEYCHAIN("/fxml/hub_no_keychain.fxml"), // HUB_AUTH_FLOW("/fxml/hub_auth_flow.fxml"), // HUB_LICENSE_EXCEEDED("/fxml/hub_license_exceeded.fxml"), // HUB_RECEIVE_KEY("/fxml/hub_receive_key.fxml"), // 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 a23a5f1b3..5adcb243d 100644 --- a/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingModule.java +++ b/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingModule.java @@ -87,6 +87,13 @@ public abstract class HubKeyLoadingModule { @StringKey(HubKeyLoadingStrategy.SCHEME_HUB_HTTPS) abstract KeyLoadingStrategy bindHubKeyLoadingStrategyToHubHttps(HubKeyLoadingStrategy strategy); + @Provides + @FxmlScene(FxmlFile.HUB_NO_KEYCHAIN) + @KeyLoadingScoped + static Scene provideHubNoKeychainScene(@KeyLoading FxmlLoaderFactory fxmlLoaders) { + return fxmlLoaders.createScene(FxmlFile.HUB_NO_KEYCHAIN); + } + @Provides @FxmlScene(FxmlFile.HUB_AUTH_FLOW) @KeyLoadingScoped @@ -136,6 +143,11 @@ public abstract class HubKeyLoadingModule { return fxmlLoaders.createScene(FxmlFile.HUB_UNAUTHORIZED_DEVICE); } + @Binds + @IntoMap + @FxControllerKey(NoKeychainController.class) + abstract FxController bindNoKeychainController(NoKeychainController controller); + @Binds @IntoMap @FxControllerKey(AuthFlowController.class) diff --git a/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingStrategy.java b/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingStrategy.java index a3c2ed820..d1a3742ae 100644 --- a/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingStrategy.java +++ b/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingStrategy.java @@ -3,6 +3,8 @@ package org.cryptomator.ui.keyloading.hub; import com.google.common.base.Preconditions; import com.nimbusds.jose.JWEObject; import dagger.Lazy; +import org.cryptomator.common.keychain.KeychainManager; +import org.cryptomator.common.keychain.NoKeychainAccessProviderException; import org.cryptomator.common.settings.DeviceKey; import org.cryptomator.cryptolib.api.Masterkey; import org.cryptomator.cryptolib.api.MasterkeyLoadingFailedException; @@ -31,15 +33,19 @@ public class HubKeyLoadingStrategy implements KeyLoadingStrategy { static final String SCHEME_HUB_HTTPS = SCHEME_PREFIX + "https"; private final Stage window; + private final KeychainManager keychainManager; private final Lazy authFlowScene; + private final Lazy noKeychainScene; private final CompletableFuture result; private final DeviceKey deviceKey; @Inject - public HubKeyLoadingStrategy(@KeyLoading Stage window, @FxmlScene(FxmlFile.HUB_AUTH_FLOW) Lazy authFlowScene, CompletableFuture result, DeviceKey deviceKey, @Named("windowTitle") String windowTitle) { + public HubKeyLoadingStrategy(@KeyLoading Stage window, @FxmlScene(FxmlFile.HUB_AUTH_FLOW) Lazy authFlowScene, @FxmlScene(FxmlFile.HUB_NO_KEYCHAIN) Lazy noKeychainScene, CompletableFuture result, DeviceKey deviceKey, KeychainManager keychainManager, @Named("windowTitle") String windowTitle) { this.window = window; + this.keychainManager = keychainManager; window.setTitle(windowTitle); this.authFlowScene = authFlowScene; + this.noKeychainScene = noKeychainScene; this.result = result; this.deviceKey = deviceKey; } @@ -48,10 +54,16 @@ public class HubKeyLoadingStrategy implements KeyLoadingStrategy { public Masterkey loadKey(URI keyId) throws MasterkeyLoadingFailedException { Preconditions.checkArgument(keyId.getScheme().startsWith(SCHEME_PREFIX)); try { + if (!keychainManager.isSupported()) { + throw new NoKeychainAccessProviderException(); + } var keypair = deviceKey.get(); - startAuthFlow(); + showWindow(authFlowScene); var jwe = result.get(); return JWEHelper.decrypt(jwe, keypair.getPrivate()); + } catch (NoKeychainAccessProviderException e) { + showWindow(noKeychainScene); + throw new UnlockCancelledException("Unlock canceled due to missing prerequisites", e); } catch (DeviceKey.DeviceKeyRetrievalException e) { throw new MasterkeyLoadingFailedException("Failed to load keypair", e); } catch (CancellationException e) { @@ -64,9 +76,9 @@ public class HubKeyLoadingStrategy implements KeyLoadingStrategy { } } - private void startAuthFlow() { + private void showWindow(Lazy scene) { Platform.runLater(() -> { - window.setScene(authFlowScene.get()); + window.setScene(scene.get()); window.show(); Window owner = window.getOwner(); if (owner != null) { diff --git a/src/main/java/org/cryptomator/ui/keyloading/hub/NoKeychainController.java b/src/main/java/org/cryptomator/ui/keyloading/hub/NoKeychainController.java new file mode 100644 index 000000000..048200815 --- /dev/null +++ b/src/main/java/org/cryptomator/ui/keyloading/hub/NoKeychainController.java @@ -0,0 +1,23 @@ +package org.cryptomator.ui.keyloading.hub; + +import org.cryptomator.ui.common.FxController; +import org.cryptomator.ui.keyloading.KeyLoading; + +import javax.inject.Inject; +import javafx.stage.Stage; + +public class NoKeychainController implements FxController { + + private final Stage window; + + @Inject + public NoKeychainController(@KeyLoading Stage window) { + this.window = window; + } + + + public void cancel() { + window.close(); + } + +} diff --git a/src/main/resources/fxml/hub_no_keychain.fxml b/src/main/resources/fxml/hub_no_keychain.fxml new file mode 100644 index 000000000..c3775af9f --- /dev/null +++ b/src/main/resources/fxml/hub_no_keychain.fxml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + From 6395f177363ddafe85e2d02e6d1795eedd48e015 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 12 Jan 2023 17:21:54 +0100 Subject: [PATCH 41/76] Handle illegelArgumentException when setting custom mountpoint --- .../mount/IllegalMountPointException.java | 9 +++++ .../mount/MountPointNotExistsException.java | 8 +++++ .../MountPointNotSupportedException.java | 8 +++++ .../org/cryptomator/common/vaults/Vault.java | 36 ++++++++++++++++--- .../UnlockInvalidMountPointController.java | 36 ++++++++++++++++++- .../cryptomator/ui/unlock/UnlockModule.java | 8 +++++ .../cryptomator/ui/unlock/UnlockWorkflow.java | 16 +++++++-- .../fxml/unlock_invalid_mount_point.fxml | 7 ++-- src/main/resources/i18n/strings.properties | 9 +++-- 9 files changed, 121 insertions(+), 16 deletions(-) create mode 100644 src/main/java/org/cryptomator/common/mount/IllegalMountPointException.java create mode 100644 src/main/java/org/cryptomator/common/mount/MountPointNotExistsException.java create mode 100644 src/main/java/org/cryptomator/common/mount/MountPointNotSupportedException.java diff --git a/src/main/java/org/cryptomator/common/mount/IllegalMountPointException.java b/src/main/java/org/cryptomator/common/mount/IllegalMountPointException.java new file mode 100644 index 000000000..5fdb1d91c --- /dev/null +++ b/src/main/java/org/cryptomator/common/mount/IllegalMountPointException.java @@ -0,0 +1,9 @@ +package org.cryptomator.common.mount; + +public class IllegalMountPointException extends IllegalArgumentException { + + public IllegalMountPointException(String msg) { + super(msg); + } + +} diff --git a/src/main/java/org/cryptomator/common/mount/MountPointNotExistsException.java b/src/main/java/org/cryptomator/common/mount/MountPointNotExistsException.java new file mode 100644 index 000000000..e90523bc2 --- /dev/null +++ b/src/main/java/org/cryptomator/common/mount/MountPointNotExistsException.java @@ -0,0 +1,8 @@ +package org.cryptomator.common.mount; + +public class MountPointNotExistsException extends IllegalMountPointException { + + public MountPointNotExistsException(String msg) { + super(msg); + } +} diff --git a/src/main/java/org/cryptomator/common/mount/MountPointNotSupportedException.java b/src/main/java/org/cryptomator/common/mount/MountPointNotSupportedException.java new file mode 100644 index 000000000..e321f23b1 --- /dev/null +++ b/src/main/java/org/cryptomator/common/mount/MountPointNotSupportedException.java @@ -0,0 +1,8 @@ +package org.cryptomator.common.mount; + +public class MountPointNotSupportedException extends IllegalMountPointException { + + public MountPointNotSupportedException(String msg) { + super(msg); + } +} diff --git a/src/main/java/org/cryptomator/common/vaults/Vault.java b/src/main/java/org/cryptomator/common/vaults/Vault.java index 547be30f5..adbe3e636 100644 --- a/src/main/java/org/cryptomator/common/vaults/Vault.java +++ b/src/main/java/org/cryptomator/common/vaults/Vault.java @@ -13,6 +13,9 @@ import org.apache.commons.lang3.SystemUtils; import org.cryptomator.common.Constants; import org.cryptomator.common.Environment; import org.cryptomator.common.mount.ActualMountService; +import org.cryptomator.common.mount.IllegalMountPointException; +import org.cryptomator.common.mount.MountPointNotExistsException; +import org.cryptomator.common.mount.MountPointNotSupportedException; import org.cryptomator.common.mount.WindowsDriveLetters; import org.cryptomator.common.settings.Settings; import org.cryptomator.common.settings.VaultSettings; @@ -175,22 +178,45 @@ public class Vault { var userChosenMountPoint = vaultSettings.getMountPoint(); var defaultMountPointBase = env.getMountPointsDir().orElseThrow(); + var canMountToDriveLetter = mountService.hasCapability(MOUNT_AS_DRIVE_LETTER); + var canMountToParent = mountService.hasCapability(MOUNT_WITHIN_EXISTING_PARENT); + var canMountToDir = mountService.hasCapability(MOUNT_TO_EXISTING_DIR); if (userChosenMountPoint == null) { if (mountService.hasCapability(MOUNT_TO_SYSTEM_CHOSEN_PATH)) { // no need to set a mount point - } else if (mountService.hasCapability(MOUNT_AS_DRIVE_LETTER)) { + } else if (canMountToDriveLetter) { builder.setMountpoint(windowsDriveLetters.getFirstDesiredAvailable().orElseThrow()); - } else if (mountService.hasCapability(MOUNT_WITHIN_EXISTING_PARENT)) { + } else if (canMountToParent) { Files.createDirectories(defaultMountPointBase); builder.setMountpoint(defaultMountPointBase); - } else if (mountService.hasCapability(MOUNT_TO_EXISTING_DIR)) { + } else if (canMountToDir) { var mountPoint = defaultMountPointBase.resolve(vaultSettings.mountName().get()); Files.createDirectories(mountPoint); builder.setMountpoint(mountPoint); } - } else if (mountService.hasCapability(MOUNT_TO_EXISTING_DIR) || mountService.hasCapability(MOUNT_WITHIN_EXISTING_PARENT) || mountService.hasCapability(MOUNT_AS_DRIVE_LETTER)) { + } else { // TODO: move the mount point away in case of MOUNT_WITHIN_EXISTING_PARENT? - builder.setMountpoint(userChosenMountPoint); + try { + builder.setMountpoint(userChosenMountPoint); + } catch (IllegalArgumentException e) { + //TODO: move code elsewhere + var mpIsDriveLetter = userChosenMountPoint.toString().matches("[A-Z]:\\\\"); + var configNotSupported = (!canMountToDriveLetter && mpIsDriveLetter) || (!canMountToDir && !mpIsDriveLetter) || (!canMountToParent && !mpIsDriveLetter); + if(configNotSupported) { + throw new MountPointNotSupportedException(e.getMessage()); + } else if (canMountToDir && !canMountToParent && !Files.exists(userChosenMountPoint)) { + //mountpoint must exist + throw new MountPointNotExistsException(e.getMessage()); + } else { + throw new IllegalMountPointException(e.getMessage()); + } + /* + //TODO: + if (!canMountToDir && canMountToParent && !Files.notExists(userChosenMountPoint)) { + //parent must exist, mountpoint must not exist + } + */ + } } return builder; diff --git a/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java b/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java index 928953c9e..aeb4a9166 100644 --- a/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java +++ b/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java @@ -1,11 +1,18 @@ package org.cryptomator.ui.unlock; +import org.cryptomator.common.mount.MountPointNotExistsException; +import org.cryptomator.common.mount.MountPointNotSupportedException; import org.cryptomator.common.vaults.Vault; import org.cryptomator.ui.common.FxController; +import org.cryptomator.ui.controls.FormattedLabel; +import org.cryptomator.ui.fxapp.FxApplicationWindows; +import org.cryptomator.ui.preferences.SelectedPreferencesTab; import javax.inject.Inject; import javafx.fxml.FXML; import javafx.stage.Stage; +import java.util.ResourceBundle; +import java.util.concurrent.atomic.AtomicReference; //At the current point in time only the CustomMountPointChooser may cause this window to be shown. @UnlockScoped @@ -13,11 +20,32 @@ public class UnlockInvalidMountPointController implements FxController { private final Stage window; private final Vault vault; + private final AtomicReference unlockException; + private final FxApplicationWindows appWindows; + private final ResourceBundle resourceBundle; + + public FormattedLabel dialogDescription; @Inject - UnlockInvalidMountPointController(@UnlockWindow Stage window, @UnlockWindow Vault vault) { + UnlockInvalidMountPointController(@UnlockWindow Stage window, @UnlockWindow Vault vault, @UnlockWindow AtomicReference unlockException, FxApplicationWindows appWindows, ResourceBundle resourceBundle) { this.window = window; this.vault = vault; + this.unlockException = unlockException; + this.appWindows = appWindows; + this.resourceBundle = resourceBundle; + } + + @FXML + public void initialize() { + var e = unlockException.get(); + String translationKey = "unlock.error.customPath.description.generic"; + if (e instanceof MountPointNotSupportedException) { + translationKey = "unlock.error.customPath.description.notSupported"; + } else if (e instanceof MountPointNotExistsException) { + translationKey = "unlock.error.customPath.description.notExists"; + } + dialogDescription.setFormat(resourceBundle.getString(translationKey)); + dialogDescription.setArg1(e.getMessage()); } @FXML @@ -25,4 +53,10 @@ public class UnlockInvalidMountPointController implements FxController { window.close(); } + @FXML + public void closeAndOpenPreferences() { + appWindows.showPreferencesWindow(SelectedPreferencesTab.VOLUME); + window.close(); + } + } \ No newline at end of file diff --git a/src/main/java/org/cryptomator/ui/unlock/UnlockModule.java b/src/main/java/org/cryptomator/ui/unlock/UnlockModule.java index b14286698..b59fa272d 100644 --- a/src/main/java/org/cryptomator/ui/unlock/UnlockModule.java +++ b/src/main/java/org/cryptomator/ui/unlock/UnlockModule.java @@ -23,6 +23,7 @@ import javafx.stage.Modality; import javafx.stage.Stage; import java.util.Map; import java.util.ResourceBundle; +import java.util.concurrent.atomic.AtomicReference; @Module(subcomponents = {KeyLoadingComponent.class}) abstract class UnlockModule { @@ -57,6 +58,13 @@ abstract class UnlockModule { return compBuilder.vault(vault).window(window).build().keyloadingStrategy(); } + @Provides + @UnlockWindow + @UnlockScoped + static AtomicReference unlockException() { + return new AtomicReference<>(); + } + @Provides @FxmlScene(FxmlFile.UNLOCK_SUCCESS) @UnlockScoped diff --git a/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java b/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java index 9c47aa281..985f1b471 100644 --- a/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java +++ b/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java @@ -2,6 +2,7 @@ package org.cryptomator.ui.unlock; import com.google.common.base.Throwables; import dagger.Lazy; +import org.cryptomator.common.mount.IllegalMountPointException; import org.cryptomator.common.vaults.Vault; import org.cryptomator.common.vaults.VaultState; import org.cryptomator.cryptolib.api.CryptoException; @@ -20,6 +21,7 @@ import javafx.concurrent.Task; import javafx.scene.Scene; import javafx.stage.Stage; import java.io.IOException; +import java.util.concurrent.atomic.AtomicReference; /** * A multi-step task that consists of background activities as well as user interaction. @@ -38,9 +40,10 @@ public class UnlockWorkflow extends Task { private final Lazy invalidMountPointScene; private final FxApplicationWindows appWindows; private final KeyLoadingStrategy keyLoadingStrategy; + private final AtomicReference unlockFailedException; @Inject - UnlockWorkflow(@UnlockWindow Stage window, @UnlockWindow Vault vault, VaultService vaultService, @FxmlScene(FxmlFile.UNLOCK_SUCCESS) Lazy successScene, @FxmlScene(FxmlFile.UNLOCK_INVALID_MOUNT_POINT) Lazy invalidMountPointScene, FxApplicationWindows appWindows, @UnlockWindow KeyLoadingStrategy keyLoadingStrategy) { + UnlockWorkflow(@UnlockWindow Stage window, @UnlockWindow Vault vault, VaultService vaultService, @FxmlScene(FxmlFile.UNLOCK_SUCCESS) Lazy successScene, @FxmlScene(FxmlFile.UNLOCK_INVALID_MOUNT_POINT) Lazy invalidMountPointScene, FxApplicationWindows appWindows, @UnlockWindow KeyLoadingStrategy keyLoadingStrategy, @UnlockWindow AtomicReference unlockFailedException) { this.window = window; this.vault = vault; this.vaultService = vaultService; @@ -48,6 +51,7 @@ public class UnlockWorkflow extends Task { this.invalidMountPointScene = invalidMountPointScene; this.appWindows = appWindows; this.keyLoadingStrategy = keyLoadingStrategy; + this.unlockFailedException = unlockFailedException; } @Override @@ -67,13 +71,15 @@ public class UnlockWorkflow extends Task { } catch (Exception e) { Throwables.propagateIfPossible(e, IOException.class); Throwables.propagateIfPossible(e, CryptoException.class); + Throwables.propagateIfPossible(e, IllegalMountPointException.class); Throwables.propagateIfPossible(e, MountFailedException.class); throw new IllegalStateException("unexpected exception type", e); } } - private void showInvalidMountPointScene() { + private void handleIllegalMountPointError(IllegalMountPointException impe) { Platform.runLater(() -> { + unlockFailedException.set(impe); window.setScene(invalidMountPointScene.get()); window.show(); }); @@ -107,7 +113,11 @@ public class UnlockWorkflow extends Task { protected void failed() { LOG.info("Unlock of '{}' failed.", vault.getDisplayName()); Throwable throwable = super.getException(); - handleGenericError(throwable); + if(throwable instanceof IllegalMountPointException impe) { + handleIllegalMountPointError(impe); + } else { + handleGenericError(throwable); + } vault.stateProperty().transition(VaultState.Value.PROCESSING, VaultState.Value.LOCKED); } diff --git a/src/main/resources/fxml/unlock_invalid_mount_point.fxml b/src/main/resources/fxml/unlock_invalid_mount_point.fxml index d6be54dac..1b52f568c 100644 --- a/src/main/resources/fxml/unlock_invalid_mount_point.fxml +++ b/src/main/resources/fxml/unlock_invalid_mount_point.fxml @@ -34,16 +34,19 @@ - + + + + + + + + + + + + + + + + diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index 8c12e81ae..1ea8e9ca2 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -338,9 +338,6 @@ main.minimizeBtn.tooltip=Minimize main.preferencesBtn.tooltip=Preferences main.debugModeEnabled.tooltip=Debug mode is enabled main.supporterCertificateMissing.tooltip=Please consider donating -## Drag 'n' Drop -main.dropZone.dropVault=Add this vault -main.dropZone.unknownDragboardContent=If you want to add a vault, drag it to this window ## Vault List main.vaultlist.emptyList.onboardingInstruction=Click here to add a vault main.vaultlist.contextMenu.remove=Remove… @@ -370,6 +367,10 @@ main.vaultDetail.throughput.idle=idle main.vaultDetail.throughput.kbps=%.1f kiB/s main.vaultDetail.throughput.mbps=%.1f MiB/s main.vaultDetail.stats=Vault Statistics +main.vaultDetail.locateEncryptedFileBtn=Locate Encrypted File +main.vaultDetail.locateEncryptedFileBtn.tooltip=Choose a file from your vault to locate its encrypted counterpart +main.vaultDetail.encryptedPathsCopied=Paths Copied to Clipboard! +main.vaultDetail.filePickerTitle=Select File Inside Vault ### Missing main.vaultDetail.missing.info=Cryptomator could not find a vault at this path. main.vaultDetail.missing.recheck=Recheck From ad321dfe551253b26487a0795e922ea86f651e61 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 20 Jan 2023 11:49:15 +0100 Subject: [PATCH 54/76] migrate 1.6.x volumeimpl to hardcoded mountservices --- .../common/settings/SettingsJsonAdapter.java | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java b/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java index 91299bb2a..b6c5c426c 100644 --- a/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java +++ b/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java @@ -9,6 +9,7 @@ import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; +import org.apache.commons.lang3.SystemUtils; import org.cryptomator.common.Environment; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -73,7 +74,9 @@ public class SettingsJsonAdapter extends TypeAdapter { @Override public Settings read(JsonReader in) throws IOException { Settings settings = new Settings(env); - + //1.6.x legacy + String volumeImpl = null; + //legacy end in.beginObject(); while (in.hasNext()) { String name = in.nextName(); @@ -105,18 +108,49 @@ public class SettingsJsonAdapter extends TypeAdapter { settings.mountService().set(in.nextString()); } } - + //1.6.x legacy + case "preferredVolumeImpl" -> volumeImpl = in.nextString(); + //legacy end default -> { LOG.warn("Unsupported vault setting found in JSON: {}", name); in.skipValue(); } } + } in.endObject(); + //1.6.x legacy + if (volumeImpl != null) { + settings.mountService().set(convertLegacyVolumeImplToMountService(volumeImpl)); + } + //legacy end + return settings; } + private String convertLegacyVolumeImplToMountService(String volumeImpl) { + if (volumeImpl.equals("Dokany")) { + return "org.cryptomator.frontend.dokany.mount.DokanyMountProvider"; + } else if (volumeImpl.equals("FUSE")) { + if(SystemUtils.IS_OS_WINDOWS) { + return "org.cryptomator.frontend.fuse.mount.WinFspNetworkMountProvider"; + } else if (SystemUtils.IS_OS_MAC) { + return "org.cryptomator.frontend.fuse.mount.MacFuseMountProvider"; + } else { + return "org.cryptomator.frontend.fuse.mount.LinuxFuseMountProvider"; + } + } else { + if(SystemUtils.IS_OS_WINDOWS) { + return "org.cryptomator.frontend.webdav.mount.WindowsMounter"; + } else if (SystemUtils.IS_OS_MAC) { + return "org.cryptomator.frontend.webdav.mount.MacAppleScriptMounter"; + } else { + return "org.cryptomator.frontend.webdav.mount.LinuxGioMounter"; + } + } + } + private UiTheme parseUiTheme(String uiThemeName) { try { return UiTheme.valueOf(uiThemeName.toUpperCase()); From 7afab6fe78d65bccc1074b147abb187e938d75e0 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 20 Jan 2023 12:29:17 +0100 Subject: [PATCH 55/76] add auto option to volume type selection --- .../VolumePreferencesController.java | 23 +++++++++++++++---- src/main/resources/i18n/strings.properties | 4 +++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/preferences/VolumePreferencesController.java b/src/main/java/org/cryptomator/ui/preferences/VolumePreferencesController.java index 229487cb6..71fdd8d3b 100644 --- a/src/main/java/org/cryptomator/ui/preferences/VolumePreferencesController.java +++ b/src/main/java/org/cryptomator/ui/preferences/VolumePreferencesController.java @@ -15,6 +15,8 @@ import javafx.scene.control.ChoiceBox; import javafx.scene.control.TextField; import javafx.util.StringConverter; import java.util.List; +import java.util.Optional; +import java.util.ResourceBundle; /** * TODO: if WebDAV is selected under Windows, show warning that specific mount options (like selecting a directory as mount point) are _not_ supported @@ -24,6 +26,7 @@ public class VolumePreferencesController implements FxController { private final Settings settings; private final ObservableValue selectedMountService; + private final ResourceBundle resourceBundle; private final BooleanExpression loopbackPortSupported; private final ObservableValue mountToDirSupported; private final ObservableValue mountToDriveLetterSupported; @@ -35,10 +38,11 @@ public class VolumePreferencesController implements FxController { public Button loopbackPortApplyButton; @Inject - VolumePreferencesController(Settings settings, List mountProviders, ObservableValue actualMountService) { + VolumePreferencesController(Settings settings, List mountProviders, ObservableValue actualMountService, ResourceBundle resourceBundle) { this.settings = settings; this.mountProviders = mountProviders; this.selectedMountService = actualMountService; + this.resourceBundle = resourceBundle; this.loopbackPortSupported = BooleanExpression.booleanExpression(selectedMountService.map(as -> as.service().hasCapability(MountCapability.LOOPBACK_PORT))); this.mountToDirSupported = selectedMountService.map(as -> as.service().hasCapability(MountCapability.MOUNT_WITHIN_EXISTING_PARENT) || as.service().hasCapability(MountCapability.MOUNT_TO_EXISTING_DIR)); this.mountToDriveLetterSupported = selectedMountService.map(as -> as.service().hasCapability(MountCapability.MOUNT_AS_DRIVE_LETTER)); @@ -47,10 +51,15 @@ public class VolumePreferencesController implements FxController { } public void initialize() { + volumeTypeChoiceBox.getItems().add(null); volumeTypeChoiceBox.getItems().addAll(mountProviders); volumeTypeChoiceBox.setConverter(new MountServiceConverter()); - volumeTypeChoiceBox.getSelectionModel().select(selectedMountService.getValue().service()); - volumeTypeChoiceBox.valueProperty().addListener((observableValue, oldProvide, newProvider) -> settings.mountService().set(newProvider.getClass().getName())); + boolean autoSelected = settings.mountService().get() == null; + volumeTypeChoiceBox.getSelectionModel().select(autoSelected ? null : selectedMountService.getValue().service()); + volumeTypeChoiceBox.valueProperty().addListener((observableValue, oldProvider, newProvider) -> { + var toSet = Optional.ofNullable(newProvider).map(nP -> nP.getClass().getName()).orElse(null); + settings.mountService().set(toSet); + }); loopbackPortField.setText(String.valueOf(settings.port().get())); loopbackPortApplyButton.visibleProperty().bind(settings.port().asString().isNotEqualTo(loopbackPortField.textProperty())); @@ -117,11 +126,15 @@ public class VolumePreferencesController implements FxController { /* Helpers */ - private static class MountServiceConverter extends StringConverter { + private class MountServiceConverter extends StringConverter { @Override public String toString(MountService provider) { - return provider.displayName(); + if (provider == null) { + return resourceBundle.getString("generic.choicebox.autoSelection"); + } else { + return provider.displayName(); + } } @Override diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index 8e870baff..07319a63e 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -14,6 +14,8 @@ generic.button.copied=Copied! generic.button.done=Done generic.button.next=Next generic.button.print=Print +## Selection +generic.choicebox.autoSelection=Automatic # Error error.message=An error occurred @@ -278,7 +280,7 @@ preferences.interface.showTrayIcon=Show tray icon (requires restart) preferences.volume=Virtual Drive preferences.volume.type=Volume Type preferences.volume.tcp.port=TCP Port -preferences.volume.supportedFeatures=This volume type supports the following features: +preferences.volume.supportedFeatures=The chosen volume type supports the following features: preferences.volume.feature.mountToDir=Custom directory as mount point preferences.volume.feature.mountToDriveLetter=Drive letter as mount point preferences.volume.feature.mountFlags=Custom mount options From c8c44e05548f98ea6cd1ded470312aa103c787d4 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 20 Jan 2023 15:01:31 +0100 Subject: [PATCH 56/76] bump fuse-nio-adapter dependency --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2124ed39a..14090a08d 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ 1.1.2 1.1.2 1.1.0 - 2.0.0-beta2 + 2.0.0-beta3 2.0.0-beta2 2.0.0-beta2 From ba4902a5bc523f16090ccea5a2b52896347157b7 Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Fri, 20 Jan 2023 16:45:35 +0100 Subject: [PATCH 57/76] Fixed vault list refresh when tray icon is clicked on macOS --- .../java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java b/src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java index 44593c6d6..14855cbe9 100644 --- a/src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java +++ b/src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java @@ -77,7 +77,7 @@ public class AwtTrayMenuController implements TrayMenuController { Preconditions.checkNotNull(this.trayIcon); this.trayIcon.addMouseListener(new MouseAdapter() { @Override - public void mouseClicked(MouseEvent e) { + public void mousePressed(MouseEvent e) { listener.run(); } }); From 774d24625c54db06ef8cf0343531a142c52719c1 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 20 Jan 2023 17:07:04 +0100 Subject: [PATCH 58/76] change styling of volume preferences --- src/main/resources/css/light_theme.css | 10 ++++++++++ src/main/resources/fxml/preferences_volume.fxml | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/resources/css/light_theme.css b/src/main/resources/css/light_theme.css index 4e47af6df..07ebab512 100644 --- a/src/main/resources/css/light_theme.css +++ b/src/main/resources/css/light_theme.css @@ -910,3 +910,13 @@ -fx-border-style: solid inside; -fx-border-width: 1px; } +/******************************************************************************* + * * + * Separator * + * * + ******************************************************************************/ + +.separator { + -fx-padding: 1px; + -fx-background-color: CONTROL_BORDER_DISABLED; +} diff --git a/src/main/resources/fxml/preferences_volume.fxml b/src/main/resources/fxml/preferences_volume.fxml index 025b0772b..81d9cb2d9 100644 --- a/src/main/resources/fxml/preferences_volume.fxml +++ b/src/main/resources/fxml/preferences_volume.fxml @@ -6,6 +6,7 @@ + - + - + From b4c384acc9e23e0f387f0b400f3a50c7e26162dd Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 25 Jan 2023 12:44:09 +0100 Subject: [PATCH 71/76] use speciaized translation key --- .../ui/preferences/VolumePreferencesController.java | 2 +- src/main/resources/i18n/strings.properties | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/preferences/VolumePreferencesController.java b/src/main/java/org/cryptomator/ui/preferences/VolumePreferencesController.java index 71fdd8d3b..e2f072261 100644 --- a/src/main/java/org/cryptomator/ui/preferences/VolumePreferencesController.java +++ b/src/main/java/org/cryptomator/ui/preferences/VolumePreferencesController.java @@ -131,7 +131,7 @@ public class VolumePreferencesController implements FxController { @Override public String toString(MountService provider) { if (provider == null) { - return resourceBundle.getString("generic.choicebox.autoSelection"); + return resourceBundle.getString("preferences.volume.type.automatic"); } else { return provider.displayName(); } diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index 1c369732c..af9ba420c 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -14,8 +14,6 @@ generic.button.copied=Copied! generic.button.done=Done generic.button.next=Next generic.button.print=Print -## Selection -generic.choicebox.autoSelection=Automatic # Error error.message=An error occurred @@ -279,6 +277,7 @@ preferences.interface.showTrayIcon=Show tray icon (requires restart) ## Volume preferences.volume=Virtual Drive preferences.volume.type=Volume Type +preferences.volume.type.automatic=Automatic 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 c3fb58f7d091578c3d1b582a0b01ce2242bfab22 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 25 Jan 2023 16:49:00 +0100 Subject: [PATCH 72/76] bump fuse-nio-adapter --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index edb6315fc..c8dc9fa8b 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ 1.2.0-beta1 1.2.0-beta1 1.2.0-beta1 - 2.0.0-beta3 + 2.0.0-beta4 2.0.0-beta2 2.0.0-beta3 From 86ccb1a58f26666eb53c2f1ff7e4051328e916fb Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 26 Jan 2023 12:05:34 +0100 Subject: [PATCH 73/76] changing volume provider requires restart due to macFUSE/FUSE-T lib loaded in same JVM --- .../cryptomator/common/mount/MountModule.java | 19 ++++++++++++++++++- src/main/resources/i18n/strings.properties | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/cryptomator/common/mount/MountModule.java b/src/main/java/org/cryptomator/common/mount/MountModule.java index d885a644e..d78cc3216 100644 --- a/src/main/java/org/cryptomator/common/mount/MountModule.java +++ b/src/main/java/org/cryptomator/common/mount/MountModule.java @@ -2,11 +2,11 @@ package org.cryptomator.common.mount; import dagger.Module; import dagger.Provides; -import org.cryptomator.common.ObservableUtil; import org.cryptomator.common.settings.Settings; import org.cryptomator.integrations.mount.MountService; import javax.inject.Singleton; +import javafx.beans.property.SimpleObjectProperty; import javafx.beans.value.ObservableValue; import java.util.List; @@ -19,6 +19,8 @@ public class MountModule { return MountService.get().toList(); } + //currently not used, because macFUSE and FUSE-T cannot be used in the same JVM + /* @Provides @Singleton static ObservableValue provideMountService(Settings settings, List serviceImpls) { @@ -30,5 +32,20 @@ public class MountModule { }, // new ActualMountService(fallbackProvider, true)); } + */ + + @Provides + @Singleton + static ActualMountService provideActualMountService(Settings settings, List serviceImpls) { + var fallbackProvider = serviceImpls.stream().findFirst().orElse(null); + var desiredService = serviceImpls.stream().filter(serviceImpl -> serviceImpl.getClass().getName().equals(settings.mountService().getValue())).findFirst(); // + return new ActualMountService(desiredService.orElse(fallbackProvider), desiredService.isPresent()); // + } + + @Provides + @Singleton + static ObservableValue provideMountService(ActualMountService service) { + return new SimpleObjectProperty<>(service); + } } diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index af9ba420c..fbee45826 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -276,7 +276,7 @@ preferences.interface.showMinimizeButton=Show minimize button preferences.interface.showTrayIcon=Show tray icon (requires restart) ## Volume preferences.volume=Virtual Drive -preferences.volume.type=Volume Type +preferences.volume.type=Volume Type (requires restart) preferences.volume.type.automatic=Automatic preferences.volume.tcp.port=TCP Port preferences.volume.supportedFeatures=The chosen volume type supports the following features: From ae1fa5851f5b03a69ddcb06bcdc6f5e3a59a0d07 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 26 Jan 2023 13:02:21 +0100 Subject: [PATCH 74/76] remove traces of ActualMountService from volume preferences controller --- .../VolumePreferencesController.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/preferences/VolumePreferencesController.java b/src/main/java/org/cryptomator/ui/preferences/VolumePreferencesController.java index e2f072261..00e680d2d 100644 --- a/src/main/java/org/cryptomator/ui/preferences/VolumePreferencesController.java +++ b/src/main/java/org/cryptomator/ui/preferences/VolumePreferencesController.java @@ -1,6 +1,6 @@ package org.cryptomator.ui.preferences; -import org.cryptomator.common.mount.ActualMountService; +import org.cryptomator.common.ObservableUtil; import org.cryptomator.common.settings.Settings; import org.cryptomator.integrations.mount.MountCapability; import org.cryptomator.integrations.mount.MountService; @@ -18,14 +18,11 @@ import java.util.List; import java.util.Optional; import java.util.ResourceBundle; -/** - * TODO: if WebDAV is selected under Windows, show warning that specific mount options (like selecting a directory as mount point) are _not_ supported - */ @PreferencesScoped public class VolumePreferencesController implements FxController { private final Settings settings; - private final ObservableValue selectedMountService; + private final ObservableValue selectedMountService; private final ResourceBundle resourceBundle; private final BooleanExpression loopbackPortSupported; private final ObservableValue mountToDirSupported; @@ -38,16 +35,18 @@ public class VolumePreferencesController implements FxController { public Button loopbackPortApplyButton; @Inject - VolumePreferencesController(Settings settings, List mountProviders, ObservableValue actualMountService, ResourceBundle resourceBundle) { + VolumePreferencesController(Settings settings, List mountProviders, ResourceBundle resourceBundle) { this.settings = settings; this.mountProviders = mountProviders; - this.selectedMountService = actualMountService; this.resourceBundle = resourceBundle; - this.loopbackPortSupported = BooleanExpression.booleanExpression(selectedMountService.map(as -> as.service().hasCapability(MountCapability.LOOPBACK_PORT))); - this.mountToDirSupported = selectedMountService.map(as -> as.service().hasCapability(MountCapability.MOUNT_WITHIN_EXISTING_PARENT) || as.service().hasCapability(MountCapability.MOUNT_TO_EXISTING_DIR)); - this.mountToDriveLetterSupported = selectedMountService.map(as -> as.service().hasCapability(MountCapability.MOUNT_AS_DRIVE_LETTER)); - this.mountFlagsSupported = selectedMountService.map(as -> as.service().hasCapability(MountCapability.MOUNT_FLAGS)); - this.readonlySupported = selectedMountService.map(as -> as.service().hasCapability(MountCapability.READ_ONLY)); + + var fallbackProvider = mountProviders.stream().findFirst().orElse(null); + this.selectedMountService = ObservableUtil.mapWithDefault(settings.mountService(), serviceName -> mountProviders.stream().filter(s -> s.getClass().getName().equals(serviceName)).findFirst().orElse(fallbackProvider), fallbackProvider); + this.loopbackPortSupported = BooleanExpression.booleanExpression(selectedMountService.map(s -> s.hasCapability(MountCapability.LOOPBACK_PORT))); + this.mountToDirSupported = selectedMountService.map(s -> s.hasCapability(MountCapability.MOUNT_WITHIN_EXISTING_PARENT) || s.hasCapability(MountCapability.MOUNT_TO_EXISTING_DIR)); + this.mountToDriveLetterSupported = selectedMountService.map(s -> s.hasCapability(MountCapability.MOUNT_AS_DRIVE_LETTER)); + this.mountFlagsSupported = selectedMountService.map(s -> s.hasCapability(MountCapability.MOUNT_FLAGS)); + this.readonlySupported = selectedMountService.map(s -> s.hasCapability(MountCapability.READ_ONLY)); } public void initialize() { @@ -55,7 +54,7 @@ public class VolumePreferencesController implements FxController { volumeTypeChoiceBox.getItems().addAll(mountProviders); volumeTypeChoiceBox.setConverter(new MountServiceConverter()); boolean autoSelected = settings.mountService().get() == null; - volumeTypeChoiceBox.getSelectionModel().select(autoSelected ? null : selectedMountService.getValue().service()); + volumeTypeChoiceBox.getSelectionModel().select(autoSelected ? null : selectedMountService.getValue()); volumeTypeChoiceBox.valueProperty().addListener((observableValue, oldProvider, newProvider) -> { var toSet = Optional.ofNullable(newProvider).map(nP -> nP.getClass().getName()).orElse(null); settings.mountService().set(toSet); From 7c8a5199191d53ed1ce6d129c9fe17a9bfbced9f Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 26 Jan 2023 13:10:32 +0100 Subject: [PATCH 75/76] bump webdav-nio-adapter --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c8dc9fa8b..68a653775 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ 1.2.0-beta1 2.0.0-beta4 2.0.0-beta2 - 2.0.0-beta3 + 2.0.0-beta4 3.12.0 From 220782b84f3f1433e91ac0874c7fb35f87724807 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 26 Jan 2023 13:28:55 +0100 Subject: [PATCH 76/76] reduce jars neede to stay on classpath due to missing module info --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index ae0afbdf2..5fb91f4fc 100644 --- a/pom.xml +++ b/pom.xml @@ -24,8 +24,8 @@ 19 - - com.github.jnr,org.ow2.asm,org.apache.jackrabbit,org.apache.httpcomponents,de.swiesend,org.purejava,com.github.hypfvieh + + org.ow2.asm,org.apache.jackrabbit,org.apache.httpcomponents,de.swiesend,org.purejava 2.1.1