summaryrefslogtreecommitdiff
path: root/app/lib/mutations/nostr.hoon
diff options
context:
space:
mode:
Diffstat (limited to 'app/lib/mutations/nostr.hoon')
-rw-r--r--app/lib/mutations/nostr.hoon18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/lib/mutations/nostr.hoon b/app/lib/mutations/nostr.hoon
index 2c6acd5..96ea6c6 100644
--- a/app/lib/mutations/nostr.hoon
+++ b/app/lib/mutations/nostr.hoon
@@ -3,6 +3,9 @@
/+ appjs=json-nostrill,
lib=nostrill,
+ nlib=nostr,
+ nreq=nostr-req,
+ server,
njs=json-nostr,
postlib=trill-post,
shim,
@@ -11,6 +14,21 @@
|_ [=state:sur =bowl:gall]
+$ card card:agent:gall
:: events
+++ handle-client-event |= [wid=@ =event:nsur] ^- (quip card _state)
+ ~& handling-client-event=event
+ =. nostr-feed.state (put:norm:sur nostr-feed.state created-at.event event)
+ =/ profile (~(get by profiles.state [%nostr author.event]))
+ :: TODO save if we're following?
+ :: =/ pw (event-to-post:nlib event profile)
+ =/ response (ok-client-event event .n 'we\'re full')
+ =/ cs (ws-response:nreq response)
+ [cs state]
+ :: =/ l events.state
+ :: =| cards=(list card:agent:gall)
+ :: |- ?~ l [cards state]
+ :: =/ n (event-parsing i.l)
+ :: $(cards -.n, state +.n, l t.l)
+
++ process-events ^- (quip card _state)
:: =/ l events.state
:: =| cards=(list card:agent:gall)