···11-import { parseResourceUri, type Did, type Handle } from '@atcute/lexicons';
11+import {
22+ parseResourceUri,
33+ type ActorIdentifier,
44+ type Did,
55+ type Handle,
66+ type ResourceUri
77+} from '@atcute/lexicons';
28import { user } from './auth.svelte';
39import type { AllowedCollection } from './settings';
410import {
···428434429435 return response.data;
430436}
437437+438438+/**
439439+ * Fetches posts by their AT URIs.
440440+ * @param uris - Array of AT URIs (e.g., "at://did:plc:xyz/app.bsky.feed.post/abc123")
441441+ * @param client - The client to use (defaults to public Bluesky API)
442442+ * @returns Array of posts or undefined on failure
443443+ */
444444+export async function getPosts(data: { uris: string[]; client?: Client }) {
445445+ data.client ??= new Client({
446446+ handler: simpleFetchHandler({ service: 'https://public.api.bsky.app' })
447447+ });
448448+449449+ const response = await data.client.get('app.bsky.feed.getPosts', {
450450+ params: { uris: data.uris as ResourceUri[] }
451451+ });
452452+453453+ if (!response.ok) return;
454454+455455+ return response.data.posts;
456456+}
457457+458458+export function getHandleOrDid(profile: AppBskyActorDefs.ProfileViewDetailed): ActorIdentifier {
459459+ if (profile.handle && profile.handle !== 'handle.invalid') {
460460+ return profile.handle;
461461+ } else {
462462+ return profile.did;
463463+ }
464464+}
+1-1
src/lib/atproto/settings.ts
···44444545// which PDS to use for signup
4646// ATTENTION: pds.rip is only for development, all accounts get deleted automatically after a week
4747-export const signUpPDS = 'https://selfhosted.social/';
4747+export const signUpPDS = 'https://pds.rip/';