diff --git a/.github/workflows/win-exe.yml b/.github/workflows/win-exe.yml
index 46e1dbed1..244cbfc36 100644
--- a/.github/workflows/win-exe.yml
+++ b/.github/workflows/win-exe.yml
@@ -22,6 +22,8 @@ jobs:
build-msi:
name: Build .msi Installer
runs-on: windows-latest
+ env:
+ LOOPBACK_ALIAS: 'cryptomator-vault'
steps:
- uses: actions/checkout@v3
with:
@@ -96,6 +98,7 @@ jobs:
--java-options "-Dcryptomator.p12Path=\"~/AppData/Roaming/Cryptomator/key.p12\""
--java-options "-Dcryptomator.ipcSocketPath=\"~/AppData/Roaming/Cryptomator/ipc.socket\""
--java-options "-Dcryptomator.mountPointsDir=\"~/Cryptomator\""
+ --java-options "-Dcryptomator.loopbackAlias=\"${{ env.LOOPBACK_ALIAS }}\""
--java-options "-Dcryptomator.showTrayIcon=true"
--java-options "-Dcryptomator.buildNumber=\"msi-${{ steps.versions.outputs.revNum }}\""
--java-options "-Dcryptomator.integrationsWin.autoStartShellLinkName=\"Cryptomator\""
@@ -105,6 +108,16 @@ jobs:
- name: Patch Application Directory
run: |
cp dist/win/contrib/* appdir/Cryptomator
+ - name: Set LOOPBACK_ALIAS in patchWebDAV.bat
+ shell: pwsh
+ run: |
+ $patchScript = "appdir\Cryptomator\patchWebDAV.bat"
+ try {
+ (Get-Content $patchScript ) -replace '::REPLACE ME', "SET LOOPBACK_ALIAS=`"${{ env.LOOPBACK_ALIAS}}`"" | Set-Content $patchScript
+ } catch {
+ Write-Host "Failed to set LOOPBACK_ALIAS for patchWebDAV.bat"
+ exit 1
+ }
- name: Fix permissions
run: attrib -r appdir/Cryptomator/Cryptomator.exe
shell: pwsh
diff --git a/dist/win/build.bat b/dist/win/build.bat
index c97ebbb35..997d94328 100644
--- a/dist/win/build.bat
+++ b/dist/win/build.bat
@@ -9,8 +9,9 @@ SET ABOUT_URL="https://cryptomator.org"
SET UPDATE_URL="https://cryptomator.org/downloads/"
SET HELP_URL="https://cryptomator.org/contact/"
SET MODULE_AND_MAIN_CLASS="org.cryptomator.desktop/org.cryptomator.launcher.Cryptomator"
+SET LOOPBACK_ALIAS="cryptomator-vault"
-powershell -NoLogo -NoExit -ExecutionPolicy Unrestricted -Command .\build.ps1^
+powershell -NoLogo -ExecutionPolicy Unrestricted -Command .\build.ps1^
-AppName %APPNAME%^
-MainJarGlob "%MAIN_JAR_GLOB%"^
-ModuleAndMainClass "%MODULE_AND_MAIN_CLASS%"^
@@ -20,4 +21,5 @@ powershell -NoLogo -NoExit -ExecutionPolicy Unrestricted -Command .\build.ps1^
-AboutUrl "%ABOUT_URL%"^
-HelpUrl "%HELP_URL%"^
-UpdateUrl "%UPDATE_URL%"^
+ -LoopbackAlias "%LOOPBACK_ALIAS%"^
-Clean 1
\ No newline at end of file
diff --git a/dist/win/build.ps1 b/dist/win/build.ps1
index 50cdbd011..1e316d5f2 100644
--- a/dist/win/build.ps1
+++ b/dist/win/build.ps1
@@ -8,6 +8,7 @@ Param(
[Parameter(Mandatory, HelpMessage="Please provide a help url")][string] $HelpUrl,
[Parameter(Mandatory, HelpMessage="Please provide an update url")][string] $UpdateUrl,
[Parameter(Mandatory, HelpMessage="Please provide an about url")][string] $AboutUrl,
+ [Parameter(Mandatory, HelpMessage="Please provide an alias for localhost")][string] $LoopbackAlias,
[bool] $clean
)
@@ -85,6 +86,7 @@ if ($clean -and (Test-Path -Path $appPath)) {
--java-options "-Dcryptomator.ipcSocketPath=`"~/AppData/Roaming/$AppName/ipc.socket`"" `
--java-options "-Dcryptomator.p12Path=`"~/AppData/Roaming/$AppName/key.p12`"" `
--java-options "-Dcryptomator.mountPointsDir=`"~/$AppName`"" `
+ --java-options "-Dcryptomator.loopbackAlias=`"$LoopbackAlias`"" `
--java-options "-Dcryptomator.integrationsWin.autoStartShellLinkName=`"$AppName`"" `
--java-options "-Dcryptomator.integrationsWin.keychainPaths=`"~/AppData/Roaming/$AppName/keychain.json`"" `
--java-options "-Dcryptomator.showTrayIcon=true" `
@@ -105,6 +107,14 @@ if ($clean -and (Test-Path -Path $appPath)) {
# patch app dir
Copy-Item "contrib\*" -Destination "$AppName"
attrib -r "$AppName\$AppName.exe"
+# patch batch script to set hostfile
+$webDAVPatcher = "$AppName\patchWebDAV.bat"
+try {
+ (Get-Content $webDAVPatcher ) -replace '::REPLACE ME', "SET LOOPBACK_ALIAS=`"$LoopbackAlias`"" | Set-Content $webDAVPatcher
+} catch {
+ Write-Host "Failed to set LOOPBACK_ALIAS for patchWebDAV.bat"
+ exit 1
+}
# create .msi
$Env:JP_WIXWIZARD_RESOURCES = "$buildDir\resources"
diff --git a/dist/win/contrib/patchWebDAV.bat b/dist/win/contrib/patchWebDAV.bat
index 1726147d2..aad226881 100644
--- a/dist/win/contrib/patchWebDAV.bat
+++ b/dist/win/contrib/patchWebDAV.bat
@@ -1,6 +1,6 @@
@echo off
:: Default values for Cryptomator builds
-SET LOOPBACK_ALIAS="cryptomator-vault"
+::REPLACE ME
cd %~dp0
powershell -NoLogo -NonInteractive -ExecutionPolicy Unrestricted -Command .\patchWebDAV.ps1^
diff --git a/dist/win/resources/main.wxs b/dist/win/resources/main.wxs
index b8703a14d..d6247bf05 100644
--- a/dist/win/resources/main.wxs
+++ b/dist/win/resources/main.wxs
@@ -23,6 +23,11 @@
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -86,7 +91,7 @@
-
+
diff --git a/dist/win/resources/overrides.wxi b/dist/win/resources/overrides.wxi
index 60133a35b..c4c946868 100644
--- a/dist/win/resources/overrides.wxi
+++ b/dist/win/resources/overrides.wxi
@@ -1,7 +1,7 @@
-
-
-
-
+
-
+Non-opening ProgID settings:
+- IconFileEncryptedData
+Full file name of icon file used for encrypted data files. Default is "Cryptomator-Vault.ico"
+
+- ProgIdContentType
+Media Type of the encrypted data files. Default is "application/vnd.cryptomator.encrypted"
+
+Close Application settings:
+- CloseApplicationTarget
+Full name of executable to be checkd in the close application util. Default is "cryptomator.exe"
+
+Legacy Installation settings:
+- SkipCryptomatorLegacyCheck
+Should be defined to disable checking for the inno setup installation of Cryptomator and undefined, to enable it.
+ -->
diff --git a/src/main/java/org/cryptomator/common/Environment.java b/src/main/java/org/cryptomator/common/Environment.java
index 261750ad1..383261119 100644
--- a/src/main/java/org/cryptomator/common/Environment.java
+++ b/src/main/java/org/cryptomator/common/Environment.java
@@ -26,6 +26,7 @@ public class Environment {
private static final String KEYCHAIN_PATHS_PROP_NAME = "cryptomator.integrationsWin.keychainPaths";
private static final String P12_PATH_PROP_NAME = "cryptomator.p12Path";
private static final String LOG_DIR_PROP_NAME = "cryptomator.logDir";
+ private static final String LOOPBACK_ALIAS_PROP_NAME = "cryptomator.loopbackAlias";
private static final String MOUNTPOINT_DIR_PROP_NAME = "cryptomator.mountPointsDir";
private static final String MIN_PW_LENGTH_PROP_NAME = "cryptomator.minPwLength";
private static final String APP_VERSION_PROP_NAME = "cryptomator.appVersion";
@@ -45,6 +46,7 @@ public class Environment {
logCryptomatorSystemProperty(IPC_SOCKET_PATH_PROP_NAME);
logCryptomatorSystemProperty(KEYCHAIN_PATHS_PROP_NAME);
logCryptomatorSystemProperty(LOG_DIR_PROP_NAME);
+ logCryptomatorSystemProperty(LOOPBACK_ALIAS_PROP_NAME);
logCryptomatorSystemProperty(PLUGIN_DIR_PROP_NAME);
logCryptomatorSystemProperty(MOUNTPOINT_DIR_PROP_NAME);
logCryptomatorSystemProperty(MIN_PW_LENGTH_PROP_NAME);
@@ -90,6 +92,10 @@ public class Environment {
return getPath(LOG_DIR_PROP_NAME).map(this::replaceHomeDir);
}
+ public Optional getLoopbackAlias() {
+ return Optional.ofNullable(System.getProperty(LOOPBACK_ALIAS_PROP_NAME));
+ }
+
public Optional getPluginDir() {
return getPath(PLUGIN_DIR_PROP_NAME).map(this::replaceHomeDir);
}
@@ -112,22 +118,13 @@ public class Environment {
}
public int getMinPwLength() {
- return getInt(MIN_PW_LENGTH_PROP_NAME, DEFAULT_MIN_PW_LENGTH);
+ return Integer.getInteger(MIN_PW_LENGTH_PROP_NAME, DEFAULT_MIN_PW_LENGTH);
}
public boolean showTrayIcon() {
return Boolean.getBoolean(TRAY_ICON_PROP_NAME);
}
- private int getInt(String propertyName, int defaultValue) {
- String value = System.getProperty(propertyName);
- try {
- return Integer.parseInt(value);
- } catch (NumberFormatException e) { // includes "null" values
- return defaultValue;
- }
- }
-
private Optional getPath(String propertyName) {
String value = System.getProperty(propertyName);
return Optional.ofNullable(value).map(Paths::get);
diff --git a/src/main/java/org/cryptomator/common/vaults/WebDavVolume.java b/src/main/java/org/cryptomator/common/vaults/WebDavVolume.java
index 3ac1820d4..af7ca10f2 100644
--- a/src/main/java/org/cryptomator/common/vaults/WebDavVolume.java
+++ b/src/main/java/org/cryptomator/common/vaults/WebDavVolume.java
@@ -2,6 +2,7 @@ package org.cryptomator.common.vaults;
import com.google.common.base.CharMatcher;
+import org.cryptomator.common.Environment;
import org.cryptomator.common.settings.Settings;
import org.cryptomator.common.settings.VaultSettings;
import org.cryptomator.common.settings.VolumeImpl;
@@ -22,12 +23,11 @@ import java.util.function.Supplier;
public class WebDavVolume implements Volume {
- private static final String LOCALHOST_ALIAS = "cryptomator-vault";
-
private final Provider serverProvider;
private final VaultSettings vaultSettings;
private final Settings settings;
private final WindowsDriveLetters windowsDriveLetters;
+ private final Environment environment;
private WebDavServer server;
private WebDavServletController servlet;
@@ -35,11 +35,12 @@ public class WebDavVolume implements Volume {
private Consumer onExitAction;
@Inject
- public WebDavVolume(Provider serverProvider, VaultSettings vaultSettings, Settings settings, WindowsDriveLetters windowsDriveLetters) {
+ public WebDavVolume(Provider serverProvider, VaultSettings vaultSettings, Settings settings, WindowsDriveLetters windowsDriveLetters, Environment environment) {
this.serverProvider = serverProvider;
this.vaultSettings = vaultSettings;
this.settings = settings;
this.windowsDriveLetters = windowsDriveLetters;
+ this.environment = environment;
}
@Override
@@ -129,16 +130,17 @@ public class WebDavVolume implements Volume {
}
private String getLocalhostAliasOrNull() {
- try {
- InetAddress alias = InetAddress.getByName(LOCALHOST_ALIAS);
- if (alias.getHostAddress().equals("127.0.0.1")) {
- return LOCALHOST_ALIAS;
- } else {
- return null;
+ return environment.getLoopbackAlias().map(alias -> {
+ try {
+ var address = InetAddress.getByName(alias);
+ if (address.getHostAddress().equals("127.0.0.1")) {
+ return alias;
+ }
+ } catch (UnknownHostException e) {
+ //no-op
}
- } catch (UnknownHostException e) {
return null;
- }
+ }).orElse(null);
}
private void cleanup() {