mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-07-27 21:36:41 -04:00
fix: honor explicit port argument in urlToApi single-server case
The single-server branch added in 0950131b2 ignored the optional port
argument and always used location.host. Mirror the multi-server branch
by preferring port > location.host.
This commit is contained in:
@@ -49,7 +49,7 @@ var Server = function() {
|
||||
const path = (this.PathToApi && (this.PathToApi != 'null')) ? this.PathToApi : '';
|
||||
// Single-server: match browser's host:port (this.Hostname/Port may be wrong behind a proxy).
|
||||
if (!this.Id) {
|
||||
return protocol + '//' + location.host + path;
|
||||
return protocol + '//' + (port ? location.hostname + ':' + port : location.host) + path;
|
||||
}
|
||||
return protocol + '//' + this.Hostname + (port ? ':' + port : (this.Port ? ':' + this.Port : (location.port ? ':' + location.port : ''))) + path;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user