audio streaming app plyr.fm
38
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix AT-URI resolution: handle :// normalization via reroute hook (#1210)

Cloudflare collapses // to / in URL paths, so /at://did:plc:xxx/...
arrives as /at:/did:plc:xxx/... which doesn't match the routes/at/
directory. add a SvelteKit reroute hook that normalizes /at:/ and
/at:// prefixes to /at/ before routing.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

authored by

nate nowack
Claude Opus 4.6
and committed by
GitHub
5a686432 5ce55496

+16
+16
frontend/src/hooks.ts
··· 1 + import type { Reroute } from '@sveltejs/kit'; 2 + 3 + /** 4 + * rewrite at:// URI paths so they match the /at/[...uri] route. 5 + * 6 + * CDNs (Cloudflare) collapse "//" to "/" in URL paths, so a request for 7 + * /at://did:plc:xxx/fm.plyr.track/rkey arrives as /at:/did:plc:xxx/... 8 + * which doesn't match the routes/at/ directory. this hook normalizes 9 + * /at:/ and /at:// prefixes to /at/ before routing. 10 + */ 11 + export const reroute: Reroute = ({ url }) => { 12 + const match = url.pathname.match(/^\/at:\/{0,2}(.+)/); 13 + if (match) { 14 + return `/at/${match[1]}`; 15 + } 16 + };