Browse Source

Fixes fetchWsUrl

pull/5308/head
Splash 4 months ago
committed by GitHub
parent
commit
f551c31010
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 10
      src/static/scripts/admin_diagnostics.js

10
src/static/scripts/admin_diagnostics.js

@ -349,7 +349,13 @@ async function checkHttpResponse() {
async function fetchWsUrl(wsUrl) {
return new Promise((resolve, reject) => {
try {
const ws = new WebSocket(wsUrl);
const url = new URL(wsUrl);
if (url.protocol == 'http:') {
url.protocol = 'ws:';
} else if (url.protocol == 'https:') {
url.protocol = 'wss:';
}
const ws = new WebSocket(url.href);
ws.onopen = () => {
ws.close();
resolve(true);
@ -424,4 +430,4 @@ document.addEventListener("DOMContentLoaded", (event) => {
if (btnCopySupport) {
btnCopySupport.addEventListener("click", copyToClipboard);
}
});
});

Loading…
Cancel
Save