()
| 375 | }; |
| 376 | |
| 377 | const armSupervisedMonitor = () => { |
| 378 | stopSupervisedMonitor(); |
| 379 | supervisedMonitorTimer = setInterval(() => { |
| 380 | void (async () => { |
| 381 | const live = await attachToSupervisedDaemon(); |
| 382 | const window = liveMainWindow(); |
| 383 | if (!live) { |
| 384 | supervisedMonitorMisses += 1; |
| 385 | if (supervisedMonitorMisses < SUPERVISED_MONITOR_MISSES_BEFORE_DOWN) return; |
| 386 | if (!supervisedDaemonDown && window) { |
| 387 | supervisedDaemonDown = true; |
| 388 | showCrashScreen(window); |
| 389 | } |
| 390 | return; |
| 391 | } |
| 392 | supervisedMonitorMisses = 0; |
| 393 | if (supervisedDaemonDown) { |
| 394 | supervisedDaemonDown = false; |
| 395 | connection = live; |
| 396 | installBearerAuthHeader(live.baseUrl, live.authToken); |
| 397 | if (window) void loadWindowUrl(window, webUrlForConnection(live)); |
| 398 | } |
| 399 | })(); |
| 400 | }, 10_000); |
| 401 | }; |
| 402 | |
| 403 | const installBearerAuthHeader = (origin: string, token: string | null) => { |
| 404 | authHeaderUnsubscribe?.(); |
no test coverage detected