]> www.vanbest.org Git - motioneye-debian/commitdiff
added an ajax timeout for reboot & poweroff commands
authorCalin Crisan <ccrisan@gmail.com>
Sun, 19 Jul 2015 12:39:22 +0000 (15:39 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Sun, 19 Jul 2015 12:39:22 +0000 (15:39 +0300)
static/js/main.js

index 2aab33f3d09e2b216d6b28896cda3da81af6ebec..656951f2621a36b9d3b1529512d88e1860fe48e7 100644 (file)
@@ -186,7 +186,7 @@ function isAdmin() {
     return username === adminUsername;
 }
 
-function ajax(method, url, data, callback, error) {
+function ajax(method, url, data, callback, error, timeout) {
     var origUrl = url;
     var origData = data;
     
@@ -224,6 +224,7 @@ function ajax(method, url, data, callback, error) {
         type: method,
         url: url,
         data: data,
+        timeout: timeout || 300 * 1000,
         success: function (data) {
             if (data && data.error == 'unauthorized') {
                 if (data.prompt) {
@@ -1950,7 +1951,8 @@ function doShutDown() {
                         setTimeout(function () {
                             $('div.modal-glass').animate({'opacity': '1', 'background-color': '#212121'}, 200);
                         },100);
-                    }
+                    },
+                    10000 /* timeout = 10s */
                 );
             }
             
@@ -1982,7 +1984,8 @@ function doReboot() {
                     function () {
                         shutDown = true; /* the first error indicates the system was shut down */
                         setTimeout(checkServer, 1000);
-                    }
+                    },
+                    5 * 1000 /* timeout = 5s */
                 );
             }