aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-29 13:26:11 -0700
committerAdam Soltys <[email protected]>2026-10-29 13:26:11 -0700
commit59cd71ff935b36aa1298ae1a9ede516930890ef9 (patch)
tree05fde263e986667da8f4286a2877c3aeda9f0134
parent344ff3f24cad678b3121e6c257e1a412e9efd3d6 (diff)
downloadcoinosv3-server-59cd71ff935b36aa1298ae1a9ede516930890ef9.tar.gz
coinosv3-server-59cd71ff935b36aa1298ae1a9ede516930890ef9.zip
names: GET /hats/worn lists every head wearing a hat (a couple of dozen), so coinos holds the whole list and a face it has never seen gets its hat in the first paint instead of after a per-head lookupHEADmaster
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6TUeqTyZB8eXLGymUY
-rw-r--r--names/server.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/names/server.js b/names/server.js
index ec60e86..0829c47 100644
--- a/names/server.js
+++ b/names/server.js
@@ -1578,6 +1578,19 @@ Bun.serve({
return json({ hats });
}
+ // Every head wearing a hat, in one go (a couple of dozen today): the
+ // client holds the whole list, so a face it has never seen gets its hat
+ // in the first paint instead of after a lookup.
+ if (url.pathname === '/hats/worn' && req.method === 'GET') {
+ const net = hatNetOf(url.searchParams.get('net'));
+ const hats = {};
+ for (const pk of [...Object.keys(hatStore(net)), HAT_ADMIN_PK]) {
+ const e = hatRec(pk, net).equipped;
+ if (e) hats[pk] = e;
+ }
+ return json({ hats });
+ }
+
// The shop view: everything one pubkey owns, plus the price list (the
// client shows what the server would actually charge).
const hm = url.pathname.match(/^\/hats\/([0-9a-f]{64})$/);