diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2018-09-29 11:50:53 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2018-09-29 11:50:53 -0400 |
| commit | 57920cc5d5e96780e13a29c04a577d4c67496aba (patch) | |
| tree | 67b4af499e0594c621f60e9a268363efe44399e7 /www | |
| parent | ebe04f8fc791413131c37425998be5be4a2ef538 (diff) | |
#709 encorce AUTH_HASH_LOGIN for mobile
Diffstat (limited to 'www')
| -rw-r--r-- | www/js/DataModel.js | 8 | ||||
| -rw-r--r-- | www/js/EventCtrl.js | 2 | ||||
| -rwxr-xr-x | www/js/app.js | 35 | ||||
| -rw-r--r-- | www/lang/locale-en.json | 1 | ||||
| -rw-r--r-- | www/templates/events.html | 5 |
5 files changed, 43 insertions, 8 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index eeaf2f53..f400259d 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -310,6 +310,7 @@ angular.module('zmApp.controllers') + function getZmsMultiPortSupport(forceReload) { var d = $q.defer(); if (configParams.ZM_MIN_STREAMING_PORT == -1 || forceReload) { @@ -1822,6 +1823,13 @@ angular.module('zmApp.controllers') // This function returns the numdigits for padding capture images //----------------------------------------------------------------------------- + + getAuthHashLogin: function () { + + return $http.get(loginData.apiurl + '/configs/viewByName/ZM_AUTH_HASH_LOGINS.json'); + + }, + getKeyConfigParams: function (forceReload) { var d = $q.defer(); diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index 871285ec..2b5ef82d 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -2863,7 +2863,7 @@ angular.module('zmApp.controllers') $scope.constructThumbnail = function (event) { var stream = ""; stream = event.Event.baseURL + - "/index.php?view=image&show=capture&fid=" + + "/index.php?view=image&show=capture&fid=" + (event.Event.MaxScoreFrameId ? event.Event.MaxScoreFrameId : "1&eid=" + event.Event.Id) + "&width=" + event.Event.thumbWidth * 2 + "&height=" + event.Event.thumbHeight * 2; diff --git a/www/js/app.js b/www/js/app.js index 1d12b353..77df01e7 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -908,6 +908,30 @@ angular.module('zmApp', [ contentBannerInstance(); }, 2000); NVRDataModel.debug("auth-success broadcast:Successful"); + + + var ld = NVRDataModel.getLogin(); + + // we need AUTH_HASH_LOGIN to be on for WKWebView /mobile + if (ld.isUseAuth && $rootScope.platformOS != 'desktop') { + NVRDataModel.getAuthHashLogin() + .then (function (data) { + + if (data.data && data.data.config.Value != '1') { + $ionicPopup.alert({ + title: $translate.instant('kError'), + template: $translate.instant('kAuthHashDisabled') + }); + } + + }, + function (err) { + console.log ("AUTH HASH ERROR: "+JSON.stringify(conf)); + }); + } + + + }); $rootScope.getProfileName = function () { @@ -2278,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, @@ -2304,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; } @@ -2312,7 +2336,8 @@ angular.module('zmApp', [ } }, function (err) { - console.log ("*** Inside native HTTP error: "+JSON.stringify(err)); + //console.log ("*** Inside native HTTP error: "+JSON.stringify(err)); + NVRDataModel.debug ("*** Native HTTP error: "+JSON.stringify(err)); d.reject(err); return d.promise; }); @@ -2320,7 +2345,7 @@ angular.module('zmApp', [ } else { // not cordova, so lets go back to default http - console.log ("**** "+method+" using XHR HTTP for "+url); + // console.log ("**** "+method+" using XHR HTTP for "+url); return $http.apply($http, arguments); } @@ -2336,7 +2361,6 @@ angular.module('zmApp', [ }); // wrap convenience functions $delegate.get = function (url,config) { - return wrapper(angular.extend(config || {}, { method: 'get', url: url @@ -2344,7 +2368,6 @@ angular.module('zmApp', [ }; $delegate.post = function (url,data,config) { - return wrapper(angular.extend(config || {}, { method: 'post', url: url, diff --git a/www/lang/locale-en.json b/www/lang/locale-en.json index a716f76e..a0749bc1 100644 --- a/www/lang/locale-en.json +++ b/www/lang/locale-en.json @@ -15,6 +15,7 @@ "kApplyingChanges" :"Applying changes. Please wait", "kArrangingImages" :"arranging images", "kAt" :"at", + "kAuthHashDisabled" :"zmNinja needs AUTH_HASH_LOGINS to be enabled to be able to display image frames", "kAuthSuccess" :"authentication success", "kAuthenticating" :"authenticating", "kAuthenticatingWebScrape" : "authenticating via web scrape", diff --git a/www/templates/events.html b/www/templates/events.html index 66291c55..79c0ef8f 100644 --- a/www/templates/events.html +++ b/www/templates/events.html @@ -101,9 +101,12 @@ <div align="right" class="col col-40" ng-if="loginData.enableThumbs" > + <img bg-color="#6C7A89" src="{{constructThumbnail(event)}}" + on-tap="closeIfOpen(event);openModalWithSnapshot(event)" width="{{event.Event.thumbWidth}}px" height="{{event.Event.thumbHeight}}px" /> + <!-- <img ng-image-appear no-loader transition-duration="0.3s" animation="fillIn" bg-color="#6C7A89" ng-src="{{constructThumbnail(event)}}" on-tap="closeIfOpen(event);openModalWithSnapshot(event)" width="{{event.Event.thumbWidth}}px" height="{{event.Event.thumbHeight}}px" /> - + --> <!--<p>{{event.Event.thumbWidth}}px*{{event.Event.thumbHeight}}px</p>--> |
