fix(webui): works now with https port 443 (#924)

* Websocket fix for SSL reverse proxies

* docs: add changelog

Co-authored-by: Sersch <edeltraud70@gmx.de>
This commit is contained in:
m33ts4k0z 2020-08-02 22:18:42 +02:00 committed by GitHub
parent 94c23653de
commit d1a2b77ce3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
### Fixed
- webui: Works now with https port 443 (#923 with #924)
### Removed
## [2.0.0-alpha.7](https://github.com/hyperion-project/hyperion.ng/releases/tag/2.0.0-alpha.7) - 2020-07-23

View File

@ -76,7 +76,13 @@ function initWebSocket()
{
if (window.websocket == null)
{
window.jsonPort = (document.location.port == '') ? '80' : document.location.port;
window.jsonPort = '';
if(document.location.port == '' && document.location.protocol == "http:")
window.jsonPort = '80';
else if (document.location.port == '' && document.location.protocol == "https:")
window.jsonPort = '443';
else
window.jsonPort = document.location.port;
window.websocket = (document.location.protocol == "https:") ? new WebSocket('wss://'+document.location.hostname+":"+window.jsonPort) : new WebSocket('ws://'+document.location.hostname+":"+window.jsonPort);
window.websocket.onopen = function (event) {