2019-11-19 01:41:08 +03:00
|
|
|
:: contact-view: sets up contact JS client and combines commands
|
|
|
|
:: into semantic actions for the UI
|
|
|
|
::
|
2020-05-25 08:52:54 +03:00
|
|
|
/-
|
|
|
|
group-hook,
|
2020-03-02 02:35:44 +03:00
|
|
|
*invite-store,
|
|
|
|
*contact-hook,
|
|
|
|
*metadata-store,
|
2020-03-02 03:38:46 +03:00
|
|
|
*metadata-hook,
|
|
|
|
*permission-group-hook,
|
2020-06-08 10:53:16 +03:00
|
|
|
*permission-hook,
|
|
|
|
pull-hook,
|
|
|
|
push-hook
|
2020-05-25 08:52:54 +03:00
|
|
|
/+ *server, *contact-json, default-agent, dbug, verb,
|
2020-06-08 10:53:16 +03:00
|
|
|
grpl=group, mdl=metadata, resource,
|
|
|
|
group-store
|
|
|
|
::
|
2019-11-19 01:41:08 +03:00
|
|
|
|%
|
2020-05-29 19:57:51 +03:00
|
|
|
+$ versioned-state
|
|
|
|
$% state-0
|
|
|
|
==
|
|
|
|
::
|
2020-05-28 21:47:34 +03:00
|
|
|
+$ state-0
|
|
|
|
$: %0
|
2020-05-29 22:22:26 +03:00
|
|
|
~
|
2020-05-28 21:47:34 +03:00
|
|
|
==
|
|
|
|
::
|
2019-12-10 02:13:52 +03:00
|
|
|
+$ card card:agent:gall
|
2019-11-19 01:41:08 +03:00
|
|
|
--
|
2020-05-28 21:47:34 +03:00
|
|
|
=| state-0
|
2020-03-28 00:18:03 +03:00
|
|
|
=* state -
|
2019-11-19 01:41:08 +03:00
|
|
|
::
|
2020-03-12 03:33:48 +03:00
|
|
|
%- agent:dbug
|
2020-05-25 08:52:54 +03:00
|
|
|
%+ verb |
|
2019-12-10 02:13:52 +03:00
|
|
|
^- agent:gall
|
|
|
|
=<
|
|
|
|
|_ =bowl:gall
|
|
|
|
+* this .
|
|
|
|
contact-core +>
|
|
|
|
cc ~(. contact-core bowl)
|
|
|
|
def ~(. (default-agent this %|) bowl)
|
|
|
|
::
|
|
|
|
++ on-init
|
|
|
|
^- (quip card _this)
|
2019-11-19 01:41:08 +03:00
|
|
|
:_ this
|
2019-12-10 02:13:52 +03:00
|
|
|
:~ [%pass /updates %agent [our.bowl %contact-store] %watch /updates]
|
|
|
|
(contact-poke:cc [%create /~/default])
|
|
|
|
(contact-poke:cc [%add /~/default our.bowl *contact])
|
2020-05-28 21:47:34 +03:00
|
|
|
:* %pass /srv %agent [our.bol %file-server]
|
|
|
|
%poke %file-server-action
|
|
|
|
!>([%serve-dir /'~groups' /app/landscape %.n])
|
|
|
|
==
|
2019-12-10 02:13:52 +03:00
|
|
|
==
|
|
|
|
::
|
2020-05-28 21:47:34 +03:00
|
|
|
++ on-save !>(state)
|
2020-04-29 22:01:31 +03:00
|
|
|
++ on-load
|
2020-05-29 19:57:51 +03:00
|
|
|
|= old-vase=vase
|
2020-04-29 22:01:31 +03:00
|
|
|
^- (quip card _this)
|
2020-05-29 19:57:51 +03:00
|
|
|
=/ old ((soft state-0) q.old-vase)
|
|
|
|
?^ old [~ this]
|
2020-05-29 22:22:26 +03:00
|
|
|
:_ this(state [%0 ~])
|
2020-04-29 22:01:31 +03:00
|
|
|
:~ [%pass / %arvo %e %disconnect [~ /'~groups']]
|
|
|
|
[%pass / %arvo %e %connect [~ /'contact-view'] %contact-view]
|
2020-05-28 21:47:34 +03:00
|
|
|
:* %pass /srv %agent [our.bol %file-server]
|
|
|
|
%poke %file-server-action
|
|
|
|
!>([%serve-dir /'~groups' /app/landscape %.n])
|
|
|
|
==
|
2020-04-29 22:01:31 +03:00
|
|
|
==
|
|
|
|
::
|
2019-12-10 02:13:52 +03:00
|
|
|
++ on-poke
|
|
|
|
|= [=mark =vase]
|
|
|
|
^- (quip card _this)
|
|
|
|
?> (team:title our.bowl src.bowl)
|
|
|
|
?+ mark (on-poke:def mark vase)
|
|
|
|
%json [(poke-json:cc !<(json vase)) this]
|
2020-02-05 02:16:20 +03:00
|
|
|
%contact-view-action
|
|
|
|
[(poke-contact-view-action:cc !<(contact-view-action vase)) this]
|
|
|
|
::
|
2019-12-10 02:13:52 +03:00
|
|
|
%handle-http-request
|
|
|
|
=+ !<([eyre-id=@ta =inbound-request:eyre] vase)
|
|
|
|
:_ this
|
|
|
|
%+ give-simple-payload:app eyre-id
|
|
|
|
%+ require-authorization:app inbound-request
|
|
|
|
poke-handle-http-request:cc
|
2019-11-19 01:41:08 +03:00
|
|
|
==
|
2019-12-10 02:13:52 +03:00
|
|
|
::
|
|
|
|
++ on-watch
|
|
|
|
|= =path
|
|
|
|
^- (quip card _this)
|
|
|
|
?> (team:title our.bowl src.bowl)
|
|
|
|
?: ?=([%http-response *] path) [~ this]
|
|
|
|
?. =(/primary path) (on-watch:def path)
|
2020-05-22 21:21:10 +03:00
|
|
|
[[%give %fact ~ %json !>((update-to-json [%initial all-scry:cc]))]~ this]
|
2019-12-10 02:13:52 +03:00
|
|
|
::
|
|
|
|
++ on-agent
|
|
|
|
|= [=wire =sign:agent:gall]
|
|
|
|
^- (quip card _this)
|
|
|
|
?+ -.sign (on-agent:def wire sign)
|
2020-05-29 04:53:14 +03:00
|
|
|
%poke-ack
|
2020-06-08 10:53:16 +03:00
|
|
|
?. ?=([%join-group %ship @ @ ~] wire)
|
2020-05-29 04:53:14 +03:00
|
|
|
(on-agent:def wire sign)
|
|
|
|
?^ p.sign
|
|
|
|
(on-agent:def wire sign)
|
|
|
|
:_ this
|
|
|
|
(joined-group:cc t.wire)
|
|
|
|
::
|
2019-12-10 02:13:52 +03:00
|
|
|
%kick
|
|
|
|
[[%pass / %agent [our.bol %contact-store] %watch /updates]~ this]
|
|
|
|
::
|
|
|
|
%fact
|
|
|
|
?+ p.cage.sign (on-agent:def wire sign)
|
|
|
|
%contact-update
|
|
|
|
=/ update=json (update-to-json !<(contact-update q.cage.sign))
|
2020-01-25 02:57:29 +03:00
|
|
|
[[%give %fact ~[/primary] %json !>(update)]~ this]
|
2019-12-10 02:13:52 +03:00
|
|
|
==
|
|
|
|
==
|
|
|
|
::
|
2020-03-04 22:50:11 +03:00
|
|
|
++ on-arvo
|
2019-12-10 02:13:52 +03:00
|
|
|
|= [=wire =sign-arvo]
|
|
|
|
^- (quip card _this)
|
|
|
|
?. ?=(%bound +<.sign-arvo)
|
|
|
|
(on-arvo:def wire sign-arvo)
|
|
|
|
[~ this]
|
|
|
|
::
|
|
|
|
++ on-leave on-leave:def
|
|
|
|
++ on-peek on-peek:def
|
|
|
|
++ on-fail on-fail:def
|
|
|
|
--
|
2019-11-19 01:41:08 +03:00
|
|
|
::
|
2019-12-10 02:13:52 +03:00
|
|
|
|_ bol=bowl:gall
|
2020-05-27 05:21:10 +03:00
|
|
|
++ grp ~(. grpl bol)
|
|
|
|
++ md ~(. mdl bol)
|
2019-12-03 03:27:01 +03:00
|
|
|
++ poke-json
|
|
|
|
|= jon=json
|
2019-12-10 02:13:52 +03:00
|
|
|
^- (list card)
|
2019-12-03 03:27:01 +03:00
|
|
|
?> (team:title our.bol src.bol)
|
|
|
|
(poke-contact-view-action (json-to-view-action jon))
|
|
|
|
::
|
|
|
|
++ poke-contact-view-action
|
|
|
|
|= act=contact-view-action
|
2019-12-10 02:13:52 +03:00
|
|
|
^- (list card)
|
2020-05-25 08:52:54 +03:00
|
|
|
?> (team:title our.bol src.bol)
|
2019-12-03 03:27:01 +03:00
|
|
|
?- -.act
|
|
|
|
%create
|
2020-06-08 10:53:16 +03:00
|
|
|
=/ rid=resource
|
2020-05-25 08:52:54 +03:00
|
|
|
[our.bol name.act]
|
|
|
|
=/ =path
|
2020-06-08 10:53:16 +03:00
|
|
|
(en-path:resource rid)
|
2020-05-29 04:53:14 +03:00
|
|
|
;: weld
|
2020-06-08 10:53:16 +03:00
|
|
|
:~ (group-poke [%add-group rid policy.act %.n])
|
2020-07-08 04:17:24 +03:00
|
|
|
(group-poke [%add-members rid (sy our.bol ~)])
|
2020-06-08 10:53:16 +03:00
|
|
|
(group-push-poke %add rid)
|
2020-05-25 08:52:54 +03:00
|
|
|
(contact-poke [%create path])
|
|
|
|
(contact-hook-poke [%add-owned path])
|
2020-03-02 22:10:29 +03:00
|
|
|
==
|
2020-05-29 04:53:14 +03:00
|
|
|
(create-metadata path title.act description.act)
|
|
|
|
?. ?=(%invite -.policy.act)
|
|
|
|
~
|
|
|
|
%+ turn
|
|
|
|
~(tap in pending.policy.act)
|
|
|
|
|= =ship
|
|
|
|
(send-invite our.bol %contacts path ship '')
|
|
|
|
==
|
2020-05-25 08:52:54 +03:00
|
|
|
::
|
|
|
|
%join
|
|
|
|
=/ =path
|
2020-06-08 10:53:16 +03:00
|
|
|
(en-path:resource resource.act)
|
2020-05-29 04:53:14 +03:00
|
|
|
=/ =cage
|
2020-06-08 10:53:16 +03:00
|
|
|
:- %group-update
|
|
|
|
!> ^- update:group-store
|
|
|
|
[%add-members resource.act (sy our.bol ~)]
|
2020-05-29 04:53:14 +03:00
|
|
|
=/ =wire
|
|
|
|
[%join-group path]
|
2020-06-08 10:53:16 +03:00
|
|
|
[%pass wire %agent [entity.resource.act %group-push-hook] %poke cage]~
|
2020-05-25 08:52:54 +03:00
|
|
|
::
|
|
|
|
%invite
|
2020-06-08 10:53:16 +03:00
|
|
|
=* rid resource.act
|
2020-05-25 08:52:54 +03:00
|
|
|
=/ =path
|
2020-06-08 10:53:16 +03:00
|
|
|
(en-path:resource rid)
|
2020-06-15 11:09:03 +03:00
|
|
|
=/ =group
|
|
|
|
(need (scry-group:grp rid))
|
|
|
|
:- (send-invite entity.rid %contacts path ship.act text.act)
|
|
|
|
?. ?=(%invite -.policy.group) ~
|
|
|
|
~[(add-pending rid ship.act)]
|
2019-12-03 03:27:01 +03:00
|
|
|
::
|
|
|
|
%delete
|
2020-06-08 10:53:16 +03:00
|
|
|
=/ rid=resource
|
|
|
|
(de-path:resource path.act)
|
2020-06-15 11:09:03 +03:00
|
|
|
=/ group-pokes=(list card)
|
|
|
|
?: =(our.bol entity.rid)
|
|
|
|
~[(group-push-poke %remove rid)]
|
|
|
|
:~ (group-proxy-poke %remove-members rid (sy our.bol ~))
|
|
|
|
(group-pull-poke %remove rid)
|
|
|
|
==
|
|
|
|
;: weld
|
|
|
|
group-pokes
|
|
|
|
:~ (contact-hook-poke [%remove path.act])
|
|
|
|
(group-poke [%remove-group rid ~])
|
|
|
|
(contact-poke [%delete path.act])
|
|
|
|
==
|
|
|
|
(delete-metadata path.act)
|
2019-12-03 03:27:01 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
%remove
|
2020-06-08 10:53:16 +03:00
|
|
|
=/ rid=resource
|
|
|
|
(de-path:resource path.act)
|
|
|
|
:~ (group-poke %remove-members rid (sy ship.act ~))
|
2019-12-03 03:27:01 +03:00
|
|
|
(contact-poke [%remove path.act ship.act])
|
|
|
|
==
|
2020-01-23 01:44:21 +03:00
|
|
|
::
|
|
|
|
%share
|
|
|
|
:: determine whether to send to our contact-hook or foreign
|
|
|
|
:: send contact-action to contact-hook with %add action
|
|
|
|
[(share-poke recipient.act [%add path.act ship.act contact.act])]~
|
2020-05-27 05:21:10 +03:00
|
|
|
::
|
|
|
|
%groupify
|
|
|
|
=/ =path
|
2020-06-08 10:53:16 +03:00
|
|
|
(en-path:resource resource.act)
|
2020-05-27 05:21:10 +03:00
|
|
|
%+ weld
|
2020-07-02 05:17:28 +03:00
|
|
|
:~ (group-poke %expose resource.act ~)
|
2020-05-27 07:32:43 +03:00
|
|
|
(contact-poke [%create path])
|
2020-05-27 05:21:10 +03:00
|
|
|
(contact-hook-poke [%add-owned path])
|
|
|
|
==
|
|
|
|
(create-metadata path title.act description.act)
|
2019-12-03 03:27:01 +03:00
|
|
|
==
|
2019-11-19 01:41:08 +03:00
|
|
|
++ poke-handle-http-request
|
|
|
|
|= =inbound-request:eyre
|
2019-12-10 02:13:52 +03:00
|
|
|
^- simple-payload:http
|
2019-11-19 01:41:08 +03:00
|
|
|
=+ url=(parse-request-line url.request.inbound-request)
|
|
|
|
=/ name=@t
|
|
|
|
=+ back-path=(flop site.url)
|
|
|
|
?~ back-path
|
|
|
|
''
|
|
|
|
i.back-path
|
2019-12-10 02:13:52 +03:00
|
|
|
?+ site.url not-found:gen
|
2020-04-29 22:01:31 +03:00
|
|
|
[%'contact-view' @ *]
|
2020-04-22 02:59:03 +03:00
|
|
|
=/ =path (flop t.t.site.url)
|
|
|
|
?~ path not-found:gen
|
|
|
|
=/ contact (contact-scry `^path`(snoc (flop t.path) name))
|
|
|
|
?~ contact not-found:gen
|
|
|
|
?~ avatar.u.contact not-found:gen
|
2020-04-23 01:08:59 +03:00
|
|
|
?- -.u.avatar.u.contact
|
|
|
|
%url [[307 ['location' url.u.avatar.u.contact]~] ~]
|
|
|
|
%octt
|
|
|
|
=/ max-3-days ['cache-control' 'max-age=259200']
|
|
|
|
=/ content-type ['content-type' content-type.u.avatar.u.contact]
|
|
|
|
[[200 [content-type max-3-days ~]] `octs.u.avatar.u.contact]
|
|
|
|
==
|
2019-11-19 01:41:08 +03:00
|
|
|
==
|
|
|
|
::
|
2020-05-29 04:53:14 +03:00
|
|
|
++ joined-group
|
|
|
|
|= =path
|
|
|
|
^- (list card)
|
2020-06-08 10:53:16 +03:00
|
|
|
=/ rid=resource
|
|
|
|
(de-path:resource path)
|
|
|
|
:~ (group-pull-poke [%add entity.rid rid])
|
|
|
|
(contact-hook-poke [%add-synced entity.rid path])
|
|
|
|
(sync-metadata entity.rid path)
|
2020-05-29 04:53:14 +03:00
|
|
|
==
|
|
|
|
::
|
2019-11-19 01:41:08 +03:00
|
|
|
:: +utilities
|
|
|
|
::
|
2020-05-25 08:52:54 +03:00
|
|
|
++ add-pending
|
2020-06-08 10:53:16 +03:00
|
|
|
|= [rid=resource =ship]
|
2020-05-25 08:52:54 +03:00
|
|
|
^- card
|
|
|
|
=/ app=term
|
2020-06-08 10:53:16 +03:00
|
|
|
?: =(our.bol entity.rid)
|
2020-05-25 08:52:54 +03:00
|
|
|
%group-store
|
2020-06-08 10:53:16 +03:00
|
|
|
%group-push-hook
|
2020-05-25 08:52:54 +03:00
|
|
|
=/ =cage
|
|
|
|
:- %group-action
|
|
|
|
!> ^- action:group-store
|
2020-06-08 10:53:16 +03:00
|
|
|
[%change-policy rid %invite %add-invites (sy ship ~)]
|
|
|
|
[%pass / %agent [entity.rid app] %poke cage]
|
|
|
|
::
|
2020-05-25 08:52:54 +03:00
|
|
|
++ send-invite
|
|
|
|
|= =invite
|
|
|
|
^- card
|
|
|
|
=/ =cage
|
|
|
|
:- %invite-action
|
|
|
|
!> ^- invite-action
|
2020-05-27 05:21:10 +03:00
|
|
|
[%invite /contacts (shaf %invite-uid eny.bol) invite]
|
2020-05-25 08:52:54 +03:00
|
|
|
[%pass / %agent [recipient.invite %invite-hook] %poke cage]
|
2020-06-08 10:53:16 +03:00
|
|
|
::
|
2019-12-03 03:27:01 +03:00
|
|
|
++ contact-poke
|
|
|
|
|= act=contact-action
|
2019-12-10 02:13:52 +03:00
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bol %contact-store] %poke %contact-action !>(act)]
|
2019-12-03 03:27:01 +03:00
|
|
|
::
|
2020-01-15 03:06:38 +03:00
|
|
|
++ contact-hook-poke
|
|
|
|
|= act=contact-hook-action
|
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bol %contact-hook] %poke %contact-hook-action !>(act)]
|
|
|
|
::
|
2020-01-23 01:44:21 +03:00
|
|
|
++ share-poke
|
|
|
|
|= [=ship act=contact-action]
|
|
|
|
^- card
|
|
|
|
[%pass / %agent [ship %contact-hook] %poke %contact-action !>(act)]
|
|
|
|
::
|
2019-12-03 03:27:01 +03:00
|
|
|
++ group-poke
|
2020-05-25 08:52:54 +03:00
|
|
|
|= act=action:group-store
|
2019-12-10 02:13:52 +03:00
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bol %group-store] %poke %group-action !>(act)]
|
2019-12-03 03:27:01 +03:00
|
|
|
::
|
2020-06-08 10:53:16 +03:00
|
|
|
++ group-push-poke
|
|
|
|
|= act=action:push-hook
|
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bol %group-push-hook] %poke %push-hook-action !>(act)]
|
|
|
|
::
|
2020-05-25 08:52:54 +03:00
|
|
|
++ group-proxy-poke
|
|
|
|
|= act=action:group-store
|
|
|
|
^- card
|
2020-06-15 11:09:03 +03:00
|
|
|
[%pass / %agent [entity.resource.act %group-push-hook] %poke %group-update !>(act)]
|
2020-05-25 08:52:54 +03:00
|
|
|
::
|
2020-06-08 10:53:16 +03:00
|
|
|
++ group-pull-poke
|
|
|
|
|= act=action:pull-hook
|
2020-01-15 03:06:38 +03:00
|
|
|
^- card
|
2020-06-08 10:53:16 +03:00
|
|
|
[%pass / %agent [our.bol %group-pull-hook] %poke %pull-hook-action !>(act)]
|
2020-01-15 03:06:38 +03:00
|
|
|
::
|
2020-03-02 02:35:44 +03:00
|
|
|
++ metadata-poke
|
|
|
|
|= act=metadata-action
|
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bol %metadata-store] %poke %metadata-action !>(act)]
|
|
|
|
::
|
|
|
|
++ metadata-hook-poke
|
|
|
|
|= act=metadata-hook-action
|
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bol %metadata-hook] %poke %metadata-hook-action !>(act)]
|
|
|
|
::
|
2020-03-02 03:38:46 +03:00
|
|
|
++ perm-group-hook-poke
|
|
|
|
|= act=permission-group-hook-action
|
|
|
|
^- card
|
|
|
|
:* %pass / %agent [our.bol %permission-group-hook]
|
|
|
|
%poke %permission-group-hook-action !>(act)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ permission-hook-poke
|
|
|
|
|= act=permission-hook-action
|
|
|
|
^- card
|
|
|
|
:* %pass / %agent [our.bol %permission-hook]
|
|
|
|
%poke %permission-hook-action !>(act)
|
|
|
|
==
|
|
|
|
::
|
2020-05-25 08:52:54 +03:00
|
|
|
++ sync-metadata
|
|
|
|
|= [=ship =path]
|
|
|
|
^- card
|
|
|
|
(metadata-hook-poke %add-synced ship path)
|
|
|
|
::
|
2020-03-02 02:35:44 +03:00
|
|
|
++ create-metadata
|
|
|
|
|= [=path title=@t description=@t]
|
|
|
|
^- (list card)
|
|
|
|
=/ =metadata
|
|
|
|
%* . *metadata
|
|
|
|
title title
|
|
|
|
description description
|
|
|
|
date-created now.bol
|
|
|
|
creator our.bol
|
|
|
|
==
|
|
|
|
:~ (metadata-poke [%add path [%contacts path] metadata])
|
|
|
|
(metadata-hook-poke [%add-owned path])
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ delete-metadata
|
|
|
|
|= =path
|
|
|
|
^- (list card)
|
|
|
|
:~ (metadata-poke [%remove path [%contacts path]])
|
|
|
|
(metadata-hook-poke [%remove path])
|
|
|
|
==
|
|
|
|
::
|
2019-12-03 03:27:01 +03:00
|
|
|
++ all-scry
|
|
|
|
^- rolodex
|
2020-05-20 03:27:34 +03:00
|
|
|
.^(rolodex %gx /(scot %p our.bol)/contact-store/(scot %da now.bol)/all/noun)
|
2020-01-25 02:57:29 +03:00
|
|
|
::
|
|
|
|
++ contact-scry
|
|
|
|
|= pax=path
|
|
|
|
^- (unit contact)
|
2020-05-19 23:53:55 +03:00
|
|
|
=. pax
|
|
|
|
;: weld
|
2020-05-20 03:27:34 +03:00
|
|
|
/(scot %p our.bol)/contact-store/(scot %da now.bol)/contact
|
2020-05-19 23:53:55 +03:00
|
|
|
pax
|
|
|
|
/noun
|
|
|
|
==
|
2020-01-25 02:57:29 +03:00
|
|
|
.^((unit contact) %gx pax)
|
2019-11-19 01:41:08 +03:00
|
|
|
--
|