mirror of
https://github.com/gnh1201/welsonjs.git
synced 2026-02-05 08:02:06 +00:00
Move TLS protocol setup into Download-File function
Relocated the TLS 1.2/1.3 configuration from the script's global scope to within the Download-File function. This ensures secure protocol settings are applied specifically when downloading files, improving reliability and scope control.
This commit is contained in:
parent
fd0c18032f
commit
054b294106
|
|
@ -31,17 +31,6 @@ $logo = @"
|
|||
|
||||
Write-Host $logo
|
||||
|
||||
# Fix TLS 1.2 connectivity issue (Tested in Windows 8.1)
|
||||
# Enable TLS 1.2 and TLS 1.3 (if available) - avoid deprecated TLS 1.0/1.1
|
||||
try {
|
||||
[Net.ServicePointManager]::SecurityProtocol = `
|
||||
[Net.SecurityProtocolType]::Tls12 -bor `
|
||||
[Net.SecurityProtocolType]::Tls13
|
||||
} catch {
|
||||
# TLS 1.3 not available, fall back to TLS 1.2 only
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
}
|
||||
|
||||
# ================================
|
||||
# SCRIPT ROOT RESOLUTION
|
||||
# ================================
|
||||
|
|
@ -303,6 +292,17 @@ function Download-File {
|
|||
Write-Host "[*] Downloading:"
|
||||
Write-Host " $Url"
|
||||
Write-Host " -> $DestinationPath"
|
||||
|
||||
# Fix TLS 1.2 connectivity issue (Tested in Windows 8.1)
|
||||
# Enable TLS 1.2 and TLS 1.3 (if available) - avoid deprecated TLS 1.0/1.1
|
||||
try {
|
||||
[Net.ServicePointManager]::SecurityProtocol = `
|
||||
[Net.SecurityProtocolType]::Tls12 -bor `
|
||||
[Net.SecurityProtocolType]::Tls13
|
||||
} catch {
|
||||
# TLS 1.3 not available, fall back to TLS 1.2 only
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
}
|
||||
|
||||
# Ensure destination directory exists
|
||||
$destDir = Split-Path -Parent $DestinationPath
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user