demos for spacedust

direct links notifications -> something ~relevant

+47 -6
+36 -2
atproto-notifications/src/components/Notification.tsx
··· 20 20 } 21 21 const lex = lexicons[appPrefix]; 22 22 icon = lex?.clients[0]?.icon; 23 - const link = lex?.clients[0]?.notifications; 23 + let link = lex?.clients[0]?.notifications; 24 24 appName = lex?.name; 25 - title = lex?.known_sources[source.slice(app.length + 1)] ?? source; 25 + const sourceRemainder = source.slice(app.length + 1); 26 + title = lex?.known_sources[sourceRemainder] ?? source; 27 + 28 + let directLink; 29 + if (subject.startsWith('did:')) { 30 + 31 + const s = source_record.slice('at://'.length).split('/'); 32 + const [sDid, sCollection, sRest] = [s[0], s[1], s.slice(2)]; // yeah did might be a handle oh well 33 + 34 + directLink = lex 35 + ?.clients[0] 36 + ?.direct_links[`did:${sourceRemainder}`] 37 + ?.replace('{subject.did}', subject) 38 + ?.replace('{source_record.did}', sDid) 39 + ?.replace('{source_record.collection}', sCollection) 40 + ?.replace('{source_record.rkey}', sRest.join('/') || null); 41 + 42 + } else if (subject.startsWith('at://')) { 43 + let s = subject.slice('at://'.length).split('/'); 44 + const [did, collection, rest] = [s[0], s[1], s.slice(2)]; // yeah did might be a handle oh well 45 + 46 + s = source_record.slice('at://'.length).split('/'); 47 + const [sDid, sCollection, sRest] = [s[0], s[1], s.slice(2)]; // yeah did might be a handle oh well 48 + 49 + directLink = lex 50 + ?.clients[0] 51 + ?.direct_links[`at_uri:${sourceRemainder}`] 52 + ?.replace('{subject.did}', did) 53 + ?.replace('{subject.collection}', collection) 54 + ?.replace('{subject.rkey}', rest.join('/') || null) 55 + ?.replace('{source_record.did}', sDid) 56 + ?.replace('{source_record.collection}', sCollection) 57 + ?.replace('{source_record.rkey}', sRest.join('/') || null); 58 + } 59 + link = directLink ?? link; 26 60 27 61 const contents = ( 28 62 <>
-1
atproto-notifications/src/db.ts
··· 98 98 99 99 let oc; 100 100 if (!!secondary && secondary !== 'all' && !!secondaryFilter) { 101 - console.log('with', secondary, secondaryFilter) 102 101 oc = store 103 102 .index(secondary) 104 103 .openCursor(IDBKeyRange.only(secondaryFilter), 'prev');
+11 -3
lexicons/index.js
··· 9 9 icon: '/icons/app.bsky.png', 10 10 notifications: 'https://bsky.app/notifications', 11 11 direct_links: { 12 - 'at_uri:feed.post': 'https://bsky.app/profile/{did}/post/{rkey}', 13 - 'did': 'https://bsky.app/profile/{did}', 12 + 'at_uri:feed.like:subject.uri': 'https://bsky.app/profile/{subject.did}/post/{subject.rkey}', 13 + 'at_uri:feed.post:reply.parent.uri': 'https://bsky.app/profile/{source_record.did}/post/{source_record.rkey}', 14 + 'at_uri:feed.post:reply.root.uri': 'https://bsky.app/profile/{source_record.did}/post/{source_record.rkey}', 15 + 'at_uri:feed.post:embed.record.uri': 'https://bsky.app/profile/{source_record.did}/post/{source_record.rkey}', 16 + 'at_uri:feed.post:embed.record.record.uri': 'https://bsky.app/profile/{source_record.did}/post/{source_record.rkey}', 17 + 'did:graph.follow:subject': 'https://bsky.app/profile/{source_record.did}', 18 + 'did:feed.post:facets[app.bsky.richtext.facet].features[app.bsky.richtext.facet#mention].did': 'https://bsky.app/profile/{source_record.did}/post/{source_record.rkey}', 14 19 }, 15 20 }, 16 21 { ··· 52 57 canonical: true, 53 58 icon: '/icons/pub.leaflet.jpg', 54 59 main: 'https://leaflet.pub/home', 60 + direct_links: { 61 + 'at_uri:graph.subscription:publication': 'https://leaflet.pub/lish/{did}/{rkey}/dashboard', 62 + }, 55 63 } 56 64 ], 57 65 known_sources: { 58 - 'graph.subscription:publication:': 'Subscription', 66 + 'graph.subscription:publication': 'Subscription', 59 67 }, 60 68 }, 61 69 'sh.tangled': {