Browse Source

Using 127.0.0.1 instead of localhost. References #512

Sebastian Stenzel 7 years ago
parent
commit
9d2aa62785

+ 0 - 7
main/commons/src/main/java/org/cryptomator/common/settings/Settings.java

@@ -29,7 +29,6 @@ public class Settings {
 	public static final int MAX_PORT = 65535;
 	public static final boolean DEFAULT_CHECK_FOR_UDPATES = true;
 	public static final int DEFAULT_PORT = 42427;
-	public static final boolean DEFAULT_USE_IPV6 = SystemUtils.IS_OS_WINDOWS;
 	public static final int DEFAULT_NUM_TRAY_NOTIFICATIONS = 3;
 	public static final String DEFAULT_GVFS_SCHEME = "dav";
 	public static final boolean DEFAULT_DEBUG_MODE = false;
@@ -37,7 +36,6 @@ public class Settings {
 	private final ObservableList<VaultSettings> directories = FXCollections.observableArrayList(VaultSettings::observables);
 	private final BooleanProperty checkForUpdates = new SimpleBooleanProperty(DEFAULT_CHECK_FOR_UDPATES);
 	private final IntegerProperty port = new SimpleIntegerProperty(DEFAULT_PORT);
-	private final BooleanProperty useIpv6 = new SimpleBooleanProperty(DEFAULT_USE_IPV6);
 	private final IntegerProperty numTrayNotifications = new SimpleIntegerProperty(DEFAULT_NUM_TRAY_NOTIFICATIONS);
 	private final StringProperty preferredGvfsScheme = new SimpleStringProperty(DEFAULT_GVFS_SCHEME);
 	private final BooleanProperty debugMode = new SimpleBooleanProperty(DEFAULT_DEBUG_MODE);
@@ -50,7 +48,6 @@ public class Settings {
 		directories.addListener((ListChangeListener.Change<? extends VaultSettings> change) -> this.save());
 		checkForUpdates.addListener(this::somethingChanged);
 		port.addListener(this::somethingChanged);
-		useIpv6.addListener(this::somethingChanged);
 		numTrayNotifications.addListener(this::somethingChanged);
 		preferredGvfsScheme.addListener(this::somethingChanged);
 		debugMode.addListener(this::somethingChanged);
@@ -84,10 +81,6 @@ public class Settings {
 		return port;
 	}
 
-	public BooleanProperty useIpv6() {
-		return useIpv6;
-	}
-
 	public IntegerProperty numTrayNotifications() {
 		return numTrayNotifications;
 	}

+ 0 - 7
main/commons/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java

@@ -30,7 +30,6 @@ public class SettingsJsonAdapter extends TypeAdapter<Settings> {
 		writeVaultSettingsArray(out, value.getDirectories());
 		out.name("checkForUpdatesEnabled").value(value.checkForUpdates().get());
 		out.name("port").value(value.port().get());
-		out.name("useIpv6").value(value.useIpv6().get());
 		out.name("numTrayNotifications").value(value.numTrayNotifications().get());
 		out.name("preferredGvfsScheme").value(value.preferredGvfsScheme().get());
 		out.name("debugMode").value(value.debugMode().get());
@@ -62,12 +61,6 @@ public class SettingsJsonAdapter extends TypeAdapter<Settings> {
 			case "port":
 				settings.port().set(in.nextInt());
 				break;
-			case "useIpv6":
-				// Temporarily we will disable loading this setting, as we want the default value on each app start.
-				// This setting might be removed completely in the future
-				// settings.useIpv6().set(in.nextBoolean());
-				in.skipValue();
-				break;
 			case "numTrayNotifications":
 				settings.numTrayNotifications().set(in.nextInt());
 				break;

+ 3 - 2
main/ui/src/main/java/org/cryptomator/ui/UiModule.java

@@ -16,6 +16,7 @@ import java.util.function.Consumer;
 import javax.inject.Named;
 import javax.inject.Singleton;
 
+import org.apache.commons.lang3.SystemUtils;
 import org.cryptomator.common.CommonsModule;
 import org.cryptomator.common.settings.Settings;
 import org.cryptomator.common.settings.SettingsProvider;
@@ -50,8 +51,8 @@ public class UiModule {
 	@Provides
 	@Singleton
 	Binding<InetSocketAddress> provideServerSocketAddressBinding(Settings settings) {
-		return EasyBind.combine(settings.useIpv6(), settings.port(), (useIpv6, port) -> {
-			String host = useIpv6 ? "::1" : "localhost";
+		return EasyBind.map(settings.port(), (Number port) -> {
+			String host = SystemUtils.IS_OS_WINDOWS ? "127.0.0.1" : "localhost";
 			return InetSocketAddress.createUnresolved(host, port.intValue());
 		});
 	}

+ 0 - 10
main/ui/src/main/java/org/cryptomator/ui/controllers/SettingsController.java

@@ -58,12 +58,6 @@ public class SettingsController implements ViewController {
 	@FXML
 	private Button changePortButton;
 
-	@FXML
-	private Label useIpv6Label;
-
-	@FXML
-	private CheckBox useIpv6Checkbox;
-
 	@FXML
 	private Label versionLabel;
 
@@ -87,9 +81,6 @@ public class SettingsController implements ViewController {
 		portField.addEventFilter(KeyEvent.KEY_TYPED, this::filterNumericKeyEvents);
 		changePortButton.visibleProperty().bind(settings.port().asString().isNotEqualTo(portField.textProperty()));
 		changePortButton.disableProperty().bind(Bindings.createBooleanBinding(this::isPortValid, portField.textProperty()).not());
-		useIpv6Label.setVisible(SystemUtils.IS_OS_WINDOWS);
-		useIpv6Checkbox.setVisible(SystemUtils.IS_OS_WINDOWS);
-		useIpv6Checkbox.setSelected(SystemUtils.IS_OS_WINDOWS && settings.useIpv6().get());
 		versionLabel.setText(String.format(localization.getString("settings.version.label"), applicationVersion.orElse("SNAPSHOT")));
 		prefGvfsSchemeLabel.setVisible(SystemUtils.IS_OS_LINUX);
 		prefGvfsScheme.setVisible(SystemUtils.IS_OS_LINUX);
@@ -99,7 +90,6 @@ public class SettingsController implements ViewController {
 		debugModeCheckbox.setSelected(settings.debugMode().get());
 
 		settings.checkForUpdates().bind(checkForUpdatesCheckbox.selectedProperty());
-		settings.useIpv6().bind(useIpv6Checkbox.selectedProperty());
 		settings.preferredGvfsScheme().bind(prefGvfsScheme.valueProperty());
 		settings.debugMode().bind(debugModeCheckbox.selectedProperty());
 	}

+ 4 - 9
main/ui/src/main/resources/fxml/settings.fxml

@@ -43,18 +43,13 @@
 				<Button text="%settings.port.apply" fx:id="changePortButton" onAction="#changePort"/>
 			</HBox>
 			
-			
 			<!-- Row 2 -->
-			<Label GridPane.rowIndex="2" GridPane.columnIndex="0" fx:id="useIpv6Label" text="%settings.useipv6.label" cacheShape="true" cache="true" />
-			<CheckBox GridPane.rowIndex="2" GridPane.columnIndex="1" fx:id="useIpv6Checkbox" cacheShape="true" cache="true" />
+			<Label GridPane.rowIndex="2" GridPane.columnIndex="0" fx:id="prefGvfsSchemeLabel" text="%settings.prefGvfsScheme.label" cacheShape="true" cache="true" />
+			<ChoiceBox GridPane.rowIndex="2" GridPane.columnIndex="1" fx:id="prefGvfsScheme" GridPane.hgrow="ALWAYS" maxWidth="Infinity" cacheShape="true" cache="true" />
 			
 			<!-- Row 3 -->
-			<Label GridPane.rowIndex="3" GridPane.columnIndex="0" fx:id="prefGvfsSchemeLabel" text="%settings.prefGvfsScheme.label" cacheShape="true" cache="true" />
-			<ChoiceBox GridPane.rowIndex="3" GridPane.columnIndex="1" fx:id="prefGvfsScheme" GridPane.hgrow="ALWAYS" maxWidth="Infinity" cacheShape="true" cache="true" />
-			
-			<!-- Row 4 -->
-			<Label GridPane.rowIndex="4" GridPane.columnIndex="0" text="%settings.debugMode.label" cacheShape="true" cache="true" />
-			<CheckBox GridPane.rowIndex="4" GridPane.columnIndex="1" fx:id="debugModeCheckbox" cacheShape="true" cache="true" />
+			<Label GridPane.rowIndex="3" GridPane.columnIndex="0" text="%settings.debugMode.label" cacheShape="true" cache="true" />
+			<CheckBox GridPane.rowIndex="3" GridPane.columnIndex="1" fx:id="debugModeCheckbox" cacheShape="true" cache="true" />
 			
 		</children>
 	</GridPane>

+ 0 - 1
main/ui/src/main/resources/localization/en.txt

@@ -112,7 +112,6 @@ settings.checkForUpdates.label=Check for Updates
 settings.port.label=WebDAV Port
 settings.port.prompt=0 = Choose automatically
 settings.port.apply=Apply
-settings.useipv6.label=Use IPv6 Literal
 settings.prefGvfsScheme.label=WebDAV Scheme
 settings.debugMode.label=Debug Mode *
 settings.requiresRestartLabel=* Cryptomator needs to restart