18978: Disable webshell idle timeout when 0.
[arvados-workbench2.git] / public / webshell / index.html
index 42ef9a44e7b59d6d02d20a7a38fb9207bfcacbc3..aae70a97afab13a30a553eb2a6196d2a074f9484 100644 (file)
@@ -59,8 +59,8 @@
         var lastTime = localStorage.getItem('lastActiveTimestamp');
         if (currentTime - lastTime > idleTimeoutMs) {
           //logout
-          sh.sendKeys('03'); // Ctrl + c
-          sh.sendKeys('04'); // Ctrl + d
+          sh.reset();
+          sh.sessionClosed("Session timed out after " + timeout + " seconds.");
           document.body.onmousemove = undefined;
           document.body.onkeydown = undefined;
         } else {
              sh.keysPressed(token + "\n");
              sh.vt100('(sent authentication token)\n');
              token = null;
-             updateIdleTimer();
-             document.body.onmousemove = updateIdleTimer;
-             document.body.onkeydown = updateIdleTimer;
-             setTimeout(checkIdleTimer, 1000);
+             if (timeout > 0) {
+               updateIdleTimer();
+               document.body.onmousemove = updateIdleTimer;
+               document.body.onkeydown = updateIdleTimer;
+               setTimeout(checkIdleTimer, 1000);
+             }
           } else {
             setTimeout(trySendToken, 200);
           }