blob: 6f287a71185d6cce8b70c132687bcd8fdb577042 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/- sur=nostrill, nsur=nostr, post=trill-post, gate=trill-gate
/+ js=json-nostr, sr=sortug, trill=trill-post, nostr-keys
|%
++ is-feed |= fs=(list filter:nsur) ^- ?
|- ?~ fs .n
=/ filter i.fs
?~ kinds.filter .n
?: (~(has in u.kinds.filter) 0) .n
?: ?& (~(has in u.kinds.filter) 1)
?=(%~ ids.filter)
?=(%~ authors.filter)
?=(%~ tags.filter)
== .y
$(fs t.fs)
++ is-posts-no-prof |= fs=(list filter:nsur) ^- ?
=/ has-posts .n
|- ?~ fs has-posts
=/ filter i.fs
?~ kinds.filter .n
?: (~(has in u.kinds.filter) 0) .n
=. has-posts
?: (~(has in u.kinds.filter) 1) .y has-posts
$(fs t.fs)
++ post-to-event |= [=keys:nsur eny=@ p=post:post] ^- event:nsur
=/ cl (latest-post-content:trill contents.p)
=/ string (crip (content-list-to-md:trill cl))
=/ ts (to-unix-secs:jikan:sr id.p)
=/ raw=raw-event:nsur [pub.keys ts 1 ~ string]
=/ event-id (hash-event:nostr-keys raw)
=/ signature (sign-event:nostr-keys priv.keys event-id eny)
~& hash-and-signed=[event-id signature]
=/ =event:nsur :*
event-id
pub.keys
created-at.raw
kind.raw
tags.raw
content.raw
signature
==
event
++ event-to-post
|= [=event:nsur profile=(unit user-meta:nsur) relay=(unit @t)]
^- post-wrapper:sur
=/ cl (tokenize:trill content.event)
=/ ts (from-unix:jikan:sr created-at.event)
=/ cm=content-map:post (init-content-map:trill cl ts)
:: TODO more about @ps and stuff
=/ p=post:post :*
id=ts
host=`@p`pubkey.event
author=`@p`pubkey.event
thread=ts
parent=~
children=~
contents=cm
read=*lock:gate
write=*lock:gate
*engagement:post
0v0
*signature:post
tags=~
==
=/ meta [(some pubkey.event) (some id.event) relay profile]
[p meta]
--
|