diff options
| author | pliablepixels <pliablepixels@gmail.com> | 2016-05-03 20:19:32 -0400 |
|---|---|---|
| committer | pliablepixels <pliablepixels@gmail.com> | 2016-05-03 20:19:32 -0400 |
| commit | b328356494410d2b2498c74ca9c54129b3e25e39 (patch) | |
| tree | 4d304aeac514bea9e7907873460e9ed4f05a82e8 /www/js/DataModel.js | |
| parent | 498d2983c9be14a80e6a1e21f73507e46ba00996 (diff) | |
#241 - using baseurl of the remote server instead of local server
Former-commit-id: 9fb4be48834421c47788a9aa3f280546e6525612
Diffstat (limited to 'www/js/DataModel.js')
| -rw-r--r-- | www/js/DataModel.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index e5d366c4..eda58e8a 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -1028,8 +1028,11 @@ angular.module('zmApp.controllers') zmDebug ("portal parsed is " + JSON.stringify(p)); var st = ""; + var baseurl = ""; + st+= (s.scheme? s.scheme: p.scheme)+"://"; // server scheme overrides + // if server doesn't have a protocol, what we want is in path if (!s.host) { @@ -1038,13 +1041,22 @@ angular.module('zmApp.controllers') } st+=s.host; + + if (p.port || s.port) { st+= (s.port ? ":"+s.port: ":"+p.port); + } + + baseurl = st; + st+= (s.path? s.path: p.path); monitors[i].Monitor.streamingURL = st; + monitors[i].Monitor.baseURL = baseurl; + zmDebug ("Streaming URL for Monitor " + i + " is " + monitors[i].Monitor.streamingURL ); + zmDebug ("Base URL for Monitor " + i + " is " + monitors[i].Monitor.baseURL ); } } @@ -1060,7 +1072,9 @@ angular.module('zmApp.controllers') monitors[i].Monitor.isAlarmed = false; monitors[i].Monitor.connKey = (Math.floor((Math.random() * 999999) + 1)).toString(); monitors[i].Monitor.streamingURL = loginData.streamingurl; + monitors[i].Monitor.baseURL = loginData.url; + } d.resolve(monitors); @@ -1343,6 +1357,31 @@ angular.module('zmApp.controllers') } return "(Unknown)"; }, + + getStreamingURL: function (id) { + var idnum = parseInt(id); + for (var i = 0; i < monitors.length; i++) { + if (parseInt(monitors[i].Monitor.Id) == idnum) { + // console.log ("Matched, exiting getMonitorname"); + return monitors[i].Monitor.streamingURL; + } + + } + return "(Unknown)"; + }, + + getBaseURL: function (id) { + var idnum = parseInt(id); + for (var i = 0; i < monitors.length; i++) { + if (parseInt(monitors[i].Monitor.Id) == idnum) { + // console.log ("Matched, exiting getMonitorname"); + return monitors[i].Monitor.baseURL; + } + + } + return "(Unknown)"; + }, + }; }]); |
