From ca8bd275bf01762bf65f38efa8e99d1defee68ad Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Fri, 21 Nov 2025 10:50:31 +0900 Subject: [PATCH 1/4] Update service paths and installer registry keys Service executable paths in installService.bat and uninstallService.bat now use %APPDATA% for improved portability. The setup.iss installer script updates registry keys to use the application name macro, adjusts file and icon paths to user appdata, and changes PowerShell execution flags. afterInstall.ps1 now downloads and extracts WelsonJS binary artifacts from a remote URL. --- afterInstall.ps1 | 51 ++++++++++++++++++++++++++------------------ installService.bat | 6 +----- setup.iss | 32 +++++++++++++-------------- uninstallService.bat | 6 +----- 4 files changed, 48 insertions(+), 47 deletions(-) diff --git a/afterInstall.ps1 b/afterInstall.ps1 index 03117f9..00bcde3 100644 --- a/afterInstall.ps1 +++ b/afterInstall.ps1 @@ -181,10 +181,13 @@ function Extract-TarGz { # ================================ # SET DOWNLOAD URLS BASED ON ARCH # ================================ -$PythonUrl = $null -$CurlUrl = $null -$YaraUrl = $null -$WamrUrl = $null +$PythonUrl = $null +$CurlUrl = $null +$YaraUrl = $null +$WamrUrl = $null + +# WelsonJS binary artifacts +$ArtifactsUrl = "https://catswords.blob.core.windows.net/welsonjs/artifacts.zip" switch ($arch) { "x64" { @@ -227,40 +230,44 @@ switch ($arch) { } } -Write-Host "[*] Python URL: $PythonUrl" -Write-Host "[*] curl URL : $CurlUrl" +Write-Host "[*] Python URL : $PythonUrl" +Write-Host "[*] curl URL : $CurlUrl" if ($YaraUrl) { - Write-Host "[*] YARA URL : $YaraUrl" + Write-Host "[*] YARA URL : $YaraUrl" } else { - Write-Host "[*] YARA : skipped on this architecture" + Write-Host "[*] YARA : skipped on this architecture" } if ($WamrUrl) { - Write-Host "[*] WAMR URL : $WamrUrl" + Write-Host "[*] WAMR URL : $WamrUrl" } else { - Write-Host "[*] WAMR : skipped on this architecture" + Write-Host "[*] WAMR : skipped on this architecture" } +Write-Host "[*] artifacts URL: $ArtifactsUrl" Write-Host "" # ================================ # DOWNLOAD FILES # ================================ -$PythonZip = Join-Path $TmpDir "python.zip" -$CurlZip = Join-Path $TmpDir "curl.zip" -$YaraZip = Join-Path $TmpDir "yara.zip" -$WamrTgz = Join-Path $TmpDir "wamr.tar.gz" +$PythonZip = Join-Path $TmpDir "python.zip" +$CurlZip = Join-Path $TmpDir "curl.zip" +$YaraZip = Join-Path $TmpDir "yara.zip" +$WamrTgz = Join-Path $TmpDir "wamr.tar.gz" +$ArtifactsZip = Join-Path $TmpDir "artifacts.zip" try { - Download-File -Url $PythonUrl -Destination $PythonZip - Download-File -Url $CurlUrl -Destination $CurlZip + Download-File -Url $PythonUrl -Destination $PythonZip + Download-File -Url $CurlUrl -Destination $CurlZip if ($YaraUrl) { - Download-File -Url $YaraUrl -Destination $YaraZip + Download-File -Url $YaraUrl -Destination $YaraZip } if ($WamrUrl) { - Download-File -Url $WamrUrl -Destination $WamrTgz + Download-File -Url $WamrUrl -Destination $WamrTgz } + + Download-File -Url $ArtifactsUrl -Destination $ArtifactsZip } catch { Write-Host "[FATAL] Download phase failed." @@ -272,16 +279,18 @@ catch { # EXTRACT FILES # ================================ try { - Extract-Zip -ZipPath $PythonZip -DestDir (Join-Path $TargetDir "python") - Extract-Zip -ZipPath $CurlZip -DestDir (Join-Path $TargetDir "curl") + Extract-Zip -ZipPath $PythonZip -DestDir (Join-Path $TargetDir "python") + Extract-Zip -ZipPath $CurlZip -DestDir (Join-Path $TargetDir "curl") if ($YaraUrl) { - Extract-Zip -ZipPath $YaraZip -DestDir (Join-Path $TargetDir "yara") + Extract-Zip -ZipPath $YaraZip -DestDir (Join-Path $TargetDir "yara") } if ($WamrUrl) { Extract-TarGz -TarGzPath $WamrTgz -DestDir (Join-Path $TargetDir "wamr") } + + Extract-Zip -ZipPath $ArtifactsZip -DestDir (Join-Path $TargetDir "bin") } catch { Write-Host "[FATAL] Extraction phase failed." diff --git a/installService.bat b/installService.bat index 687dbd6..c491708 100644 --- a/installService.bat +++ b/installService.bat @@ -6,12 +6,8 @@ REM https://github.com/gnh1201/welsonjs REM Set the service name set SERVICE_NAME=WelsonJS.Service -REM Get the current directory -set CURRENT_DIR=%~dp0 -set CURRENT_DIR=%CURRENT_DIR:~0,-1% - REM Set the paths -set EXE_PATH=%CURRENT_DIR%\bin\x86\WelsonJS.Service.exe +set EXE_PATH=%APPDATA%\WelsonJS\bin\WelsonJS.Service.exe set INSTALL_UTIL_PATH=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe REM Uninstall the service diff --git a/setup.iss b/setup.iss index a1a32df..7faadea 100644 --- a/setup.iss +++ b/setup.iss @@ -1,5 +1,5 @@ ; @created_on 2020-06-26 -; @updated_on 2025-03-21 +; @updated_on 2025-11-21 ; @author Namhyeon Go [Setup] @@ -32,17 +32,17 @@ ChangesAssociations=yes ; Root: HKCR; Subkey: "welsonjs"; ValueType: "string"; ValueName: "URL Protocol"; ValueData: "" ; Root: HKCR; Subkey: "welsonjs\DefaultIcon"; ValueType: "string"; ValueData: "{app}\app\favicon.ico,0" ; Root: HKCR; Subkey: "welsonjs\shell\open\command"; ValueType: "string"; ValueData: "cscript ""{app}\app.js"" uriloader ""%1""" -Root: HKCR; Subkey: "WelsonJS.Script"; ValueType: string; ValueData: "WelsonJS Script"; Flags: uninsdeletekey -Root: HKCR; Subkey: "WelsonJS.Script\DefaultIcon"; ValueType: string; ValueData: "{app}\app\favicon.ico,0"; Flags: uninsdeletekey -Root: HKCR; Subkey: "WelsonJS.Script\shell"; ValueType: string; ValueData: "open"; Flags: uninsdeletevalue -Root: HKCR; Subkey: "WelsonJS.Script\shell\open"; ValueType: string; ValueData: "Run with WelsonJS"; Flags: uninsdeletevalue -Root: HKCR; Subkey: "WelsonJS.Script\shell\open\command"; ValueType: string; ValueData: """{app}\bin\x86\WelsonJS.Launcher.exe"" --file ""%1"""; Flags: uninsdeletevalue -Root: HKCR; Subkey: ".js"; ValueType: string; ValueData: "WelsonJS.Script"; Flags: uninsdeletevalue -Root: HKCR; Subkey: ".ts"; ValueType: string; ValueData: "WelsonJS.Script"; Flags: uninsdeletevalue -Root: HKCR; Subkey: ".re"; ValueType: string; ValueData: "WelsonJS.Script"; Flags: uninsdeletevalue -Root: HKCR; Subkey: ".res"; ValueType: string; ValueData: "WelsonJS.Script"; Flags: uninsdeletevalue -Root: HKCR; Subkey: ".ls"; ValueType: string; ValueData: "WelsonJS.Script"; Flags: uninsdeletevalue -Root: HKCR; Subkey: ".coffee"; ValueType: string; ValueData: "WelsonJS.Script"; Flags: uninsdeletevalue +Root: HKCR; Subkey: "{cm:AppName}.Script"; ValueType: string; ValueData: "{cm:AppName} Script"; Flags: uninsdeletekey +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"; Flags: uninsdeletevalue +Root: HKCR; Subkey: "{cm:AppName}.Script\shell\open"; ValueType: string; ValueData: "Run with {cm:AppName}"; Flags: uninsdeletevalue +Root: HKCR; Subkey: "{cm:AppName}.Script\shell\open\command"; ValueType: string; ValueData: """{app}\bin\x86\WelsonJS.Launcher.exe"" --file ""%1"""; Flags: uninsdeletevalue +Root: HKCR; Subkey: ".js"; ValueType: string; ValueData: "{cm:AppName}.Script"; Flags: uninsdeletevalue +Root: HKCR; Subkey: ".ts"; ValueType: string; ValueData: "{cm:AppName}.Script"; Flags: uninsdeletevalue +Root: HKCR; Subkey: ".re"; ValueType: string; ValueData: "{cm:AppName}.Script"; Flags: uninsdeletevalue +Root: HKCR; Subkey: ".res"; ValueType: string; ValueData: "{cm:AppName}.Script"; Flags: uninsdeletevalue +Root: HKCR; Subkey: ".ls"; ValueType: string; ValueData: "{cm:AppName}.Script"; Flags: uninsdeletevalue +Root: HKCR; Subkey: ".coffee"; ValueType: string; ValueData: "{cm:AppName}.Script"; Flags: uninsdeletevalue [Files] Source: "app.js"; DestDir: "{app}"; @@ -64,7 +64,7 @@ Source: "afterInstall.ps1"; DestDir: "{app}"; Source: "helloworld.*"; DestDir: "{app}"; Source: "app\*"; Excludes: "assets\img\_templates,assets\tessdata\*,assets\tessdata_best\*,assets\tessdata_fast\*"; 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\*"; Excludes: "installer\*"; DestDir: "{app}/bin"; 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; @@ -77,7 +77,7 @@ Type: files; Name: "{app}\settings.ini" Type: files; Name: "{app}\defaultService.js" [Icons] -Name: "{group}\Start {cm:AppName} Launcher"; Filename: "{app}\bin\x86\WelsonJS.Launcher.exe"; AfterInstall: SetElevationBit('{group}\Start {cm:AppName} Launcher.lnk'); +Name: "{group}\Start {cm:AppName} Launcher"; Filename: "{userappdata}\{cm:AppName}\WelsonJS.Launcher.exe"; 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'); @@ -85,9 +85,9 @@ Name: "{group}\Uninstall {cm:AppName}"; Filename: "{uninstallexe}"; AfterInstall ; Filename: {app}\bin\gtk2-runtime-2.24.33-2021-01-30-ts-win64.exe; ; Filename: {app}\bin\nmap-7.92\VC_redist.x86.exe; ; Filename: {app}\bin\nmap-7.92\npcap-1.50.exe; -Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -NoProfile -File ""{app}\afterInstall.ps1"""; WorkingDir: "{app}"; Flags: nowait +Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -NoProfile -File ""{app}\afterInstall.ps1"""; WorkingDir: "{app}"; Flags: waituntilterminated Filename: {app}\installService.bat; Flags: nowait -Filename: {app}\bin\x86\WelsonJS.Launcher.exe; Flags: nowait +Filename: "{userappdata}\{cm:AppName}\bin\WelsonJS.Launcher.exe"; Flags: nowait [UninstallRun] Filename: {app}\uninstallService.bat; diff --git a/uninstallService.bat b/uninstallService.bat index 5adc932..9b36ae1 100644 --- a/uninstallService.bat +++ b/uninstallService.bat @@ -6,12 +6,8 @@ REM https://github.com/gnh1201/welsonjs REM Set the service name set SERVICE_NAME=WelsonJS.Service -REM Get the current directory -set CURRENT_DIR=%~dp0 -set CURRENT_DIR=%CURRENT_DIR:~0,-1% - REM Set the paths -set EXE_PATH=%CURRENT_DIR%\bin\x86\WelsonJS.Service.exe +set EXE_PATH=%APPDATA%\WelsonJS\bin\WelsonJS.Service.exe set INSTALL_UTIL_PATH=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe REM Uninstall the service From 15e6596285c4d160859790de89b3342b995e0833 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Fri, 21 Nov 2025 11:01:10 +0900 Subject: [PATCH 2/4] Fix EXE_PATH case in service scripts Updated the EXE_PATH variable in both installService.bat and uninstallService.bat to use 'welsonjs' instead of 'WelsonJS' for consistency and to avoid potential path issues. --- installService.bat | 2 +- uninstallService.bat | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/installService.bat b/installService.bat index c491708..0ac8efc 100644 --- a/installService.bat +++ b/installService.bat @@ -7,7 +7,7 @@ REM Set the service name set SERVICE_NAME=WelsonJS.Service REM Set the paths -set EXE_PATH=%APPDATA%\WelsonJS\bin\WelsonJS.Service.exe +set EXE_PATH=%APPDATA%\welsonjs\bin\WelsonJS.Service.exe set INSTALL_UTIL_PATH=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe REM Uninstall the service diff --git a/uninstallService.bat b/uninstallService.bat index 9b36ae1..bb35442 100644 --- a/uninstallService.bat +++ b/uninstallService.bat @@ -7,7 +7,7 @@ REM Set the service name set SERVICE_NAME=WelsonJS.Service REM Set the paths -set EXE_PATH=%APPDATA%\WelsonJS\bin\WelsonJS.Service.exe +set EXE_PATH=%APPDATA%\welsonjs\bin\WelsonJS.Service.exe set INSTALL_UTIL_PATH=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe REM Uninstall the service From c75859b350882dea679aa3d1f455e5b900703a46 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Fri, 21 Nov 2025 11:31:00 +0900 Subject: [PATCH 3/4] Enable registry section in setup script Uncommented the [Registry] section in setup.iss to allow registry entries to be created during installation. This change is necessary for proper file association and protocol handling. --- setup.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.iss b/setup.iss index 7faadea..1a36683 100644 --- a/setup.iss +++ b/setup.iss @@ -27,7 +27,7 @@ DisableProgramGroupPage=yes LicenseFile=SECURITY.MD ChangesAssociations=yes -; [Registry] +[Registry] ; Root: HKCR; Subkey: "welsonjs"; ValueType: "string"; ValueData: "URL:{cm:AppName}"; Flags: uninsdeletekey ; Root: HKCR; Subkey: "welsonjs"; ValueType: "string"; ValueName: "URL Protocol"; ValueData: "" ; Root: HKCR; Subkey: "welsonjs\DefaultIcon"; ValueType: "string"; ValueData: "{app}\app\favicon.ico,0" From cc862674717d5c045a8979943730e995259f5e4b Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Fri, 21 Nov 2025 11:53:25 +0900 Subject: [PATCH 4/4] Update launcher path in registry and shortcut Changed the registry command and Start Menu shortcut to reference WelsonJS.Launcher.exe in the user app data directory, ensuring correct file location and execution. --- setup.iss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.iss b/setup.iss index 1a36683..cf3165c 100644 --- a/setup.iss +++ b/setup.iss @@ -36,7 +36,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"; Flags: uninsdeletevalue Root: HKCR; Subkey: "{cm:AppName}.Script\shell\open"; ValueType: string; ValueData: "Run with {cm:AppName}"; Flags: uninsdeletevalue -Root: HKCR; Subkey: "{cm:AppName}.Script\shell\open\command"; ValueType: string; ValueData: """{app}\bin\x86\WelsonJS.Launcher.exe"" --file ""%1"""; Flags: uninsdeletevalue +Root: HKCR; Subkey: "{cm:AppName}.Script\shell\open\command"; ValueType: string; ValueData: """{userappdata}\{cm:AppName}\WelsonJS.Launcher.exe"" --file ""%1"""; Flags: uninsdeletevalue Root: HKCR; Subkey: ".js"; ValueType: string; ValueData: "{cm:AppName}.Script"; Flags: uninsdeletevalue Root: HKCR; Subkey: ".ts"; ValueType: string; ValueData: "{cm:AppName}.Script"; Flags: uninsdeletevalue Root: HKCR; Subkey: ".re"; ValueType: string; ValueData: "{cm:AppName}.Script"; Flags: uninsdeletevalue @@ -77,7 +77,7 @@ Type: files; Name: "{app}\settings.ini" Type: files; Name: "{app}\defaultService.js" [Icons] -Name: "{group}\Start {cm:AppName} Launcher"; Filename: "{userappdata}\{cm:AppName}\WelsonJS.Launcher.exe"; AfterInstall: SetElevationBit('{group}\Start {cm:AppName} Launcher.lnk'); +Name: "{group}\Start {cm:AppName} Launcher"; Filename: "{userappdata}\{cm:AppName}\bin\WelsonJS.Launcher.exe"; 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');