da03 commited on
Commit
9a27d48
·
1 Parent(s): 6e88d5e
Files changed (1) hide show
  1. static/index.html +24 -6
static/index.html CHANGED
@@ -550,7 +550,28 @@
550
  }
551
  }
552
 
553
- // Find the timeout that will expire first
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
554
  let newEarliestTimeout = null;
555
  let newEarliestTime = Infinity;
556
 
@@ -561,12 +582,9 @@
561
  }
562
  }
563
 
564
- if (!newEarliestTimeout || newEarliestTimeout.remaining <= 0) {
565
- stopAutoInput();
566
  stopTimeoutCountdown();
567
- console.log("Connection timeout countdown finished - refreshing page");
568
- // Refresh the page to reconnect
569
- window.location.reload();
570
  return;
571
  }
572
 
 
550
  }
551
  }
552
 
553
+ // Check if ANY timeout has reached 0 (expired)
554
+ let expiredTimeout = null;
555
+ for (const [type, timeout] of Object.entries(currentTimeouts)) {
556
+ if (timeout && timeout.remaining <= 0) {
557
+ expiredTimeout = { type, ...timeout };
558
+ break;
559
+ }
560
+ }
561
+
562
+ // If any timeout expired, trigger the appropriate action
563
+ if (expiredTimeout) {
564
+ console.log(`${expiredTimeout.type} timeout expired - refreshing page`);
565
+ // Remove the expired timeout from tracking
566
+ currentTimeouts[expiredTimeout.type] = null;
567
+ stopAutoInput();
568
+ stopTimeoutCountdown();
569
+ // All timeout types result in page refresh for now
570
+ window.location.reload();
571
+ return;
572
+ }
573
+
574
+ // Find the timeout that will expire first among remaining timeouts
575
  let newEarliestTimeout = null;
576
  let newEarliestTime = Infinity;
577
 
 
582
  }
583
  }
584
 
585
+ // If no active timeouts remain, hide the warning
586
+ if (!newEarliestTimeout) {
587
  stopTimeoutCountdown();
 
 
 
588
  return;
589
  }
590