From 3925df0e4ea617895dd36c93ef50ae5254d14477 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sat, 20 Dec 2025 15:25:18 +0900 Subject: [PATCH 01/10] Fix #374 (postInstall.ps1) The `Import-PowerShellDataFile` command not supported in PowerShell 4.0 --- postInstall.ps1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/postInstall.ps1 b/postInstall.ps1 index b78ed8d..7df6bac 100644 --- a/postInstall.ps1 +++ b/postInstall.ps1 @@ -30,6 +30,12 @@ $logo = @" Write-Host $logo +# Fix TLS 1.2 connectivity issue (Tested in Windows 8.1) +[Net.ServicePointManager]::SecurityProtocol = ` + [Net.SecurityProtocolType]::Tls12 -bor ` + [Net.SecurityProtocolType]::Tls11 -bor ` + [Net.SecurityProtocolType]::Tls + # ================================ # SCRIPT ROOT RESOLUTION # ================================ @@ -49,7 +55,11 @@ $urlsFilePath = Join-Path $ScriptRoot "data/DownloadUrls.psd1" if (Test-Path $urlsFilePath) { try { - $DownloadUrls = Import-PowerShellDataFile -Path $urlsFilePath + if (Get-Command Import-PowerShellDataFile -ErrorAction SilentlyContinue) { + $DownloadUrls = Import-PowerShellDataFile $urlsFilePath + } else { + $DownloadUrls = Invoke-Expression (Get-Content $urlsFilePath -Raw) # Tested in Windows 8.1 + } } catch { Write-Host "[WARN] Failed to load DownloadUrls.psd1. Falling back to empty URL table." From 028ace4e17ed6a681a9391aca697aaaa68ae3e89 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sat, 20 Dec 2025 15:32:21 +0900 Subject: [PATCH 02/10] Update postInstall.ps1 --- postInstall.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postInstall.ps1 b/postInstall.ps1 index 7df6bac..d8ecd44 100644 --- a/postInstall.ps1 +++ b/postInstall.ps1 @@ -56,7 +56,7 @@ $urlsFilePath = Join-Path $ScriptRoot "data/DownloadUrls.psd1" if (Test-Path $urlsFilePath) { try { if (Get-Command Import-PowerShellDataFile -ErrorAction SilentlyContinue) { - $DownloadUrls = Import-PowerShellDataFile $urlsFilePath + $DownloadUrls = Import-PowerShellDataFile -Path $urlsFilePath } else { $DownloadUrls = Invoke-Expression (Get-Content $urlsFilePath -Raw) # Tested in Windows 8.1 } From 9fe110b6acf03934277eebaa357edacdbca01b0c Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sat, 20 Dec 2025 19:43:59 +0900 Subject: [PATCH 03/10] Update postInstall.ps1 Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- postInstall.ps1 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/postInstall.ps1 b/postInstall.ps1 index d8ecd44..d6d1792 100644 --- a/postInstall.ps1 +++ b/postInstall.ps1 @@ -31,10 +31,15 @@ $logo = @" Write-Host $logo # Fix TLS 1.2 connectivity issue (Tested in Windows 8.1) -[Net.ServicePointManager]::SecurityProtocol = ` - [Net.SecurityProtocolType]::Tls12 -bor ` - [Net.SecurityProtocolType]::Tls11 -bor ` - [Net.SecurityProtocolType]::Tls +# 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 From ec7553b538efaa136d6773abd8f1a550edee1193 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sat, 20 Dec 2025 20:06:06 +0900 Subject: [PATCH 04/10] Use script filename as telemetry source Replaces the hardcoded 'source' field in the telemetry payload with the actual script filename, improving accuracy in identifying the script sending telemetry events. --- postInstall.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/postInstall.ps1 b/postInstall.ps1 index d6d1792..9db5827 100644 --- a/postInstall.ps1 +++ b/postInstall.ps1 @@ -137,6 +137,8 @@ if ($TelemetryProvider -and $TelemetryProvider.ToLower() -eq "posthog") { } if ($finalDistinctId -and $finalDistinctId.Trim() -ne "") { + # Get current script file name + $scriptName = Split-Path $PSCommandPath -Leaf # Build single event payload for PostHog /i/v0/e endpoint $body = @{ @@ -147,7 +149,7 @@ if ($TelemetryProvider -and $TelemetryProvider.ToLower() -eq "posthog") { product = "welsonjs" version = $Version os = "windows" - source = "post-install.ps1" + source = $scriptName components = $Components # Keep raw string here } timestamp = (Get-Date).ToString("o") # ISO 8601 format From 7910bb3bbeb403442bbd919adb340c24b587b03b Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sat, 20 Dec 2025 21:13:32 +0900 Subject: [PATCH 05/10] Update installer to use local x86 launcher path Changed setup.iss to reference the launcher executable from the application directory (bin/x86) instead of the user app data directory. Updated file sources and icon/command paths accordingly. Improved postInstall.ps1 to handle cases where PSCommandPath is not set by falling back to MyInvocation.MyCommand.Path. --- postInstall.ps1 | 6 +++++- setup.iss | 11 +++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/postInstall.ps1 b/postInstall.ps1 index 9db5827..70dfa73 100644 --- a/postInstall.ps1 +++ b/postInstall.ps1 @@ -138,7 +138,11 @@ if ($TelemetryProvider -and $TelemetryProvider.ToLower() -eq "posthog") { if ($finalDistinctId -and $finalDistinctId.Trim() -ne "") { # Get current script file name - $scriptName = Split-Path $PSCommandPath -Leaf + $scriptName = if (Get-Variable -Name PSCommandPath -ErrorAction SilentlyContinue) { + Split-Path $PSCommandPath -Leaf + } else { + Split-Path $MyInvocation.MyCommand.Path -Leaf + } # Build single event payload for PostHog /i/v0/e endpoint $body = @{ diff --git a/setup.iss b/setup.iss index 96eb725..6181dcf 100644 --- a/setup.iss +++ b/setup.iss @@ -49,7 +49,7 @@ Root: HKCR; Subkey: "{cm:AppName}.Script"; ValueType: string; ValueData: "{cm:Ap Root: HKCR; Subkey: "{cm:AppName}.Script\DefaultIcon"; ValueType: string; ValueData: "{app}\app\favicon.ico,0"; Flags: uninsdeletekey Root: HKCR; Subkey: "{cm:AppName}.Script\shell"; ValueType: string; ValueData: "open"; Components: artifacts; Flags: uninsdeletevalue Root: HKCR; Subkey: "{cm:AppName}.Script\shell\open"; ValueType: string; ValueData: "Run with {cm:AppName}"; Components: artifacts; Flags: uninsdeletevalue -Root: HKCR; Subkey: "{cm:AppName}.Script\shell\open\command"; ValueType: string; ValueData: """{userappdata}\{cm:AppName}\bin\WelsonJS.Launcher.exe"" --file ""%1"""; Components: artifacts; Flags: uninsdeletevalue +Root: HKCR; Subkey: "{cm:AppName}.Script\shell\open\command"; ValueType: string; ValueData: """{app}\bin\x86\WelsonJS.Launcher.exe"" --file ""%1"""; Components: artifacts; Flags: uninsdeletevalue Root: HKCR; Subkey: "{cm:AppName}.Script\ScriptEngine"; ValueType: string; ValueData: "JScript"; Flags: uninsdeletevalue Root: HKCR; Subkey: "{cm:AppName}.Script\ScriptHostEncode"; ValueType: string; ValueData: "{{85131630-480C-11D2-B1F9-00C04F86C324}}"; Flags: uninsdeletevalue Root: HKCR; Subkey: ".js"; ValueType: string; ValueData: "{cm:AppName}.Script"; Components: fileassoc; Flags: uninsdeletevalue; @@ -75,6 +75,9 @@ Source: "helloworld.*"; DestDir: "{app}"; Source: "app\*"; DestDir: "{app}/app"; Flags: ignoreversion recursesubdirs; Source: "lib\*"; DestDir: "{app}/lib"; Flags: ignoreversion recursesubdirs; ; Source: "bin\*"; Excludes: "installer\*"; DestDir: "{app}/bin"; Flags: ignoreversion recursesubdirs; +Source: "bin\x86\7zr.exe"; DestDir: "{app}/bin/x86"; Flags: ignoreversion recursesubdirs; +Source: "bin\x86\WelsonJS.Launcher.exe"; DestDir: "{app}/bin/x86"; Flags: ignoreversion recursesubdirs; +Source: "bin\x86\WelsonJS.Launcher.exe.config"; DestDir: "{app}/bin/x86"; Flags: ignoreversion recursesubdirs; Source: "data\*"; Excludes: "*-apikey.txt"; DestDir: "{app}/data"; Flags: ignoreversion recursesubdirs; ; Source: "node_modules\*"; DestDir: "{app}/node_modules"; Flags: ignoreversion recursesubdirs; ; Source: "bower_components\*"; DestDir: "{app}/node_modules"; Flags: ignoreversion recursesubdirs; @@ -87,14 +90,14 @@ Name: "{app}\tmp"; ; Type: files; Name: "{app}\defaultService.js" [Icons] -Name: "{group}\Start {cm:AppName} Launcher"; Filename: "{userappdata}\{cm:AppName}\bin\WelsonJS.Launcher.exe"; Components: artifacts; AfterInstall: SetElevationBit('{group}\Start {cm:AppName} Launcher.lnk'); +Name: "{group}\Start {cm:AppName} Launcher"; Filename: "{app}\bin\x86\WelsonJS.Launcher.exe"; Components: artifacts; AfterInstall: SetElevationBit('{group}\Start {cm:AppName} Launcher.lnk'); Name: "{group}\Test {cm:AppName}"; Filename: "{app}\bootstrap.bat"; AfterInstall: SetElevationBit('{group}\Test {cm:AppName}.lnk'); Name: "{group}\Uninstall {cm:AppName}"; Filename: "{uninstallexe}"; AfterInstall: SetElevationBit('{group}\Uninstall {cm:AppName}.lnk'); [Run] Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -NoProfile -File ""{app}\postInstall.ps1"" -TelemetryProvider posthog -TelemetryApiKey ""{cm:PostHogApiKey}"" -Version ""{cm:AppVersion}"" -DistinctId ""{computername}"" -Components ""{code:GetSelectedComponents}"""; WorkingDir: "{app}"; Flags: waituntilterminated -Filename: {app}\installService.bat; Components: artifacts; Flags: nowait -Filename: "{userappdata}\{cm:AppName}\bin\WelsonJS.Launcher.exe"; Components: artifacts; Flags: nowait +Filename: "{app}\installService.bat"; Components: artifacts; Flags: nowait +Filename: "{app}\bin\x86\WelsonJS.Launcher.exe"; Components: artifacts; Flags: nowait [UninstallRun] Filename: {app}\uninstallService.bat; Components: artifacts; Flags: waituntilterminated From d44b63286bd001dfe739356900e0a0a405c44ea2 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sat, 20 Dec 2025 21:37:46 +0900 Subject: [PATCH 06/10] Improve archive extraction with 7zr fallback Enhanced Extract-CompressedFile and Extract-TarGzArchive to use 7zr.exe as a fallback when native extraction methods fail or are unavailable. Added Invoke-7zr helper for consistent 7zr invocation. Improved script root resolution for better compatibility with older PowerShell versions. --- postInstall.ps1 | 103 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 78 insertions(+), 25 deletions(-) diff --git a/postInstall.ps1 b/postInstall.ps1 index 70dfa73..c93ff36 100644 --- a/postInstall.ps1 +++ b/postInstall.ps1 @@ -1,5 +1,6 @@ # WelsonJS post-install script # Namhyeon Go , and Catswords OSS contributors. +# Updated on: 2025-12-20 # https://github.com/gnh1201/welsonjs # ================================ @@ -45,11 +46,14 @@ try { # SCRIPT ROOT RESOLUTION # ================================ # Ensure $ScriptRoot is available even on older PowerShell -if (-not (Get-Variable -Name PSScriptRoot -ErrorAction SilentlyContinue)) { - $ScriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path +$ScriptRoot = if ($PSScriptRoot) { + $PSScriptRoot +} +elseif ($MyInvocation.MyCommand.Path) { + Split-Path -Parent $MyInvocation.MyCommand.Path } else { - $ScriptRoot = $PSScriptRoot + (Get-Location).Path } # ================================ @@ -329,10 +333,45 @@ function Download-File { } } +function Invoke-7zr { + param( + [Parameter(Mandatory = $true)] + [string[]]$Arguments, + + [Parameter(Mandatory = $false)] + [string[]]$PipeToArguments + ) + + $sevenZip = Join-Path $ScriptRoot "bin\x86\7zr.exe" + if (-not (Test-Path $sevenZip)) { + throw "7zr.exe is missing: $sevenZip" + } + + Write-Host "[INFO] Using 7zr.exe:" + Write-Host " $sevenZip" + Write-Host "[DEBUG] 7zr args:" + Write-Host " $($Arguments -join ' ')" + + if ($PipeToArguments) { + Write-Host "[DEBUG] 7zr pipe-to args:" + Write-Host " $($PipeToArguments -join ' ')" + + & $sevenZip @Arguments | & $sevenZip @PipeToArguments + } + else { + & $sevenZip @Arguments + } + + if ($LASTEXITCODE -ne 0) { + throw "7zr exited with code $LASTEXITCODE." + } +} + function Extract-CompressedFile { param( [Parameter(Mandatory = $true)] [string]$CompressedPath, + [Parameter(Mandatory = $true)] [string]$DestinationDirectory ) @@ -341,32 +380,46 @@ function Extract-CompressedFile { Write-Host " $CompressedPath" Write-Host " -> $DestinationDirectory" - # Ensure destination directory exists (clean) Ensure-EmptyDirectory -Path $DestinationDirectory - # Temporary extraction workspace $tmpExtractDir = Join-Path $DestinationDirectory "_tmp_extract" Ensure-EmptyDirectory -Path $tmpExtractDir - # Extract all - Add-Type -AssemblyName System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::ExtractToDirectory($CompressedPath, $tmpExtractDir) + $extractedOk = $false + $zipErrorMsg = $null - # Detect source root to move from + # Try ZipFile first + try { + Add-Type -AssemblyName System.IO.Compression.FileSystem -ErrorAction Stop + [System.IO.Compression.ZipFile]::ExtractToDirectory($CompressedPath, $tmpExtractDir) + $extractedOk = $true + } + catch { + $zipErrorMsg = $_.Exception.Message + Write-Host "[WARN] ZipFile extraction failed. Falling back to 7zr.exe." + Write-Host " $zipErrorMsg" + } + + # Fallback: 7zr.exe + if (-not $extractedOk) { + Invoke-7zr -Arguments @("x", $CompressedPath, "-o$tmpExtractDir", "-y") + $extractedOk = $true + } + + # Detect root folder unwrap $entries = Get-ChildItem -Path $tmpExtractDir -Force $SourceRoot = $tmpExtractDir if ($entries.Count -eq 1 -and $entries[0].PSIsContainer) { - # ZIP contains exactly one top-level folder → unwrap that folder $SourceRoot = $entries[0].FullName - Write-Host "[*] Detected single root folder inside zip: $($entries[0].Name)" + Write-Host "[*] Detected single root folder inside archive: $($entries[0].Name)" Write-Host "[*] Unwrapping folder content..." } else { Write-Host "[*] Extracting multi-item archive (no root folder unwrapping needed)." } - # Move all items from source root to final destination + # Move items into final destination Get-ChildItem -Path $SourceRoot -Force | ForEach-Object { $targetPath = Join-Path $DestinationDirectory $_.Name @@ -376,7 +429,6 @@ function Extract-CompressedFile { Move-Item -Path $_.FullName -Destination $targetPath } - # Cleanup Remove-Item -Path $tmpExtractDir -Recurse -Force } @@ -384,6 +436,7 @@ function Extract-TarGzArchive { param( [Parameter(Mandatory = $true)] [string]$ArchivePath, + [Parameter(Mandatory = $true)] [string]$DestinationDirectory ) @@ -394,27 +447,27 @@ function Extract-TarGzArchive { Ensure-EmptyDirectory -Path $DestinationDirectory - # Validate tar availability + # Try tar first $tarCommand = Get-Command tar -ErrorAction SilentlyContinue - if (-not $tarCommand) { - Write-Host "[ERROR] 'tar' command not found." - throw "tar not available on this system." - } + if ($tarCommand) { + Write-Host "[DEBUG] tar command:" + Write-Host " tar -xzf `"$ArchivePath`" -C `"$DestinationDirectory`"" - Write-Host "[DEBUG] tar command:" - Write-Host " tar -xzf `"$ArchivePath`" -C `"$DestinationDirectory`"" - - try { & tar -xzf "$ArchivePath" -C "$DestinationDirectory" if ($LASTEXITCODE -ne 0) { throw "tar exited with code $LASTEXITCODE." } + return } - catch { - throw "Failed to extract TAR.GZ archive: $($_.Exception.Message)" - } + + Write-Host "[WARN] 'tar' not found. Falling back to 7zr.exe." + + Invoke-7zr ` + -Arguments @("x", $ArchivePath, "-so") ` + -PipeToArguments @("x", "-ttar", "-si", "-o$DestinationDirectory", "-y") } + # ================================ # COMPRESSED / INSTALLER PATHS # ================================ From fd0c18032f1ce6551d3fd68102f732b7810e03ce Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sat, 20 Dec 2025 22:11:35 +0900 Subject: [PATCH 07/10] Update setup script metadata date Changed the @updated_on field in setup.iss from 2025-12-01 to 2025-12-20 to reflect the latest modification date. --- setup.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.iss b/setup.iss index 6181dcf..258ea6c 100644 --- a/setup.iss +++ b/setup.iss @@ -1,5 +1,5 @@ ; @created_on 2020-06-26 -; @updated_on 2025-12-01 +; @updated_on 2025-12-20 ; @author Namhyeon Go and Catswords OSS contributors. [Setup] From 054b294106a3f5ca708e1e467edf90169bee23ff Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sat, 20 Dec 2025 22:21:53 +0900 Subject: [PATCH 08/10] 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. --- postInstall.ps1 | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/postInstall.ps1 b/postInstall.ps1 index c93ff36..ef5c8a3 100644 --- a/postInstall.ps1 +++ b/postInstall.ps1 @@ -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 From b53d80ce2181f7bb435f456cd0c21f6fda896059 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sat, 20 Dec 2025 22:42:38 +0900 Subject: [PATCH 09/10] Improve TLS protocol handling in Download-File Expanded TLS protocol support to include TLS 1.0, 1.1, 1.2, and conditionally TLS 1.3 for better compatibility. Added error handling and warning output if TLS configuration fails. --- postInstall.ps1 | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/postInstall.ps1 b/postInstall.ps1 index ef5c8a3..0aa5aed 100644 --- a/postInstall.ps1 +++ b/postInstall.ps1 @@ -292,16 +292,21 @@ 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 + + # Fix TLS connectivity issues (Tested in Windows 8.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 + $protocol = [Net.SecurityProtocolType]::Tls12 -bor ` + [Net.SecurityProtocolType]::Tls11 -bor ` + [Net.SecurityProtocolType]::Tls + + try { + $protocol = $protocol -bor [Enum]::Parse([Net.SecurityProtocolType], 'Tls13') + } catch {} + + [Net.ServicePointManager]::SecurityProtocol = $protocol + } + catch { + Write-Host "[WARN] TLS configuration failed: $($_.Exception.Message)" } # Ensure destination directory exists From 32e864271d76a211d7390e2ab0d2134bd4a991df Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sun, 21 Dec 2025 00:23:24 +0900 Subject: [PATCH 10/10] Add curl fallback for file downloads in postInstall.ps1 Updated the Download-File function to use curl as a fallback if PowerShell download fails. Also added curl.exe and curl-ca-bundle.crt to the installer in setup.iss to ensure curl is available during installation. --- postInstall.ps1 | 25 +++++++++++++++++++++---- setup.iss | 2 ++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/postInstall.ps1 b/postInstall.ps1 index 0aa5aed..55e70ef 100644 --- a/postInstall.ps1 +++ b/postInstall.ps1 @@ -1,6 +1,6 @@ # WelsonJS post-install script # Namhyeon Go , and Catswords OSS contributors. -# Updated on: 2025-12-20 +# Updated on: 2025-12-21 # https://github.com/gnh1201/welsonjs # ================================ @@ -298,11 +298,9 @@ function Download-File { $protocol = [Net.SecurityProtocolType]::Tls12 -bor ` [Net.SecurityProtocolType]::Tls11 -bor ` [Net.SecurityProtocolType]::Tls - try { $protocol = $protocol -bor [Enum]::Parse([Net.SecurityProtocolType], 'Tls13') } catch {} - [Net.ServicePointManager]::SecurityProtocol = $protocol } catch { @@ -334,7 +332,26 @@ function Download-File { } if (-not $success) { - throw "Failed to download $Url after $maxRetries attempts." + Write-Host "[WARN] PowerShell download failed. Falling back to curl." + + $curlPath = Join-Path $ScriptRoot "bin\x86\curl.exe" + if (-not (Test-Path $curlPath)) { + throw "curl not found at $curlPath" + } + + $curlArgs = @( + "-L" + "--fail" + "--retry", "3" + "--retry-delay", "5" + "-o", $DestinationPath + $Url + ) + + $proc = Start-Process -FilePath $curlPath -ArgumentList $curlArgs -NoNewWindow -Wait -PassThru + if ($proc.ExitCode -ne 0 -or -not (Test-Path $DestinationPath)) { + throw "curl download failed with exit code $($proc.ExitCode)." + } } } diff --git a/setup.iss b/setup.iss index 258ea6c..c466dc2 100644 --- a/setup.iss +++ b/setup.iss @@ -76,6 +76,8 @@ Source: "app\*"; DestDir: "{app}/app"; Flags: ignoreversion recursesubdirs; Source: "lib\*"; DestDir: "{app}/lib"; Flags: ignoreversion recursesubdirs; ; Source: "bin\*"; Excludes: "installer\*"; DestDir: "{app}/bin"; Flags: ignoreversion recursesubdirs; Source: "bin\x86\7zr.exe"; DestDir: "{app}/bin/x86"; Flags: ignoreversion recursesubdirs; +Source: "bin\x86\curl.exe"; DestDir: "{app}/bin/x86"; Flags: ignoreversion recursesubdirs; +Source: "bin\x86\curl-ca-bundle.crt"; DestDir: "{app}/bin/x86"; Flags: ignoreversion recursesubdirs; Source: "bin\x86\WelsonJS.Launcher.exe"; DestDir: "{app}/bin/x86"; Flags: ignoreversion recursesubdirs; Source: "bin\x86\WelsonJS.Launcher.exe.config"; DestDir: "{app}/bin/x86"; Flags: ignoreversion recursesubdirs; Source: "data\*"; Excludes: "*-apikey.txt"; DestDir: "{app}/data"; Flags: ignoreversion recursesubdirs;