diff options
Diffstat (limited to 'desk/lib/nostrill/comms.hoon')
-rw-r--r-- | desk/lib/nostrill/comms.hoon | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/desk/lib/nostrill/comms.hoon b/desk/lib/nostrill/comms.hoon index 833c07d..87a63b2 100644 --- a/desk/lib/nostrill/comms.hoon +++ b/desk/lib/nostrill/comms.hoon @@ -9,7 +9,6 @@ ?- -.req %feed handle-feed %thread (handle-thread +.req) - %prof handle-prof == ++ handle-feed =/ can (can-access:gatelib src.bowl lock.feed-perms.state bowl) @@ -21,49 +20,35 @@ =/ lp latest-page:feedlib =/ lp2 lp(count backlog.feed-perms.state) =/ =fc:feed (lp2 feed.state) - =/ crd (res-poke [%ok %feed fc]) + =/ prof (~(get by profiles.state) [%urbit our.bowl]) + =/ crd (res-poke [%ok %feed fc prof]) :_ state :~(crd) -++ give-feed +++ give-feed + |= pat=path ~& give-feed=src.bowl =/ can (can-access:gatelib src.bowl lock.feed-perms.state bowl) ?. can :: TODO keep track of the requests at the feed-perms struct - (res-fact [%ng 'not allowed']) + (res-fact [%ng 'not allowed'] pat) :: =/ lp latest-page:feedlib =/ lp2 lp(count backlog.feed-perms.state) =/ =fc:feed (lp2 feed.state) - (res-fact [%ok %feed fc]) + =/ prof (~(get by profiles.state) [%urbit our.bowl]) + (res-fact [%ok %feed fc prof] pat) -++ give-ted |= id=@ +++ give-ted |= [id=@ pat=path] =/ ted (get:orm:feed feed.state id) ?~ ted - (res-fact [%ng 'no such thread']) + (res-fact [%ng 'no such thread'] pat) =/ can (can-access:gatelib src.bowl read.u.ted bowl) ?. can - (res-fact [%ng 'not allowed']) + (res-fact [%ng 'not allowed'] pat) :: =/ fn (node-to-full:feedlib u.ted feed.state) - (res-fact [%ok %thread fn]) + (res-fact [%ok %thread fn] pat) :: -++ handle-prof - =/ can (can-access:gatelib src.bowl lock.feed-perms.state bowl) - ?. can - :: TODO keep track of the requests at the feed-perms struct - =/ crd (res-poke [%ng 'not allowed']) - :_ state :~(crd) - :: - :: TODO @p or keys... wat do - :: =/ up (~(get by profiles.state) our.bowl) - =/ up (~(get by profiles.state) pub.i.keys.state) - ?~ up - =/ crd (res-poke [%ng 'dont have one']) - :_ state :~(crd) - - =/ crd (res-poke [%ok %prof u.up]) - :_ state :~(crd) - ++ handle-thread |= id=@da =/ ted (get:orm:feed feed.state id) ?~ ted @@ -85,8 +70,8 @@ =/ =poke:comms [%res res] =/ cage [%noun !>(poke)] [%pass /poke %agent [src.bowl dap.bowl] %poke cage] -++ res-fact |= =res:comms ^- (list card:agent:gall) - =/ paths ~[/beg/feed] +++ res-fact |= [=res:comms pat=path] ^- (list card:agent:gall) + =/ paths ~[pat] =/ =poke:comms [%res res] ~& > giving-res-fact=res =/ jon (beg-res:en:jsonlib res) |