···1-import { parseResourceUri, type Did, type Handle } from '@atcute/lexicons';
0000002import { user } from './auth.svelte';
3import type { AllowedCollection } from './settings';
4import {
···428429 return response.data;
430}
0000000000000000000000000000
···1+import {
2+ parseResourceUri,
3+ type ActorIdentifier,
4+ type Did,
5+ type Handle,
6+ type ResourceUri
7+} from '@atcute/lexicons';
8import { user } from './auth.svelte';
9import type { AllowedCollection } from './settings';
10import {
···434435 return response.data;
436}
437+438+/**
439+ * Fetches posts by their AT URIs.
440+ * @param uris - Array of AT URIs (e.g., "at://did:plc:xyz/app.bsky.feed.post/abc123")
441+ * @param client - The client to use (defaults to public Bluesky API)
442+ * @returns Array of posts or undefined on failure
443+ */
444+export async function getPosts(data: { uris: string[]; client?: Client }) {
445+ data.client ??= new Client({
446+ handler: simpleFetchHandler({ service: 'https://public.api.bsky.app' })
447+ });
448+449+ const response = await data.client.get('app.bsky.feed.getPosts', {
450+ params: { uris: data.uris as ResourceUri[] }
451+ });
452+453+ if (!response.ok) return;
454+455+ return response.data.posts;
456+}
457+458+export function getHandleOrDid(profile: AppBskyActorDefs.ProfileViewDetailed): ActorIdentifier {
459+ if (profile.handle && profile.handle !== 'handle.invalid') {
460+ return profile.handle;
461+ } else {
462+ return profile.did;
463+ }
464+}
+1-1
src/lib/atproto/settings.ts
···4445// which PDS to use for signup
46// ATTENTION: pds.rip is only for development, all accounts get deleted automatically after a week
47-export const signUpPDS = 'https://selfhosted.social/';
···4445// which PDS to use for signup
46// ATTENTION: pds.rip is only for development, all accounts get deleted automatically after a week
47+export const signUpPDS = 'https://pds.rip/';