a tool for shared writing and social publishing
0
fork

Configure Feed

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

use public bsky endpoint and cache for postdata

+20 -15
+20 -15
app/lish/[did]/[publication]/[rkey]/page.tsx
··· 64 64 </p> 65 65 </div> 66 66 ); 67 - let identity = await getIdentityData(); 68 - let agent; 69 - if (identity?.atp_did) { 70 - const oauthClient = await createOauthClient(); 71 - let credentialSession = await oauthClient.restore(identity.atp_did); 72 - agent = new Agent(credentialSession); 73 - } else agent = new AtpAgent({ service: "https://public.api.bsky.app" }); 67 + let agent = new AtpAgent({ 68 + service: "https://public.api.bsky.app", 69 + fetch: (...args) => 70 + fetch(args[0], { 71 + ...args[1], 72 + cache: "no-store", 73 + next: { revalidate: 3600 }, 74 + }), 75 + }); 74 76 let [document, profile] = await Promise.all([ 75 77 getPostPageData( 76 78 AtUri.make( ··· 100 102 }); 101 103 let bskyPostData = 102 104 bskyPosts.length > 0 103 - ? await agent.getPosts({ 104 - uris: bskyPosts 105 - .map((p) => { 106 - let block = p?.block as PubLeafletBlocksBskyPost.Main; 107 - return block.postRef.uri; 108 - }) 109 - .slice(0, 24), 110 - }) 105 + ? await agent.getPosts( 106 + { 107 + uris: bskyPosts 108 + .map((p) => { 109 + let block = p?.block as PubLeafletBlocksBskyPost.Main; 110 + return block.postRef.uri; 111 + }) 112 + .slice(0, 24), 113 + }, 114 + { headers: {} }, 115 + ) 111 116 : { data: { posts: [] } }; 112 117 let firstPage = record.pages[0]; 113 118 let blocks: PubLeafletPagesLinearDocument.Block[] = [];