summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/DevOptionsCtrl.js8
-rw-r--r--www/js/NVR.js18
-rwxr-xr-xwww/js/app.js28
3 files changed, 41 insertions, 13 deletions
diff --git a/www/js/DevOptionsCtrl.js b/www/js/DevOptionsCtrl.js
index 55aa0e5b..57e7e2fa 100644
--- a/www/js/DevOptionsCtrl.js
+++ b/www/js/DevOptionsCtrl.js
@@ -141,6 +141,14 @@ angular.module('zmApp.controllers').controller('zmApp.DevOptionsCtrl', ['$scope'
}
+ $scope.useDefaultCustom = function() {
+ if ($scope.loginData.zmNinjaHeader=='') {
+ $scope.loginData.zmNinjaHeader = 'zmNinja version:'+NVR.getAppVersion();
+ }
+
+
+ };
+
$scope.saveDevOptions = function () {
saveDevOptions();
diff --git a/www/js/NVR.js b/www/js/NVR.js
index 36ddf880..37a6c816 100644
--- a/www/js/NVR.js
+++ b/www/js/NVR.js
@@ -22,7 +22,7 @@ angular.module('zmApp.controllers')
It is changed by sync_version.sh
*/
var zmAppVersion = "1.3.085";
- var zmAPIVersion = null;
+
var isBackground = false;
var justResumed = false;
var timeSinceResumed = -1;
@@ -210,6 +210,7 @@ angular.module('zmApp.controllers')
'useAPICaching': true,
'pauseStreams': false,
'liveStreamBuffer': 100,
+ 'zmNinjaHeader':undefined, // filled in init. custom header
};
@@ -233,6 +234,10 @@ angular.module('zmApp.controllers')
cordova.plugin.http.useBasicAuth(loginData.basicAuthUser, loginData.basicAuthPassword);
}
+ // setup custom header
+ cordova.plugin.http.setHeader('*', 'X-ZmNinja', loginData.zmNinjaHeader);
+
+
if (!loginData.enableStrictSSL) {
//alert("Enabling insecure SSL");
@@ -1602,6 +1607,10 @@ angular.module('zmApp.controllers')
loginData.liveStreamBuffer = 100;
}
+ if ((typeof loginData.zmNinjaHeader == undefined) || (loginData.zmNinjaHeader == '')) {
+ loginData.zmNinjaHeader = 'zmNinja version:'+zmAppVersion;
+ }
+
loginData.canSwipeMonitors = true;
loginData.forceImageModePath = false;
loginData.enableBlog = true;
@@ -2283,6 +2292,13 @@ angular.module('zmApp.controllers')
setAppVersion: function (ver) {
zmAppVersion = ver;
+ $rootScope.appVersion = ver; // for custom header
+
+ //console.log ('****** VER:'+$rootScope.appVersion);
+ },
+
+ getCustomHeader: function () {
+ return loginData.zmNinjaHeader;
},
getAppVersion: function () {
diff --git a/www/js/app.js b/www/js/app.js
index b5c2c6f4..3eb7210f 100755
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -2,14 +2,7 @@
/* jslint browser: true*/
/* global cordova,StatusBar,angular,console,alert,PushNotification, moment ,ionic, URI,Packery, ConnectSDK, CryptoJS, ContactFindOptions, localforage,$, Connection, MobileAccessibility, hello */
-// For desktop versions, this is replaced
-// with actual app version from config.xml by the
-// ./make_desktop.sh script
-// For mobile versions, I use cordova app version plugin
-// to get it at run time
-
-var appVersion = "0.0.0";
// core app start stuff
angular.module('zmApp', [
@@ -662,12 +655,18 @@ angular.module('zmApp', [
request: function (config) {
if (!config) return config;
if (!config.url) return config;
-
+ nvr = $injector.get('NVR');
if ($rootScope.basicAuthHeader) {
config.headers.Authorization = $rootScope.basicAuthHeader;
}
+ var chdr = nvr.getCustomHeader();
+ if (chdr) {
+ config.headers['X-ZmNinja'] = chdr;
+ }
+
+
return config || $q.when(config);
},
@@ -1131,7 +1130,7 @@ angular.module('zmApp', [
-
+
$rootScope.dpadId = 0;
$rootScope.textScaleFactor = 1.0;
$rootScope.isLoggedIn = false;
@@ -1765,11 +1764,16 @@ angular.module('zmApp', [
// console.log("app version");
cordova.getAppVersion.getVersionNumber().then(function (version) {
- appVersion = version;
- NVR.log("App Version: " + appVersion);
- NVR.setAppVersion(appVersion);
+
+ NVR.log("App Version: " + version);
+ NVR.setAppVersion(version);
});
}
+ else {
+ // custom header
+ $rootScope.appVersion = NVR.getAppVersion();
+ }
+
// At this stage, NVR.init is not called yet