# SPipe intranet server # powershell -ExecutionPolicy Bypass -File .\start-lan.ps1 (build if needed, then serve) # powershell -ExecutionPolicy Bypass -File .\start-lan.ps1 -Rebuild (force a fresh build) # # Web app: http://:8080 (all interfaces) # API: 127.0.0.1:8000 only -- reached through the web server's /api proxy. param([switch]$Rebuild) $ErrorActionPreference = 'Stop' Set-Location $PSScriptRoot if ($Rebuild -or -not (Test-Path 'dist\index.html')) { Write-Host '[1/3] Building web app...' npm run build if ($LASTEXITCODE -ne 0) { throw 'Build failed.' } } else { Write-Host '[1/3] Using existing build (dist). Pass -Rebuild after code changes.' } Write-Host '[2/3] Starting analysis API on 127.0.0.1:8000...' $api = Start-Process -FilePath '.venv\Scripts\python.exe' ` -ArgumentList '-m', 'uvicorn', 'backend.main:app', '--host', '127.0.0.1', '--port', '8000' ` -WindowStyle Minimized -PassThru $ips = Get-NetIPAddress -AddressFamily IPv4 -PrefixOrigin Dhcp, Manual -ErrorAction SilentlyContinue | Where-Object { $_.IPAddress -notlike '127.*' -and $_.IPAddress -notlike '169.254.*' -and $_.InterfaceAlias -notlike 'vEthernet*' } | Select-Object -ExpandProperty IPAddress Write-Host '' Write-Host '[3/3] Web app is available at:' foreach ($ip in $ips) { Write-Host " http://${ip}:8080" -ForegroundColor Green } Write-Host ' (Ctrl+C to stop both servers)' Write-Host '' try { npm run serve:lan } finally { if ($api -and -not $api.HasExited) { Stop-Process -Id $api.Id -Force } }