diff options
Diffstat (limited to 'test-client/main.ts')
-rw-r--r-- | test-client/main.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/test-client/main.ts b/test-client/main.ts index b2a5ef46..4c1f28f0 100644 --- a/test-client/main.ts +++ b/test-client/main.ts @@ -39,9 +39,9 @@ export let canvas: HTMLCanvasElement; let ws: WebSocket; document.addEventListener("DOMContentLoaded", async () => { await init_locale() - const ws_uri = window.location.protocol.endsWith("s:") - ? `wss://${window.location.host}/` - : `ws://${window.location.hostname}:27032/` + const ws_uri = globalThis.location.protocol.endsWith("s:") + ? `wss://${globalThis.location.host}/` + : `ws://${globalThis.location.hostname}:27032/` ws = new WebSocket(ws_uri) ws.onerror = console.error ws.onmessage = m => { @@ -297,7 +297,12 @@ function packet(p: PacketC) { break; case "menu": switch (p.menu) { - case "book": open("https://s.metamuffin.org/static/hurrycurry/book.pdf"); break + case "document": + // TODO implement document format + if (JSON.stringify(p.data).search("b.toc") != -1) + open("https://s.metamuffin.org/static/hurrycurry/book.pdf"); + else alert("document display not supported yet") + break case "score": global_message = { timeout: { initial: 5, remaining: 5, pinned: false }, |