Refactor installer scripts and update components

Renamed afterInstall.ps1 to postInstall.ps1 and added telemetry support for PostHog. Updated Python embeddable package URLs to version 3.14.0. Revised setup.iss to improve component granularity, update author info, and integrate the new post-install script and telemetry parameters.
This commit is contained in:
Namhyeon Go 2025-12-01 12:29:46 +09:00
parent 6bbfa23946
commit 505801664a
2 changed files with 104 additions and 14 deletions

View File

@ -1,3 +1,76 @@
# WelsonJS post-install script
# Namhyeon Go <gnh1201@catswords.re.kr>, and Catswords OSS contributors.
# https://github.com/gnh1201/welsonjs
# ================================
# PARAMETERS
# ================================
param(
[string]$TelemetryProvider = "",
[string]$TelemetryApiKey = "",
[string]$Version = "",
[string]$DistinctId = "",
[string]$Components = ""
)
# ================================
# TELEMETRY
# ================================
if ($TelemetryProvider -and $TelemetryProvider.ToLower() -eq "posthog") {
# Skip telemetry if API key is missing
if (-not $TelemetryApiKey -or $TelemetryApiKey.Trim() -eq "") {
# No-op: continue script
}
else {
# Resolve distinct ID (fallback to machine name)
$finalDistinctId = if ($DistinctId -and $DistinctId.Trim() -ne "") {
$DistinctId
} else {
$env:COMPUTERNAME
}
# Skip if distinct_id is empty (PostHog will ignore anyway)
if ($finalDistinctId -and $finalDistinctId.Trim() -ne "") {
# Parse Components into array
$componentsList = @()
if ($Components -and $Components.Trim() -ne "") {
$componentsList = $Components.Split(",") | ForEach-Object { $_.Trim() }
}
# Build single event payload for PostHog /i/v0/e endpoint
# Anonymous event is default: $process_person_profile = false
$body = @{
api_key = $TelemetryApiKey
event = "app_installed"
distinct_id = $finalDistinctId
properties = @{
"$process_person_profile" = $false # Anonymous event (no person profile)
version = $Version
os = "windows"
source = "post-install.ps1"
components = $componentsList
}
timestamp = (Get-Date).ToString("o") # ISO 8601 format
} | ConvertTo-Json -Depth 5
try {
Invoke-RestMethod `
-Uri "https://us.i.posthog.com/i/v0/e/" `
-Method Post `
-ContentType "application/json" `
-Body $body | Out-Null
}
catch {
# Ignore telemetry failure (installer must not break)
}
}
}
}
# ================================
# CONFIGURATION
# ================================
@ -201,7 +274,7 @@ $ArtifactsUrl = $null
switch ($arch) {
"x64" {
# Python embeddable (x64)
$PythonUrl = "https://www.python.org/ftp/python/3.13.9/python-3.13.9-embeddable-amd64.zip"
$PythonUrl = "https://www.python.org/ftp/python/3.14.0/python-3.14.0-embed-amd64.zip"
# curl (x64, mingw)
$CurlUrl = "https://curl.se/windows/latest.cgi?p=win64-mingw.zip"
@ -221,7 +294,7 @@ switch ($arch) {
"arm64" {
# Python embeddable (ARM64)
$PythonUrl = "https://www.python.org/ftp/python/3.13.9/python-3.13.9-embeddable-arm64.zip"
$PythonUrl = "https://www.python.org/ftp/python/3.14.0/python-3.14.0-embed-win32.zip"
# curl (ARM64)
$CurlUrl = "https://curl.se/windows/latest.cgi?p=win64a-mingw.zip"

View File

@ -1,6 +1,6 @@
; @created_on 2020-06-26
; @updated_on 2025-11-23
; @author Namhyeon Go <gnh1201@catswords.re.kr>
; @updated_on 2025-12-01
; @author Namhyeon Go <gnh1201@catswords.re.kr> and Catswords OSS contributors.
[Setup]
AppName=WelsonJS
@ -9,7 +9,6 @@ WizardStyle=modern
; DefaultDirName={pf}\{cm:AppName}
DefaultDirName={commonpf32}\{cm:AppName}
DefaultGroupName={cm:AppName}
; UninstallDisplayIcon={app}\UnInst.exe
UninstallDisplayIcon={app}\unins000.exe
Compression=lzma2
SolidCompression=yes
@ -30,13 +29,23 @@ ChangesAssociations=yes
[Components]
; Add an optional component for the user to select during installation
Name: "fileassoc"; Description: "Associate .js files to run with WelsonJS"; Types: full compact custom;
Name: "addtools"; Description: "Additional tools and Windows service for WelsonJS"; Types: full;
Name: "artifacts": Description: "WelsonJS Launcher and Windows Service"; Types: full compact custom;
Name: "python"; Description: "Download Python Windows embeddable package"; Types: full;
Name: "curl"; Description: "Download cURL (Universal HTTP client)"; Types: full;
Name: "websocat"; Description: "Download websocat (Command-line WebSocket client)"; Types: full;
Name: "yara"; Description: "Download YARA (Binary pattern matching library)"; Types: custom;
Name: "wamr"; Description: "Download WebAssembly Micro Runtime (Add support *.wasm file)"; Types: custom;
Name: "tessdata"; Description: "Download Tesseract OCR pre-trained data"; Types: custom;
Name: "tessdata_best"; Description: "Download the pre-trained Tesseract OCR data (most accurate)"; Types: custom;
Name: "tessdata_fast"; Description: "Download the pre-trained Tesseract OCR data (faster)"; Types: custom;
Name: "gtk2runtime"; Description: "Download and install GTK2 runtime for Windows"; Types: custom;
Name: "nmap"; Description: "Download and Nmap and Npcap"; Types: custom;
[Registry]
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"; Components: addtools; Flags: uninsdeletevalue
Root: HKCR; Subkey: "{cm:AppName}.Script\shell\open"; ValueType: string; ValueData: "Run with {cm:AppName}"; Components: addtools; Flags: uninsdeletevalue
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: addtools; 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
@ -58,7 +67,7 @@ Source: "settings.example.ini"; DestDir: "{app}";
Source: "defaultService.example.js"; DestDir: "{app}";
Source: "installService.bat"; DestDir: "{app}";
Source: "uninstallService.bat"; DestDir: "{app}";
Source: "afterInstall.ps1"; DestDir: "{app}";
Source: "postInstall.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;
@ -75,7 +84,7 @@ 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: addtools; AfterInstall: SetElevationBit('{group}\Start {cm:AppName} Launcher.lnk');
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}\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');
@ -83,18 +92,26 @@ 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}"; Components: addtools; Flags: waituntilterminated
Filename: {app}\installService.bat; Components: addtools; Flags: nowait
Filename: "{userappdata}\{cm:AppName}\bin\WelsonJS.Launcher.exe"; Components: addtools; Flags: nowait
Filename: "powershell.exe"; \
Parameters: "-ExecutionPolicy Bypass -NoProfile -File ""{app}\postInstall.ps1"" " +
"-TelemetryProvider posthog " +
"-TelemetryApiKey ""{cm:PostHogApiKey}"" " +
"-Version ""{#AppVersion}"" " +
"-DistinctId ""{computername}"" " +
"-Components ""{code:GetSelectedComponents}""";
WorkingDir: "{app}"; Components: artifacts; Flags: waituntilterminated
Filename: {app}\installService.bat; Components: artifacts; Flags: nowait
Filename: "{userappdata}\{cm:AppName}\bin\WelsonJS.Launcher.exe"; Components: artifacts; Flags: nowait
[UninstallRun]
Filename: {app}\uninstallService.bat; Components: addtools; Flags: waituntilterminated
Filename: {app}\uninstallService.bat; Components: artifacts; Flags: waituntilterminated
; Filename: {code:GetProgramFiles}\GTK2-Runtime Win64\gtk2_runtime_uninst.exe;
; Filename: {code:GetProgramFiles}\Npcap\Uninstall.exe;
; Filename: {app}\bin\nmap-7.92\VC_redist.x86.exe;
[CustomMessages]
AppName=WelsonJS
PostHogApiKey=phc_pmRHJ0aVEhtULRT4ilexwCjYpGtE9VYRhlA05fwiYt8
[Code]
const