18978: Disable webshell idle timeout when 0.
[arvados-workbench2.git] / public / webshell / index.html
index 126962b6a764c6d49082a1a41d50a2eb9e4d8a17..aae70a97afab13a30a553eb2a6196d2a074f9484 100644 (file)
         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 {
           setTimeout(checkIdleTimer, 1000);
         }
              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);
           }