your personal website on atproto - mirror blento.app

manage handle not found

jycouet c1b45b9a a30b2b5d

+22 -5
+7 -2
src/lib/atproto/methods.ts
··· 10 } from '@atcute/identity-resolver'; 11 import { Client, simpleFetchHandler } from '@atcute/client'; 12 import type { AppBskyActorDefs } from '@atcute/bluesky'; 13 14 export type Collection = `${string}.${string}.${string}`; 15 ··· 30 } 31 }); 32 33 - const data = await handleResolver.resolve(handle); 34 - return data; 35 } 36 37 const didResolver = new CompositeDidDocumentResolver({
··· 10 } from '@atcute/identity-resolver'; 11 import { Client, simpleFetchHandler } from '@atcute/client'; 12 import type { AppBskyActorDefs } from '@atcute/bluesky'; 13 + import { redirect } from '@sveltejs/kit'; 14 15 export type Collection = `${string}.${string}.${string}`; 16 ··· 31 } 32 }); 33 34 + try { 35 + const data = await handleResolver.resolve(handle); 36 + return data; 37 + } catch (error) { 38 + redirect(307, '/?error=handle_not_found&handle=' + handle); 39 + } 40 } 41 42 const didResolver = new CompositeDidDocumentResolver({
-2
src/lib/website/EditableWebsite.svelte
··· 756 {handleImageInputChange} 757 {handleVideoInputChange} 758 /> 759 - 760 - <Toaster /> 761 </Context>
··· 756 {handleImageInputChange} 757 {handleVideoInputChange} 758 /> 759 </Context>
+15 -1
src/routes/+layout.svelte
··· 1 <script lang="ts"> 2 import '../app.css'; 3 4 - import { ThemeToggle } from '@foxui/core'; 5 import { onMount } from 'svelte'; 6 import { initClient } from '$lib/atproto'; 7 import YoutubeVideoPlayer, { videoPlayer } from '$lib/components/YoutubeVideoPlayer.svelte'; 8 9 let { children } = $props(); 10 11 onMount(() => { 12 initClient(); 13 }); 14 </script> 15 16 {@render children()} 17 18 <ThemeToggle class="fixed top-2 left-2 z-10" /> 19 20 {#if videoPlayer.id} 21 <YoutubeVideoPlayer />
··· 1 <script lang="ts"> 2 import '../app.css'; 3 4 + import { ThemeToggle, Toaster, toast } from '@foxui/core'; 5 import { onMount } from 'svelte'; 6 import { initClient } from '$lib/atproto'; 7 import YoutubeVideoPlayer, { videoPlayer } from '$lib/components/YoutubeVideoPlayer.svelte'; 8 + import { page } from '$app/state'; 9 + import { goto } from '$app/navigation'; 10 11 let { children } = $props(); 12 + 13 + const errorMessages: Record<string, (params: URLSearchParams) => string> = { 14 + handle_not_found: (p) => `Handle ${p.get('handle') ?? ''} not found!` 15 + }; 16 17 onMount(() => { 18 initClient(); 19 + 20 + const error = page.url.searchParams.get('error'); 21 + if (error) { 22 + const msg = errorMessages[error]?.(page.url.searchParams) ?? error; 23 + toast.error(msg); 24 + goto(page.url.pathname, { replaceState: true }); 25 + } 26 }); 27 </script> 28 29 {@render children()} 30 31 <ThemeToggle class="fixed top-2 left-2 z-10" /> 32 + <Toaster /> 33 34 {#if videoPlayer.id} 35 <YoutubeVideoPlayer />