Compact short share links (personas.draftbit.com/<code>)#84
Open
bluerssen wants to merge 1 commit into
Open
Conversation
Share buttons now emit personas.draftbit.com/<code> where the code is a bit-packed base64url encoding of the avatar config (12 chars for palette colors, 31 max with custom hex). No storage: the code is the config. The address bar keeps the readable query-param form. - shareUrl.js: v1 codec (4-bit version, per-category style indices, flagged palette-index-or-raw-hex colors); config arrays are now append-only, documented in the file header - worker/index.js (new): serves the SPA shell for code paths, exposes GET /api/options (config JSON, CORS *), falls through to assets; run_worker_first with asset-dir exclusions so browser navigations reach the worker instead of the asset layer's own 404 handling - Modal gets the short URL via prop for Copy Link and the tweet intent Verified: 127-case codec round-trip suite in Node; wrangler dev in a real browser (code decodes, URL normalizes, share buttons emit short form, assets and 404s unaffected). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Share links shrink from ~200-char query strings to
personas.draftbit.com/<code>— 12 characters for palette-color avatars, up to 31 with custom hex colors. Stateless: the code is the bit-packed avatar config (no KV, nothing to expire or migrate).shareUrl.js: 4-bit version + per-category style indices + per-colorpalette-index | raw-hexflag bits, base64url. Decode failures fall back to a random avatar. Config arrays are now append-only (indices live in shared links) — documented in the file header; the version nibble covers future breaking changes.GET /api/options(valid styles/palettes as JSON, CORS*— also groundwork for the LLM/API PR).run_worker_firstwith asset-dir exclusions, because Cloudflare's asset layer otherwise answers browser navigations (Sec-Fetch-Mode: navigate) with its own 404 before the worker runs.?hair=...form (self-documenting, hand-constructable); Copy Link and the tweet intent use the short form. Long URLs keep working forever.Verification
wrangler dev+ headless browser:/EpCSCBgBgACAboots the SPA to the exact encoded avatar and normalizes the URL; Copy Link/tweet emit the short URL;/favicon.png200; garbage and deep paths 404🤖 Generated with Claude Code