Ionosphere.tv
3
fork

Configure Feed

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

feat: add getMentions XRPC endpoint

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+34
+34
apps/ionosphere-appview/src/routes.ts
··· 271 271 return c.json({ comments: [] }); 272 272 }); 273 273 274 + app.get("/xrpc/tv.ionosphere.getMentions", (c) => { 275 + const talkRkey = c.req.query("talkRkey"); 276 + if (!talkRkey) return c.json({ mentions: [], total: 0 }); 277 + 278 + const talk = db.prepare("SELECT uri FROM talks WHERE rkey = ?").get(talkRkey) as any; 279 + if (!talk) return c.json({ mentions: [], total: 0 }); 280 + 281 + const topLevel = db.prepare( 282 + `SELECT m.*, p.handle as author_handle, p.display_name as author_display_name, p.avatar_url as author_avatar_url 283 + FROM mentions m 284 + LEFT JOIN profiles p ON m.author_did = p.did 285 + WHERE m.talk_uri = ? AND m.parent_uri IS NULL 286 + ORDER BY 287 + CASE m.mention_type WHEN 'during_talk' THEN 0 ELSE 1 END, 288 + m.talk_offset_ms ASC, 289 + m.created_at ASC` 290 + ).all(talk.uri); 291 + 292 + const replyStmt = db.prepare( 293 + `SELECT m.*, p.handle as author_handle, p.display_name as author_display_name, p.avatar_url as author_avatar_url 294 + FROM mentions m 295 + LEFT JOIN profiles p ON m.author_did = p.did 296 + WHERE m.parent_uri = ? 297 + ORDER BY m.created_at ASC` 298 + ); 299 + 300 + const mentions = topLevel.map((m: any) => ({ 301 + ...m, 302 + thread: replyStmt.all(m.uri), 303 + })); 304 + 305 + return c.json({ mentions, total: mentions.length }); 306 + }); 307 + 274 308 app.get("/xrpc/tv.ionosphere.getConceptClusters", (c) => { 275 309 try { 276 310 const clustersPath = path.resolve(import.meta.dirname, "../data/concept-clusters.json");