tangled
alpha
login
or
join now
bad-example.com
/
spacedust-utils
6
fork
atom
demos for spacedust
6
fork
atom
overview
issues
pulls
pipelines
direct links notifications -> something ~relevant
bad-example.com
8 months ago
52fd7d8b
8c2842ac
+47
-6
3 changed files
expand all
collapse all
unified
split
atproto-notifications
src
components
Notification.tsx
db.ts
lexicons
index.js
+36
-2
atproto-notifications/src/components/Notification.tsx
···
20
20
}
21
21
const lex = lexicons[appPrefix];
22
22
icon = lex?.clients[0]?.icon;
23
23
-
const link = lex?.clients[0]?.notifications;
23
23
+
let link = lex?.clients[0]?.notifications;
24
24
appName = lex?.name;
25
25
-
title = lex?.known_sources[source.slice(app.length + 1)] ?? source;
25
25
+
const sourceRemainder = source.slice(app.length + 1);
26
26
+
title = lex?.known_sources[sourceRemainder] ?? source;
27
27
+
28
28
+
let directLink;
29
29
+
if (subject.startsWith('did:')) {
30
30
+
31
31
+
const s = source_record.slice('at://'.length).split('/');
32
32
+
const [sDid, sCollection, sRest] = [s[0], s[1], s.slice(2)]; // yeah did might be a handle oh well
33
33
+
34
34
+
directLink = lex
35
35
+
?.clients[0]
36
36
+
?.direct_links[`did:${sourceRemainder}`]
37
37
+
?.replace('{subject.did}', subject)
38
38
+
?.replace('{source_record.did}', sDid)
39
39
+
?.replace('{source_record.collection}', sCollection)
40
40
+
?.replace('{source_record.rkey}', sRest.join('/') || null);
41
41
+
42
42
+
} else if (subject.startsWith('at://')) {
43
43
+
let s = subject.slice('at://'.length).split('/');
44
44
+
const [did, collection, rest] = [s[0], s[1], s.slice(2)]; // yeah did might be a handle oh well
45
45
+
46
46
+
s = source_record.slice('at://'.length).split('/');
47
47
+
const [sDid, sCollection, sRest] = [s[0], s[1], s.slice(2)]; // yeah did might be a handle oh well
48
48
+
49
49
+
directLink = lex
50
50
+
?.clients[0]
51
51
+
?.direct_links[`at_uri:${sourceRemainder}`]
52
52
+
?.replace('{subject.did}', did)
53
53
+
?.replace('{subject.collection}', collection)
54
54
+
?.replace('{subject.rkey}', rest.join('/') || null)
55
55
+
?.replace('{source_record.did}', sDid)
56
56
+
?.replace('{source_record.collection}', sCollection)
57
57
+
?.replace('{source_record.rkey}', sRest.join('/') || null);
58
58
+
}
59
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
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
12
-
'at_uri:feed.post': 'https://bsky.app/profile/{did}/post/{rkey}',
13
13
-
'did': 'https://bsky.app/profile/{did}',
12
12
+
'at_uri:feed.like:subject.uri': 'https://bsky.app/profile/{subject.did}/post/{subject.rkey}',
13
13
+
'at_uri:feed.post:reply.parent.uri': 'https://bsky.app/profile/{source_record.did}/post/{source_record.rkey}',
14
14
+
'at_uri:feed.post:reply.root.uri': 'https://bsky.app/profile/{source_record.did}/post/{source_record.rkey}',
15
15
+
'at_uri:feed.post:embed.record.uri': 'https://bsky.app/profile/{source_record.did}/post/{source_record.rkey}',
16
16
+
'at_uri:feed.post:embed.record.record.uri': 'https://bsky.app/profile/{source_record.did}/post/{source_record.rkey}',
17
17
+
'did:graph.follow:subject': 'https://bsky.app/profile/{source_record.did}',
18
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
60
+
direct_links: {
61
61
+
'at_uri:graph.subscription:publication': 'https://leaflet.pub/lish/{did}/{rkey}/dashboard',
62
62
+
},
55
63
}
56
64
],
57
65
known_sources: {
58
58
-
'graph.subscription:publication:': 'Subscription',
66
66
+
'graph.subscription:publication': 'Subscription',
59
67
},
60
68
},
61
69
'sh.tangled': {