From 5099cf67e73652bdca8e98243b76c459597d3dfe Mon Sep 17 00:00:00 2001 From: Eric Wagoner Date: Tue, 27 Oct 2026 12:54:54 -0400 Subject: [PATCH] The glass board is open to everyone: the gate and its word are gone, and the toggle shows under the flat boards at every table and on the told game The flat boards stay the default; the glass board is a tap away. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01CCLa2PaEeCj8njQZSWGqHx --- README.md | 6 ++--- src/lib/components/Board.svelte | 5 +--- src/lib/components/Hall.svelte | 1 - src/lib/glass.svelte.ts | 37 ------------------------------ src/routes/learn/game/+page.svelte | 5 +--- 5 files changed, 5 insertions(+), 49 deletions(-) delete mode 100644 src/lib/glass.svelte.ts diff --git a/README.md b/README.md index a2af100..23b2c06 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,9 @@ tables, the Peanut Gallery, the ledgers and the ops tools are the kit's; takes the same taps as the flat boards. The figures in `static/figures/` are glTF, one per kind, with a `livery` material the view recolours per side; `docs/figures-brief.md` is what they were made from. three.js and - the figures load only when the view is opened. Until the keeper opens it - to everyone, the view shows only to a browser let in through - `src/lib/glass.svelte.ts`. + the figures load only when the view is opened. The flat boards are the + default; the glass board is offered under them at the table and on the + told game. - The guide's figures are screenshots in `static/guide/`, taken from the running site at 960 pixels wide. diff --git a/src/lib/components/Board.svelte b/src/lib/components/Board.svelte index efa3df8..36b71c8 100644 --- a/src/lib/components/Board.svelte +++ b/src/lib/components/Board.svelte @@ -14,7 +14,6 @@ } from '$lib/game'; import type { Room } from '$lib/net/room.svelte'; import { prefs, reducedMotion } from '$lib/prefs.svelte'; - import { glass } from '$lib/glass.svelte'; let { room }: { room: Room } = $props(); @@ -218,9 +217,7 @@ {/if} {#if room.error}

{room.error}

{/if} - {#if glass.open} -

- {/if} +

{#if onGlass && Glass} {:else} diff --git a/src/lib/components/Hall.svelte b/src/lib/components/Hall.svelte index 132d14d..5cf2802 100644 --- a/src/lib/components/Hall.svelte +++ b/src/lib/components/Hall.svelte @@ -8,7 +8,6 @@ import TallyBoard from './Tally.svelte'; import Preferences from './Preferences.svelte'; import { prefs, setPref } from '$lib/prefs.svelte'; - import '$lib/glass.svelte'; import { allSeats, doubtSeat, forgetSeat, rememberSeat, ServerError, trustSeat } from '$lib/net/client'; import { api, NAME_MAX, playerName, rememberName, Room } from '$lib/net/room.svelte'; import { unreadTalk } from '$lib/net/talk'; diff --git a/src/lib/glass.svelte.ts b/src/lib/glass.svelte.ts deleted file mode 100644 index 660c547..0000000 --- a/src/lib/glass.svelte.ts +++ /dev/null @@ -1,37 +0,0 @@ -// The glass board, the three-dimensional view of a game, is shown only to -// a browser that has been let in. A visit to any page with ?glass= -// opens it for that browser, if the word's hash is the one kept here; the -// word itself is nowhere in the site. Until the keeper decides the view is -// ready for everyone, this is the whole of the gate. - -const KEY = 'wyrm:glass'; -const GATE = 'eec81ab3bd646536b3464bb0411aea9b2e92e6387c6a04ef15743191ac4d142f'; - -function remembered(): boolean { - try { - return localStorage.getItem(KEY) === '1'; - } catch { - return false; - } -} - -/** Whether this browser may open the glass board. */ -export const glass = $state({ open: typeof localStorage !== 'undefined' && remembered() }); - -/** Let the browser in if the address carries the word, and remember it. */ -export async function claimGlass(): Promise { - if (glass.open || typeof location === 'undefined') return; - const word = new URLSearchParams(location.search).get('glass'); - if (!word) return; - const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(word)); - const hex = Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, '0')).join(''); - if (hex !== GATE) return; - glass.open = true; - try { - localStorage.setItem(KEY, '1'); - } catch { - // Opened for this visit only. - } -} - -if (typeof location !== 'undefined') void claimGlass(); diff --git a/src/routes/learn/game/+page.svelte b/src/routes/learn/game/+page.svelte index b539d0b..41a8d34 100644 --- a/src/routes/learn/game/+page.svelte +++ b/src/routes/learn/game/+page.svelte @@ -7,7 +7,6 @@ import { narrate } from '$lib/game/chronicle'; import { notation, kingSquare, inCheck, movesFrom, legalMovesFrom, sideOf } from '$lib/game'; import { prefs, reducedMotion } from '$lib/prefs.svelte'; - import { glass } from '$lib/glass.svelte'; /** The glass board, loaded the first time it is asked for. */ let Glass = $state(null); @@ -79,9 +78,7 @@
- {#if glass.open} -

- {/if} +

{#if onGlass && Glass} {:else}