anproto personal data server
2
fork

Configure Feed

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

Add /latest endpoint for last 5 minutes posts

+6
+6
serve.js
··· 81 81 const q = await apds.query() 82 82 return new Response(JSON.stringify(q), {headers: header}) 83 83 } 84 + if (key === 'latest') { 85 + const q = await apds.query() 86 + const cutoff = Date.now() - (5 * 60 * 1000) 87 + const latest = q.filter(m => m.ts && parseInt(m.ts) > cutoff) 88 + return new Response(JSON.stringify(latest), {headers: header}) 89 + } 84 90 if (q && q[0]) { 85 91 return new Response(JSON.stringify(q), {headers: header}) 86 92 } else if (await apds.get(key)) {