summaryrefslogtreecommitdiff
path: root/www/js/NVR.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/NVR.js')
-rw-r--r--www/js/NVR.js35
1 files changed, 29 insertions, 6 deletions
diff --git a/www/js/NVR.js b/www/js/NVR.js
index d9991b38..be2265ff 100644
--- a/www/js/NVR.js
+++ b/www/js/NVR.js
@@ -1465,6 +1465,33 @@ angular.module('zmApp.controllers')
}
+ function regenConnKeys (mon) {
+ var nowt = moment();
+ if (mon) {
+ debug ("NVR: Regnerating connkey for Monitor:"+mon.Monitor.Id + " at "+nowt);
+ mon.Monitor.connKey = (Math.floor((Math.random() * 999999) + 1)).toString();
+ mon.Monitor.regenTime = nowt;
+ if (mon.Monitor.regenHandle) {
+ //debug ("cancelling regen timer for Monitor:"+mon.Monitor.Id);
+ $timeout.cancel(mon.Monitor.regenHandle);
+ mon.Monitor.regenHandle = null;
+ }
+
+ } else {
+ debug("NVR: Regenerating connkeys for all monitors at "+nowt);
+ for (var i = 0; i < monitors.length; i++) {
+ monitors[i].Monitor.connKey = (Math.floor((Math.random() * 999999) + 1)).toString();
+ monitors[i].Monitor.rndKey = (Math.floor((Math.random() * 999999) + 1)).toString();
+ monitors[i].Monitor.regenTime = nowt;
+ if (monitors[i].Monitor.regenHandle) {
+ $timeout.cancel(monitors[i].Monitor.regenHandle);
+ monitors[i].Monitor.regenHandle = null;
+ }
+ }
+
+ }
+ }
+
//--------------------------------------------------------------------------
// Banner display of messages
//--------------------------------------------------------------------------
@@ -2540,13 +2567,9 @@ angular.module('zmApp.controllers')
},
- regenConnKeys: function () {
+ regenConnKeys: function (mon) {
- debug("NVR: Regenerating connkeys...");
- for (var i = 0; i < monitors.length; i++) {
- monitors[i].Monitor.connKey = (Math.floor((Math.random() * 999999) + 1)).toString();
- monitors[i].Monitor.rndKey = (Math.floor((Math.random() * 999999) + 1)).toString();
- }
+ return regenConnKeys (mon);
},
getMonitors: function (forceReload) {