@@ -103,9 +103,9 @@ ECHO %REPONAME%: Getting latest release...
103103SET UPSTREAMAPIURL = %UPSTREAMURL:github.com =api.github.com/repos %
104104REM Check if secure OAuth is available
105105IF " %GITHUBTOKEN% " == " " (
106- powershell -nologo -noprofile -command " try { Invoke-RestMethod -Uri %UPSTREAMAPIURL% /%REPONAME% /releases/latest > latest.json } catch {exit 1}"
106+ powershell -nologo -noprofile -command " $currentMaxTls = [Math]::Max([Net.ServicePointManager]::SecurityProtocol.value__,[Net.SecurityProtocolType]::Tls.value__);$newTlsTypes = [enum]::GetValues('Net.SecurityProtocolType') | ?{ $_ -gt $currentMaxTls };ForEach ($newTls in $newTlsTypes) { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor $newTls }; try { Invoke-RestMethod -Uri %UPSTREAMAPIURL% /%REPONAME% /releases/latest > latest.json } catch {exit 1}"
107107) ELSE (
108- powershell -nologo -noprofile -command " try { Invoke-RestMethod -Uri %UPSTREAMAPIURL% /%REPONAME% /releases/latest -Headers @{'Authorization' = 'token %GITHUBTOKEN% '} > latest.json } catch {exit 1}"
108+ powershell -nologo -noprofile -command " $currentMaxTls = [Math]::Max([Net.ServicePointManager]::SecurityProtocol.value__,[Net.SecurityProtocolType]::Tls.value__);$newTlsTypes = [enum]::GetValues('Net.SecurityProtocolType') | ?{ $_ -gt $currentMaxTls };ForEach ($newTls in $newTlsTypes) { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor $newTls }; try { Invoke-RestMethod -Uri %UPSTREAMAPIURL% /%REPONAME% /releases/latest -Headers @{'Authorization' = 'token %GITHUBTOKEN% '} > latest.json } catch {exit 1}"
109109)
110110IF ERRORLEVEL 1 ( ECHO Failed getting latest %REPONAME% release & EXIT /B 1 )
111111REM Get tag for latest release
@@ -128,7 +128,7 @@ REM Download a pre-built archive and extract
128128ECHO %REPONAME% : Downloading %LIBNAME% _%TAG% _msvc%MSVC_VER% .zip...
129129SET PREBUILTDIR = prebuilt
130130MKDIR %PREBUILTDIR% > NUL 2 >& 1
131- powershell -nologo -noprofile -command " try { (New-Object Net.WebClient).DownloadFile('%DLURL% ', '%PREBUILTDIR% \temp.zip') } catch {exit 1}"
131+ powershell -nologo -noprofile -command " $currentMaxTls = [Math]::Max([Net.ServicePointManager]::SecurityProtocol.value__,[Net.SecurityProtocolType]::Tls.value__);$newTlsTypes = [enum]::GetValues('Net.SecurityProtocolType') | ?{ $_ -gt $currentMaxTls };ForEach ($newTls in $newTlsTypes) { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor $newTls }; try { (New-Object Net.WebClient).DownloadFile('%DLURL% ', '%PREBUILTDIR% \temp.zip') } catch {exit 1}"
132132IF ERRORLEVEL 1 ( ECHO Failed downloading %DLURL% & EXIT /B 1 )
133133powershell -nologo -noprofile -command " Add-Type -AssemblyName System.IO.Compression.FileSystem; $zip=[System.IO.Compression.ZipFile]::OpenRead('%PREBUILTDIR% \temp.zip'); foreach ($item in $zip.Entries) { try {$file=(Join-Path -Path .\%PREBUILTDIR% -ChildPath $item.FullName); $null=[System.IO.Directory]::CreateDirectory((Split-Path -Path $file)); [System.IO.Compression.ZipFileExtensions]::ExtractToFile($item,$file,$true)} catch {exit 1} }"
134134IF ERRORLEVEL 1 ( ECHO Failed extracting downloaded archive & EXIT /B 1 )
0 commit comments