diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2018-04-08 06:40:08 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2018-04-08 06:40:08 -0400 |
| commit | 148c6fcb5b6b815d69e59c38e6f5e0edbc1294f4 (patch) | |
| tree | a5daf18b264aa5b1723a8e30cbe117380e45fbff /www/js/DataModel.js | |
| parent | 85b06277f844384f1dbd3da1534a01284a94cce1 (diff) | |
#606 intelligently switch between snapshot and streaming based on settings
Diffstat (limited to 'www/js/DataModel.js')
| -rwxr-xr-x | www/js/DataModel.js | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index 3b19b686..55485aba 100755 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -292,8 +292,18 @@ angular.module('zmApp.controllers') $http.get(myurl) .success(function (data) { configParams.ZM_MIN_STREAMING_PORT = data.config.Value; - setCurrentServerMultiPortSupported(true); + + if (!data.config.Value) { + setCurrentServerMultiPortSupported(false); + log ("ZM_MIN_STREAMING_PORT not configure, disabling"); + configParams.ZM_MIN_STREAMING_PORT = 0; + } + else { + setCurrentServerMultiPortSupported(true); log("Got min streaming port value of: " + configParams.ZM_MIN_STREAMING_PORT); + } + + d.resolve(configParams.ZM_MIN_STREAMING_PORT); return (d.promise); }) @@ -1517,6 +1527,58 @@ angular.module('zmApp.controllers') return monitors; }, + killStream: function (ck) { + debug ("Killing connKey: "+ck); + var myauthtoken = $rootScope.authSession.replace("&auth=", ""); + var req = $http( + { + method: 'POST', + /*timeout: 15000,*/ + url: loginData.url + '/index.php', + headers: + { + 'Content-Type': 'application/x-www-form-urlencoded', + //'Accept': '*/*', + }, + transformRequest: function(obj) + { + var str = []; + for (var p in obj) + str.push(encodeURIComponent(p) + "=" + + encodeURIComponent(obj[p])); + var foo = str.join("&"); + //console.log("****RETURNING " + foo); + return foo; + }, + + data: + { + view: "request", + request: "stream", + connkey: ck, + command: 17, + auth: myauthtoken, + + } + }) + .then (function (succ) { + console.log ("KILL OK WITH: " + JSON.stringify(succ)); + }, + function (err) { + console.log ("KILL ERROR WITH: " + JSON.stringify(err)); + }); + + + }, + + regenConnKeys: function () { + + ddebug ("Regenerating connkeys..."); + for (var i=0; i < monitors.length; i++){ + monitors[i].Monitor.connKey = (Math.floor((Math.random() * 999999) + 1)).toString(); + } + }, + getMonitors: function (forceReload) { //console.log("** Inside ZMData getMonitors with forceReload=" + forceReload); @@ -1556,6 +1618,7 @@ angular.module('zmApp.controllers') reloadMonitorDisplayStatus(); + debug ("Inside getMonitors, will also regen connkeys"); debug("Now trying to get multi-server data, if present"); $http.get(apiurl + "/servers.json") .success(function (data) { @@ -1564,6 +1627,7 @@ angular.module('zmApp.controllers') log("multi server list loaded" + JSON.stringify(data)); multiservers = data.servers; + for (var i = 0; i < monitors.length; i++) { // make them all show for now |
