2020-04-15 00:57:21 +03:00
|
|
|
/- *contact-view, *contact-hook
|
2020-12-08 13:36:11 +03:00
|
|
|
/+ group-store, resource
|
2019-11-19 01:41:08 +03:00
|
|
|
|%
|
|
|
|
++ nu :: parse number as hex
|
2020-11-25 23:22:55 +03:00
|
|
|
|= jon=json
|
2020-11-26 17:09:31 +03:00
|
|
|
?> ?=([%s *] jon)
|
2019-11-19 01:41:08 +03:00
|
|
|
(rash p.jon hex)
|
|
|
|
::
|
2020-04-15 00:57:21 +03:00
|
|
|
++ hook-update-to-json
|
|
|
|
|= upd=contact-hook-update
|
|
|
|
=, enjs:format
|
|
|
|
^- json
|
|
|
|
%+ frond %contact-hook-update
|
|
|
|
%- pairs
|
|
|
|
%+ turn ~(tap by synced.upd)
|
|
|
|
|= [pax=^path shp=^ship]
|
|
|
|
^- [cord json]
|
|
|
|
[(spat pax) s+(scot %p shp)]
|
|
|
|
::
|
2019-11-19 01:41:08 +03:00
|
|
|
++ rolodex-to-json
|
|
|
|
|= rolo=rolodex
|
|
|
|
=, enjs:format
|
|
|
|
^- json
|
|
|
|
%- pairs
|
|
|
|
%+ turn ~(tap by rolo)
|
|
|
|
|= [pax=^path =contacts]
|
|
|
|
^- [cord json]
|
|
|
|
:- (spat pax)
|
2020-04-21 22:29:47 +03:00
|
|
|
(contacts-to-json pax contacts)
|
2019-11-19 01:41:08 +03:00
|
|
|
::
|
|
|
|
++ contacts-to-json
|
2020-04-21 22:29:47 +03:00
|
|
|
|= [=path con=contacts]
|
2019-11-19 01:41:08 +03:00
|
|
|
^- json
|
2020-04-21 22:29:47 +03:00
|
|
|
%- pairs:enjs:format
|
2019-11-19 01:41:08 +03:00
|
|
|
%+ turn ~(tap by con)
|
2020-04-21 22:29:47 +03:00
|
|
|
|= [=ship =contact]
|
2019-11-19 01:41:08 +03:00
|
|
|
^- [cord json]
|
2020-04-21 22:29:47 +03:00
|
|
|
[(crip (slag 1 (scow %p ship))) (contact-to-json path ship contact)]
|
2019-11-19 01:41:08 +03:00
|
|
|
::
|
|
|
|
++ contact-to-json
|
2020-04-21 22:29:47 +03:00
|
|
|
|= [=path =ship con=contact]
|
2019-11-19 01:41:08 +03:00
|
|
|
^- json
|
2020-04-21 22:29:47 +03:00
|
|
|
%- pairs:enjs:format
|
2019-11-19 01:41:08 +03:00
|
|
|
:~ [%nickname s+nickname.con]
|
|
|
|
[%email s+email.con]
|
|
|
|
[%phone s+phone.con]
|
|
|
|
[%website s+website.con]
|
|
|
|
[%notes s+notes.con]
|
|
|
|
[%color s+(scot %ux color.con)]
|
2020-04-21 22:29:47 +03:00
|
|
|
[%avatar (avatar-to-json path ship avatar.con)]
|
2019-11-19 01:41:08 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ edit-to-json
|
2020-04-21 22:29:47 +03:00
|
|
|
|= [=path =ship edit=edit-field]
|
2019-11-19 01:41:08 +03:00
|
|
|
^- json
|
2020-04-21 22:29:47 +03:00
|
|
|
%+ frond:enjs:format -.edit
|
2019-11-19 01:41:08 +03:00
|
|
|
?- -.edit
|
|
|
|
%nickname s+nickname.edit
|
|
|
|
%email s+email.edit
|
|
|
|
%phone s+phone.edit
|
|
|
|
%website s+website.edit
|
|
|
|
%notes s+notes.edit
|
|
|
|
%color s+(scot %ux color.edit)
|
2020-04-21 22:29:47 +03:00
|
|
|
%avatar (avatar-to-json path ship avatar.edit)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ avatar-to-json
|
|
|
|
|= [=path =ship avat=(unit avatar)]
|
|
|
|
^- json
|
|
|
|
?~ avat ~
|
|
|
|
?- -.u.avat
|
|
|
|
%octt
|
|
|
|
:- %s
|
|
|
|
%- crip
|
|
|
|
%- zing
|
2020-04-29 22:01:31 +03:00
|
|
|
:~ "/contact-view"
|
2020-04-21 22:29:47 +03:00
|
|
|
(trip (spat path))
|
|
|
|
"/"
|
|
|
|
(trip (scot %p ship))
|
|
|
|
==
|
|
|
|
::
|
|
|
|
%url s+url.u.avat
|
2019-11-19 01:41:08 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ update-to-json
|
|
|
|
|= upd=contact-update
|
|
|
|
=, enjs:format
|
|
|
|
^- json
|
|
|
|
%+ frond %contact-update
|
|
|
|
%- pairs
|
|
|
|
:~
|
2020-05-22 21:21:10 +03:00
|
|
|
?: ?=(%initial -.upd)
|
|
|
|
[%initial (rolodex-to-json rolodex.upd)]
|
2019-11-19 01:41:08 +03:00
|
|
|
?: ?=(%create -.upd)
|
|
|
|
[%create (pairs [%path (path path.upd)]~)]
|
|
|
|
?: ?=(%delete -.upd)
|
|
|
|
[%delete (pairs [%path (path path.upd)]~)]
|
|
|
|
?: ?=(%add -.upd)
|
|
|
|
:- %add
|
|
|
|
%- pairs
|
|
|
|
:~ [%path (path path.upd)]
|
|
|
|
[%ship (ship ship.upd)]
|
2020-04-21 22:29:47 +03:00
|
|
|
[%contact (contact-to-json path.upd ship.upd contact.upd)]
|
2019-11-19 01:41:08 +03:00
|
|
|
==
|
|
|
|
?: ?=(%remove -.upd)
|
|
|
|
:- %remove
|
|
|
|
%- pairs
|
|
|
|
:~ [%path (path path.upd)]
|
|
|
|
[%ship (ship ship.upd)]
|
|
|
|
==
|
|
|
|
?: ?=(%edit -.upd)
|
|
|
|
:- %edit
|
|
|
|
%- pairs
|
|
|
|
:~ [%path (path path.upd)]
|
|
|
|
[%ship (ship ship.upd)]
|
2020-04-21 22:29:47 +03:00
|
|
|
[%edit-field (edit-to-json path.upd ship.upd edit-field.upd)]
|
2019-11-19 01:41:08 +03:00
|
|
|
==
|
|
|
|
[*@t *^json]
|
|
|
|
==
|
|
|
|
::
|
2019-12-03 03:27:01 +03:00
|
|
|
++ json-to-view-action
|
|
|
|
|= jon=json
|
|
|
|
^- contact-view-action
|
|
|
|
=, dejs:format
|
|
|
|
=< (parse-json jon)
|
|
|
|
|%
|
|
|
|
++ parse-json
|
|
|
|
%- of
|
|
|
|
:~ [%create create]
|
|
|
|
[%delete delete]
|
2020-06-08 10:53:16 +03:00
|
|
|
[%join dejs:resource]
|
2020-05-25 08:52:54 +03:00
|
|
|
[%invite invite]
|
2019-12-03 03:27:01 +03:00
|
|
|
[%remove remove]
|
2020-01-23 01:44:21 +03:00
|
|
|
[%share share]
|
2019-12-03 03:27:01 +03:00
|
|
|
==
|
2019-12-19 03:24:35 +03:00
|
|
|
::
|
|
|
|
++ create
|
|
|
|
%- ot
|
2020-05-25 08:52:54 +03:00
|
|
|
:~ [%name so]
|
|
|
|
[%policy policy:dejs:group-store]
|
2020-03-02 02:35:44 +03:00
|
|
|
[%title so]
|
|
|
|
[%description so]
|
2019-12-19 03:24:35 +03:00
|
|
|
==
|
|
|
|
::
|
2020-05-25 08:52:54 +03:00
|
|
|
++ invite
|
|
|
|
%- ot
|
2020-06-08 10:53:16 +03:00
|
|
|
:~ [%resource dejs:resource]
|
2020-05-25 08:52:54 +03:00
|
|
|
[%ship (su ;~(pfix sig fed:ag))]
|
|
|
|
[%text so]
|
|
|
|
==
|
|
|
|
::
|
2019-12-03 03:27:01 +03:00
|
|
|
++ delete (ot [%path pa]~)
|
|
|
|
::
|
|
|
|
++ remove
|
|
|
|
%- ot
|
|
|
|
:~ [%path pa]
|
|
|
|
[%ship (su ;~(pfix sig fed:ag))]
|
|
|
|
==
|
2020-01-23 01:44:21 +03:00
|
|
|
::
|
|
|
|
++ share
|
|
|
|
%- ot
|
|
|
|
:~ [%recipient (su ;~(pfix sig fed:ag))]
|
|
|
|
[%path pa]
|
|
|
|
[%ship (su ;~(pfix sig fed:ag))]
|
|
|
|
[%contact cont]
|
|
|
|
==
|
2019-12-03 03:27:01 +03:00
|
|
|
--
|
|
|
|
::
|
2019-11-19 01:41:08 +03:00
|
|
|
++ json-to-action
|
|
|
|
|= jon=json
|
|
|
|
^- contact-action
|
|
|
|
=, dejs:format
|
|
|
|
=< (parse-json jon)
|
|
|
|
|%
|
|
|
|
++ parse-json
|
|
|
|
%- of
|
|
|
|
:~ [%create create]
|
|
|
|
[%delete delete]
|
|
|
|
[%add add]
|
|
|
|
[%remove remove]
|
|
|
|
[%edit edit]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ create
|
|
|
|
(ot [%path pa]~)
|
|
|
|
::
|
|
|
|
++ delete
|
|
|
|
(ot [%path pa]~)
|
|
|
|
::
|
|
|
|
++ add
|
|
|
|
%- ot
|
|
|
|
:~ [%path pa]
|
|
|
|
[%ship (su ;~(pfix sig fed:ag))]
|
|
|
|
[%contact cont]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ remove
|
|
|
|
%- ot
|
|
|
|
:~ [%path pa]
|
|
|
|
[%ship (su ;~(pfix sig fed:ag))]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ edit
|
|
|
|
%- ot
|
|
|
|
:~ [%path pa]
|
|
|
|
[%ship (su ;~(pfix sig fed:ag))]
|
|
|
|
[%edit-field edit-fi]
|
|
|
|
==
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ octet
|
|
|
|
%- ot:dejs:format
|
|
|
|
:~ [%p ni:dejs:format]
|
|
|
|
[%q so:dejs:format]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ avat
|
2020-04-21 22:29:47 +03:00
|
|
|
|= jon=json
|
|
|
|
^- avatar
|
2020-04-22 02:59:03 +03:00
|
|
|
|^
|
|
|
|
=/ =avatar (parse-json jon)
|
|
|
|
?- -.avatar
|
|
|
|
%url avatar
|
|
|
|
%octt
|
2020-12-08 13:36:11 +03:00
|
|
|
=. octs.avatar (need (de:base64:mimes:html q.octs.avatar))
|
2020-04-22 02:59:03 +03:00
|
|
|
avatar
|
|
|
|
==
|
|
|
|
::
|
2020-04-21 22:29:47 +03:00
|
|
|
++ parse-json
|
|
|
|
%- of:dejs:format
|
|
|
|
:~ [%octt octt]
|
|
|
|
[%url url]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ octt
|
|
|
|
%- ot:dejs:format
|
2020-04-22 02:59:03 +03:00
|
|
|
:~ [%content-type so:dejs:format]
|
2020-04-21 22:29:47 +03:00
|
|
|
[%octs octet]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ url so:dejs:format
|
|
|
|
--
|
2019-11-19 01:41:08 +03:00
|
|
|
::
|
|
|
|
++ cont
|
|
|
|
%- ot:dejs:format
|
|
|
|
:~ [%nickname so:dejs:format]
|
|
|
|
[%email so:dejs:format]
|
|
|
|
[%phone so:dejs:format]
|
|
|
|
[%website so:dejs:format]
|
|
|
|
[%notes so:dejs:format]
|
|
|
|
[%color nu]
|
|
|
|
[%avatar (mu:dejs:format avat)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ edit-fi
|
|
|
|
%- of:dejs:format
|
|
|
|
:~ [%nickname so:dejs:format]
|
|
|
|
[%email so:dejs:format]
|
|
|
|
[%phone so:dejs:format]
|
|
|
|
[%website so:dejs:format]
|
|
|
|
[%notes so:dejs:format]
|
|
|
|
[%color nu]
|
|
|
|
[%avatar (mu:dejs:format avat)]
|
|
|
|
==
|
|
|
|
--
|