Fix websockets on other ports than 80

pull/166/head
Henrique Dias 2017-07-27 14:02:50 +01:00
parent 01a9896b19
commit 736e7d6167
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
1 changed files with 2 additions and 2 deletions

View File

@ -163,7 +163,7 @@ function checksum (url, algo) {
function command (url, command, onmessage, onclose) {
let protocol = (ssl ? 'wss:' : 'ws:')
url = removePrefix(url)
url = `${protocol}//${window.location.hostname}${store.state.baseURL}/api/command${url}`
url = `${protocol}//${window.location.host}${store.state.baseURL}/api/command${url}`
let conn = new window.WebSocket(url)
conn.onopen = () => conn.send(command)
@ -174,7 +174,7 @@ function command (url, command, onmessage, onclose) {
function search (url, search, onmessage, onclose) {
let protocol = (ssl ? 'wss:' : 'ws:')
url = removePrefix(url)
url = `${protocol}//${window.location.hostname}${store.state.baseURL}/api/search${url}`
url = `${protocol}//${window.location.host}${store.state.baseURL}/api/search${url}`
let conn = new window.WebSocket(url)
conn.onopen = () => conn.send(search)