1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-05-10 05:33:56 +00:00

Fixes fetchWsUrl

This commit is contained in:
Splash 2024-12-18 16:03:30 +08:00 committed by GitHub
parent a523c82f5f
commit f551c31010
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);
}
});
});