|
|
@@ -1,6 +1,7 @@
|
|
|
import { randomUUID } from "node:crypto"
|
|
|
import { EventEmitter } from "node:events"
|
|
|
import { existsSync } from "node:fs"
|
|
|
+import * as http from "node:http"
|
|
|
import { createServer } from "node:net"
|
|
|
import { homedir } from "node:os"
|
|
|
import { join } from "node:path"
|
|
|
@@ -77,6 +78,7 @@ setupApp()
|
|
|
|
|
|
function setupApp() {
|
|
|
ensureLoopbackNoProxy()
|
|
|
+ useEnvProxy()
|
|
|
app.commandLine.appendSwitch("proxy-bypass-list", "<-loopback>")
|
|
|
if (!app.isPackaged) app.commandLine.appendSwitch("remote-debugging-port", "9222")
|
|
|
|
|
|
@@ -133,6 +135,15 @@ function useSystemCertificates() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+function useEnvProxy() {
|
|
|
+ try {
|
|
|
+ // Electron 41.2 runs Node 24.14.1; latest @types/node@24 is 24.12.2.
|
|
|
+ ;(http as any).setGlobalProxyFromEnv()
|
|
|
+ } catch (error) {
|
|
|
+ logger.warn("failed to load proxy environment", error)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
function emitDeepLinks(urls: string[]) {
|
|
|
if (urls.length === 0) return
|
|
|
pendingDeepLinks.push(...urls)
|
|
|
@@ -189,7 +200,10 @@ async function initialize() {
|
|
|
}
|
|
|
|
|
|
logger.log("spawning sidecar", { url })
|
|
|
- const { listener, health } = await spawnLocalServer(hostname, port, password)
|
|
|
+ const { listener, health } = await spawnLocalServer(hostname, port, password, () => {
|
|
|
+ ensureLoopbackNoProxy()
|
|
|
+ useEnvProxy()
|
|
|
+ })
|
|
|
server = listener
|
|
|
serverReady.resolve({
|
|
|
url,
|