Hide unrevealed Cards pulls and show the odds players really get

Keep a pending opening's cards out of the home highlight and collection until
they are revealed, and refuse transfers meanwhile. Odds now ignore rarities a
pack cannot give. Stable files gain an ETag so card images revalidate instead
of downloading again, and logging out clears the local collection copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-05 18:00:32 +01:00
parent b2e46b1d2a
commit 155187d01f
11 changed files with 167 additions and 26 deletions

View file

@ -65,3 +65,35 @@ test("production server separates stable files from versioned assets", async (t)
assert.equal(missingBundle.status, 404);
assert.equal(missingBundle.headers.get("cache-control"), "no-store");
});
test("stable files can be revalidated with an ETag while no-store and immutable responses stay unconditional", async (t) => {
const root = await mkdtemp(join(tmpdir(), "sokko-server-etag-"));
await writeFixture(root, "index.html", "<main>Sokko G</main>");
await writeFixture(root, "assets/index-Ab12_cd34.js", "console.log('versioned');");
const imageFile = await writeFixture(root, "static/img/card.webp", "image-v1");
const server = createStaticServer({ root, publicRoot: root });
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
t.after(async () => {
await new Promise((resolve) => server.close(resolve));
await rm(root, { recursive: true, force: true });
});
const url = (path) => `http://127.0.0.1:${server.address().port}${path}`;
const first = await fetch(url("/static/img/card.webp"));
const etag = first.headers.get("etag");
assert.match(etag, /^W\/"/);
assert.equal(await first.text(), "image-v1");
const unchanged = await fetch(url("/static/img/card.webp"), { headers: { "If-None-Match": `"other", ${etag}` } });
assert.equal(unchanged.status, 304);
assert.equal(unchanged.headers.get("cache-control"), "no-cache");
assert.equal(await unchanged.text(), "");
await writeFile(imageFile, "image-version-2");
const replaced = await fetch(url("/static/img/card.webp"), { headers: { "If-None-Match": etag } });
assert.equal(replaced.status, 200);
assert.equal(await replaced.text(), "image-version-2");
assert.equal((await fetch(url("/"))).headers.get("etag"), null);
assert.equal((await fetch(url("/assets/index-Ab12_cd34.js"))).headers.get("etag"), null);
});