mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-09-06 16:17:31 +00:00
+11
-6
@@ -10,29 +10,34 @@
|
||||
<name>Cryptomator GUI</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>keychain</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>commons</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>cryptofs</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>webdav-nio-adapter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>jni</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>keychain</artifactId>
|
||||
<artifactId>fuse-nio-adapter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>fuse-nio-adapter</artifactId>
|
||||
<artifactId>dokany-nio-adapter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>webdav-nio-adapter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- CryptoLib -->
|
||||
|
||||
@@ -97,7 +97,7 @@ public class SettingsController implements ViewController {
|
||||
|
||||
//NIOADAPTER
|
||||
volume.getItems().addAll(getSupportedAdapters());
|
||||
volume.setValue(settings.volumeImpl().get());
|
||||
volume.setValue(settings.preferredVolumeImpl().get());
|
||||
volume.setVisible(true);
|
||||
volume.setConverter(new NioAdapterImplStringConverter());
|
||||
|
||||
@@ -127,7 +127,7 @@ public class SettingsController implements ViewController {
|
||||
|
||||
settings.checkForUpdates().bind(checkForUpdatesCheckbox.selectedProperty());
|
||||
settings.preferredGvfsScheme().bind(prefGvfsScheme.valueProperty());
|
||||
settings.volumeImpl().bind(volume.valueProperty());
|
||||
settings.preferredVolumeImpl().bind(volume.valueProperty());
|
||||
settings.debugMode().bind(debugModeCheckbox.selectedProperty());
|
||||
}
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ public class UnlockController implements ViewController {
|
||||
winDriveLetterLabel.setManaged(false);
|
||||
winDriveLetter.setVisible(false);
|
||||
winDriveLetter.setManaged(false);
|
||||
if (VolumeImpl.WEBDAV.equals(settings.volumeImpl().get())) {
|
||||
if (VolumeImpl.WEBDAV.equals(settings.preferredVolumeImpl().get())) {
|
||||
useOwnMountPath.setVisible(false);
|
||||
useOwnMountPath.setManaged(false);
|
||||
mountPathLabel.setManaged(false);
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.cryptomator.ui.model;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import org.cryptomator.common.settings.VaultSettings;
|
||||
import org.cryptomator.cryptofs.CryptoFileSystem;
|
||||
import org.cryptomator.frontend.dokany.Mount;
|
||||
import org.cryptomator.frontend.dokany.MountFactory;
|
||||
|
||||
@VaultModule.PerVault
|
||||
public class DokanyVolume implements Volume {
|
||||
|
||||
private static final String FS_TYPE_NAME = "Cryptomator File System";
|
||||
|
||||
private final VaultSettings vaultSettings;
|
||||
private final MountFactory mountFactory;
|
||||
private Mount mount;
|
||||
|
||||
@Inject
|
||||
public DokanyVolume(VaultSettings vaultSettings, ExecutorService executorService) {
|
||||
this.vaultSettings = vaultSettings;
|
||||
this.mountFactory = new MountFactory(executorService);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isSupported() {
|
||||
return MountFactory.isApplicable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mount(CryptoFileSystem fs) {
|
||||
char driveLetter = vaultSettings.winDriveLetter().get().charAt(0);
|
||||
String mountName = vaultSettings.mountName().get();
|
||||
this.mount = mountFactory.mount(fs.getPath("/"), driveLetter, mountName, FS_TYPE_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reveal() throws VolumeException {
|
||||
boolean success = mount.reveal();
|
||||
if (!success) {
|
||||
throw new VolumeException("Reveal failed.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unmount() {
|
||||
mount.close();
|
||||
}
|
||||
}
|
||||
@@ -43,20 +43,15 @@ public class VaultModule {
|
||||
|
||||
@Provides
|
||||
@PerVault
|
||||
public Volume provideNioAdpater(Settings settings, WebDavVolume webDavVolume, FuseVolume fuseVolume) {
|
||||
VolumeImpl impl = settings.volumeImpl().get();
|
||||
switch (impl) {
|
||||
case FUSE:
|
||||
if (fuseVolume.isSupported()) {
|
||||
return fuseVolume;
|
||||
} else {
|
||||
settings.volumeImpl().set(VolumeImpl.WEBDAV);
|
||||
// fallthrough to WEBDAV
|
||||
}
|
||||
case WEBDAV:
|
||||
return webDavVolume;
|
||||
default:
|
||||
throw new IllegalStateException("Unsupported NioAdapter: " + impl);
|
||||
public Volume provideVolume(Settings settings, WebDavVolume webDavVolume, FuseVolume fuseVolume, DokanyVolume dokanyVolume) {
|
||||
VolumeImpl impl = settings.preferredVolumeImpl().get();
|
||||
if (VolumeImpl.DOKANY == impl && dokanyVolume.isSupported()) {
|
||||
return dokanyVolume;
|
||||
} else if (VolumeImpl.FUSE == impl && fuseVolume.isSupported()) {
|
||||
return fuseVolume;
|
||||
} else {
|
||||
assert webDavVolume.isSupported();
|
||||
return webDavVolume;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user