From 16e47163ec0ac032b21504fa05f87b6b4e7b2ae9 Mon Sep 17 00:00:00 2001 From: Yohann Streibel <159243091+y-streibel-uiris@users.noreply.github.com> Date: Thu, 18 Dec 2025 00:16:15 +0100 Subject: [PATCH] Refactor WebSocket connection to support HTTPS --- data/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/index.js b/data/index.js index 2a70854..8521ccb 100644 --- a/data/index.js +++ b/data/index.js @@ -469,7 +469,9 @@ async function initSockets() { ui.waitMessage(document.getElementById('divContainer')).classList.add('socket-wait'); let host = window.location.protocol === 'file:' ? hst : window.location.hostname; try { - socket = new WebSocket(`ws://${host}:8080/`); + const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; + const port = window.location.protocol === 'https:' ? '' : ':8080'; + socket = new WebSocket(`${protocol}//${host}${port}/`); socket.onmessage = (evt) => { if (evt.data.startsWith('42')) { let ndx = evt.data.indexOf(',');