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:
Isaac Connor
2026-05-08 10:24:45 -04:00
parent 1b4f8127ad
commit afc792b583

View File

@@ -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;
}