diff options
Diffstat (limited to 'www')
| -rwxr-xr-x | www/js/DataModel.js | 34 | ||||
| -rw-r--r-- | www/js/FirstUseCtrl.js | 10 | ||||
| -rwxr-xr-x | www/js/app.js | 13 | ||||
| -rw-r--r-- | www/lang/locale-en.json | 1 | ||||
| -rw-r--r-- | www/templates/devoptions.html | 5 |
5 files changed, 60 insertions, 3 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index d2b21c2c..40ed4738 100755 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -151,6 +151,7 @@ angular.module('zmApp.controllers') 'hideArchived': false, 'videoPlaybackSpeed': 2, 'enableGIFMP4': false, + 'enableStrictSSL': false, }; @@ -161,6 +162,27 @@ angular.module('zmApp.controllers') 'ZM_PATH_ZMS': '' }; + + function setSSLCerts() + { + if (!window.cordova) return; + if (!loginData.enableStrictSSL) + { + + //alert("Enabling insecure SSL"); + log(">>>> Disabling strict SSL checking (turn off in Dev Options if you can't connect)"); + cordova.plugins.certificates.trustUnsecureCerts(true); + + } + else + { + + log(">>>> Enabling strict SSL checking (turn off in Dev Options if you can't connect)"); + cordova.plugins.certificates.trustUnsecureCerts(false); + } + } + + // credit: http://stackoverflow.com/questions/4994201/is-object-empty function isEmpty(obj) { @@ -994,6 +1016,13 @@ angular.module('zmApp.controllers') } + if (typeof loginData.enableStrictSSL == 'undefined') + { + + loginData.enableStrictSSL = false; + + } + log("DataModel init recovered this loginData as " + JSON.stringify(loginData)); } else @@ -1001,6 +1030,11 @@ angular.module('zmApp.controllers') log("defaultServer configuration NOT found. Keeping login at defaults"); } + // now set up SSL - need to do it after data return + // from local forage + setSSLCerts(); + + // FIXME: HACK: This is the latest entry point into dataModel init, so start portal login after this // not the neatest way $rootScope.$emit('init-complete'); diff --git a/www/js/FirstUseCtrl.js b/www/js/FirstUseCtrl.js index e5692188..1dc6c514 100644 --- a/www/js/FirstUseCtrl.js +++ b/www/js/FirstUseCtrl.js @@ -16,6 +16,16 @@ angular.module('zmApp.controllers').controller('zmApp.FirstUseCtrl', ['$scope', { //console.log("**VIEW ** FirstUse Ctrl Entered"); $ionicSideMenuDelegate.canDragContent(true); + // right up here lets set certs to true, we will disable it later + // this is for first starts + + // + if (window.cordova) + { + cordova.plugins.certificates.trustUnsecureCerts(true); + NVRDataModel.log (">>>>>Accepting all certificates, since its first use"); + } + }); diff --git a/www/js/app.js b/www/js/app.js index d0f30afe..b006390a 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -1485,6 +1485,8 @@ angular.module('zmApp', [ $ionicPlatform.ready(function() { + + // handles URL launches // if you just launch zmninja:// then it will honor the settings in "tap screen" -> events or montage @@ -1694,8 +1696,7 @@ angular.module('zmApp', [ { $cordovaSplashscreen.hide(); - NVRDataModel.log("Enabling insecure SSL"); - cordova.plugins.certificates.trustUnsecureCerts(true); + cordova.getAppVersion.getVersionNumber().then(function(version) { @@ -1819,6 +1820,10 @@ angular.module('zmApp', [ { NVRDataModel.log("Language file loaded, continuing with rest"); NVRDataModel.init(); + + // now do SSL check + //setSSLCerts(); + EventServer.init(); zmCheckUpdates.start(); NVRDataModel.log("Setting up POST LOGIN timer"); @@ -1826,10 +1831,12 @@ angular.module('zmApp', [ setupPauseAndResume(); + } } + function setupPauseAndResume() { NVRDataModel.log("Setting up pause and resume handler AFTER language is loaded..."); @@ -2193,7 +2200,7 @@ angular.module('zmApp', [ { data: { - requireLogin: true + requireLogin: false }, url: "/devoptions", cache: false, diff --git a/www/lang/locale-en.json b/www/lang/locale-en.json index 61701716..aa6611e4 100644 --- a/www/lang/locale-en.json +++ b/www/lang/locale-en.json @@ -77,6 +77,7 @@ "kEnableLogs" :"Enable logs", "kEnableNewsUpdates" :"enable news updates", "kEnterPin" :"Enter PIN", + "kEnableStrictSSL" : "Enable strict SSL check", "kError" :"Error", "kErrorChangingMonitors" :"Error changing monitors. Please check logs", "kErrorFrameBanner" :"could not retrieve frame details", diff --git a/www/templates/devoptions.html b/www/templates/devoptions.html index e84ef7de..e72ffe72 100644 --- a/www/templates/devoptions.html +++ b/www/templates/devoptions.html @@ -116,6 +116,11 @@ </ion-toggle> </label> + <label ng-if="$root.platformOS!='desktop'"> + <ion-toggle ng-model="loginData.enableStrictSSL" ng-checked="loginData.enableStrictSSL" toggle-class="toggle-calm"><span class="item-text-wrap">{{'kEnableStrictSSL' | translate}} + </span> + </ion-toggle> + </label> <label> <ion-toggle ng-model="loginData.enableGIFMP4" ng-checked="loginData.enableGIFMP4" toggle-class="toggle-calm"><span class="item-text-wrap">{{'kEnableGIFMP4' | translate}} |
