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