diff --git a/spug_web/src/pages/deploy/do/Ext1Index.js b/spug_web/src/pages/deploy/do/Ext1Index.js index 81a3a2f..74b0572 100644 --- a/spug_web/src/pages/deploy/do/Ext1Index.js +++ b/spug_web/src/pages/deploy/do/Ext1Index.js @@ -37,7 +37,8 @@ class Ext1Index extends React.Component { .then(({token, outputs}) => { store.request.status = '2'; store.outputs = outputs; - this.socket = new WebSocket(`ws://localhost:8000/ws/exec/${token}/`); + const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; + this.socket = new WebSocket(`${protocol}//${window.location.host}/api/ws/exec/${token}/`); this.socket.onopen = () => { this.socket.send('ok'); }; diff --git a/spug_web/src/pages/deploy/do/Ext2Index.js b/spug_web/src/pages/deploy/do/Ext2Index.js index f7b418c..c685e11 100644 --- a/spug_web/src/pages/deploy/do/Ext2Index.js +++ b/spug_web/src/pages/deploy/do/Ext2Index.js @@ -37,7 +37,8 @@ class Ext1Index extends React.Component { .then(({token, outputs}) => { store.request.status = '2'; store.outputs = outputs; - this.socket = new WebSocket(`ws://localhost:8000/ws/exec/${token}/`); + const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; + this.socket = new WebSocket(`${protocol}//${window.location.host}/api/ws/exec/${token}/`); this.socket.onopen = () => { this.socket.send('ok'); }; diff --git a/spug_web/src/pages/exec/task/ExecConsole.js b/spug_web/src/pages/exec/task/ExecConsole.js index 9785430..687b99b 100644 --- a/spug_web/src/pages/exec/task/ExecConsole.js +++ b/spug_web/src/pages/exec/task/ExecConsole.js @@ -17,7 +17,8 @@ class ExecConsole extends React.Component { } componentDidMount() { - this.socket = new WebSocket(`ws://localhost:8000/ws/exec/${store.token}/`); + const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; + this.socket = new WebSocket(`${protocol}//${window.location.host}/api/ws/exec/${store.token}/`); this.socket.onopen = () => { this.socket.send('ok'); for (let item of Object.values(store.outputs)) {