diff options
| -rwxr-xr-x | www/js/DataModel.js | 15 | ||||
| -rw-r--r-- | www/js/EventCtrl.js | 25 | ||||
| -rw-r--r-- | www/js/MomentCtrl.js | 2 | ||||
| -rw-r--r-- | www/js/MonitorModalCtrl.js | 8 | ||||
| -rw-r--r-- | www/js/MontageCtrl.js | 2 | ||||
| -rw-r--r-- | www/js/TimelineModalCtrl.js | 3 | ||||
| -rw-r--r-- | www/lang/locale-en.json | 2 | ||||
| -rw-r--r-- | www/templates/devoptions.html | 8 |
8 files changed, 44 insertions, 21 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index 455e4c0a..e94ea0a4 100755 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -183,6 +183,7 @@ angular.module('zmApp.controllers') 'momentArrangeBy': 'StartTime', 'showLiveForInProgressEvents': true, 'disableSimulStreaming': false, + 'insertBasicAuthToken': false, }; @@ -589,6 +590,14 @@ angular.module('zmApp.controllers') return { + + + insertBasicAuthToken: function () { + + return loginData.insertBasicAuthToken && $rootScope.basicAuthToken ? "&basicauth="+$rootScope.basicAuthToken:""; + + }, + setCurrentServerMultiPortSupported:function (val) { setCurrentServerMultiPortSupported(val); }, @@ -1258,6 +1267,12 @@ angular.module('zmApp.controllers') loginData.momentArrangeBy = "StartTime"; } + + if (typeof loginData.insertBasicAuthToken == 'undefined') { + + loginData.insertBasicAuthToken = false; + + } if (typeof loginData.showLiveForInProgressEvents == 'undefined') { diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index 5604ff8d..666f7c7f 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -965,10 +965,10 @@ angular.module('zmApp.controllers') $scope.fallbackImgSrc +=$rootScope.authSession; } - if ($rootScope.basicAuthToken) { - $scope.imgsrc +="&basicauth="+$rootScope.basicAuthToken; - $scope.fallbackImgSrc +="&basicauth="+$rootScope.basicAuthToken; - } + + $scope.imgsrc +=NVRDataModel.insertBasicAuthToken(); + $scope.fallbackImgSrc +=NVRDataModel.insertBasicAuthToken(); + $rootScope.zmPopup = $ionicPopup.show( @@ -2479,9 +2479,9 @@ angular.module('zmApp.controllers') /* videoURL = event.Event.baseURL + "/events/" + event.Event.relativePath + event.Event.DefaultVideo;*/ videoURL = event.Event.baseURL + "/index.php?view=view_video&eid=" + event.Event.Id; if ($rootScope.authSession != 'undefined') videoURL +=$rootScope.authSession; - if ($rootScope.basicAuthToken) videoURL = videoURL+"&basicauth="+$rootScope.basicAuthToken; - - + vidoeURL+=NVRDataModel.insertBasicAuthToken(); + + console.log("************** VIDEO IS " + videoURL); event.Event.video.config = { autoPlay: true, @@ -3159,7 +3159,8 @@ angular.module('zmApp.controllers') "&width="+event.Event.thumbWidth*2 + "&height="+event.Event.thumbHeight*2; if ($rootScope.authSession !='undefined') stream+=$rootScope.authSession; - if ($rootScope.basicAuthToken) stream +="&basicauth="+$rootScope.basicAuthToken; + + stream += NVRDataModel.insertBasicAuthToken(); return stream; }; @@ -3177,7 +3178,9 @@ angular.module('zmApp.controllers') "&fid="+slide.id; } if ($rootScope.authSession !='undefined') stream+=$rootScope.authSession; - if ($rootScope.basicAuthToken) stream +="&basicauth="+$rootScope.basicAuthToken; + + stream +=NVRDataModel.insertBasicAuthToken(); + return stream; } @@ -3201,8 +3204,8 @@ angular.module('zmApp.controllers') } if ($rootScope.authSession !='undefined') stream+=$rootScope.authSession; - if ($rootScope.basicAuthToken) stream +="&basicauth="+$rootScope.basicAuthToken; - + stream += NVRDataModel.insertBasicAuthToken(); + return stream; }; diff --git a/www/js/MomentCtrl.js b/www/js/MomentCtrl.js index 06658e0e..97f864b7 100644 --- a/www/js/MomentCtrl.js +++ b/www/js/MomentCtrl.js @@ -265,7 +265,7 @@ angular.module('zmApp.controllers').controller('zmApp.MomentCtrl', ['$scope', '$ "&height="+moment.Event.thumbHeight*2; if ($rootScope.authSession != 'undefined') stream +=$rootScope.authSession; - if ($rootScope.basicAuthToken) stream = stream+"&basicauth="+$rootScope.basicAuthToken; + stream += NVRDataModel.insertBasicAuthToken(); return stream; }; diff --git a/www/js/MonitorModalCtrl.js b/www/js/MonitorModalCtrl.js index ed81cd4e..49fe3741 100644 --- a/www/js/MonitorModalCtrl.js +++ b/www/js/MonitorModalCtrl.js @@ -1086,10 +1086,7 @@ angular.module('zmApp.controllers').controller('MonitorModalCtrl', ['$scope', '$ url +=$rootScope.authSession; } - if ($rootScope.basicAuthToken) { - url +="&basicauth="+$rootScope.basicAuthToken; - - } + url += NVRDataModel.insertBasicAuthToken(); NVRDataModel.log("SavetoPhone:Trying to save image from " + url); @@ -1153,8 +1150,7 @@ angular.module('zmApp.controllers').controller('MonitorModalCtrl', ['$scope', '$ //console.log ("STREAM="+stream); - if ($rootScope.basicAuthToken) stream +="&basicauth="+$rootScope.basicAuthToken; - + stream += NVRDataModel.insertBasicAuthToken(); return stream; diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index be20a340..0809fabc 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -1714,7 +1714,7 @@ angular.module('zmApp.controllers') $rootScope.authSession + appendConnKey(monitor.Monitor.connKey); - if ($rootScope.basicAuthToken) stream +="&basicauth="+$rootScope.basicAuthToken; + stream += NVRDataModel.insertBasicAuthToken(); //"&rand=" + randToAvoidCacheMem; diff --git a/www/js/TimelineModalCtrl.js b/www/js/TimelineModalCtrl.js index d442b47d..fb1e480f 100644 --- a/www/js/TimelineModalCtrl.js +++ b/www/js/TimelineModalCtrl.js @@ -64,7 +64,8 @@ angular.module('zmApp.controllers').controller('TimelineModalCtrl', ['$scope', ' } if ($rootScope.authSession !='undefined') stream+=$rootScope.authSession; - if ($rootScope.basicAuthToken) stream +="&basicauth="+$rootScope.basicAuthToken; + + stream+= NVRDataModel.insertBasicAuthToken(); return stream; }; diff --git a/www/lang/locale-en.json b/www/lang/locale-en.json index eb9a7c50..f98dd34e 100644 --- a/www/lang/locale-en.json +++ b/www/lang/locale-en.json @@ -171,6 +171,8 @@ "kImpMsg6" :"Recommended Version", "kImpMsg7" :"Ok, got it", "kIncreaseSize" :"increase size", + "kInsertBasicAuthToken" : "Append basic auth token in images", + "kInsertBasicAuthTokenNote" : "not a good idea if you are not using HTTPS", "kInvalidAPIBody" :"API access failed. Please make sure your APIs are configured correctly and are accessible .Tap on the button below to read the instructions", "kInvalidAPIHeader" :"API Access Error", "kInvalidAPIRead" :"Read FAQ", diff --git a/www/templates/devoptions.html b/www/templates/devoptions.html index c7a132d8..51fec871 100644 --- a/www/templates/devoptions.html +++ b/www/templates/devoptions.html @@ -155,13 +155,19 @@ </ion-toggle> </label> + <label> + <ion-toggle ng-model="loginData.insertBasicAuthToken" ng-checked="loginData.insertBasicAuthToken" toggle-class="toggle-calm"><span class="item-text-wrap">{{'kInsertBasicAuthToken' | translate}} + <p>{{'kInsertBasicAuthTokenNote' | translate}}</p></span> + </ion-toggle> + </label> + <label ng-if="isMultiPort"> <ion-toggle ng-model="loginData.disableSimulStreaming" ng-checked="loginData.disableSimulStreaming" ng-change="checkMultiPortToggle()" toggle-class="toggle-calm"><span class="item-text-wrap">{{'kDisableSimulStreaming' | translate}} <p ng-if="$root.platformOS=='ios'">{{'kDisableSimulStreamingNote' | translate}}</p> </span> </ion-toggle> - </label> + </label> <label> <ion-toggle ng-model="loginData.enableLogs" ng-checked="{{loginData.enableLogs}}" toggle-class="toggle-calm"><span class="item-text-wrap">{{'kEnableLogs' | translate}}</span></ion-toggle> |
