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:
@@ -58,7 +58,17 @@ var (
|
||||
user32 = syscall.NewLazyDLL("user32.dll")
|
||||
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}
|
||||
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)
|
||||
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,
|
||||
"--app="+url,
|
||||
"--user-data-dir="+profile,
|
||||
"--window-size=1500,950",
|
||||
"--no-first-run",
|
||||
"--no-default-browser-check",
|
||||
"--no-proxy-server",
|
||||
"--disable-features=Translate",
|
||||
)
|
||||
if err := cmd.Start(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user