audio streaming app plyr.fm
38
fork

Configure Feed

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

fix AT-URI error pages: render in app layout, add profile redirect (#1211)

+server.ts returned raw error responses outside the app shell.
converting to +page.server.ts ensures errors render through +error.svelte
with proper styling. also adds .actor.profile → /u/{did} redirect.

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

authored by

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

+9 -2
+3
frontend/src/routes/at/[...uri]/+page.svelte
··· 1 + <script lang="ts"> 2 + // this page never renders — +page.server.ts always throws a redirect or error 3 + </script>
+6 -2
frontend/src/routes/at/[...uri]/+server.ts frontend/src/routes/at/[...uri]/+page.server.ts
··· 1 1 import { error, redirect } from '@sveltejs/kit'; 2 2 import { AtUri } from '@atproto/api'; 3 3 import { API_URL } from '$lib/config'; 4 - import type { RequestHandler } from './$types'; 4 + import type { PageServerLoad } from './$types'; 5 5 6 6 /** 7 7 * resolve AT-URIs to canonical plyr.fm pages. ··· 9 9 * handles URLs like: https://plyr.fm/at://did:plc:xxx/fm.plyr.track/rkey 10 10 * browsers may normalize the :// so we accept multiple path forms. 11 11 */ 12 - export const GET: RequestHandler = async ({ params, fetch }) => { 12 + export const load: PageServerLoad = async ({ params, fetch }) => { 13 13 // reconstruct AT-URI from the catch-all path segment. 14 14 // browsers may collapse "://" to ":/" or strip it entirely, 15 15 // so we normalize by stripping any leading ":/" or "://" prefix. ··· 50 50 } 51 51 const playlist: { id: number } = await response.json(); 52 52 throw redirect(301, `/playlist/${playlist.id}`); 53 + } 54 + 55 + if (uri.collection.endsWith('.actor.profile')) { 56 + throw redirect(301, `/u/${uri.hostname}`); 53 57 } 54 58 55 59 throw error(404, `unsupported collection: ${uri.collection}`);