mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-16 10:49:26 +03:00
ames: improve scry interface
No longer abuse the desk field, instead making use of the path. Reject any scries outside of the local ship, empty desk and current time as invalid.
This commit is contained in:
parent
ed808614aa
commit
b224ac0878
@ -491,11 +491,11 @@
|
||||
++ v-ames
|
||||
|%
|
||||
++ peers
|
||||
(scry (map ship ?(%alien %known)) %a %peers ~)
|
||||
(scry (map ship ?(%alien %known)) %ax %$ /peers)
|
||||
::
|
||||
++ peer
|
||||
|= who=ship
|
||||
(scry ship-state:ames %a %peer /(scot %p who))
|
||||
(scry ship-state:ames %ax %$ /peers/(scot %p who))
|
||||
::
|
||||
++ peer-to-json
|
||||
=, ames
|
||||
|
@ -691,35 +691,37 @@
|
||||
--
|
||||
:: +scry: dereference namespace
|
||||
::
|
||||
:: The ones producing vases are expected to be used like this:
|
||||
::
|
||||
:: &tang [(sell .^(vase %a /=peer=/~zod)) ~]
|
||||
::
|
||||
++ scry
|
||||
|= [fur=(unit (set monk)) ren=@tas why=shop syd=desk lot=coin tyl=path]
|
||||
^- (unit (unit cage))
|
||||
?. =(lot [%$ %da now]) ~
|
||||
?. =(%$ ren) [~ ~]
|
||||
?. =([%& our] why)
|
||||
[~ ~]
|
||||
?+ syd ~
|
||||
%peers
|
||||
?^ tyl [~ ~]
|
||||
:: only respond for the local identity, %$ desk, current timestamp
|
||||
::
|
||||
?. ?& =(&+our why)
|
||||
=([%$ %da now] lot)
|
||||
=(%$ syd)
|
||||
==
|
||||
~
|
||||
:: /ax/peers (map ship ?(%alien known))
|
||||
:: /ax/peers/[ship] ship-state
|
||||
:: /ax/bones/[ship] [snd=(set bone) rcv=(set bone)]
|
||||
:: /ax/snd-bones/[ship]/[bone] vase
|
||||
::
|
||||
?. ?=(%x ren) ~
|
||||
?+ tyl [~ ~]
|
||||
[%peers ~]
|
||||
:^ ~ ~ %noun
|
||||
!> ^- (map ship ?(%alien %known))
|
||||
(~(run by peers.ames-state) head)
|
||||
::
|
||||
%peer
|
||||
?. ?=([@ ~] tyl) [~ ~]
|
||||
=/ who (slaw %p i.tyl)
|
||||
[%peers @ ~]
|
||||
=/ who (slaw %p i.t.tyl)
|
||||
?~ who [~ ~]
|
||||
?~ peer=(~(get by peers.ames-state) u.who)
|
||||
[~ ~]
|
||||
``noun+!>(u.peer)
|
||||
::
|
||||
%bones
|
||||
?. ?=([@ ~] tyl) [~ ~]
|
||||
=/ who (slaw %p i.tyl)
|
||||
[%bones @ ~]
|
||||
=/ who (slaw %p i.t.tyl)
|
||||
?~ who [~ ~]
|
||||
=/ per (~(get by peers.ames-state) u.who)
|
||||
?. ?=([~ %known *] per) [~ ~]
|
||||
@ -728,11 +730,10 @@
|
||||
[snd=~(key by snd) rcv=~(key by rcv)]
|
||||
``noun+!>(res)
|
||||
::
|
||||
%snd-bone
|
||||
?. ?=([@ @ ~] tyl) [~ ~]
|
||||
=/ who (slaw %p i.tyl)
|
||||
[%snd-bones @ @ ~]
|
||||
=/ who (slaw %p i.t.tyl)
|
||||
?~ who [~ ~]
|
||||
=/ ost (slaw %ud i.t.tyl)
|
||||
=/ ost (slaw %ud i.t.t.tyl)
|
||||
?~ ost [~ ~]
|
||||
=/ per (~(get by peers.ames-state) u.who)
|
||||
?. ?=([~ %known *] per) [~ ~]
|
||||
|
Loading…
Reference in New Issue
Block a user