mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-14 08:41:28 +00:00
Merge branch 'feature/patch-webdav' into develop
# Conflicts: # dist/win/contrib/patchWebDAV.ps1 # dist/win/resources/main.wxs
This commit is contained in:
16
dist/win/contrib/patchHosts.ps1
vendored
16
dist/win/contrib/patchHosts.ps1
vendored
@@ -1,16 +0,0 @@
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
$sysdir = [Environment]::SystemDirectory
|
||||
$hostsFile = "$sysdir\drivers\etc\hosts"
|
||||
$aliasLine = '127.0.0.1 cryptomator-vault'
|
||||
|
||||
foreach ($line in Get-Content $hostsFile) {
|
||||
if ($line -eq $aliasLine){
|
||||
Write-Output 'No changes necessary'
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
|
||||
Add-Content -Path $hostsFile -Encoding ascii -Value "`r`n$aliasLine"
|
||||
Write-Output 'Added alias to hosts file'
|
||||
exit 0
|
||||
@@ -1,3 +1,3 @@
|
||||
@echo off
|
||||
cd %~dp0
|
||||
powershell -NoLogo -NonInteractive -ExecutionPolicy Unrestricted -Command .\patchHosts.ps1
|
||||
powershell -NoLogo -NonInteractive -ExecutionPolicy Unrestricted -Command .\patchWebDAV.ps1
|
||||
61
dist/win/contrib/patchWebDAV.ps1
vendored
Normal file
61
dist/win/contrib/patchWebDAV.ps1
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
# Adds for address 127.0.0.1 the 'cryptomator-vault' alias to the hosts file
|
||||
function Add-AliasToHost {
|
||||
$sysdir = [Environment]::SystemDirectory
|
||||
$hostsFile = "$sysdir\drivers\etc\hosts"
|
||||
$aliasLine = '127.0.0.1 cryptomator-vault'
|
||||
|
||||
foreach ($line in Get-Content $hostsFile) {
|
||||
if ($line -eq $aliasLine){
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Add-Content -Path $hostsFile -Encoding ascii -Value "`r`n$aliasLine"
|
||||
}
|
||||
|
||||
|
||||
# Sets in the registry the webclient file size limit to the maximum value
|
||||
function Set-WebDAVFileSizeLimit {
|
||||
# Set variables to indicate value and key to set
|
||||
$RegistryPath = 'HKLM:\SYSTEM\CurrentControlSet\Services\WebClient\Parameters'
|
||||
$Name = 'FileSizeLimitInBytes'
|
||||
$Value = '0xffffffff'
|
||||
|
||||
# Create the key if it does not exist
|
||||
If (-NOT (Test-Path $RegistryPath)) {
|
||||
New-Item -Path $RegistryPath -Force | Out-Null
|
||||
}
|
||||
|
||||
# Now set the value
|
||||
New-ItemProperty -Path $RegistryPath -Name $Name -Value $Value -PropertyType DWORD -Force | Out-Null
|
||||
}
|
||||
|
||||
|
||||
# Changes the network provider order such that the builtin Windows webclient is always first
|
||||
function Edit-ProviderOrder {
|
||||
$RegistryPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\NetworkProvider\HwOrder'
|
||||
$Name = 'ProviderOrder'
|
||||
$WebClientString = 'webclient'
|
||||
|
||||
$CurrentOrder = (Get-ItemProperty $RegistryPath $Name).$Name
|
||||
|
||||
$OrderWithoutWebclientArray = $CurrentOrder -split ',' | Where-Object {$_ -ne $WebClientString}
|
||||
$WebClientArray = @($WebClientString)
|
||||
|
||||
$UpdatedOrder = ($WebClientArray + $OrderWithoutWebclientArray) -join ","
|
||||
New-ItemProperty -Path $RegistryPath -Name $Name -Value $UpdatedOrder -PropertyType String -Force | Out-Null
|
||||
}
|
||||
|
||||
|
||||
Add-AliasToHost
|
||||
Write-Output 'Ensured alias exists in hosts file'
|
||||
|
||||
Set-WebDAVFileSizeLimit
|
||||
Write-Output 'Set WebDAV file size limit'
|
||||
|
||||
Edit-ProviderOrder
|
||||
Write-Output 'Ensured correct provider order'
|
||||
|
||||
exit 0
|
||||
5
dist/win/resources/main.wxs
vendored
5
dist/win/resources/main.wxs
vendored
@@ -124,7 +124,8 @@
|
||||
<CustomAction Id="JpSetARPURLUPDATEINFO" Property="ARPURLUPDATEINFO" Value="$(var.JpUpdateURL)" />
|
||||
<?endif?>
|
||||
|
||||
<CustomAction Id="PatchHostsFile" Impersonate="no" ExeCommand="[INSTALLDIR]patchHosts.bat" Directory="INSTALLDIR" Execute="deferred" Return="asyncWait" />
|
||||
<!-- WebDAV patches -->
|
||||
<CustomAction Id="PatchWebDAV" Impersonate="no" ExeCommand="[INSTALLDIR]patchWebDAV.bat" Directory="INSTALLDIR" Execute="deferred" Return="asyncWait" />
|
||||
|
||||
<?ifdef JpIcon ?>
|
||||
<Property Id="ARPPRODUCTICON" Value="JpARPPRODUCTICON"/>
|
||||
@@ -156,7 +157,7 @@
|
||||
<?endif?>
|
||||
<RemoveExistingProducts Before="CostInitialize"/>
|
||||
|
||||
<Custom Action="PatchHostsFile" After="InstallFiles">NOT Installed OR REINSTALL</Custom>
|
||||
<Custom Action="PatchWebDAV" After="InstallFiles">NOT Installed OR REINSTALL</Custom>
|
||||
</InstallExecuteSequence>
|
||||
|
||||
<WixVariable Id="WixUIBannerBmp" Value="$(env.JP_WIXWIZARD_RESOURCES)\banner.bmp" />
|
||||
|
||||
Reference in New Issue
Block a user