fix(ops): allow local Admin LAN access (#304)

This commit is contained in:
QiuSW
2026-09-17 17:02:35 +08:00
parent c2426e2671
commit 9194fd664f
3 changed files with 28 additions and 7 deletions
+7 -3
View File
@@ -168,18 +168,22 @@ try {
}
}
$env:VUE_APP_BASE_API = "http://127.0.0.1:$($ports.Server)"
Write-Host "Starting GoAuto web UI at http://127.0.0.1:$($ports.Web)" -ForegroundColor Green
# Keep browser requests same-origin. Vite proxies API/static requests to the
# local backend, so a LAN client never tries to call its own 127.0.0.1.
$env:VUE_APP_BASE_API = ""
$env:VITE_DEV_PROXY_TARGET = "http://127.0.0.1:$($ports.Server)"
Write-Host "Starting GoAuto web UI at http://0.0.0.0:$($ports.Web)" -ForegroundColor Green
$viteCli = Join-Path $webDirectory "node_modules\vite\bin\vite.js"
if (-not (Test-Path -LiteralPath $viteCli -PathType Leaf)) {
throw "Vite was not found after dependency installation: $viteCli"
}
& $nodePath $viteCli --host 127.0.0.1 --port $ports.Web --strictPort
& $nodePath $viteCli --host 0.0.0.0 --port $ports.Web --strictPort
if ($LASTEXITCODE -ne 0) {
throw "Frontend exited with code $LASTEXITCODE."
}
}
finally {
Remove-Item Env:VUE_APP_BASE_API -ErrorAction SilentlyContinue
Remove-Item Env:VITE_DEV_PROXY_TARGET -ErrorAction SilentlyContinue
Pop-Location
}