summaryrefslogtreecommitdiff
path: root/desk/app/nostrill.hoon
diff options
context:
space:
mode:
Diffstat (limited to 'desk/app/nostrill.hoon')
-rw-r--r--desk/app/nostrill.hoon40
1 files changed, 24 insertions, 16 deletions
diff --git a/desk/app/nostrill.hoon b/desk/app/nostrill.hoon
index 17732e7..cbd1c2f 100644
--- a/desk/app/nostrill.hoon
+++ b/desk/app/nostrill.hoon
@@ -1,7 +1,7 @@
/- sur=nostrill, nsur=nostr
/+ lib=nostrill, nlib=nostr, sr=sortug,
shim, dbug, muta=nostrill-mutations, jsonlib=json-nostrill,
- trill=trill-post, comms=nostrill-comms
+ trill=trill-post, comms=nostrill-comms, followlib=follows
/= web /web/router
|%
+$ versioned-state $%(state-0:sur)
@@ -17,6 +17,7 @@
mutat ~(. muta [state bowl])
shimm ~(. shim [state bowl])
coms ~(. comms [state bowl])
+ fols ~(. followlib [state bowl])
++ on-init
^- (quip card:agent:gall agent:gall)
=/ default (default-state:lib bowl)
@@ -31,11 +32,11 @@
++ on-load
|~ old-state=vase
^- (quip card:agent:gall agent:gall)
- =/ old-state !<(versioned-state old-state)
- ?- -.old-state
- %0 `this(state old-state)
- ==
- :: `this(state (default-state:lib bowl))
+ :: =/ old-state !<(versioned-state old-state)
+ :: ?- -.old-state
+ :: %0 `this(state old-state)
+ :: ==
+ `this(state (default-state:lib bowl))
::
++ on-poke
|~ [=mark =vase]
@@ -97,7 +98,7 @@
=/ sp (build-sp:trill our.bowl our.bowl content.poke)
=/ p (build-post:trill now.bowl pub.i.keys sp)
=. state (add-to-feed:mutat p)
- =/ profile (~(get by profiles) pub.i.keys)
+ =/ profile (~(get by profiles) [%urbit our.bowl])
=/ pw [p (some pub.i.keys) ~ ~ profile]
=/ =fact:ui:sur [%post %add pw]
=/ card (update-ui:cards fact)
@@ -116,17 +117,21 @@
[cs this]
==
++ handle-fols |= poke=fols-poke:ui:sur
- ?- -.poke
- %add `this
- %del `this
- ==
+ =^ cs state
+ ?- -.poke
+ %add (handle-add:fols +.poke)
+
+ %del (handle-del:fols +.poke)
+ ==
+ [cs this]
+
++ handle-prof |= poke=prof-poke:ui:sur
?- -.poke
%add
- =. profiles (~(put by profiles) pub.i.keys +.poke)
+ =. profiles (~(put by profiles) [%urbit our.bowl] +.poke)
`this
%del
- =. profiles (~(del by profiles) pub.i.keys)
+ =. profiles (~(del by profiles) [%urbit our.bowl])
`this
==
++ handle-rela |= poke=relay-poke:ui:sur
@@ -243,12 +248,13 @@
|= =(pole knot)
~& on-watch=`path`pole
?+ pole !!
+ [%follow ~] :_ this (give-feed:coms pole)
[%beg %feed ~]
- :_ this give-feed:coms
+ :_ this (give-feed:coms pole)
[%beg %thread ids=@t ~]
=/ id (slaw:sr %uw ids.pole)
?~ id ~& error-parsing-ted-id=pole `this
- :_ this (give-ted:coms u.id)
+ :_ this (give-ted:coms u.id pole)
[%ui ~]
?> .=(our.bowl src.bowl)
:_ this
@@ -271,8 +277,10 @@
==
::
++ on-agent
- |~ [wire sign:agent:gall]
+ |~ [wire=(pole knot) =sign:agent:gall]
^- (quip card:agent:gall agent:gall)
+ ~& on-agent=wire
+ ~& on-agent=sign
`this
::
++ on-arvo