diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2018-10-08 12:14:32 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2018-10-08 12:14:32 -0400 |
| commit | bace2be553e3175ba7a47024c8352e43d285b620 (patch) | |
| tree | 8cae03c058a6500ab225f65e5a2842e4db7bde07 /www/js | |
| parent | 881a3b160a1320f2318712c1063e40775236099f (diff) | |
log cleanup, wait for eventserver init before sending messages
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/DataModel.js | 10 | ||||
| -rw-r--r-- | www/js/FirstUseCtrl.js | 7 | ||||
| -rw-r--r-- | www/js/LoginCtrl.js | 43 | ||||
| -rw-r--r-- | www/js/MenuController.js | 27 | ||||
| -rwxr-xr-x | www/js/app.js | 4 |
5 files changed, 52 insertions, 39 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index 05a77294..a87f7765 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -1142,13 +1142,13 @@ angular.module('zmApp.controllers') } - console.log("INIT SIMUL=" + loginData.disableSimulStreaming); - console.log("INIT PLATFORM IS=" + $rootScope.platformOS); + //console.log("INIT SIMUL=" + loginData.disableSimulStreaming); + //console.log("INIT PLATFORM IS=" + $rootScope.platformOS); if (typeof loginData.disableSimulStreaming == 'undefined') { loginData.disableSimulStreaming = ($rootScope.platformOS == 'ios') ? true : false; - console.log("INIT DISABLING SIMUL:" + loginData.disableSimulStreaming); + //console.log("INIT DISABLING SIMUL:" + loginData.disableSimulStreaming); } @@ -1870,12 +1870,16 @@ angular.module('zmApp.controllers') //-------------------------------------------------------------------------- getPathZms: function () { var d = $q.defer(); + + var apiurl = loginData.apiurl; var myurl = apiurl + '/configs/viewByName/ZM_PATH_ZMS.json'; debug("Config URL for ZMS PATH is:" + myurl); $http.get(myurl) .then(function (data) { + data = data.data; + //console.log (">>>> GOT: "+JSON.stringify(data)); configParams.ZM_PATH_ZMS = data.config.Value; d.resolve(configParams.ZM_PATH_ZMS); return (d.promise); diff --git a/www/js/FirstUseCtrl.js b/www/js/FirstUseCtrl.js index 89f45e96..1ad42e9c 100644 --- a/www/js/FirstUseCtrl.js +++ b/www/js/FirstUseCtrl.js @@ -18,8 +18,11 @@ angular.module('zmApp.controllers').controller('zmApp.FirstUseCtrl', ['$scope', // if (window.cordova) { - cordova.plugins.certificates.trustUnsecureCerts(true); - NVRDataModel.log(">>>>>Accepting all certificates, since its first use"); + cordova.plugin.http.setSSLCertMode('nocheck', function() { + NVRDataModel.debug('--> First use -> SSL is permissive, will allow any certs for now. You can change it later.'); + }, function() { + console.log('-->First Use -> Error setting SSL permissive'); + }); } diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index fc63ff06..d2dfe899 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -583,23 +583,23 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r if ($rootScope.platformOS != 'desktop') { if ($scope.loginData.isUseBasicAuth) { - debug ("Cordova HTTP: configuring basic auth"); + NVRDataModel.debug ("Cordova HTTP: configuring basic auth"); cordova.plugin.http.useBasicAuth($scope.loginData.basicAuthUser, $scope.loginData.basicAuthPassword); } if (!$scope.loginData.enableStrictSSL) { //alert("Enabling insecure SSL"); - log(">>>> Disabling strict SSL checking (turn off in Dev Options if you can't connect)"); + NVRDataModel.log(">>>> Disabling strict SSL checking (turn off in Dev Options if you can't connect)"); cordova.plugin.http.setSSLCertMode('nocheck', function() { - debug('--> SSL is permissive, will allow any certs. Use at your own risk.'); + NVRDataModel.debug('--> SSL is permissive, will allow any certs. Use at your own risk.'); }, function() { console.log('-->Error setting SSL permissive'); }); } else { - log(">>>> Enabling strict SSL checking (turn off in Dev Options if you can't connect)"); + NVRDataModel.log(">>>> Enabling strict SSL checking (turn off in Dev Options if you can't connect)"); } @@ -649,21 +649,28 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r oldName = $scope.loginData.serverName; if ($scope.loginData.isUseEventServer) { - EventServer.init(); - if ($rootScope.apnsToken && $scope.loginData.disablePush != true) { - NVRDataModel.log("Making sure we get push notifications"); - EventServer.sendMessage('push', { - type: 'token', - platform: $rootScope.platformOS, - token: $rootScope.apnsToken, - state: "enabled" - }, 1); - } - EventServer.sendMessage("control", { - type: 'filter', - monlist: $scope.loginData.eventServerMonitors, - intlist: $scope.loginData.eventServerInterval + EventServer.init() + .then (function (succ) { + if ($rootScope.apnsToken && $scope.loginData.disablePush != true) { + NVRDataModel.log("Making sure we get push notifications"); + EventServer.sendMessage('push', { + type: 'token', + platform: $rootScope.platformOS, + token: $rootScope.apnsToken, + state: "enabled" + }, 1); + } + EventServer.sendMessage("control", { + type: 'filter', + monlist: $scope.loginData.eventServerMonitors, + intlist: $scope.loginData.eventServerInterval, + token: $rootScope.apnsToken + }); + }, + function (err) { + NVRDataModel.log ("Event server init failed"); }); + } diff --git a/www/js/MenuController.js b/www/js/MenuController.js index 52ab51ac..d9d4d114 100644 --- a/www/js/MenuController.js +++ b/www/js/MenuController.js @@ -111,21 +111,20 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io if (loginData.isUseEventServer) { - EventServer.init(); - if ($rootScope.apnsToken && loginData.disablePush != true) { - NVRDataModel.log("Making sure we get push notifications"); - EventServer.sendMessage('push', { - type: 'token', - platform: $rootScope.platformOS, - token: $rootScope.apnsToken, - state: "enabled" - }, 1); - } - EventServer.sendMessage("control", { - type: 'filter', - monlist: loginData.eventServerMonitors, - intlist: loginData.eventServerInterval + EventServer.init() + .then (function (succ) { + EventServer.sendMessage("control", { + type: 'filter', + monlist: loginData.eventServerMonitors, + intlist: loginData.eventServerInterval, + token: $rootScope.apnsToken + }); + }, + function (err) { + NVRDataModel.debug ("EventServer init failed"); }); + + } diff --git a/www/js/app.js b/www/js/app.js index bcfe67c0..b3553664 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -2302,7 +2302,7 @@ angular.module('zmApp', [ method = arguments[0].method; var isOutgoingRequest = /^(http|https):\/\//.test(url); if (window.cordova && isOutgoingRequest) { - // console.log ("**** -->"+method+"<-- using native HTTP with:"+encodeURI(url)); + //console.log ("**** -->"+method+"<-- using native HTTP with:"+encodeURI(url)); var d = $q.defer(); var options = { method: method, @@ -2328,7 +2328,7 @@ angular.module('zmApp', [ } catch (e) { - // console.log ("*** Native HTTP response: JSON parsing failed for "+url+", returning text"); + //console.log ("*** Native HTTP response: JSON parsing failed for "+url+", returning text"); d.resolve({"data":succ.data}); return d.promise; } |
