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