diff --git a/src/site-tools.ts b/src/site-tools.ts index a76c3e3..3a400b2 100644 --- a/src/site-tools.ts +++ b/src/site-tools.ts @@ -29,27 +29,6 @@ export function sameOriginSiteUrl(currentUrl, value) { return target.href; } -export function pixePuzzleNavigationUrl(currentUrl, puzzleKey) { - let current; - try { - current = new URL(String(currentUrl || "")); - } catch { - return ""; - } - const key = String(puzzleKey || ""); - const validKey = /^L[1-9]\d{0,5}$/.test(key) || - (/^D\d{4}-\d{2}-\d{2}$/.test(key) && - !Number.isNaN(Date.parse(key.slice(1)))); - if ( - current.hostname !== "pixe.frgmt.xyz" || - current.pathname !== "/" || - !validKey - ) { - return ""; - } - return new URL(`/play/${key}`, current).href; -} - export function normalizeSiteHeaders(value) { if (!isRecord(value)) return {}; const headers = {}; diff --git a/tests/node/site-tools.test.ts b/tests/node/site-tools.test.ts index 77774e6..e223554 100644 --- a/tests/node/site-tools.test.ts +++ b/tests/node/site-tools.test.ts @@ -3,7 +3,6 @@ import test from "node:test"; import { normalizeSiteHeaders, - pixePuzzleNavigationUrl, sameOriginSiteUrl, siteTextExcerpts, } from "../../dist/src/site-tools.js"; @@ -23,29 +22,6 @@ test("site helpers resolve relative URLs but reject cross-origin access", () => ); }); -test("Pixe puzzle cards use bounded direct routes on the lightweight DOM backend", () => { - assert.equal( - pixePuzzleNavigationUrl("https://pixe.frgmt.xyz/", "L12"), - "https://pixe.frgmt.xyz/play/L12", - ); - assert.equal( - pixePuzzleNavigationUrl("https://pixe.frgmt.xyz/", "D2026-08-06"), - "https://pixe.frgmt.xyz/play/D2026-08-06", - ); - assert.equal( - pixePuzzleNavigationUrl("https://pixe.frgmt.xyz/play/L1", "L2"), - "", - ); - assert.equal( - pixePuzzleNavigationUrl("https://example.com/", "L1"), - "", - ); - assert.equal( - pixePuzzleNavigationUrl("https://pixe.frgmt.xyz/", "../admin"), - "", - ); -}); - test("site.request headers preserve the browser's credential boundary", () => { assert.deepEqual(normalizeSiteHeaders({ Accept: "application/json" }), { accept: "application/json",