diff options
Diffstat (limited to 'web/script/player/sync.ts')
-rw-r--r-- | web/script/player/sync.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/web/script/player/sync.ts b/web/script/player/sync.ts index 29a7c80..eabd360 100644 --- a/web/script/player/sync.ts +++ b/web/script/player/sync.ts @@ -82,11 +82,11 @@ export class Playersync { channel_name ??= Math.random().toString(16).padEnd(5, "0").substring(2).substring(0, 6) let [localpart, remotepart, port] = channel_name.split(":") - if (!remotepart?.length) remotepart = window.location.host + if (!remotepart?.length) remotepart = globalThis.location.host if (port) remotepart += ":" + port this.name = localpart + ":" + remotepart - this.ws = new WebSocket(`${window.location.protocol.endsWith("s:") ? "wss" : "ws"}://${remotepart}/playersync/${encodeURIComponent(localpart)}`) + this.ws = new WebSocket(`${globalThis.location.protocol.endsWith("s:") ? "wss" : "ws"}://${remotepart}/playersync/${encodeURIComponent(localpart)}`) this.on_destroy.push(() => this.ws.close()) this.ws.onopen = () => { |