mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 08:32:39 +03:00
82 lines
1.7 KiB
Plaintext
82 lines
1.7 KiB
Plaintext
/+ store=contact-store, res=resource, contact, default-agent, dbug, push-hook
|
|
~% %contact-push-hook-top ..part ~
|
|
|%
|
|
+$ card card:agent:gall
|
|
++ config
|
|
^- config:push-hook
|
|
:* %contact-store
|
|
/our
|
|
update:store
|
|
%contact-update
|
|
%graph-pull-hook
|
|
==
|
|
::
|
|
+$ agent (push-hook:push-hook config)
|
|
--
|
|
::
|
|
%- agent:dbug
|
|
^- agent:gall
|
|
%- (agent:push-hook config)
|
|
^- agent
|
|
|_ =bowl:gall
|
|
+* this .
|
|
def ~(. (default-agent this %|) bowl)
|
|
con ~(. contact bowl)
|
|
::
|
|
++ on-init on-init:def
|
|
++ on-save !>(~)
|
|
++ on-load on-load:def
|
|
++ on-poke on-poke:def
|
|
++ on-agent on-agent:def
|
|
++ on-watch on-watch:def
|
|
++ on-leave on-leave:def
|
|
++ on-peek on-peek:def
|
|
++ on-arvo on-arvo:def
|
|
++ on-fail on-fail:def
|
|
::
|
|
++ should-proxy-update
|
|
|= =vase
|
|
^- ?
|
|
=/ =update:store !<(update:store vase)
|
|
?- -.update
|
|
%initial %.n
|
|
%add %.y
|
|
%remove %.y
|
|
%edit %.y
|
|
%allow %.n
|
|
%disallow %.n
|
|
==
|
|
::
|
|
++ resource-for-update
|
|
|= =vase
|
|
^- (unit resource:res)
|
|
=/ =update:store !<(update:store vase)
|
|
?- -.update
|
|
%initial ~
|
|
%add `[our.bowl %our]
|
|
%remove `[our.bowl %our]
|
|
%edit `[our.bowl %our]
|
|
%allow ~
|
|
%disallow `[our.bowl %our]
|
|
==
|
|
::
|
|
++ initial-watch
|
|
|= [=path =resource:res]
|
|
^- vase
|
|
?> (is-allowed:con src.bowl)
|
|
!> ^- update:store
|
|
=/ contact=(unit contact:store) (get-contact:con our.bowl)
|
|
:+ %add
|
|
our.bowl
|
|
?^ contact u.contact
|
|
*contact:store
|
|
::
|
|
++ take-update
|
|
|= =vase
|
|
^- [(list card) agent]
|
|
=/ =update:store !<(update:store vase)
|
|
?. ?=(%disallow -.update) [~ this]
|
|
:_ this
|
|
[%give %kick ~[resource+(en-path:res [our.bowl %our])] ~]~
|
|
--
|