summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2018-09-29 11:50:53 -0400
committerPliable Pixels <pliablepixels@gmail.com>2018-09-29 11:50:53 -0400
commit57920cc5d5e96780e13a29c04a577d4c67496aba (patch)
tree67b4af499e0594c621f60e9a268363efe44399e7 /www/js
parentebe04f8fc791413131c37425998be5be4a2ef538 (diff)
#709 encorce AUTH_HASH_LOGIN for mobile
Diffstat (limited to 'www/js')
-rw-r--r--www/js/DataModel.js8
-rw-r--r--www/js/EventCtrl.js2
-rwxr-xr-xwww/js/app.js35
3 files changed, 38 insertions, 7 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,