From 0a0b471a039059d4e7ec5051ee10dc131b664577 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 25 Dec 2022 15:37:54 -0600 Subject: [PATCH] Add support for websockets over HTTP in addition to HTTPS --- tailbone/templates/datasync/status.mako | 4 ++-- tailbone/templates/upgrades/view.mako | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tailbone/templates/datasync/status.mako b/tailbone/templates/datasync/status.mako index 11c4aa12..6b9e02a9 100644 --- a/tailbone/templates/datasync/status.mako +++ b/tailbone/templates/datasync/status.mako @@ -200,8 +200,8 @@ ThisPage.mounted = function() { ## TODO: should be a cleaner way to get this url? - let url = '${request.route_url('ws.datasync.status')}' - url = url.replace(/^https?:/, 'wss:') + let url = '${url('ws.datasync.status')}' + url = url.replace(/^http(s?):/, 'ws$1:') this.ws = new WebSocket(url) let that = this diff --git a/tailbone/templates/upgrades/view.mako b/tailbone/templates/upgrades/view.mako index 61bb2264..7d83a332 100644 --- a/tailbone/templates/upgrades/view.mako +++ b/tailbone/templates/upgrades/view.mako @@ -211,8 +211,8 @@ ThisPage.methods.establishWebsocket = function() { ## TODO: should be a cleaner way to get this url? - url = '${request.route_url('ws.upgrades.execution_progress', _query={'uuid': instance.uuid})}' - url = url.replace(/^https?:/, 'wss:') + let url = '${url('ws.upgrades.execution_progress', _query={'uuid': instance.uuid})}' + url = url.replace(/^http(s?):/, 'ws$1:') this.ws = new WebSocket(url)