ui: fix websocket connection to alt host when not logged in

This commit is contained in:
undefined committed 2023-11-28 01:47:12 +08:00
1 parent 599a177f46
commit ef9f671b35
1 file changed
+3 -1
@@ -6,7 +6,9 @@ export default class Sock {
constructor(public url: string, nocookie = false) {
const i = new URL(url, window.location.href);
if (i.host !== window.location.host && !nocookie) i.searchParams.append('sid', document.cookie.split('sid=')[1].split(';')[0]);
if (i.host !== window.location.host && !nocookie && document.cookie.includes('sid=')) {
i.searchParams.append('sid', document.cookie.split('sid=')[1].split(';')[0]);
}
i.protocol = i.protocol.replace('http', 'ws');
this.url = i.toString();
this.sock = new ReconnectingWebSocket(this.url, [], {