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-01-15 03:06:38 +03:00
|
|
|
/- *group-store, *group-hook, *invite-store, *contact-hook
|
2019-12-10 02:13:52 +03:00
|
|
|
/+ *server, *contact-json, default-agent
|
2019-11-19 01:41:08 +03:00
|
|
|
/= index
|
|
|
|
/^ octs
|
|
|
|
/; as-octs:mimes:html
|
|
|
|
/: /===/app/contacts/index
|
|
|
|
/| /html/
|
|
|
|
/~ ~
|
|
|
|
==
|
|
|
|
/= tile-js
|
|
|
|
/^ octs
|
|
|
|
/; as-octs:mimes:html
|
|
|
|
/: /===/app/contacts/js/tile
|
|
|
|
/| /js/
|
|
|
|
/~ ~
|
|
|
|
==
|
|
|
|
/= script
|
|
|
|
/^ octs
|
|
|
|
/; as-octs:mimes:html
|
|
|
|
/: /===/app/contacts/js/index
|
|
|
|
/| /js/
|
|
|
|
/~ ~
|
|
|
|
==
|
|
|
|
/= style
|
|
|
|
/^ octs
|
|
|
|
/; as-octs:mimes:html
|
|
|
|
/: /===/app/contacts/css/index
|
|
|
|
/| /css/
|
|
|
|
/~ ~
|
|
|
|
==
|
|
|
|
/= contact-png
|
|
|
|
/^ (map knot @)
|
|
|
|
/: /===/app/contacts/img /_ /png/
|
|
|
|
::
|
|
|
|
|%
|
2019-12-10 02:13:52 +03:00
|
|
|
+$ card card:agent:gall
|
2019-11-19 01:41:08 +03:00
|
|
|
--
|
|
|
|
::
|
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]
|
|
|
|
[%pass / %arvo %e %connect [~ /'~contacts'] %contact-view]
|
|
|
|
(launch-poke:cc [%contact-view /primary '/~contacts/js/tile.js'])
|
|
|
|
(contact-poke:cc [%create /~/default])
|
|
|
|
(group-poke:cc [%bundle /~/default])
|
|
|
|
(contact-poke:cc [%add /~/default our.bowl *contact])
|
|
|
|
(group-poke:cc [%add [our.bowl ~ ~] /~/default])
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ on-save on-save:def
|
|
|
|
++ on-load on-load:def
|
|
|
|
++ 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]
|
|
|
|
%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)
|
|
|
|
[[%give %fact ~ %json !>((rolodex-to-json all-scry:cc))]~ this]
|
|
|
|
::
|
|
|
|
++ on-agent
|
|
|
|
|= [=wire =sign:agent:gall]
|
|
|
|
^- (quip card _this)
|
|
|
|
?+ -.sign (on-agent:def wire sign)
|
|
|
|
%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))
|
|
|
|
[[%give %fact `/primary %json !>(update)]~ this]
|
|
|
|
==
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ on-arvo
|
|
|
|
|= [=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
|
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)
|
2019-12-03 03:27:01 +03:00
|
|
|
?- -.act
|
|
|
|
%create
|
2020-01-15 03:06:38 +03:00
|
|
|
?> ?=([@ *] path.act)
|
2019-12-19 03:24:35 +03:00
|
|
|
%+ welp
|
|
|
|
:~ (group-poke [%bundle path.act])
|
|
|
|
(contact-poke [%create path.act])
|
2020-01-15 03:06:38 +03:00
|
|
|
(contact-hook-poke [%add-owned path.act])
|
|
|
|
(group-hook-poke [%add our.bol path.act])
|
|
|
|
(group-poke [%add (~(put in ships.act) our.bol) path.act])
|
2019-12-19 03:24:35 +03:00
|
|
|
==
|
2020-01-15 03:06:38 +03:00
|
|
|
%+ turn ~(tap in (~(del in ships.act) our.bol))
|
2019-12-19 03:24:35 +03:00
|
|
|
|= =ship
|
|
|
|
(send-invite-poke path.act ship)
|
2019-12-03 03:27:01 +03:00
|
|
|
::
|
|
|
|
%delete
|
2019-12-05 01:41:44 +03:00
|
|
|
:~ (group-poke [%unbundle path.act])
|
|
|
|
(contact-poke [%delete path.act])
|
2020-01-15 03:06:38 +03:00
|
|
|
(contact-hook-poke [%remove path.act])
|
2019-12-03 03:27:01 +03:00
|
|
|
==
|
2020-01-15 03:06:38 +03:00
|
|
|
::
|
|
|
|
%add
|
|
|
|
%+ welp [(group-poke [%add ships.act path.act])]~
|
|
|
|
%+ turn ~(tap in (~(del in ships.act) our.bol))
|
|
|
|
|=(=ship (send-invite-poke path.act ship))
|
2019-12-03 03:27:01 +03:00
|
|
|
::
|
|
|
|
%remove
|
|
|
|
:~ (group-poke [%remove [ship.act ~ ~] path.act])
|
|
|
|
(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+act
|
|
|
|
[(share-poke recipient.act [%add path.act ship.act contact.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
|
|
|
|
[%'~contacts' %css %index ~] (css-response:gen style)
|
|
|
|
[%'~contacts' %js %index ~] (js-response:gen script)
|
|
|
|
[%'~contacts' %js %tile ~] (js-response:gen tile-js)
|
2019-11-19 01:41:08 +03:00
|
|
|
[%'~contacts' %img *]
|
2019-12-10 02:13:52 +03:00
|
|
|
(png-response:gen (as-octs:mimes:html (~(got by contact-png) `@ta`name)))
|
2019-11-19 01:41:08 +03:00
|
|
|
::
|
2019-12-10 02:13:52 +03:00
|
|
|
[%'~contacts' *] (html-response:gen index)
|
2019-11-19 01:41:08 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
:: +utilities
|
|
|
|
::
|
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-11-19 01:41:08 +03:00
|
|
|
++ launch-poke
|
2019-12-10 02:13:52 +03:00
|
|
|
|= act=[@tas path @t]
|
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bol %launch] %poke %launch-action !>(act)]
|
2019-12-03 03:27:01 +03:00
|
|
|
::
|
|
|
|
++ group-poke
|
|
|
|
|= act=group-action
|
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-01-15 03:06:38 +03:00
|
|
|
++ group-hook-poke
|
|
|
|
|= act=group-hook-action
|
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bol %group-hook] %poke %group-hook-action !>(act)]
|
|
|
|
::
|
2019-12-19 03:24:35 +03:00
|
|
|
++ send-invite-poke
|
|
|
|
|= [=path =ship]
|
|
|
|
^- card
|
|
|
|
=/ =invite
|
|
|
|
:* our.bol %contact-hook
|
|
|
|
path ship ''
|
|
|
|
==
|
|
|
|
=/ act=invite-action [%invite /contacts (shaf %msg-uid eny.bol) invite]
|
|
|
|
[%pass / %agent [our.bol %invite-hook] %poke %invite-action !>(act)]
|
|
|
|
::
|
2019-12-03 03:27:01 +03:00
|
|
|
++ all-scry
|
|
|
|
^- rolodex
|
|
|
|
.^(rolodex %gx /=contact-store/(scot %da now.bol)/all/noun)
|
2019-11-19 01:41:08 +03:00
|
|
|
--
|