BlueSky & more on desktop lazurite.stormlightlabs.org/
tauri rust typescript bluesky appview atproto solid
2
fork

Configure Feed

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

at main 57 lines 1.9 kB view raw
1import { parseActorList, parseProfileFeed, parseProfileResult } from "$/lib/profile"; 2import type { CreateRecordResult, FlaggedFollow, FollowBatchResult, ProfileLookupResult } from "$/lib/types"; 3import { invoke } from "@tauri-apps/api/core"; 4 5async function getProfile(actor: string): Promise<ProfileLookupResult> { 6 return parseProfileResult(await invoke("get_profile", { actor })); 7} 8 9async function getAuthorFeed(actor: string, cursor?: string | null, limit?: number) { 10 return parseProfileFeed(await invoke("get_author_feed", { actor, cursor: cursor ?? null, limit: limit ?? null })); 11} 12 13async function getActorLikes(actor: string, cursor?: string | null, limit?: number) { 14 return parseProfileFeed(await invoke("get_actor_likes", { actor, cursor: cursor ?? null, limit: limit ?? null })); 15} 16 17async function followActor(did: string): Promise<CreateRecordResult> { 18 return invoke("follow_actor", { did }); 19} 20 21async function unfollowActor(followUri: string): Promise<void> { 22 return invoke("unfollow_actor", { followUri }); 23} 24 25async function getFollowers(actor: string, cursor?: string | null, limit?: number) { 26 return parseActorList( 27 await invoke("get_followers", { actor, cursor: cursor ?? null, limit: limit ?? null }), 28 "followers", 29 ); 30} 31 32async function getFollows(actor: string, cursor?: string | null, limit?: number) { 33 return parseActorList( 34 await invoke("get_follows", { actor, cursor: cursor ?? null, limit: limit ?? null }), 35 "follows", 36 ); 37} 38 39async function auditFollows(): Promise<FlaggedFollow[]> { 40 return invoke("audit_follows"); 41} 42 43async function batchUnfollow(followUris: string[]): Promise<FollowBatchResult> { 44 return invoke("batch_unfollow", { followUris }); 45} 46 47export const ProfileController = { 48 auditFollows, 49 batchUnfollow, 50 getProfile, 51 getAuthorFeed, 52 getActorLikes, 53 followActor, 54 unfollowActor, 55 getFollowers, 56 getFollows, 57};