Files
DorkNet/installer/build-installer.ps1
Alexa f5ad4b59ef Localtunnel hosting + admin panel + AppData db
- Default hosting mode is now Localtunnel — public *.loca.lt URL,
  no account, auto-fetched on first run. Replaces the prototyped
  Tailscale mode.
- Tailscale code purged from launcher + CLI; docs swapped to
  Localtunnel throughout (easy-setup, joining-a-server, server-cli,
  troubleshooting, faq, READMEs).
- Launcher sidebar gains an Open admin panel button — opens
  https://admin.<apex> in the browser once the server is live.
- SQLite db moves to %APPDATA%\DorkNet\dorknet.db (server reads
  Database__SqlitePath env var, launcher passes it). Existing dbs
  under <serverDir>\data\ are migrated on first run.
- CLI Program.cs: --mode default flips from tailscale to localtunnel;
  csproj links in LocaltunnelTunnel + LocaltunnelInstaller.
- New Backend files: LauncherNameServer, LocaltunnelInstaller,
  LocaltunnelTunnel, SingleOriginServiceMap.
- .gitignore: exclude installer/out/.
2026-05-28 01:39:38 +03:00

70 lines
2.5 KiB
PowerShell

# Build the DorkNet Windows installer.
#
# Usage:
# pwsh -File installer\build-installer.ps1 # uses default 0.1.0
# pwsh -File installer\build-installer.ps1 -Version 0.2.0
#
# Output:
# installer\out\dorknet-setup-<version>.exe
#
# Requirements:
# - .NET 9 SDK (for `dotnet publish`)
# - Inno Setup 6 installed; ISCC must be on PATH or at the default
# install location (C:\Program Files (x86)\Inno Setup 6\ISCC.exe).
# Grab it free from https://jrsoftware.org/isinfo.php
[CmdletBinding()]
param(
[string]$Version = "0.1.0",
[string]$Configuration = "Release"
)
$ErrorActionPreference = "Stop"
$repo = Split-Path -Parent $PSScriptRoot
$launcher = Join-Path $repo "launcher"
$installer = $PSScriptRoot
Write-Host "==> Publishing launcher (self-contained, single file)..." -ForegroundColor Cyan
& dotnet publish $launcher `
-c $Configuration `
-r win-x64 `
--self-contained true `
/p:PublishSingleFile=true `
/p:Version=$Version `
/p:AssemblyVersion="$Version.0" `
/p:FileVersion="$Version.0" `
/p:InformationalVersion=$Version
if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed" }
$publishDir = Join-Path $launcher "bin\$Configuration\net9.0-windows\win-x64\publish"
$exe = Join-Path $publishDir "dorknet.exe"
if (-not (Test-Path $exe)) { throw "Expected $exe not found after publish" }
$exeSize = "{0:N1} MB" -f ((Get-Item $exe).Length / 1MB)
Write-Host "==> Published: $exe ($exeSize)" -ForegroundColor Green
# Resolve ISCC.exe — try PATH first, then common machine/user install dirs.
$iscc = (Get-Command "ISCC.exe" -ErrorAction SilentlyContinue).Source
if (-not $iscc) { $iscc = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" }
if (-not (Test-Path $iscc)) {
$iscc = Join-Path $env:LOCALAPPDATA "Programs\Inno Setup 6\ISCC.exe"
}
if (-not (Test-Path $iscc)) { $iscc = "C:\Program Files\Inno Setup 6\ISCC.exe" }
if (-not (Test-Path $iscc)) {
throw "ISCC.exe not found. Install Inno Setup 6 from https://jrsoftware.org/isinfo.php"
}
Write-Host "==> Compiling installer..." -ForegroundColor Cyan
$iss = Join-Path $installer "dorknet.iss"
$outDir = Join-Path $installer "out"
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
& $iscc "/DAppVersion=$Version" $iss
if ($LASTEXITCODE -ne 0) { throw "ISCC failed" }
$installerExe = Join-Path $outDir "dorknet-setup-$Version.exe"
if (-not (Test-Path $installerExe)) { throw "Installer not produced at $installerExe" }
$instSize = "{0:N1} MB" -f ((Get-Item $installerExe).Length / 1MB)
Write-Host "==> Built: $installerExe ($instSize)" -ForegroundColor Green