summaryrefslogtreecommitdiff
path: root/desk/sur/nostrill.hoon
blob: 70ce480d9a49689da26a44b00d4893cc1d10f4fb (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
72
73
74
75
76
77
78
79
80
81
/-  nostr, trill=trill-feed, tp=trill-post, gate=trill-gate
|%
+$  state  state-0
+$  state-0
  $:  %0
      :: nostr config
      relays=(map @t relay-stats:nostr)
      keys=(lest keys:nostr)  :: cycled, i.keys is current one
      ::  own feed
      feed=feed:trill
      feed-perms=gate:gate
      ::  nostr feed from relays
      =nostr-feed
      ::  profiles
      profiles=(map @ux user-meta:nostr)
      following=(map @ux =feed:trill)
      follow-graph=(map @ux (set follow))
    :: TODO global feed somehow?

  ==
+$  nostr-feed  ((mop @ud event:nostr) gth)
++  norm        ((on @ud event:nostr) gth)
+$  nfc         [feed=nostr-feed start=cursor:trill end=cursor:trill]

+$  post-wrapper  [=post:tp nostr-meta=nostr-meta]
+$  nostr-meta
$:  pub=(unit @ux)
    ev-id=(unit @ux)
    relay=(unit @t)
    pr=(unit user-meta:nostr)
==

+$  follow  [pubkey=@ux name=@t relay=(unit @t)]
++  ui
  |%
  +$  poke
  $%  [%fols fols-poke]
      [%begs begs-poke]
      [%post post-poke]
      :: [%reac reac-poke]
      [%prof prof-poke]
      [%keys ~]  ::  cycle-keys
      [%rela relay-poke]
  ==
  +$  begs-poke
  $%  [%feed p=@p]
      [%thread p=@p id=@da]
  ==
  +$  post-poke
  $%  [%add content=@t]
      [%rt id=@ux pubkey=@ux relay=@t]  :: NIP-18
      [%del pubkey=@ux]
  ==
  +$  fols-poke
  $%  [%add pubkey=@ux]
      [%del pubkey=@ux]
  ==
  +$  prof-poke
  $%  [%add meta=user-meta:nostr]
      [%del ~]
  ==
  +$  relay-poke
  $%  [%add p=@t]
      [%del p=@t]
      ::
      [%sync ~]
      ::  send event for... relaying
      [%send host=@p id=@ relays=(list @t)]
  ==
  :: facts
  +$  fact
  $%  [%nostr feed=nostr-feed]
      [%post post-fact]
      [%enga p=post-wrapper reaction=*]
  ==
  +$  post-fact
  $%  [%add post-wrapper]
      [%del post-wrapper]
  ==
  --
--