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