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
}
21
const lex = lexicons[appPrefix];
22
icon = lex?.clients[0]?.icon;
23
-
const link = lex?.clients[0]?.notifications;
24
appName = lex?.name;
25
-
title = lex?.known_sources[source.slice(app.length + 1)] ?? source;
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
26
27
const contents = (
28
<>
···
20
}
21
const lex = lexicons[appPrefix];
22
icon = lex?.clients[0]?.icon;
23
+
let link = lex?.clients[0]?.notifications;
24
appName = lex?.name;
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;
60
61
const contents = (
62
<>
-1
atproto-notifications/src/db.ts
···
98
99
let oc;
100
if (!!secondary && secondary !== 'all' && !!secondaryFilter) {
101
-
console.log('with', secondary, secondaryFilter)
102
oc = store
103
.index(secondary)
104
.openCursor(IDBKeyRange.only(secondaryFilter), 'prev');
···
98
99
let oc;
100
if (!!secondary && secondary !== 'all' && !!secondaryFilter) {
0
101
oc = store
102
.index(secondary)
103
.openCursor(IDBKeyRange.only(secondaryFilter), 'prev');
+11
-3
lexicons/index.js
···
9
icon: '/icons/app.bsky.png',
10
notifications: 'https://bsky.app/notifications',
11
direct_links: {
12
-
'at_uri:feed.post': 'https://bsky.app/profile/{did}/post/{rkey}',
13
-
'did': 'https://bsky.app/profile/{did}',
0
0
0
0
0
14
},
15
},
16
{
···
52
canonical: true,
53
icon: '/icons/pub.leaflet.jpg',
54
main: 'https://leaflet.pub/home',
0
0
0
55
}
56
],
57
known_sources: {
58
-
'graph.subscription:publication:': 'Subscription',
59
},
60
},
61
'sh.tangled': {
···
9
icon: '/icons/app.bsky.png',
10
notifications: 'https://bsky.app/notifications',
11
direct_links: {
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}',
19
},
20
},
21
{
···
57
canonical: true,
58
icon: '/icons/pub.leaflet.jpg',
59
main: 'https://leaflet.pub/home',
60
+
direct_links: {
61
+
'at_uri:graph.subscription:publication': 'https://leaflet.pub/lish/{did}/{rkey}/dashboard',
62
+
},
63
}
64
],
65
known_sources: {
66
+
'graph.subscription:publication': 'Subscription',
67
},
68
},
69
'sh.tangled': {