summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-12-23 17:09:43 +0100
committermetamuffin <metamuffin@disroot.org>2024-12-23 17:09:43 +0100
commit654aa3d508927ccf7c8806b8109c62ba9ed0a58f (patch)
tree59a50129f8f8e86a0471e276e938448a3cbbf759
parentbd71cd120fa4d8caf4987fd9c76838ccbeec19f7 (diff)
downloadhurrycurry-654aa3d508927ccf7c8806b8109c62ba9ed0a58f.tar
hurrycurry-654aa3d508927ccf7c8806b8109c62ba9ed0a58f.tar.bz2
hurrycurry-654aa3d508927ccf7c8806b8109c62ba9ed0a58f.tar.zst
test client document packet
-rw-r--r--test-client/main.ts13
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 },