()
| 336 | }; |
| 337 | |
| 338 | const armSupervisedMonitor = () => { |
| 339 | stopSupervisedMonitor(); |
| 340 | supervisedMonitorTimer = setInterval(() => { |
| 341 | void (async () => { |
| 342 | const live = await attachToSupervisedDaemon(); |
| 343 | const window = liveMainWindow(); |
| 344 | if (!live) { |
| 345 | supervisedMonitorMisses += 1; |
| 346 | if (supervisedMonitorMisses < SUPERVISED_MONITOR_MISSES_BEFORE_DOWN) return; |
| 347 | if (!supervisedDaemonDown && window) { |
| 348 | supervisedDaemonDown = true; |
| 349 | showCrashScreen(window); |
| 350 | } |
| 351 | return; |
| 352 | } |
| 353 | supervisedMonitorMisses = 0; |
| 354 | if (supervisedDaemonDown) { |
| 355 | supervisedDaemonDown = false; |
| 356 | connection = live; |
| 357 | installBearerAuthHeader(live.baseUrl, live.authToken); |
| 358 | if (window) void window.loadURL(webUrlForConnection(live)); |
| 359 | } |
| 360 | })(); |
| 361 | }, 10_000); |
| 362 | }; |
| 363 | |
| 364 | const installBearerAuthHeader = (origin: string, token: string | null) => { |
| 365 | authHeaderUnsubscribe?.(); |
no test coverage detected