Start the Windows bundle when the network is disconnected
The launcher asked /api/health through Invoke-WebRequest, which resolves the system proxy or PAC script before it looks at the URL; with no network every probe timed out and the launcher killed a healthy local process after two minutes and reported that Luminary had not started. Both launchers now probe 127.0.0.1 over a raw TCP socket, which uses no proxy, DNS or certificate store, and the app window is started with --no-proxy-server.
This commit is contained in:
+6
-1
@@ -343,6 +343,11 @@ then replaces `node.exe`. It refuses while Luminary is running. Set
|
|||||||
- No tray icon and no auto-update in this version (both are launcher features,
|
- No tray icon and no auto-update in this version (both are launcher features,
|
||||||
not app changes).
|
not app changes).
|
||||||
- Loopback only by default; set `HOST=0.0.0.0` for LAN proofing galleries.
|
- Loopback only by default; set `HOST=0.0.0.0` for LAN proofing galleries.
|
||||||
|
- Fully offline: the app, the catalog and the start-up wait are local. The
|
||||||
|
launcher probes `127.0.0.1` over plain TCP, which never consults the system
|
||||||
|
proxy or DNS, so a disconnected network, VPN or proxy setting cannot stop it
|
||||||
|
from starting. Only `-Repair` (downloading `node.exe`) and the optional Immich
|
||||||
|
sync use the network.
|
||||||
- The PowerShell launcher cannot clean up after a server crash; a stale
|
- The PowerShell launcher cannot clean up after a server crash; a stale
|
||||||
`runtime.json` is simply ignored on the next start.
|
`runtime.json` is simply ignored on the next start.
|
||||||
- The setup exe cannot be executed on the Linux build host. It is verified by
|
- The setup exe cannot be executed on the Linux build host. It is verified by
|
||||||
@@ -360,7 +365,7 @@ then replaces `node.exe`. It refuses while Luminary is running. Set
|
|||||||
| "Luminary needs Windows 10 or 11" (exit 4) | the launcher read `CurrentBuild` below 10240. The app targets Windows 10/11; there is no Windows 7/8 build |
|
| "Luminary needs Windows 10 or 11" (exit 4) | the launcher read `CurrentBuild` below 10240. The app targets Windows 10/11; there is no Windows 7/8 build |
|
||||||
| "The Universal C Runtime is missing" | Windows 8.1 without KB2999226 — install <https://support.microsoft.com/help/2999226> or use Windows 10/11 |
|
| "The Universal C Runtime is missing" | Windows 8.1 without KB2999226 — install <https://support.microsoft.com/help/2999226> or use Windows 10/11 |
|
||||||
| "The data drive has only … GB free" | free space before starting; catalogs and previews grow in `%LOCALAPPDATA%` |
|
| "The data drive has only … GB free" | free space before starting; catalogs and previews grow in `%LOCALAPPDATA%` |
|
||||||
| "did not answer on /api/health" | `logs\server.err.log`; run `node app\server\index.mjs` from `app\` to see the failure |
|
| "did not answer on /api/health" | `logs\server.err.log`; run `node app\server\index.mjs` from `app\` to see the failure. This is not a network error: start-up only talks to `127.0.0.1`, so a disconnected machine starts the same way |
|
||||||
| Browser opens an error page | the port was taken between the check and the spawn; start again |
|
| Browser opens an error page | the port was taken between the check and the spawn; start again |
|
||||||
| RAW import fails | `app\node_modules\@img\sharp-win32-x64` must contain a `.node` binary; RAW decode itself is wasm |
|
| RAW import fails | `app\node_modules\@img\sharp-win32-x64` must contain a `.node` binary; RAW decode itself is wasm |
|
||||||
| `node.exe failed its SHA-256 check` | delete `<out>/cache` and rebuild (the download was truncated) |
|
| `node.exe failed its SHA-256 check` | delete `<out>/cache` and rebuild (the download was truncated) |
|
||||||
|
|||||||
@@ -142,8 +142,13 @@ create data dir → create log dir → pick port → spawn node.exe (hidden)
|
|||||||
second or third attempt).
|
second or third attempt).
|
||||||
- The PowerShell launcher checks `$process.HasExited` first, so a crash reports
|
- The PowerShell launcher checks `$process.HasExited` first, so a crash reports
|
||||||
the log instead of waiting the full timeout.
|
the log instead of waiting the full timeout.
|
||||||
- The browser is opened only after health succeeds; opening earlier shows a
|
- The probe is a raw HTTP request over TCP to `127.0.0.1`, in both launchers,
|
||||||
connection error on slow machines.
|
and never `Invoke-WebRequest` or a proxy-aware HTTP client. WinINET resolves
|
||||||
|
the system proxy (a PAC script or WPAD) before it looks at the URL, which can
|
||||||
|
block for far longer than the request timeout on a machine with no network;
|
||||||
|
the server was healthy the whole time, but every probe timed out and the
|
||||||
|
launcher reported that Luminary had not started. Start-up must never depend on
|
||||||
|
a connection, a proxy setting or DNS.
|
||||||
|
|
||||||
Logs are append-only: `logs\server.out.log` and `logs\server.err.log` from the
|
Logs are append-only: `logs\server.out.log` and `logs\server.err.log` from the
|
||||||
child, `logs\launcher.log` from the Go launcher. They fall back to
|
child, `logs\launcher.log` from the Go launcher. They fall back to
|
||||||
|
|||||||
@@ -96,11 +96,34 @@ function Read-Runtime {
|
|||||||
try { return Get-Content -Raw -LiteralPath $runtimeFile | ConvertFrom-Json } catch { return $null }
|
try { return Get-Content -Raw -LiteralPath $runtimeFile | ConvertFrom-Json } catch { return $null }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Loopback liveness probe.
|
||||||
|
#
|
||||||
|
# Invoke-WebRequest goes through WinINET, which resolves the system proxy (a PAC
|
||||||
|
# script or WPAD) before it looks at the URL. On a machine with no network that
|
||||||
|
# lookup can block for far longer than -TimeoutSec, so every probe timed out and
|
||||||
|
# the launcher killed a healthy local server: the app "would not start" offline.
|
||||||
|
# A raw request over TCP to 127.0.0.1 uses no proxy, DNS or certificate store, so
|
||||||
|
# start-up behaves the same with or without a connection.
|
||||||
function Test-Health([int]$port) {
|
function Test-Health([int]$port) {
|
||||||
|
$client = $null
|
||||||
try {
|
try {
|
||||||
$response = Invoke-WebRequest -UseBasicParsing -TimeoutSec 2 -Uri ("http://127.0.0.1:{0}/api/health" -f $port)
|
$client = New-Object System.Net.Sockets.TcpClient
|
||||||
return ($response.StatusCode -eq 200)
|
$connect = $client.ConnectAsync([System.Net.IPAddress]::Loopback, $port)
|
||||||
} catch { return $false }
|
if (-not $connect.Wait(2000)) { return $false }
|
||||||
|
$client.ReceiveTimeout = 3000
|
||||||
|
$stream = $client.GetStream()
|
||||||
|
$request = [System.Text.Encoding]::ASCII.GetBytes((
|
||||||
|
"GET /api/health HTTP/1.0`r`nHost: 127.0.0.1:{0}`r`nConnection: close`r`n`r`n" -f $port))
|
||||||
|
$stream.Write($request, 0, $request.Length)
|
||||||
|
$stream.Flush()
|
||||||
|
$reader = New-Object System.IO.StreamReader($stream, [System.Text.Encoding]::ASCII)
|
||||||
|
$status = $reader.ReadLine()
|
||||||
|
return ($status -match '^HTTP/1\.[01] 200\b')
|
||||||
|
} catch {
|
||||||
|
return $false
|
||||||
|
} finally {
|
||||||
|
if ($client) { $client.Close() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Test-Process([int]$processId) {
|
function Test-Process([int]$processId) {
|
||||||
@@ -183,12 +206,16 @@ function Open-App([string]$url) {
|
|||||||
$profile = Join-Path (Get-DataDir) 'window-profile'
|
$profile = Join-Path (Get-DataDir) 'window-profile'
|
||||||
try {
|
try {
|
||||||
New-Item -ItemType Directory -Force -Path $profile | Out-Null
|
New-Item -ItemType Directory -Force -Path $profile | Out-Null
|
||||||
|
# --no-proxy-server: the window only ever loads 127.0.0.1. A proxy or PAC
|
||||||
|
# script set on the machine must not be able to intercept (or stall) it
|
||||||
|
# when the network is down.
|
||||||
Start-Process -FilePath $exe -ArgumentList @(
|
Start-Process -FilePath $exe -ArgumentList @(
|
||||||
"--app=$url",
|
"--app=$url",
|
||||||
"--user-data-dir=$profile",
|
"--user-data-dir=$profile",
|
||||||
'--window-size=1500,950',
|
'--window-size=1500,950',
|
||||||
'--no-first-run',
|
'--no-first-run',
|
||||||
'--no-default-browser-check',
|
'--no-default-browser-check',
|
||||||
|
'--no-proxy-server',
|
||||||
'--disable-features=Translate'
|
'--disable-features=Translate'
|
||||||
) | Out-Null
|
) | Out-Null
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
@@ -58,7 +58,17 @@ var (
|
|||||||
user32 = syscall.NewLazyDLL("user32.dll")
|
user32 = syscall.NewLazyDLL("user32.dll")
|
||||||
messageBoxW = user32.NewProc("MessageBoxW")
|
messageBoxW = user32.NewProc("MessageBoxW")
|
||||||
|
|
||||||
client = &http.Client{Timeout: 2 * time.Second}
|
// Health is a loopback call: no proxy, no DNS, no internet. The default
|
||||||
|
// transport honours HTTP_PROXY, so a stale corporate proxy or PAC script
|
||||||
|
// would make every probe fail and the launcher would kill a server that was
|
||||||
|
// already answering.
|
||||||
|
client = &http.Client{
|
||||||
|
Timeout: 2 * time.Second,
|
||||||
|
Transport: &http.Transport{
|
||||||
|
Proxy: nil,
|
||||||
|
DialContext: (&net.Dialer{Timeout: 2 * time.Second}).DialContext,
|
||||||
|
},
|
||||||
|
}
|
||||||
downloadClient = &http.Client{Timeout: 10 * time.Minute}
|
downloadClient = &http.Client{Timeout: 10 * time.Minute}
|
||||||
nodePinRE = regexp.MustCompile(`^node\s+v?(\d+\.\d+\.\d+)\s+win-x64(?:\s+sha256\s+([0-9a-f]{64}))?(?:\s+size\s+(\d+))?`)
|
nodePinRE = regexp.MustCompile(`^node\s+v?(\d+\.\d+\.\d+)\s+win-x64(?:\s+sha256\s+([0-9a-f]{64}))?(?:\s+size\s+(\d+))?`)
|
||||||
)
|
)
|
||||||
@@ -621,12 +631,16 @@ func openApp(url string) {
|
|||||||
openBrowser(url)
|
openBrowser(url)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// --no-proxy-server: the window only ever loads 127.0.0.1, so a proxy or
|
||||||
|
// PAC script on the machine must not intercept or stall it when the
|
||||||
|
// network is down.
|
||||||
cmd := exec.Command(exe,
|
cmd := exec.Command(exe,
|
||||||
"--app="+url,
|
"--app="+url,
|
||||||
"--user-data-dir="+profile,
|
"--user-data-dir="+profile,
|
||||||
"--window-size=1500,950",
|
"--window-size=1500,950",
|
||||||
"--no-first-run",
|
"--no-first-run",
|
||||||
"--no-default-browser-check",
|
"--no-default-browser-check",
|
||||||
|
"--no-proxy-server",
|
||||||
"--disable-features=Translate",
|
"--disable-features=Translate",
|
||||||
)
|
)
|
||||||
if err := cmd.Start(); err != nil {
|
if err := cmd.Start(); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user