commit 6b4dedf9f92a911371d7f3f656f96c3b78348e2a parent 6868af5a8a169796590b2e7ff6595f2166445b77 Author: Jack Mordaunt <jackmordaunt@gmail.com> Date: Thu, 15 Nov 2018 15:36:00 +1300 [+] Dynamically resolve api endpoint. Diffstat:
| M | cmd/desktop/ui/src/App.vue | | | 5 | +++-- |
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/cmd/desktop/ui/src/App.vue b/cmd/desktop/ui/src/App.vue @@ -150,7 +150,8 @@ export default { } // console.log("waiting for download to be ready...") let { file, info } = resp.data - let updates = new WebSocket(`ws://localhost:8081${info}`) + let updates = new WebSocket(((window.location.protocol === "https:") ? "wss://" : "ws://") + window.location.host + info) + updates.onmessage = (msg) => { this.loading = false updates.close() @@ -165,7 +166,7 @@ export default { return } // console.log("ready to download!") - this.link = `http://localhost:8081${file}` + this.link = `${file}` } }) .catch(err => {