浏览代码

Merge branch 'develop' into release/1.7.0

Armin Schrenk 2 年之前
父节点
当前提交
e221019b57

+ 31 - 30
src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java

@@ -37,30 +37,30 @@ public class SettingsJsonAdapter extends TypeAdapter<Settings> {
 	@Override
 	public void write(JsonWriter out, Settings value) throws IOException {
 		out.beginObject();
-		out.name("lastWrittenByVersion").value(env.getAppVersion()+env.getBuildNumber().map("-"::concat).orElse(""));
+		out.name("writtenByVersion").value(env.getAppVersion() + env.getBuildNumber().map("-"::concat).orElse(""));
 		out.name("directories");
 		writeVaultSettingsArray(out, value.getDirectories());
 		out.name("askedForUpdateCheck").value(value.askedForUpdateCheck().get());
-		out.name("checkForUpdatesEnabled").value(value.checkForUpdates().get());
-		out.name("startHidden").value(value.startHidden().get());
 		out.name("autoCloseVaults").value(value.autoCloseVaults().get());
-		out.name("port").value(value.port().get());
-		out.name("numTrayNotifications").value(value.numTrayNotifications().get());
+		out.name("checkForUpdatesEnabled").value(value.checkForUpdates().get());
 		out.name("debugMode").value(value.debugMode().get());
-		out.name("theme").value(value.theme().get().name());
-		out.name("uiOrientation").value(value.userInterfaceOrientation().get().name());
+		out.name("displayConfiguration").value((value.displayConfigurationProperty().get()));
 		out.name("keychainProvider").value(value.keychainProvider().get());
-		out.name("useKeychain").value(value.useKeychain().get());
+		out.name("language").value((value.languageProperty().get()));
 		out.name("licenseKey").value(value.licenseKey().get());
+		out.name("mountService").value(value.mountService().get());
+		out.name("numTrayNotifications").value(value.numTrayNotifications().get());
+		out.name("port").value(value.port().get());
 		out.name("showMinimizeButton").value(value.showMinimizeButton().get());
 		out.name("showTrayIcon").value(value.showTrayIcon().get());
+		out.name("startHidden").value(value.startHidden().get());
+		out.name("theme").value(value.theme().get().name());
+		out.name("uiOrientation").value(value.userInterfaceOrientation().get().name());
+		out.name("useKeychain").value(value.useKeychain().get());
+		out.name("windowHeight").value((value.windowHeightProperty().get()));
+		out.name("windowWidth").value((value.windowWidthProperty().get()));
 		out.name("windowXPosition").value((value.windowXPositionProperty().get()));
 		out.name("windowYPosition").value((value.windowYPositionProperty().get()));
-		out.name("windowWidth").value((value.windowWidthProperty().get()));
-		out.name("windowHeight").value((value.windowHeightProperty().get()));
-		out.name("displayConfiguration").value((value.displayConfigurationProperty().get()));
-		out.name("language").value((value.languageProperty().get()));
-		out.name("mountService").value(value.mountService().get());
 		out.endObject();
 	}
 
@@ -82,33 +82,34 @@ public class SettingsJsonAdapter extends TypeAdapter<Settings> {
 		while (in.hasNext()) {
 			String name = in.nextName();
 			switch (name) {
+				case "writtenByVersion" -> in.skipValue(); //noop
 				case "directories" -> settings.getDirectories().addAll(readVaultSettingsArray(in));
 				case "askedForUpdateCheck" -> settings.askedForUpdateCheck().set(in.nextBoolean());
-				case "checkForUpdatesEnabled" -> settings.checkForUpdates().set(in.nextBoolean());
-				case "startHidden" -> settings.startHidden().set(in.nextBoolean());
 				case "autoCloseVaults" -> settings.autoCloseVaults().set(in.nextBoolean());
-				case "port" -> settings.port().set(in.nextInt());
-				case "numTrayNotifications" -> settings.numTrayNotifications().set(in.nextInt());
+				case "checkForUpdatesEnabled" -> settings.checkForUpdates().set(in.nextBoolean());
 				case "debugMode" -> settings.debugMode().set(in.nextBoolean());
-				case "theme" -> settings.theme().set(parseUiTheme(in.nextString()));
-				case "uiOrientation" -> settings.userInterfaceOrientation().set(parseUiOrientation(in.nextString()));
-				case "keychainProvider" -> settings.keychainProvider().set(in.nextString());
-				case "useKeychain" -> settings.useKeychain().set(in.nextBoolean());
-				case "licenseKey" -> settings.licenseKey().set(in.nextString());
-				case "showMinimizeButton" -> settings.showMinimizeButton().set(in.nextBoolean());
-				case "showTrayIcon" -> settings.showTrayIcon().set(in.nextBoolean());
-				case "windowXPosition" -> settings.windowXPositionProperty().set(in.nextInt());
-				case "windowYPosition" -> settings.windowYPositionProperty().set(in.nextInt());
-				case "windowWidth" -> settings.windowWidthProperty().set(in.nextInt());
-				case "windowHeight" -> settings.windowHeightProperty().set(in.nextInt());
 				case "displayConfiguration" -> settings.displayConfigurationProperty().set(in.nextString());
+				case "keychainProvider" -> settings.keychainProvider().set(in.nextString());
 				case "language" -> settings.languageProperty().set(in.nextString());
+				case "licenseKey" -> settings.licenseKey().set(in.nextString());
 				case "mountService" -> {
 					var token = in.peek();
 					if (JsonToken.STRING == token) {
 						settings.mountService().set(in.nextString());
 					}
 				}
+				case "numTrayNotifications" -> settings.numTrayNotifications().set(in.nextInt());
+				case "port" -> settings.port().set(in.nextInt());
+				case "showMinimizeButton" -> settings.showMinimizeButton().set(in.nextBoolean());
+				case "showTrayIcon" -> settings.showTrayIcon().set(in.nextBoolean());
+				case "startHidden" -> settings.startHidden().set(in.nextBoolean());
+				case "theme" -> settings.theme().set(parseUiTheme(in.nextString()));
+				case "uiOrientation" -> settings.userInterfaceOrientation().set(parseUiOrientation(in.nextString()));
+				case "useKeychain" -> settings.useKeychain().set(in.nextBoolean());
+				case "windowHeight" -> settings.windowHeightProperty().set(in.nextInt());
+				case "windowWidth" -> settings.windowWidthProperty().set(in.nextInt());
+				case "windowXPosition" -> settings.windowXPositionProperty().set(in.nextInt());
+				case "windowYPosition" -> settings.windowYPositionProperty().set(in.nextInt());
 				//1.6.x legacy
 				case "preferredVolumeImpl" -> volumeImpl = in.nextString();
 				//legacy end
@@ -134,7 +135,7 @@ public class SettingsJsonAdapter extends TypeAdapter<Settings> {
 		if (volumeImpl.equals("Dokany")) {
 			return "org.cryptomator.frontend.dokany.mount.DokanyMountProvider";
 		} else if (volumeImpl.equals("FUSE")) {
-			if(SystemUtils.IS_OS_WINDOWS) {
+			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";
@@ -142,7 +143,7 @@ public class SettingsJsonAdapter extends TypeAdapter<Settings> {
 				return "org.cryptomator.frontend.fuse.mount.LinuxFuseMountProvider";
 			}
 		} else {
-			if(SystemUtils.IS_OS_WINDOWS) {
+			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";

+ 1 - 1
src/main/java/org/cryptomator/ui/common/FxmlFile.java

@@ -15,7 +15,7 @@ public enum FxmlFile {
 	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_INVALID_LICENSE("/fxml/hub_invalid_license.fxml"), //
 	HUB_RECEIVE_KEY("/fxml/hub_receive_key.fxml"), //
 	HUB_REGISTER_DEVICE("/fxml/hub_register_device.fxml"), //
 	HUB_REGISTER_SUCCESS("/fxml/hub_register_success.fxml"), //

+ 5 - 5
src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingModule.java

@@ -102,10 +102,10 @@ public abstract class HubKeyLoadingModule {
 	}
 
 	@Provides
-	@FxmlScene(FxmlFile.HUB_LICENSE_EXCEEDED)
+	@FxmlScene(FxmlFile.HUB_INVALID_LICENSE)
 	@KeyLoadingScoped
-	static Scene provideLicenseExceededScene(@KeyLoading FxmlLoaderFactory fxmlLoaders) {
-		return fxmlLoaders.createScene(FxmlFile.HUB_LICENSE_EXCEEDED);
+	static Scene provideInvalidLicenseScene(@KeyLoading FxmlLoaderFactory fxmlLoaders) {
+		return fxmlLoaders.createScene(FxmlFile.HUB_INVALID_LICENSE);
 	}
 
 	@Provides
@@ -162,8 +162,8 @@ public abstract class HubKeyLoadingModule {
 
 	@Binds
 	@IntoMap
-	@FxControllerKey(LicenseExceededController.class)
-	abstract FxController bindLicenseExceededController(LicenseExceededController controller);
+	@FxControllerKey(InvalidLicenseController.class)
+	abstract FxController bindInvalidLicenseController(InvalidLicenseController controller);
 
 	@Binds
 	@IntoMap

+ 2 - 2
src/main/java/org/cryptomator/ui/keyloading/hub/LicenseExceededController.java

@@ -7,12 +7,12 @@ import javax.inject.Inject;
 import javafx.fxml.FXML;
 import javafx.stage.Stage;
 
-public class LicenseExceededController implements FxController {
+public class InvalidLicenseController implements FxController {
 
 	private final Stage window;
 
 	@Inject
-	public LicenseExceededController(@KeyLoading Stage window) {
+	public InvalidLicenseController(@KeyLoading Stage window) {
 		this.window = window;
 	}
 

+ 4 - 4
src/main/java/org/cryptomator/ui/keyloading/hub/ReceiveKeyController.java

@@ -42,11 +42,11 @@ public class ReceiveKeyController implements FxController {
 	private final Lazy<Scene> registerDeviceScene;
 	private final Lazy<Scene> unauthorizedScene;
 	private final URI vaultBaseUri;
-	private final Lazy<Scene> licenseExceededScene;
+	private final Lazy<Scene> invalidLicenseScene;
 	private final HttpClient httpClient;
 
 	@Inject
-	public ReceiveKeyController(@KeyLoading Vault vault, ExecutorService executor, @KeyLoading Stage window, @Named("deviceId") String deviceId, @Named("bearerToken") AtomicReference<String> tokenRef, CompletableFuture<JWEObject> result, @FxmlScene(FxmlFile.HUB_REGISTER_DEVICE) Lazy<Scene> registerDeviceScene, @FxmlScene(FxmlFile.HUB_UNAUTHORIZED_DEVICE) Lazy<Scene> unauthorizedScene, @FxmlScene(FxmlFile.HUB_LICENSE_EXCEEDED) Lazy<Scene> licenseExceededScene) {
+	public ReceiveKeyController(@KeyLoading Vault vault, ExecutorService executor, @KeyLoading Stage window, @Named("deviceId") String deviceId, @Named("bearerToken") AtomicReference<String> tokenRef, CompletableFuture<JWEObject> result, @FxmlScene(FxmlFile.HUB_REGISTER_DEVICE) Lazy<Scene> registerDeviceScene, @FxmlScene(FxmlFile.HUB_UNAUTHORIZED_DEVICE) Lazy<Scene> unauthorizedScene, @FxmlScene(FxmlFile.HUB_INVALID_LICENSE) Lazy<Scene> invalidLicenseScene) {
 		this.window = window;
 		this.deviceId = deviceId;
 		this.bearerToken = Objects.requireNonNull(tokenRef.get());
@@ -54,7 +54,7 @@ public class ReceiveKeyController implements FxController {
 		this.registerDeviceScene = registerDeviceScene;
 		this.unauthorizedScene = unauthorizedScene;
 		this.vaultBaseUri = getVaultBaseUri(vault);
-		this.licenseExceededScene = licenseExceededScene;
+		this.invalidLicenseScene = invalidLicenseScene;
 		this.window.addEventHandler(WindowEvent.WINDOW_HIDING, this::windowClosed);
 		this.httpClient = HttpClient.newBuilder().version(HttpClient.Version.HTTP_1_1).executor(executor).build();
 	}
@@ -96,7 +96,7 @@ public class ReceiveKeyController implements FxController {
 	}
 
 	private void licenseExceeded() {
-		window.setScene(licenseExceededScene.get());
+		window.setScene(invalidLicenseScene.get());
 	}
 
 	private void needsDeviceRegistration() {

+ 6 - 1
src/main/java/org/cryptomator/ui/mainwindow/VaultDetailUnlockedController.java

@@ -5,6 +5,7 @@ import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import com.tobiasdiez.easybind.EasyBind;
+import org.apache.commons.lang3.SystemUtils;
 import org.cryptomator.common.vaults.Vault;
 import org.cryptomator.integrations.mount.Mountpoint;
 import org.cryptomator.integrations.revealpath.RevealFailedException;
@@ -101,7 +102,11 @@ public class VaultDetailUnlockedController implements FxController {
 
 	private void handleDragEvent(DragEvent event) {
 		if (DragEvent.DRAG_OVER.equals(event.getEventType()) && event.getGestureSource() == null && event.getDragboard().hasFiles()) {
-			event.acceptTransferModes(TransferMode.LINK);
+			if(SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_MAC) {
+				event.acceptTransferModes(TransferMode.LINK);
+			} else {
+				event.acceptTransferModes(TransferMode.ANY);
+			}
 			draggingOver.set(true);
 		} else if (DragEvent.DRAG_DROPPED.equals(event.getEventType()) && event.getGestureSource() == null && event.getDragboard().hasFiles()) {
 			List<Path> ciphertextPaths = event.getDragboard().getFiles().stream().map(File::toPath).map(this::getCiphertextPath).flatMap(Optional::stream).toList();

+ 3 - 3
src/main/resources/fxml/hub_license_exceeded.fxml

@@ -13,7 +13,7 @@
 <?import javafx.scene.shape.Circle?>
 <HBox xmlns:fx="http://javafx.com/fxml"
 	  xmlns="http://javafx.com/javafx"
-	  fx:controller="org.cryptomator.ui.keyloading.hub.LicenseExceededController"
+	  fx:controller="org.cryptomator.ui.keyloading.hub.InvalidLicenseController"
 	  minWidth="400"
 	  maxWidth="400"
 	  minHeight="145"
@@ -33,12 +33,12 @@
 			</StackPane>
 		</Group>
 		<VBox HBox.hgrow="ALWAYS">
-			<Label styleClass="label-large" text="%hub.licenseExceeded.message" wrapText="true" textAlignment="LEFT">
+			<Label styleClass="label-large" text="%hub.invalidLicense.message" wrapText="true" textAlignment="LEFT">
 				<padding>
 					<Insets bottom="6" top="6"/>
 				</padding>
 			</Label>
-			<Label text="%hub.licenseExceeded.description" wrapText="true"/>
+			<Label text="%hub.invalidLicense.description" wrapText="true"/>
 
 			<Region VBox.vgrow="ALWAYS" minHeight="18"/>
 			<ButtonBar buttonMinWidth="120" buttonOrder="+C">

+ 2 - 3
src/main/resources/i18n/strings.properties

@@ -155,9 +155,8 @@ hub.registerFailed.description=An error was thrown in the naming process. For mo
 hub.unauthorized.message=Access denied
 hub.unauthorized.description=Your device has not yet been authorized to access this vault. Ask the vault owner to authorize it.
 ### License Exceeded
-hub.licenseExceeded.message=License exceeded
-hub.licenseExceeded.description=Cryptomator Hub has given access to more users than its license permits. Please contact your Hub admin to upgrade the license or a vault admin to remove users from vaults.
-
+hub.invalidLicense.message=Hub License invalid
+hub.invalidLicense.description=Your Cryptomator Hub instance has an invalid license. Please inform a Hub administrator to upgrade or renew the license.
 
 # Lock
 ## Force