From 34ef3de7374e1a213438175d034cec09cc6ab006 Mon Sep 17 00:00:00 2001 From: Travis McLane Date: Thu, 2 Jan 2020 05:43:34 -0600 Subject: [PATCH] [313-remote-conn] allow remote connections to the websocket bridge (#314) * [313-remote-conn] feat: compute wsURL based on window.location * [313-remote-conn] feat: allow any host to connect to vue server removing the 'host: "localhost"' specification causes the development server to listen on all interfaces. * [313-remote-conn] feat: allow any host to connect to angular dev server * test: reinject tabs Co-authored-by: Lea Anthony --- cmd/templates/angular-template/frontend/package.json.template | 2 +- cmd/templates/vuebasic/frontend/vue.config.js | 3 +-- cmd/templates/vuetify-basic/frontend/vue.config.js | 3 +-- runtime/assets/bridge.js | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cmd/templates/angular-template/frontend/package.json.template b/cmd/templates/angular-template/frontend/package.json.template index 640bcea4a..7b2ae8278 100644 --- a/cmd/templates/angular-template/frontend/package.json.template +++ b/cmd/templates/angular-template/frontend/package.json.template @@ -3,7 +3,7 @@ "version": "0.0.0", "scripts": { "ng": "npx ng", - "start": "npx ng serve --poll=2000", + "start": "npx ng serve --poll=2000 --host=0.0.0.0", "build": "npx ng build --single-bundle true --output-hashing none --prod --bundle-styles false", "test": "npx ng test", "lint": "npx ng lint", diff --git a/cmd/templates/vuebasic/frontend/vue.config.js b/cmd/templates/vuebasic/frontend/vue.config.js index 471d578f5..a2691b1f7 100644 --- a/cmd/templates/vuebasic/frontend/vue.config.js +++ b/cmd/templates/vuebasic/frontend/vue.config.js @@ -37,7 +37,6 @@ module.exports = { } }, devServer: { - disableHostCheck: true, - host: "localhost" + disableHostCheck: true } }; diff --git a/cmd/templates/vuetify-basic/frontend/vue.config.js b/cmd/templates/vuetify-basic/frontend/vue.config.js index 471d578f5..a2691b1f7 100644 --- a/cmd/templates/vuetify-basic/frontend/vue.config.js +++ b/cmd/templates/vuetify-basic/frontend/vue.config.js @@ -37,7 +37,6 @@ module.exports = { } }, devServer: { - disableHostCheck: true, - host: "localhost" + disableHostCheck: true } }; diff --git a/runtime/assets/bridge.js b/runtime/assets/bridge.js index 9c786221e..5c2f73ee3 100644 --- a/runtime/assets/bridge.js +++ b/runtime/assets/bridge.js @@ -14,7 +14,7 @@ function init() { window.wailsbridge = { reconnectOverlay: null, reconnectTimer: 300, - wsURL: 'ws://localhost:34115/bridge', + wsURL: 'ws://' + window.location.hostname + ':34115/bridge', connectionState: null, config: {}, websocket: null,