diff options
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/EventCtrl.js | 12 | ||||
| -rw-r--r-- | www/js/EventServer.js | 7 | ||||
| -rw-r--r-- | www/js/MomentCtrl.js | 2 | ||||
| -rw-r--r-- | www/js/MonitorModalCtrl.js | 4 | ||||
| -rw-r--r-- | www/js/MontageCtrl.js | 31 | ||||
| -rw-r--r-- | www/js/MontageHistoryCtrl.js | 6 | ||||
| -rw-r--r-- | www/js/TimelineCtrl.js | 2 | ||||
| -rw-r--r-- | www/js/TimelineModalCtrl.js | 2 | ||||
| -rw-r--r-- | www/js/WizardCtrl.js | 2 | ||||
| -rwxr-xr-x | www/js/app.js | 6 |
10 files changed, 46 insertions, 28 deletions
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index 77a50a64..e06309aa 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -974,10 +974,10 @@ angular.module('zmApp.controllers') //$rootScope.zmPopup = $ionicPopup.alert({title: kFrame+':'+fid+'/'+kEvent+':'+e,template:img, cssClass:'popup80'}); - if ($rootScope.authSession != 'undefined') { + $scope.imgsrc += $rootScope.authSession; $scope.fallbackImgSrc += $rootScope.authSession; - } + $scope.imgsrc += NVR.insertBasicAuthToken(); @@ -2316,7 +2316,7 @@ angular.module('zmApp.controllers') videoURL = event.Event.recordingURL + "/index.php?view=view_video&eid=" + event.Event.Id; - if ($rootScope.authSession != 'undefined') videoURL += $rootScope.authSession; + videoURL += $rootScope.authSession; videoURL += NVR.insertBasicAuthToken(); @@ -2965,7 +2965,7 @@ angular.module('zmApp.controllers') NVR.getSnapshotFrame()+"&eid="+event.Event.Id + "&width=" + event.Event.thumbWidth * 2 + "&height=" + event.Event.thumbHeight * 2; - if ($rootScope.authSession != 'undefined') stream += $rootScope.authSession; + stream += $rootScope.authSession; stream += NVR.insertBasicAuthToken(); return stream; @@ -2979,7 +2979,7 @@ angular.module('zmApp.controllers') stream = event.Event.recordingURL + "/index.php?view=image" + "&fid=" + slide.id + $scope.outlineMotionParam; - if ($rootScope.authSession != 'undefined') stream += $rootScope.authSession; + stream += $rootScope.authSession; stream += NVR.insertBasicAuthToken(); @@ -2994,7 +2994,7 @@ angular.module('zmApp.controllers') stream = event.Event.recordingURL + "/index.php?view=image&fid=" + alarm.id; if (motion) stream += $scope.outlineMotionParam; - if ($rootScope.authSession != 'undefined') stream += $rootScope.authSession; + stream += $rootScope.authSession; stream += NVR.insertBasicAuthToken(); // console.log ("alarm:"+stream); diff --git a/www/js/EventServer.js b/www/js/EventServer.js index 6343cd0a..7dcb6937 100644 --- a/www/js/EventServer.js +++ b/www/js/EventServer.js @@ -520,10 +520,11 @@ angular.module('zmApp.controllers') var media; var ld = NVR.getLogin(); - var plat = $ionicPlatform.is('ios') ? 'ios' : 'android'; + //var plat = $ionicPlatform.is('ios') ? 'ios' : 'android'; + var plat = $rootScope.platformOS; if ($rootScope.platformOS == 'desktop') { - NVR.log("Desktop instance, not setting up push. Websockets only, I hope"); + NVR.log ('Not setting up push as this is desktop.'); return; } @@ -573,7 +574,7 @@ angular.module('zmApp.controllers') NVR.debug("EventSever: Push Notification registration ID received: " + JSON.stringify(data)); $rootScope.apnsToken = data.registrationId; - var plat = $ionicPlatform.is('ios') ? 'ios' : 'android'; + var plat = $rootScope.platformOS; var ld = NVR.getLogin(); var pushstate = "enabled"; if (ld.disablePush == true) diff --git a/www/js/MomentCtrl.js b/www/js/MomentCtrl.js index 06294a16..b749837a 100644 --- a/www/js/MomentCtrl.js +++ b/www/js/MomentCtrl.js @@ -273,7 +273,7 @@ angular.module('zmApp.controllers').controller('zmApp.MomentCtrl', ['$scope', '$ "&width=" + moment.Event.thumbWidth * 2 + "&height=" + moment.Event.thumbHeight * 2; - if ($rootScope.authSession != 'undefined') stream += $rootScope.authSession; + stream += $rootScope.authSession; stream += NVR.insertBasicAuthToken(); return stream; diff --git a/www/js/MonitorModalCtrl.js b/www/js/MonitorModalCtrl.js index 4d5f94f2..1279c013 100644 --- a/www/js/MonitorModalCtrl.js +++ b/www/js/MonitorModalCtrl.js @@ -1184,11 +1184,9 @@ angular.module('zmApp.controllers').controller('MonitorModalCtrl', ['$scope', '$ var loginData = NVR.getLogin(); var url = loginData.streamingurl + '/zms?mode=single&monitor=' + mid; - - if ($rootScope.authSession != 'undefined') { url += $rootScope.authSession; - } + url += NVR.insertBasicAuthToken(); NVR.log("SavetoPhone:Trying to save image from " + url); diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index 6b769b21..e6fba792 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -636,11 +636,25 @@ angular.module('zmApp.controllers') NVR.debug ("Getting event count using:"+apiurl); $http.get(apiurl) .then (function (data) { - // console.log ("EVENTS GOT: "+JSON.stringify(data)); + console.log ("EVENTS GOT: "+JSON.stringify(data)); var res = data.data; var mid = monitor.Monitor.Id; if (res.events.length == 0) res = undefined; + monitor.Monitor.lastEvent = res; + + if (monitor.Monitor.lastEvent) { + var notes = res.events[0].Event.Notes; + if (notes.indexOf('detected:') != -1) { + monitor.Monitor.lastEvent.object = true; + } + else { + monitor.Monitor.lastEvent.object = false; + } + + } + + if (monitor.Monitor.lastEvent && showMontageSidebars) { monitor.Monitor.showSidebar = true; } @@ -868,7 +882,7 @@ angular.module('zmApp.controllers') "&monitor=" + item.Monitor.Id + "&scale=50"; - if ($rootScope.authSession != 'undefined') frame += $rootScope.authSession; + frame += $rootScope.authSession; frame += NVR.insertBasicAuthToken(); return frame; }; @@ -1908,7 +1922,7 @@ angular.module('zmApp.controllers') ld.lastEventCheckTimes[mid] = (new moment()).tz(NVR.getTimeZoneNow()).format('YYYY-MM-DD HH:mm:ss'); NVR.debug ("Updating monitor:"+mid+" event check time (server tz) to " + ld.lastEventCheckTimes[mid] ); NVR.setLogin(ld); - monitor.Monitor.lastEvent = undefined; + $http.get(url) .then ( function (succ) { @@ -1941,6 +1955,7 @@ angular.module('zmApp.controllers') }); NVR.log("Cancelling montage timer, opening Modal"); + // NVR.log("Starting Modal timer"); //console.log ("openModal:Cancelling timer"); $interval.cancel(intervalHandleMontage); @@ -1969,6 +1984,8 @@ angular.module('zmApp.controllers') $scope.modalData = { doRefresh: false }; + + monitor.Monitor.lastEvent = undefined; $ionicModal.fromTemplateUrl('templates/events-modal.html', { scope: $scope, // give ModalCtrl access to this scope animation: 'slide-in-up', @@ -2013,10 +2030,12 @@ angular.module('zmApp.controllers') - if ($rootScope.authSession != 'undefined') stream += $rootScope.authSession; + + stream += $rootScope.authSession; stream += NVR.insertBasicAuthToken(); // console.log (stream); + //console.log ("EVENT="+stream); return stream; }; @@ -2024,7 +2043,7 @@ angular.module('zmApp.controllers') $scope.constructStream = function (monitor) { var stream; - if (currentStreamState == streamState.STOPPED || monitor.Monitor.listDisplay == 'noshow' || $rootScope.authSession == 'undefined') { + if (currentStreamState == streamState.STOPPED || monitor.Monitor.listDisplay == 'noshow' ) { //console.log ("STREAM=empty and auth="+$rootScope.authSession); return ""; } @@ -2048,7 +2067,7 @@ angular.module('zmApp.controllers') //"&rand="+$scope.randToAvoidCacheMem + - // console.log("STREAM=" + stream); + console.log("STREAM=" + stream); return stream; }; diff --git a/www/js/MontageHistoryCtrl.js b/www/js/MontageHistoryCtrl.js index 5cf9892b..6f6687e4 100644 --- a/www/js/MontageHistoryCtrl.js +++ b/www/js/MontageHistoryCtrl.js @@ -301,7 +301,7 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc if (eType=='video') { var videoURL= $scope.MontageMonitors[j].Monitor.baseURL + "/index.php?view=view_video&eid=" + eid; - if ($rootScope.authSession != 'undefined') videoURL += $rootScope.authSession; + videoURL += $rootScope.authSession; if ($rootScope.basicAuthToken) videoURL = videoURL + "&basicauth=" + $rootScope.basicAuthToken; @@ -422,7 +422,7 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc if (eType=='video') { var videoURL= $scope.MontageMonitors[i].Monitor.baseURL + "/index.php?view=view_video&eid=" + eid; - if ($rootScope.authSession != 'undefined') videoURL += $rootScope.authSession; + videoURL += $rootScope.authSession; if ($rootScope.basicAuthToken) videoURL = videoURL + "&basicauth=" + $rootScope.basicAuthToken; @@ -892,7 +892,7 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc var videoURL= m.Monitor.baseURL + "/index.php?view=view_video&eid=" + success.eid; - if ($rootScope.authSession != 'undefined') videoURL += $rootScope.authSession; + videoURL += $rootScope.authSession; if ($rootScope.basicAuthToken) videoURL = videoURL + "&basicauth=" + $rootScope.basicAuthToken; m.Monitor.videoObject = { diff --git a/www/js/TimelineCtrl.js b/www/js/TimelineCtrl.js index 3e09a24b..78006f37 100644 --- a/www/js/TimelineCtrl.js +++ b/www/js/TimelineCtrl.js @@ -1501,7 +1501,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla stream = event.Event.recordingURL + "/index.php?view=image&fid=" + NVR.getSnapshotFrame()+"&eid="+event.Event.Id + "&width=400" ; - if ($rootScope.authSession != 'undefined') stream += $rootScope.authSession; + stream += $rootScope.authSession; stream += NVR.insertBasicAuthToken(); $timeout ( function () { diff --git a/www/js/TimelineModalCtrl.js b/www/js/TimelineModalCtrl.js index 0753182e..0b7fb5cb 100644 --- a/www/js/TimelineModalCtrl.js +++ b/www/js/TimelineModalCtrl.js @@ -52,7 +52,7 @@ angular.module('zmApp.controllers').controller('TimelineModalCtrl', ['$scope', ' "&fid=" + alarm.id; - if ($rootScope.authSession != 'undefined') stream += $rootScope.authSession; + stream += $rootScope.authSession; stream += NVR.insertBasicAuthToken(); return stream; diff --git a/www/js/WizardCtrl.js b/www/js/WizardCtrl.js index 5ca0aa25..c1a2ca57 100644 --- a/www/js/WizardCtrl.js +++ b/www/js/WizardCtrl.js @@ -678,7 +678,7 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$ function validateData() { - $rootScope.authSession = 'undefined'; + $rootScope.authSession = ''; $rootScope.zmCookie = ''; $scope.wizard.portalValidText = ""; diff --git a/www/js/app.js b/www/js/app.js index cc941d9b..c5428465 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -700,7 +700,7 @@ angular.module('zmApp', [ //console.log ("HTTP response"); - if (response.data && typeof(response.data) == 'string' && response.data.startsWith("<pre class=\"cake-error\">")) { + if (response.data && typeof(response.data) == 'string' && (response.data.indexOf("<pre class=\"cake-error\">")==0)) { console.log ("cake error detected, attempting fix..."); //console.log ("BAD = "+ JSON.stringify(response.data)); response.data = JSON.parse(response.data.replace(/<pre class=\"cake-error\">[\s\S]*<\/pre>/,'')); @@ -1333,7 +1333,7 @@ angular.module('zmApp', [ // Now go ahead and re-get auth key // if login was a success - $rootScope.authSession = "undefined"; + $rootScope.authSession = ''; var ld = NVR.getLogin(); NVR.getAuthKey($rootScope.validMonitorId) .then(function (success) { @@ -2381,7 +2381,7 @@ angular.module('zmApp', [ // work around for cake-error leak // console.log ("HTTP RESPONSE:" + JSON.stringify(succ.data)); - if (succ.data && succ.data.startsWith("<pre class=\"cake-error\">") ) { + if (succ.data && (succ.data.indexOf("<pre class=\"cake-error\">") == 0) ) { logger.debug ("**** Native: cake-error in message, trying fix..."); succ.data = JSON.parse(succ.data.replace(/<pre class=\"cake-error\">[\s\S]*<\/pre>/,'')); } |
