Skip to content

Commit

Permalink
ZoneMinder#724 copy paths from portal to recording and multi-server p…
Browse files Browse the repository at this point in the history
…ort too
  • Loading branch information
pliablepixels committed Oct 23, 2018
1 parent 4496496 commit 022cd0c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-packageName="com.pliablepixels.zmninja_pro" id="com.pliablepixels.zmninja_pro" ios-CFBundleIdentifier="com.pliablepixels.zmninja-pro" version="1.3.026" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-packageName="com.pliablepixels.zmninja_pro" id="com.pliablepixels.zmninja_pro" ios-CFBundleIdentifier="com.pliablepixels.zmninja-pro" version="1.3.028" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>zmNinja</name>
<description>
High performance ZoneMinder client
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zmninjapro",
"description": "Home security mobile app for ZoneMinder",
"version":"1.3.026",
"version":"1.3.028",
"displayName": "zmNinja",
"author": "Pliable Pixels",
"license": "custom see LICENSE.md",
Expand Down
38 changes: 23 additions & 15 deletions www/js/DataModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ angular.module('zmApp.controllers')
DO NOT TOUCH zmAppVersion
It is changed by sync_version.sh
*/
var zmAppVersion = "1.3.026";
var zmAppVersion = "1.3.028";
var isBackground = false;
var justResumed = false;
var timeSinceResumed = -1;
Expand Down Expand Up @@ -2178,15 +2178,16 @@ angular.module('zmApp.controllers')
multiservers[j].Server.Hostname = multiserver_scheme + multiservers[j].Server.Hostname;
}

debug("Monitor " + monitors[i].Monitor.Id + " has a recording server hostname of " + multiservers[j].Server.Hostname);
// debug("Monitor " + monitors[i].Monitor.Id + " has a recording server hostname of " + multiservers[j].Server.Hostname);



// Now here is the logic, I need to retrieve serverhostname,
// and slap on the host protocol and path. Meh.

var p = URI.parse(loginData.streamingurl);
var s = URI.parse(multiservers[j].Server.Hostname);
var s = URI.parse(loginData.streamingurl);
var m = URI.parse(multiservers[j].Server.Hostname);
var p = URI.parse(loginData.url);

/* if (!p.port && !isNaN(p.path)) {
debug ("Portal: port path reversed?");
Expand All @@ -2203,49 +2204,53 @@ angular.module('zmApp.controllers')
}
*/

debug("recording server parsed is " + JSON.stringify(s));
debug("recording server reported is " + JSON.stringify(m));
debug("portal parsed is " + JSON.stringify(p));
debug("streaming url parsed is " + JSON.stringify(s));
debug ("multi-port is:"+zmsPort);

var st = "";
var baseurl = "";
var streamingurl = "";


st += (s.scheme ? s.scheme : p.scheme) + "://"; // server scheme overrides
st += (m.scheme ? m.scheme : p.scheme) + "://"; // server scheme overrides



// if server doesn't have a protocol, what we want is in path
if (!s.host) {
s.host = s.path;
s.path = undefined;
if (!m.host) {
m.host = m.path;
m.path = undefined;
}

st += s.host;
st += m.host;

//console.log ("STEP 1: ST="+st);

if (zmsPort <= 0 || loginData.disableSimulStreaming) {
if (p.port || s.port) {
st += (s.port ? ":" + s.port : ":" + p.port);
if (p.port || m.port) {
st += (m.port ? ":" + m.port : ":" + p.port);
streamingurl = st;
//console.log ("STEP 2 no ZMS: ST="+st);

}

} else {
var sport = parseInt(zmsPort) + parseInt(monitors[i].Monitor.Id);
streamingurl = st + ':' + sport;
st = st + ':' + sport;

if (p.port || s.port)
st += (s.port ? ":" + s.port : ":" + p.port);
if (p.port || m.port)
st += (m.port ? ":" + m.port : ":" + p.port);
//console.log ("STEP 2: ST="+st);

}


baseurl = st;

controlURL = st;
controlURL += (p.path ? p.path:'');

st += (s.path ? s.path : p.path);
streamingurl += (s.path ? s.path : p.path);
Expand All @@ -2258,6 +2263,9 @@ angular.module('zmApp.controllers')
monitors[i].Monitor.streamingURL = st;
monitors[i].Monitor.baseURL = baseurl;
monitors[i].Monitor.controlURL = controlURL;


debug ("Storing baseurl="+baseurl+" streamingURL="+st+" recordingURL="+controlURL);
//console.log ("** Streaming="+st+" **base="+baseurl);
// starting 1.30 we have fid=xxx mode to return images
monitors[i].Monitor.imageMode = (versionCompare($rootScope.apiVersion, "1.30") == -1) ? "path" : "fid";
Expand Down
2 changes: 1 addition & 1 deletion www/js/EventCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ angular.module('zmApp.controllers')
$scope.showImage = function (p, f, fid, e, imode, id, parray, ndx) {
var img;

console.log ("P="+p+" F="+f+" E="+e+" imode="+imode+" id="+id+" parray="+JSON.stringify(parray)+" ndx="+ndx);
// console.log ("P="+p+" F="+f+" E="+e+" imode="+imode+" id="+id+" parray="+JSON.stringify(parray)+" ndx="+ndx);

//console.log ("HERE");
$scope.kFrame = $translate.instant('kFrame');
Expand Down

0 comments on commit 022cd0c

Please sign in to comment.