2019-11-21 21:58:15 +03:00
|
|
|
::
|
2020-01-08 21:45:16 +03:00
|
|
|
/- *publish,
|
|
|
|
*group-store,
|
|
|
|
*permission-hook,
|
|
|
|
*permission-group-hook,
|
|
|
|
*permission-store,
|
|
|
|
*invite-store
|
2019-12-03 23:10:50 +03:00
|
|
|
/+ *server, *publish, cram, default-agent
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
|
|
|
/= index
|
|
|
|
/^ $-(json manx)
|
|
|
|
/: /===/app/publish/index /!noun/
|
|
|
|
::
|
|
|
|
/= js
|
|
|
|
/^ octs
|
|
|
|
/; as-octs:mimes:html
|
|
|
|
/| /: /===/app/publish/js/index /js/
|
|
|
|
/~ ~
|
|
|
|
==
|
|
|
|
::
|
|
|
|
/= css
|
|
|
|
/^ octs
|
|
|
|
/; as-octs:mimes:html
|
|
|
|
/| /: /===/app/publish/css/index /css/
|
|
|
|
/~ ~
|
|
|
|
==
|
|
|
|
::
|
|
|
|
/= tile-js
|
|
|
|
/^ octs
|
|
|
|
/; as-octs:mimes:html
|
|
|
|
/| /: /===/app/publish/js/tile /js/
|
|
|
|
/~ ~
|
|
|
|
==
|
|
|
|
::
|
|
|
|
/= images
|
|
|
|
/^ (map knot @)
|
|
|
|
/: /===/app/publish/img /_ /png/
|
|
|
|
::
|
|
|
|
|%
|
2019-12-03 23:10:50 +03:00
|
|
|
+$ card card:agent:gall
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
2020-01-21 21:48:52 +03:00
|
|
|
+$ collection-zero [* pos=(map @tas *) *]
|
|
|
|
::
|
|
|
|
+$ state-zero
|
|
|
|
$: pubs=(map @tas collection-zero)
|
|
|
|
*
|
2019-12-03 23:10:50 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ state-one
|
|
|
|
$: our-paths=(list path)
|
|
|
|
books=(map @tas notebook)
|
|
|
|
subs=(map [@p @tas] notebook)
|
2020-01-10 04:11:06 +03:00
|
|
|
tile-num=@ud
|
2019-12-03 23:10:50 +03:00
|
|
|
==
|
2020-01-21 21:48:52 +03:00
|
|
|
::
|
|
|
|
+$ versioned-state
|
|
|
|
$% [%1 state-one]
|
|
|
|
==
|
|
|
|
::
|
2019-11-21 21:58:15 +03:00
|
|
|
--
|
|
|
|
::
|
2020-01-21 21:48:52 +03:00
|
|
|
=| versioned-state
|
2019-11-21 21:58:15 +03:00
|
|
|
=* state -
|
|
|
|
^- agent:gall
|
|
|
|
=<
|
|
|
|
|_ bol=bowl:gall
|
2019-12-03 23:10:50 +03:00
|
|
|
+* this .
|
|
|
|
def ~(. (default-agent this %|) bol)
|
|
|
|
main ~(. +> bol)
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
|
|
|
++ on-init
|
2019-12-03 23:10:50 +03:00
|
|
|
^- (quip card _this)
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ lac [%publish /publishtile '/~publish/tile.js']
|
2019-12-03 23:10:50 +03:00
|
|
|
=/ rav [%sing %t [%da now.bol] /app/publish/notebooks]
|
2019-11-21 21:58:15 +03:00
|
|
|
:_ this
|
2019-12-03 23:10:50 +03:00
|
|
|
:~ [%pass /bind %arvo %e %connect [~ /'~publish'] %publish]
|
|
|
|
[%pass /tile %agent [our.bol %launch] %poke %launch-action !>(lac)]
|
|
|
|
[%pass /read/paths %arvo %c %warp our.bol q.byk.bol `rav]
|
2019-12-06 02:42:38 +03:00
|
|
|
[%pass /permissions %agent [our.bol %permission-store] %watch /updates]
|
2020-01-10 04:11:06 +03:00
|
|
|
(invite-poke:main [%create /publish])
|
2019-12-06 02:42:38 +03:00
|
|
|
:* %pass /invites %agent [our.bol %invite-store] %watch
|
|
|
|
/invitatory/publish
|
|
|
|
==
|
2019-11-21 21:58:15 +03:00
|
|
|
==
|
2019-12-03 23:10:50 +03:00
|
|
|
::
|
2019-11-21 21:58:15 +03:00
|
|
|
++ on-save !>(state)
|
2019-12-03 23:10:50 +03:00
|
|
|
::
|
2019-11-21 21:58:15 +03:00
|
|
|
++ on-load
|
|
|
|
|= old=vase
|
2019-12-03 23:10:50 +03:00
|
|
|
^- (quip card _this)
|
2020-01-21 21:48:52 +03:00
|
|
|
=/ old-state=(each versioned-state tang)
|
|
|
|
(mule |.(!<(versioned-state old)))
|
|
|
|
?: ?=(%& -.old-state)
|
|
|
|
[~ this(state p.old-state)]
|
|
|
|
=/ zero !<(state-zero old)
|
|
|
|
:: unsubscribe from all foreign notebooks
|
|
|
|
:: kill all ford builds
|
|
|
|
:: flush all state
|
|
|
|
:: detect files in /web/publish
|
|
|
|
:: move to /app/publish/notebooks
|
|
|
|
:: for each notebook
|
|
|
|
:: kick all subscribers
|
|
|
|
:: make a group for it
|
|
|
|
:: send invites to all previously subscribed ships
|
|
|
|
::
|
|
|
|
|^
|
|
|
|
=/ rav [%sing %t [%da now.bol] /app/publish/notebooks]
|
|
|
|
=/ tile-json
|
|
|
|
(frond:enjs:format %notifications (numb:enjs:format 0))
|
|
|
|
=/ init-cards=(list card)
|
|
|
|
:~ [%pass /read/paths %arvo %c %warp our.bol q.byk.bol `rav]
|
|
|
|
:* %pass /permissions %agent [our.bol %permission-store] %watch
|
|
|
|
/updates
|
|
|
|
==
|
|
|
|
(invite-poke:main [%create /publish])
|
|
|
|
:* %pass /invites %agent [our.bol %invite-store] %watch
|
|
|
|
/invitatory/publish
|
|
|
|
==
|
|
|
|
[%give %fact [/publishtile]~ %json !>(tile-json)]
|
|
|
|
==
|
|
|
|
=+ ^- [kick-cards=(list card) old-subs=(jug @tas @p)] kick-subs
|
|
|
|
:_ this(state [%1 *state-one])
|
|
|
|
;: weld
|
2020-01-22 23:47:00 +03:00
|
|
|
kill-builds
|
2020-01-21 21:48:52 +03:00
|
|
|
leave-subs
|
|
|
|
kick-cards
|
|
|
|
init-cards
|
|
|
|
(move-files old-subs)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ leave-subs
|
|
|
|
^- (list card)
|
|
|
|
%+ turn ~(tap by wex.bol)
|
|
|
|
|= [[wir=wire who=@p @] ? path]
|
|
|
|
^- card
|
|
|
|
[%pass wir %agent [who %publish] %leave ~]
|
|
|
|
::
|
|
|
|
++ kick-subs
|
|
|
|
^- [(list card) (jug @tas @p)]
|
|
|
|
=+ ^- [paths=(list path) subs=(jug @tas @p)]
|
|
|
|
%+ roll ~(tap by sup.bol)
|
|
|
|
|= [[duct [who=@p pax=path]] paths=(list path) subs=(jug @tas @p)]
|
|
|
|
^- [(list path) (jug @tas @p)]
|
|
|
|
?. ?=([%collection @ ~] pax)
|
|
|
|
[paths subs]
|
|
|
|
=/ book-name i.t.pax
|
|
|
|
:- [pax paths]
|
|
|
|
(~(put ju subs) book-name who)
|
2020-01-22 23:47:00 +03:00
|
|
|
?~ paths
|
|
|
|
[~ subs]
|
2020-01-21 21:48:52 +03:00
|
|
|
[[%give %kick paths ~]~ subs]
|
|
|
|
::
|
|
|
|
++ kill-builds
|
|
|
|
^- (list card)
|
|
|
|
%- zing
|
|
|
|
%+ turn ~(tap by pubs.zero)
|
|
|
|
|= [col-name=@tas col-data=collection-zero]
|
|
|
|
^- (list card)
|
|
|
|
:- [%pass /collection/[col-name] %arvo %f %kill ~]
|
|
|
|
%- zing
|
|
|
|
%+ turn ~(tap by pos.col-data)
|
|
|
|
|= [pos-name=@tas *]
|
|
|
|
:~ [%pass /post/[col-name]/[pos-name] %arvo %f %kill ~]
|
|
|
|
[%pass /comments/[col-name]/[pos-name] %arvo %f %kill ~]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ send-invites
|
|
|
|
|= [book=@tas subscribers=(set @p)]
|
|
|
|
^- (list card)
|
|
|
|
%+ turn ~(tap in subscribers)
|
|
|
|
|= who=@p
|
|
|
|
^- card
|
|
|
|
=/ uid (sham %publish who book eny.bol)
|
|
|
|
=/ inv=invite
|
|
|
|
:* our.bol %publish /notebook/[book] who
|
|
|
|
'invite for notebook {<who>}/{<book>}'
|
|
|
|
==
|
|
|
|
=/ act=invite-action [%invite /publish uid inv]
|
|
|
|
[%pass /invite %agent [who %invite-hook] %poke %invite-action !>(act)]
|
|
|
|
::
|
|
|
|
++ move-files
|
|
|
|
|= old-subs=(jug @tas @p)
|
|
|
|
^- (list card)
|
|
|
|
=+ ^- [cards=(list card) sob=soba:clay]
|
2020-01-22 23:47:00 +03:00
|
|
|
%+ roll .^((list path) %ct (weld our-beak:main /web/publish))
|
2020-01-21 21:48:52 +03:00
|
|
|
|= [pax=path car=(list card) sob=soba:clay]
|
|
|
|
^- [(list card) soba:clay]
|
|
|
|
?+ pax
|
|
|
|
[car sob]
|
|
|
|
::
|
|
|
|
[%web %publish @ %publish-info ~]
|
|
|
|
=/ book-name i.t.t.pax
|
2020-01-22 23:47:00 +03:00
|
|
|
=/ old=old-info .^(old-info %cx (welp our-beak:main pax))
|
2020-02-04 22:14:06 +03:00
|
|
|
=/ write-pax /~/publish/(scot %p our.bol)/[book-name]/write
|
|
|
|
=/ read-pax /~/publish/(scot %p our.bol)/[book-name]/read
|
|
|
|
=/ book=notebook-info
|
|
|
|
[title.old '' =(%open comments.old) write-pax read-pax]
|
|
|
|
=/ grp-car=(list card)
|
|
|
|
(make-groups ~ writers.book ~ subscribers.book %journal)
|
2020-01-21 21:48:52 +03:00
|
|
|
=/ inv-car (send-invites book-name (~(get ju old-subs) book-name))
|
|
|
|
:- :(weld car grp-car inv-car)
|
|
|
|
^- soba:clay
|
|
|
|
:+ [pax %del ~]
|
|
|
|
:- /app/publish/notebooks/[book-name]/publish-info
|
|
|
|
[%ins %publish-info !>(book)]
|
|
|
|
sob
|
|
|
|
::
|
|
|
|
[%web %publish @ @ %udon ~]
|
|
|
|
=/ book i.t.t.pax
|
|
|
|
=/ note i.t.t.t.pax
|
|
|
|
:- car
|
|
|
|
:+ [pax %del ~]
|
|
|
|
:- /app/publish/notebooks/[book]/[note]/udon
|
2020-01-22 23:47:00 +03:00
|
|
|
[%ins %udon !>(.^(@t %cx (welp our-beak:main pax)))]
|
2020-01-21 21:48:52 +03:00
|
|
|
sob
|
|
|
|
::
|
|
|
|
[%web %publish @ @ @ %publish-comment ~]
|
|
|
|
=/ book i.t.t.pax
|
|
|
|
=/ note i.t.t.t.pax
|
|
|
|
=/ comm i.t.t.t.t.pax
|
2020-01-22 23:47:00 +03:00
|
|
|
=/ old=old-comment .^(old-comment %cx (welp our-beak:main pax))
|
|
|
|
=/ new=comment [creator.old date-created.old content.old]
|
2020-01-21 21:48:52 +03:00
|
|
|
:- car
|
2020-01-22 23:47:00 +03:00
|
|
|
|
2020-01-21 21:48:52 +03:00
|
|
|
:+ [pax %del ~]
|
|
|
|
:- /app/publish/notebooks/[book]/[note]/[comm]/publish-comment
|
2020-01-22 23:47:00 +03:00
|
|
|
[%ins %publish-comment !>(new)]
|
2020-01-21 21:48:52 +03:00
|
|
|
sob
|
|
|
|
==
|
|
|
|
[[%pass /move-files %arvo %c %info q.byk.bol %& sob] cards]
|
|
|
|
--
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
|
|
|
++ on-poke
|
2019-12-03 23:10:50 +03:00
|
|
|
|= [mar=mark vas=vase]
|
2019-11-21 21:58:15 +03:00
|
|
|
^- (quip card _this)
|
2019-12-03 23:10:50 +03:00
|
|
|
?+ mar (on-poke:def mar vas)
|
|
|
|
%noun
|
2020-01-24 21:58:18 +03:00
|
|
|
?: =(%print-state q.vas)
|
|
|
|
~& state
|
|
|
|
[~ this]
|
|
|
|
?: =(%print-bowl q.vas)
|
|
|
|
~& bol
|
|
|
|
[~ this]
|
2019-12-03 23:10:50 +03:00
|
|
|
[~ this]
|
|
|
|
::
|
|
|
|
%handle-http-request
|
|
|
|
=+ !<([id=@ta req=inbound-request:eyre] vas)
|
|
|
|
:_ this
|
|
|
|
%+ give-simple-payload:app id
|
|
|
|
%+ require-authorization:app req
|
2019-12-09 20:10:03 +03:00
|
|
|
handle-http-request:main
|
2019-12-06 02:42:38 +03:00
|
|
|
::
|
2020-01-09 02:13:42 +03:00
|
|
|
%publish-action
|
2019-12-06 02:42:38 +03:00
|
|
|
=^ cards state
|
2019-12-09 20:10:03 +03:00
|
|
|
(poke-publish-action:main !<(action vas))
|
2019-12-06 02:42:38 +03:00
|
|
|
[cards this]
|
2019-12-03 23:10:50 +03:00
|
|
|
==
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
|
|
|
++ on-watch
|
2019-12-06 02:42:38 +03:00
|
|
|
|= pax=path
|
2019-11-21 21:58:15 +03:00
|
|
|
^- (quip card _this)
|
2019-12-06 02:42:38 +03:00
|
|
|
?+ pax (on-watch:def pax)
|
|
|
|
[%http-response *] [~ this]
|
|
|
|
::
|
|
|
|
[%notebook @ ~]
|
2020-01-09 02:13:42 +03:00
|
|
|
=^ cards state
|
|
|
|
(watch-notebook:main pax)
|
|
|
|
[cards this]
|
2019-12-09 20:10:03 +03:00
|
|
|
::
|
|
|
|
[%primary ~] [~ this]
|
2019-12-06 02:42:38 +03:00
|
|
|
::
|
2020-01-10 04:11:06 +03:00
|
|
|
[%publishtile ~]
|
|
|
|
=/ jon=json
|
|
|
|
(frond:enjs:format %notifications (numb:enjs:format tile-num))
|
|
|
|
:_ this
|
|
|
|
[%give %fact ~ %json !>(jon)]~
|
2019-12-03 23:10:50 +03:00
|
|
|
==
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
2019-12-14 01:27:37 +03:00
|
|
|
++ on-leave on-leave:def
|
2020-01-08 21:45:16 +03:00
|
|
|
++ on-peek on-peek:def
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
|
|
|
++ on-agent
|
2019-12-06 02:42:38 +03:00
|
|
|
|= [wir=wire sin=sign:agent:gall]
|
2019-11-21 21:58:15 +03:00
|
|
|
^- (quip card _this)
|
2019-12-06 02:42:38 +03:00
|
|
|
?- -.sin
|
|
|
|
%poke-ack (on-agent:def wir sin)
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
2019-12-06 02:42:38 +03:00
|
|
|
%watch-ack (on-agent:def wir sin)
|
|
|
|
::
|
|
|
|
%kick (on-agent:def wir sin)
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
|
|
|
%fact
|
2019-12-06 02:42:38 +03:00
|
|
|
?+ wir (on-agent:def wir sin)
|
|
|
|
[%subscribe @ @ ~]
|
|
|
|
=/ who=@p (slav %p i.t.wir)
|
|
|
|
=/ book-name i.t.t.wir
|
2019-12-14 01:27:37 +03:00
|
|
|
?> ?=(%publish-notebook-delta p.cage.sin)
|
|
|
|
=^ cards state
|
2020-01-25 00:42:47 +03:00
|
|
|
(handle-notebook-delta:main !<(notebook-delta q.cage.sin) state)
|
2019-12-14 01:27:37 +03:00
|
|
|
[cards this]
|
2019-12-06 02:42:38 +03:00
|
|
|
::
|
2020-01-08 21:45:16 +03:00
|
|
|
[%permissions ~]
|
|
|
|
=^ cards state
|
|
|
|
(handle-permission-update:main !<(permission-update q.cage.sin))
|
|
|
|
[cards this]
|
2019-12-06 02:42:38 +03:00
|
|
|
::
|
2020-01-08 21:45:16 +03:00
|
|
|
[%invites ~]
|
|
|
|
=^ cards state
|
|
|
|
(handle-invite-update:main !<(invite-update q.cage.sin))
|
|
|
|
[cards this]
|
2019-12-06 02:42:38 +03:00
|
|
|
==
|
2019-11-21 21:58:15 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ on-arvo
|
2019-12-03 23:10:50 +03:00
|
|
|
|= [wir=wire sin=sign-arvo]
|
2019-11-21 21:58:15 +03:00
|
|
|
^- (quip card _this)
|
2019-12-03 23:10:50 +03:00
|
|
|
?+ wir
|
|
|
|
(on-arvo:def wir sin)
|
|
|
|
::
|
|
|
|
[%read %paths ~]
|
|
|
|
?> ?=([?(%b %c) %writ *] sin)
|
|
|
|
=/ rot=riot:clay +>.sin
|
|
|
|
?> ?=(^ rot)
|
|
|
|
=^ cards state
|
|
|
|
(read-paths:main u.rot)
|
|
|
|
[cards this]
|
2019-12-14 01:27:37 +03:00
|
|
|
::
|
|
|
|
[%read %info *]
|
|
|
|
?> ?=([?(%b %c) %writ *] sin)
|
|
|
|
=/ rot=riot:clay +>.sin
|
|
|
|
=^ cards state
|
|
|
|
(read-info:main t.t.wir rot)
|
|
|
|
[cards this]
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
2019-12-03 23:10:50 +03:00
|
|
|
[%read %note *]
|
|
|
|
?> ?=([?(%b %c) %writ *] sin)
|
|
|
|
=/ rot=riot:clay +>.sin
|
|
|
|
=^ cards state
|
|
|
|
(read-note:main t.t.wir rot)
|
|
|
|
[cards this]
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
2019-12-03 23:10:50 +03:00
|
|
|
[%read %comment *]
|
|
|
|
?> ?=([?(%b %c) %writ *] sin)
|
|
|
|
=/ rot=riot:clay +>.sin
|
2019-11-21 21:58:15 +03:00
|
|
|
=^ cards state
|
2019-12-03 23:10:50 +03:00
|
|
|
(read-comment:main t.t.wir rot)
|
2019-11-21 21:58:15 +03:00
|
|
|
[cards this]
|
|
|
|
::
|
2019-12-03 23:10:50 +03:00
|
|
|
[%bind ~]
|
|
|
|
[~ this]
|
2019-11-21 21:58:15 +03:00
|
|
|
==
|
|
|
|
::
|
2019-12-14 01:27:37 +03:00
|
|
|
++ on-fail on-fail:def
|
2019-11-21 21:58:15 +03:00
|
|
|
--
|
|
|
|
::
|
|
|
|
|_ bol=bowl:gall
|
|
|
|
::
|
2019-12-03 23:10:50 +03:00
|
|
|
++ read-paths
|
|
|
|
|= ran=rant:clay
|
|
|
|
^- (quip card _state)
|
|
|
|
=/ rav [%next %t [%da now.bol] /app/publish/notebooks]
|
|
|
|
=/ new (filter-and-sort-paths !<((list path) q.r.ran))
|
|
|
|
=/ dif (diff-paths our-paths new)
|
|
|
|
=^ del-moves state (del-paths del.dif)
|
|
|
|
=^ add-moves state (add-paths add.dif)
|
|
|
|
::
|
|
|
|
=/ cards=(list card)
|
|
|
|
;: weld
|
|
|
|
[%pass /read/paths %arvo %c %warp our.bol q.byk.bol `rav]~
|
|
|
|
del-moves
|
|
|
|
add-moves
|
|
|
|
==
|
|
|
|
[cards state(our-paths new)]
|
|
|
|
::
|
2019-12-14 01:27:37 +03:00
|
|
|
++ read-info
|
|
|
|
|= [pax=path rot=riot:clay]
|
|
|
|
^- (quip card _state)
|
|
|
|
?> ?=([%app %publish %notebooks @ %publish-info ~] pax)
|
|
|
|
=/ book-name i.t.t.t.pax
|
|
|
|
?~ rot
|
|
|
|
[~ state]
|
|
|
|
=/ info=notebook-info !<(notebook-info q.r.u.rot)
|
|
|
|
=/ new-book=notebook
|
|
|
|
:* title.info
|
|
|
|
description.info
|
|
|
|
comments.info
|
|
|
|
writers.info
|
|
|
|
subscribers.info
|
|
|
|
now.bol
|
|
|
|
~ ~ ~
|
|
|
|
==
|
|
|
|
=/ rif=riff:clay [q.byk.bol `[%next %x [%da now.bol] pax]]
|
|
|
|
=/ delta=notebook-delta
|
|
|
|
[%edit-book our.bol book-name new-book]
|
|
|
|
=^ cards state
|
2020-01-25 00:42:47 +03:00
|
|
|
(handle-notebook-delta delta state)
|
2019-12-14 01:27:37 +03:00
|
|
|
:_ state
|
|
|
|
:* [%pass (welp /read/info pax) %arvo %c %warp our.bol rif]
|
|
|
|
cards
|
|
|
|
==
|
|
|
|
::
|
2019-12-03 23:10:50 +03:00
|
|
|
++ read-note
|
|
|
|
|= [pax=path rot=riot:clay]
|
|
|
|
^- (quip card _state)
|
|
|
|
?> ?=([%app %publish %notebooks @ @ %udon ~] pax)
|
|
|
|
=/ book-name i.t.t.t.pax
|
|
|
|
=/ note-name i.t.t.t.t.pax
|
|
|
|
=/ book (~(get by books) book-name)
|
|
|
|
?~ book
|
|
|
|
[~ state]
|
|
|
|
=/ old-note (~(get by notes.u.book) note-name)
|
|
|
|
?~ old-note
|
|
|
|
[~ state]
|
|
|
|
?~ rot
|
|
|
|
[~ state]
|
|
|
|
=/ udon !<(@t q.r.u.rot)
|
|
|
|
=/ new-note=note (form-note note-name udon)
|
|
|
|
=/ rif=riff:clay [q.byk.bol `[%next %x [%da now.bol] pax]]
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ delta=notebook-delta
|
|
|
|
[%edit-note our.bol book-name note-name new-note]
|
|
|
|
=^ cards state
|
2020-01-25 00:42:47 +03:00
|
|
|
(handle-notebook-delta delta state)
|
2019-12-14 01:27:37 +03:00
|
|
|
:_ state
|
|
|
|
:* [%pass (welp /read/note pax) %arvo %c %warp our.bol rif]
|
|
|
|
cards
|
2019-12-09 20:10:03 +03:00
|
|
|
==
|
2019-12-03 23:10:50 +03:00
|
|
|
::
|
|
|
|
++ read-comment
|
|
|
|
|= [pax=path rot=riot:clay]
|
|
|
|
^- (quip card _state)
|
|
|
|
?> ?=([%app %publish %notebooks @ @ @ %publish-comment ~] pax)
|
2019-12-14 01:27:37 +03:00
|
|
|
?~ rot
|
|
|
|
[~ state]
|
2019-12-03 23:10:50 +03:00
|
|
|
=/ comment-date (slaw %da i.t.t.t.t.t.pax)
|
|
|
|
?~ comment-date
|
|
|
|
[~ state]
|
2019-12-19 01:45:37 +03:00
|
|
|
=/ book-name i.t.t.t.pax
|
|
|
|
=/ note-name i.t.t.t.t.pax
|
|
|
|
=/ new-comment !<(comment q.r.u.rot)
|
2019-12-03 23:10:50 +03:00
|
|
|
=/ rif=riff:clay [q.byk.bol `[%next %x [%da now.bol] pax]]
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ delta=notebook-delta
|
|
|
|
[%edit-comment our.bol book-name note-name u.comment-date new-comment]
|
|
|
|
=^ cards state
|
2020-01-25 00:42:47 +03:00
|
|
|
(handle-notebook-delta delta state)
|
2019-12-14 01:27:37 +03:00
|
|
|
:_ state
|
|
|
|
:* [%pass (welp /read/comment pax) %arvo %c %warp our.bol rif]
|
|
|
|
cards
|
2019-12-09 20:10:03 +03:00
|
|
|
==
|
2019-12-03 23:10:50 +03:00
|
|
|
::
|
|
|
|
++ filter-and-sort-paths
|
|
|
|
|= paths=(list path)
|
|
|
|
^- (list path)
|
|
|
|
%+ sort
|
|
|
|
%+ skim paths
|
|
|
|
|= pax=path
|
2019-12-14 01:27:37 +03:00
|
|
|
?| ?=([%app %publish %notebooks @ %publish-info ~] pax)
|
|
|
|
?=([%app %publish %notebooks @ @ %udon ~] pax)
|
2019-12-03 23:10:50 +03:00
|
|
|
?=([%app %publish %notebooks @ @ @ %publish-comment ~] pax)
|
|
|
|
==
|
|
|
|
|= [a=path b=path]
|
|
|
|
^- ?
|
|
|
|
(lte (lent a) (lent b))
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
2019-12-03 23:10:50 +03:00
|
|
|
++ diff-paths
|
|
|
|
|= [old=(list path) new=(list path)]
|
|
|
|
^- [del=(list path) add=(list path)]
|
|
|
|
=/ del=(list path) (skim old |=(p=path ?=(~ (find [p]~ new))))
|
|
|
|
=/ add=(list path) (skim new |=(p=path ?=(~ (find [p]~ old))))
|
|
|
|
[del add]
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
2019-12-03 23:10:50 +03:00
|
|
|
++ del-paths
|
|
|
|
|= paths=(list path)
|
|
|
|
^- (quip card _state)
|
|
|
|
%+ roll paths
|
|
|
|
|= [pax=path cad=(list card) sty=_state]
|
|
|
|
?+ pax !!
|
2019-12-14 01:27:37 +03:00
|
|
|
[%app %publish %notebooks @ %publish-info ~]
|
|
|
|
=/ book-name i.t.t.t.pax
|
|
|
|
=/ delta=notebook-delta [%del-book our.bol book-name]
|
2020-01-27 20:23:20 +03:00
|
|
|
=^ cards sty (handle-notebook-delta delta sty)
|
|
|
|
[(weld cards cad) sty]
|
2019-12-14 01:27:37 +03:00
|
|
|
::
|
2019-12-03 23:10:50 +03:00
|
|
|
[%app %publish %notebooks @ @ %udon ~]
|
|
|
|
=/ book-name i.t.t.t.pax
|
|
|
|
=/ note-name i.t.t.t.t.pax
|
|
|
|
=/ book (~(get by books.sty) book-name)
|
|
|
|
?~ book
|
|
|
|
[~ sty]
|
|
|
|
=. notes.u.book (~(del by notes.u.book) note-name)
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ delta=notebook-delta [%del-note our.bol book-name note-name]
|
2020-01-27 20:23:20 +03:00
|
|
|
=^ cards sty (handle-notebook-delta delta sty)
|
|
|
|
[(weld cards cad) sty]
|
2019-12-03 23:10:50 +03:00
|
|
|
::
|
|
|
|
[%app %publish %notebooks @ @ @ %publish-comment ~]
|
|
|
|
=/ book-name i.t.t.t.pax
|
|
|
|
=/ note-name i.t.t.t.t.pax
|
|
|
|
=/ comment-date (slaw %da i.t.t.t.t.t.pax)
|
|
|
|
?~ comment-date
|
|
|
|
[~ sty]
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ delta=notebook-delta
|
|
|
|
[%del-comment our.bol book-name note-name u.comment-date]
|
2020-01-27 20:23:20 +03:00
|
|
|
=^ cards sty (handle-notebook-delta delta sty)
|
|
|
|
[(weld cards cad) sty]
|
2019-12-14 01:27:37 +03:00
|
|
|
==
|
|
|
|
::
|
2019-12-03 23:10:50 +03:00
|
|
|
++ add-paths
|
|
|
|
|= paths=(list path)
|
|
|
|
^- (quip card _state)
|
|
|
|
%+ roll paths
|
|
|
|
|= [pax=path cad=(list card) sty=_state]
|
2019-12-14 01:27:37 +03:00
|
|
|
^- (quip card _state)
|
2019-12-03 23:10:50 +03:00
|
|
|
?+ pax !!
|
2019-12-14 01:27:37 +03:00
|
|
|
[%app %publish %notebooks @ %publish-info ~]
|
|
|
|
=/ book-name i.t.t.t.pax
|
|
|
|
=/ info=notebook-info .^(notebook-info %cx (welp our-beak pax))
|
|
|
|
=/ new-book=notebook
|
|
|
|
:* title.info
|
|
|
|
description.info
|
|
|
|
comments.info
|
|
|
|
writers.info
|
|
|
|
subscribers.info
|
|
|
|
now.bol
|
|
|
|
~ ~ ~
|
|
|
|
==
|
2020-02-04 22:14:06 +03:00
|
|
|
=? writers.new-book =(writers.new-book /)
|
|
|
|
/~/publish/(scot %p our.bol)/[book-name]/write
|
|
|
|
=? subscribers.new-book =(writers.new-book /)
|
|
|
|
/~/publish/(scot %p our.bol)/[book-name]/read
|
|
|
|
=/ grp-car=(list card)
|
|
|
|
(make-groups ~ writers.new-book ~ subscribers.new-book %journal)
|
2019-12-14 01:27:37 +03:00
|
|
|
=+ ^- [read-cards=(list card) notes=(map @tas note)]
|
|
|
|
(watch-notes /app/publish/notebooks/[book-name])
|
|
|
|
=. notes.new-book notes
|
|
|
|
=/ delta=notebook-delta [%add-book our.bol book-name new-book]
|
|
|
|
::
|
|
|
|
=/ rif=riff:clay [q.byk.bol `[%next %x [%da now.bol] pax]]
|
2020-01-25 00:42:47 +03:00
|
|
|
=^ update-cards sty (handle-notebook-delta delta sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
:_ sty
|
|
|
|
;: weld
|
2020-01-27 20:23:20 +03:00
|
|
|
grp-car
|
2019-12-14 01:27:37 +03:00
|
|
|
[%pass (welp /read/info pax) %arvo %c %warp our.bol rif]~
|
|
|
|
read-cards
|
|
|
|
update-cards
|
2020-01-27 20:23:20 +03:00
|
|
|
cad
|
2019-12-14 01:27:37 +03:00
|
|
|
==
|
|
|
|
::
|
2019-12-03 23:10:50 +03:00
|
|
|
[%app %publish %notebooks @ @ %udon ~]
|
|
|
|
=/ book-name i.t.t.t.pax
|
|
|
|
=/ note-name i.t.t.t.t.pax
|
|
|
|
=/ new-note=note (scry-note pax)
|
2019-12-14 01:27:37 +03:00
|
|
|
=+ ^- [read-cards=(list card) comments=(map @da comment)]
|
|
|
|
(watch-comments /app/publish/notebooks/[book-name]/[note-name])
|
|
|
|
=. comments.new-note comments
|
2019-12-03 23:10:50 +03:00
|
|
|
=/ rif=riff:clay [q.byk.bol `[%next %x [%da now.bol] pax]]
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ delta=notebook-delta
|
|
|
|
[%add-note our.bol book-name note-name new-note]
|
2020-01-25 00:42:47 +03:00
|
|
|
=^ update-cards sty (handle-notebook-delta delta sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
:_ sty
|
|
|
|
;: weld
|
|
|
|
[%pass (welp /read/note pax) %arvo %c %warp our.bol rif]~
|
|
|
|
read-cards
|
|
|
|
update-cards
|
2020-01-27 20:23:20 +03:00
|
|
|
cad
|
2019-12-09 20:10:03 +03:00
|
|
|
==
|
2019-12-03 23:10:50 +03:00
|
|
|
::
|
|
|
|
[%app %publish %notebooks @ @ @ %publish-comment ~]
|
|
|
|
=/ book-name i.t.t.t.pax
|
|
|
|
=/ note-name i.t.t.t.t.pax
|
|
|
|
=/ comment-name (slaw %da i.t.t.t.t.t.pax)
|
|
|
|
?~ comment-name
|
|
|
|
[~ sty]
|
|
|
|
=/ new-com .^(comment %cx (welp our-beak pax))
|
|
|
|
=/ rif=riff:clay [q.byk.bol `[%next %x [%da now.bol] pax]]
|
2019-12-14 01:27:37 +03:00
|
|
|
::
|
|
|
|
=/ delta=notebook-delta
|
|
|
|
[%add-comment our.bol book-name note-name u.comment-name new-com]
|
2020-01-25 00:42:47 +03:00
|
|
|
=^ update-cards sty (handle-notebook-delta delta sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
:_ sty
|
|
|
|
;: weld
|
|
|
|
[%pass (welp /read/comment pax) %arvo %c %warp our.bol rif]~
|
|
|
|
update-cards
|
2020-01-27 20:23:20 +03:00
|
|
|
cad
|
2019-12-09 20:10:03 +03:00
|
|
|
==
|
2019-12-03 23:10:50 +03:00
|
|
|
==
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
2019-12-14 01:27:37 +03:00
|
|
|
++ watch-notes
|
|
|
|
|= pax=path
|
|
|
|
^- [(list card) (map @tas note)]
|
|
|
|
=/ paths .^((list path) %ct (weld our-beak pax))
|
|
|
|
%+ roll paths
|
|
|
|
|= [pax=path cards=(list card) notes=(map @tas note)]
|
|
|
|
?. ?=([%app %publish %notebooks @ @ %udon ~] pax)
|
|
|
|
[cards notes]
|
|
|
|
=/ book-name i.t.t.t.pax
|
|
|
|
=/ note-name i.t.t.t.t.pax
|
|
|
|
=/ new-note (scry-note pax)
|
|
|
|
=^ comment-cards comments.new-note
|
|
|
|
(watch-comments /app/publish/notebooks/[book-name]/[note-name])
|
|
|
|
=/ rif=riff:clay [q.byk.bol `[%next %x [%da now.bol] pax]]
|
|
|
|
:_ (~(put by notes) note-name new-note)
|
|
|
|
;: weld
|
|
|
|
[%pass (welp /read/comment pax) %arvo %c %warp our.bol rif]~
|
|
|
|
comment-cards
|
|
|
|
cards
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ watch-comments
|
|
|
|
|= pax=path
|
|
|
|
^- [(list card) (map @da comment)]
|
|
|
|
=/ paths .^((list path) %ct (weld our-beak pax))
|
|
|
|
%+ roll paths
|
|
|
|
|= [pax=path cards=(list card) comments=(map @da comment)]
|
|
|
|
?. ?=([%app %publish %notebooks @ @ @ %publish-comment ~] pax)
|
|
|
|
[cards comments]
|
|
|
|
=/ comment-name (slaw %da i.t.t.t.t.t.pax)
|
|
|
|
?~ comment-name
|
|
|
|
[cards comments]
|
|
|
|
=/ new-com .^(comment %cx (welp our-beak pax))
|
|
|
|
=/ rif=riff:clay [q.byk.bol `[%next %x [%da now.bol] pax]]
|
|
|
|
:_ (~(put by comments) u.comment-name new-com)
|
|
|
|
[[%pass (welp /read/comment pax) %arvo %c %warp our.bol rif] cards]
|
|
|
|
::
|
2019-12-03 23:10:50 +03:00
|
|
|
++ scry-note
|
|
|
|
|= pax=path
|
|
|
|
^- note
|
|
|
|
?> ?=([%app %publish %notebooks @ @ %udon ~] pax)
|
|
|
|
=/ note-name i.t.t.t.t.pax
|
|
|
|
=/ udon=@t .^(@t %cx (welp our-beak pax))
|
|
|
|
(form-note note-name udon)
|
|
|
|
::
|
|
|
|
++ form-note
|
|
|
|
|= [note-name=@tas udon=@t]
|
|
|
|
^- note
|
2020-02-01 02:00:06 +03:00
|
|
|
=/ body=tape (slag (add 3 (need (find ";>" (trip udon)))) (trip udon))
|
|
|
|
=/ snippet=@t (of-wain:format (scag 1 (to-wain:format (crip body))))
|
|
|
|
:: =/ build=(each manx tang)
|
|
|
|
:: %- mule |.
|
|
|
|
:: ^- manx
|
|
|
|
:: elm:(static:cram (ream udon))
|
2019-12-03 23:10:50 +03:00
|
|
|
::
|
|
|
|
=/ meta=(each (map term knot) tang)
|
|
|
|
%- mule |.
|
|
|
|
%- ~(run by inf:(static:cram (ream udon)))
|
|
|
|
|= a=dime ^- cord
|
|
|
|
?+ (end 3 1 p.a) (scot a)
|
|
|
|
%t q.a
|
|
|
|
==
|
|
|
|
::
|
|
|
|
=/ author=@p our.bol
|
|
|
|
=? author ?=(%.y -.meta)
|
|
|
|
%+ fall
|
|
|
|
(biff (~(get by p.meta) %author) (slat %p))
|
|
|
|
our.bol
|
|
|
|
::
|
|
|
|
=/ title=@t note-name
|
|
|
|
=? title ?=(%.y -.meta)
|
|
|
|
(fall (~(get by p.meta) %title) note-name)
|
|
|
|
::
|
|
|
|
:* author
|
|
|
|
title
|
|
|
|
note-name
|
|
|
|
now.bol
|
|
|
|
now.bol
|
2019-12-19 01:45:37 +03:00
|
|
|
%.n
|
2019-12-03 23:10:50 +03:00
|
|
|
udon
|
2020-02-01 02:00:06 +03:00
|
|
|
snippet
|
2019-12-03 23:10:50 +03:00
|
|
|
~
|
|
|
|
==
|
|
|
|
::
|
2020-01-08 21:45:16 +03:00
|
|
|
++ handle-permission-update
|
|
|
|
|= upd=permission-update
|
|
|
|
^- (quip card _state)
|
2020-01-10 04:11:06 +03:00
|
|
|
?. ?=(%remove -.upd)
|
2020-01-08 21:45:16 +03:00
|
|
|
[~ state]
|
|
|
|
=/ book=@tas
|
|
|
|
%- need
|
|
|
|
%+ roll ~(tap by books)
|
|
|
|
|= [[nom=@tas book=notebook] out=(unit @tas)]
|
|
|
|
?: =(path.upd subscribers.book)
|
|
|
|
`nom
|
|
|
|
out
|
|
|
|
:_ state
|
|
|
|
%- zing
|
|
|
|
%+ turn ~(tap in who.upd)
|
|
|
|
|= who=@p
|
|
|
|
?: (allowed who %read book)
|
|
|
|
~
|
2020-01-10 04:11:06 +03:00
|
|
|
[%give %kick [/notebook/[book]]~ `who]~
|
2020-01-08 21:45:16 +03:00
|
|
|
::
|
|
|
|
++ handle-invite-update
|
|
|
|
|= upd=invite-update
|
|
|
|
^- (quip card _state)
|
2020-01-10 04:11:06 +03:00
|
|
|
?+ -.upd
|
2020-01-08 21:45:16 +03:00
|
|
|
[~ state]
|
2020-01-10 04:11:06 +03:00
|
|
|
::
|
|
|
|
%delete
|
|
|
|
=/ scry-pax
|
|
|
|
/(scot %p our.bol)/invite-store/(scot %da now.bol)/invitatory/publish/noun
|
|
|
|
=/ inv=(unit invitatory) .^((unit invitatory) %gx scry-pax)
|
|
|
|
?~ inv
|
|
|
|
[~ state]
|
|
|
|
=. tile-num (sub tile-num ~(wyt by u.inv))
|
|
|
|
=/ jon=json (frond:enjs:format %notifications (numb:enjs:format tile-num))
|
|
|
|
:_ state
|
|
|
|
[%give %fact [/publishtile]~ %json !>(jon)]~
|
|
|
|
::
|
|
|
|
%invite
|
|
|
|
=. tile-num +(tile-num)
|
|
|
|
=/ jon=json (frond:enjs:format %notifications (numb:enjs:format tile-num))
|
|
|
|
:_ state
|
|
|
|
[%give %fact [/publishtile]~ %json !>(jon)]~
|
|
|
|
::
|
|
|
|
%decline
|
|
|
|
=. tile-num (dec tile-num)
|
|
|
|
=/ jon=json (frond:enjs:format %notifications (numb:enjs:format tile-num))
|
|
|
|
:_ state
|
|
|
|
[%give %fact [/publishtile]~ %json !>(jon)]~
|
|
|
|
::
|
|
|
|
%accepted
|
|
|
|
?> ?=([%notebook @ ~] path.invite.upd)
|
|
|
|
=/ book i.t.path.invite.upd
|
|
|
|
=/ wir=wire /subscribe/(scot %p ship.invite.upd)/[book]
|
|
|
|
=. tile-num (dec tile-num)
|
|
|
|
=/ jon=json (frond:enjs:format %notifications (numb:enjs:format tile-num))
|
|
|
|
:_ state
|
|
|
|
:~ [%pass wir %agent [ship.invite.upd %publish] %watch path.invite.upd]
|
|
|
|
[%give %fact [/publishtile]~ %json !>(jon)]
|
|
|
|
==
|
2020-01-08 21:45:16 +03:00
|
|
|
==
|
|
|
|
::
|
2020-01-09 02:13:42 +03:00
|
|
|
++ watch-notebook
|
|
|
|
|= pax=path
|
|
|
|
?> ?=([%notebook @ ~] pax)
|
|
|
|
=/ book-name i.t.pax
|
|
|
|
?. (allowed src.bol %read book-name)
|
|
|
|
~|("not permitted" !!)
|
|
|
|
=/ book (~(got by books) book-name)
|
|
|
|
=/ delta=notebook-delta
|
|
|
|
[%add-book our.bol book-name book]
|
|
|
|
:_ state
|
|
|
|
[%give %fact ~ %publish-notebook-delta !>(delta)]~
|
|
|
|
::
|
2019-12-03 23:10:50 +03:00
|
|
|
++ our-beak /(scot %p our.bol)/[q.byk.bol]/(scot %da now.bol)
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
|
|
|
++ allowed
|
2020-01-08 21:45:16 +03:00
|
|
|
|= [who=@p mod=?(%read %write) book=@tas]
|
2019-11-21 21:58:15 +03:00
|
|
|
^- ?
|
2020-01-08 21:45:16 +03:00
|
|
|
=/ scry-bek /(scot %p our.bol)/permission-store/(scot %da now.bol)
|
|
|
|
=/ book=notebook (~(got by books) book)
|
|
|
|
=/ scry-pax
|
|
|
|
?: =(%read mod)
|
|
|
|
subscribers.book
|
|
|
|
writers.book
|
2020-01-09 02:13:42 +03:00
|
|
|
=/ full-pax :(weld scry-bek /permitted/(scot %p who) scry-pax /noun)
|
2020-01-08 21:45:16 +03:00
|
|
|
.^(? %gx full-pax)
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
|
|
|
++ write-file
|
|
|
|
|= [pax=path cay=cage]
|
2020-01-04 00:06:42 +03:00
|
|
|
^- card
|
2019-11-21 21:58:15 +03:00
|
|
|
=. pax (weld our-beak pax)
|
2019-12-14 01:27:37 +03:00
|
|
|
[%pass (weld /write pax) %arvo %c %info (foal:space:userlib pax cay)]
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
|
|
|
++ delete-file
|
|
|
|
|= pax=path
|
|
|
|
^- card
|
|
|
|
=. pax (weld our-beak pax)
|
2019-12-14 01:27:37 +03:00
|
|
|
[%pass (weld /delete pax) %arvo %c %info (fray:space:userlib pax)]
|
2019-11-21 21:58:15 +03:00
|
|
|
::
|
2019-12-06 02:42:38 +03:00
|
|
|
++ delete-dir
|
|
|
|
|= pax=path
|
|
|
|
^- card
|
|
|
|
=/ nor=nori:clay
|
|
|
|
:- %&
|
|
|
|
%+ turn .^((list path) %ct (weld our-beak pax))
|
|
|
|
|= pax=path
|
|
|
|
^- [path miso:clay]
|
|
|
|
[pax %del ~]
|
|
|
|
[%pass (weld /delete pax) %arvo %c %info q.byk.bol nor]
|
|
|
|
::
|
|
|
|
++ add-front-matter
|
2019-11-21 21:58:15 +03:00
|
|
|
|= [fro=(map knot cord) udon=@t]
|
|
|
|
^- @t
|
|
|
|
%- of-wain:format
|
|
|
|
=/ tum (trip udon)
|
|
|
|
=/ id (find ";>" tum)
|
|
|
|
?~ id
|
|
|
|
%+ weld (front-to-wain fro)
|
2019-12-06 02:42:38 +03:00
|
|
|
(to-wain:format (crip :(weld ";>\0a" tum)))
|
2019-11-21 21:58:15 +03:00
|
|
|
%+ weld (front-to-wain fro)
|
|
|
|
(to-wain:format (crip (slag u.id tum)))
|
|
|
|
::
|
|
|
|
++ front-to-wain
|
|
|
|
|= a=(map knot cord)
|
|
|
|
^- wain
|
|
|
|
=/ entries=wain
|
|
|
|
%+ turn ~(tap by a)
|
|
|
|
|= b=[knot cord]
|
|
|
|
=/ c=[term cord] (,[term cord] b)
|
|
|
|
(crip " [{<-.c>} {<+.c>}]")
|
|
|
|
::
|
|
|
|
?~ entries ~
|
|
|
|
;: weld
|
|
|
|
[':- :~' ~]
|
|
|
|
entries
|
|
|
|
[' ==' ~]
|
|
|
|
==
|
|
|
|
::
|
2019-12-06 02:42:38 +03:00
|
|
|
++ group-poke
|
|
|
|
|= act=group-action
|
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bol %group-store] %poke %group-action !>(act)]
|
|
|
|
::
|
|
|
|
++ perm-hook-poke
|
|
|
|
|= act=permission-hook-action
|
|
|
|
^- card
|
|
|
|
:* %pass
|
|
|
|
/
|
|
|
|
%agent
|
|
|
|
[our.bol %permission-hook]
|
|
|
|
%poke
|
|
|
|
%permission-hook-action
|
|
|
|
!>(act)
|
|
|
|
==
|
|
|
|
::
|
2020-01-10 04:11:06 +03:00
|
|
|
++ invite-poke
|
|
|
|
|= act=invite-action
|
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bol %invite-store] %poke %invite-action !>(act)]
|
|
|
|
::
|
2019-12-06 02:42:38 +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)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ create-security
|
2020-01-08 21:45:16 +03:00
|
|
|
|= [read=path write=path sec=rw-security]
|
2019-12-06 02:42:38 +03:00
|
|
|
^- (list card)
|
2020-01-08 21:45:16 +03:00
|
|
|
=+ ^- [read-type=?(%black %white) write-type=?(%black %white)]
|
2019-12-06 02:42:38 +03:00
|
|
|
?- sec
|
|
|
|
%channel [%black %black]
|
|
|
|
%village [%white %white]
|
|
|
|
%journal [%black %white]
|
|
|
|
%mailbox [%white %black]
|
|
|
|
==
|
2020-01-08 21:45:16 +03:00
|
|
|
:~ (perm-group-hook-poke [%associate read [[read read-type] ~ ~]])
|
|
|
|
(perm-group-hook-poke [%associate write [[write write-type] ~ ~]])
|
2019-12-06 02:42:38 +03:00
|
|
|
==
|
|
|
|
::
|
2020-01-08 21:45:16 +03:00
|
|
|
++ make-groups
|
2020-02-04 22:14:06 +03:00
|
|
|
|= $: write-grp=(set ship) write-pax=path
|
|
|
|
read-grp=(set ship) read-pax=path
|
|
|
|
sec=rw-security
|
2020-01-08 21:45:16 +03:00
|
|
|
==
|
2020-02-04 22:14:06 +03:00
|
|
|
^- (list card)
|
|
|
|
;: weld
|
|
|
|
:~ (group-poke [%bundle write-pax])
|
|
|
|
(group-poke [%bundle read-pax])
|
|
|
|
(group-poke [%add write-grp write-pax])
|
|
|
|
(group-poke [%add read-grp read-pax])
|
|
|
|
==
|
|
|
|
(create-security read-pax write-pax sec)
|
|
|
|
:~ (perm-hook-poke [%add-owned write-pax write-pax])
|
|
|
|
(perm-hook-poke [%add-owned read-pax read-pax])
|
2020-01-08 21:45:16 +03:00
|
|
|
==
|
|
|
|
==
|
2019-12-14 01:27:37 +03:00
|
|
|
::
|
2019-12-09 20:10:03 +03:00
|
|
|
++ poke-publish-action
|
|
|
|
|= act=action
|
2019-12-06 02:42:38 +03:00
|
|
|
^- (quip card _state)
|
|
|
|
?- -.act
|
|
|
|
%new-book
|
2020-01-08 21:45:16 +03:00
|
|
|
?. (team:title our.bol src.bol)
|
|
|
|
~|("action not permitted" !!)
|
|
|
|
?: (~(has by books) book.act)
|
|
|
|
~|("notebook already exists: {<book.act>}" !!)
|
2020-02-04 22:14:06 +03:00
|
|
|
=+ ^- [cards=(list card) write-pax=path read-pax=path]
|
|
|
|
?. ?=(%new -.group.act)
|
|
|
|
[~ write-pax.group.act read-pax.group.act]
|
|
|
|
:_ [write-pax.group.act read-pax.group.act]
|
|
|
|
%- make-groups
|
|
|
|
:* write-grp.group.act write-pax.group.act
|
|
|
|
read-grp.group.act read-pax.group.act
|
|
|
|
sec.group.act
|
|
|
|
==
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ new-book=notebook-info
|
|
|
|
:* title.act
|
|
|
|
about.act
|
|
|
|
coms.act
|
2020-02-04 22:14:06 +03:00
|
|
|
write-pax
|
|
|
|
read-pax
|
2019-12-06 02:42:38 +03:00
|
|
|
==
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ pax=path /app/publish/notebooks/[book.act]/publish-info
|
|
|
|
:_ state
|
|
|
|
[(write-file pax %publish-info !>(new-book)) cards]
|
2019-12-06 02:42:38 +03:00
|
|
|
::
|
|
|
|
%new-note
|
2019-12-14 01:27:37 +03:00
|
|
|
?: &(=(src.bol our.bol) !=(our.bol who.act))
|
|
|
|
:_ state
|
2020-01-09 02:13:42 +03:00
|
|
|
[%pass /forward %agent [who.act %publish] %poke %publish-action !>(act)]~
|
2020-01-08 21:45:16 +03:00
|
|
|
=/ book=(unit notebook) (~(get by books) book.act)
|
|
|
|
?~ book
|
|
|
|
~|("nonexistent notebook {<book.act>}" !!)
|
|
|
|
?: (~(has by notes.u.book) note.act)
|
|
|
|
~|("note already exists: {<note.act>}" !!)
|
|
|
|
?. ?| (team:title our.bol src.bol)
|
|
|
|
(allowed src.bol %write book.act)
|
|
|
|
==
|
|
|
|
~|("action not permitted" !!)
|
2019-12-06 02:42:38 +03:00
|
|
|
=/ pax=path /app/publish/notebooks/[book.act]/[note.act]/udon
|
|
|
|
=/ front=(map knot cord)
|
|
|
|
%- my
|
|
|
|
:~ title+title.act
|
|
|
|
author+(scot %p src.bol)
|
|
|
|
==
|
|
|
|
=. body.act (cat 3 body.act '\0a')
|
|
|
|
=/ file=@t (add-front-matter front body.act)
|
|
|
|
:_ state
|
|
|
|
[(write-file pax %udon !>(file))]~
|
|
|
|
::
|
|
|
|
%new-comment
|
2019-12-14 01:27:37 +03:00
|
|
|
?: &(=(src.bol our.bol) !=(our.bol who.act))
|
|
|
|
:_ state
|
2020-01-09 02:13:42 +03:00
|
|
|
[%pass /forward %agent [who.act %publish] %poke %publish-action !>(act)]~
|
2020-01-08 21:45:16 +03:00
|
|
|
=/ book=(unit notebook) (~(get by books) book.act)
|
|
|
|
?~ book
|
|
|
|
~|("nonexistent notebook {<book.act>}" !!)
|
|
|
|
?. (~(has by notes.u.book) note.act)
|
|
|
|
~|("nonexistent note {<note.act>}" !!)
|
|
|
|
?. ?& ?| (team:title our.bol src.bol)
|
|
|
|
(allowed src.bol %read book.act)
|
|
|
|
==
|
|
|
|
comments.u.book
|
|
|
|
==
|
|
|
|
~|("action not permitted" !!)
|
2019-12-06 02:42:38 +03:00
|
|
|
=/ pax=path
|
|
|
|
%+ weld /app/publish/notebooks
|
|
|
|
/[book.act]/[note.act]/(scot %da now.bol)/publish-comment
|
|
|
|
=/ new-comment=comment
|
|
|
|
:* author=src.bol
|
|
|
|
date-created=now.bol
|
|
|
|
content=body.act
|
|
|
|
==
|
|
|
|
:_ state
|
|
|
|
[(write-file pax %publish-comment !>(new-comment))]~
|
|
|
|
::
|
|
|
|
%edit-book
|
2020-01-08 21:45:16 +03:00
|
|
|
?. (team:title our.bol src.bol)
|
|
|
|
~|("action not permitted" !!)
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ book (~(get by books) book.act)
|
|
|
|
?~ book
|
2020-01-08 21:45:16 +03:00
|
|
|
~|("nonexistent notebook" !!)
|
2020-02-04 22:14:06 +03:00
|
|
|
=+ ^- [cards=(list card) write-pax=path read-pax=path]
|
2019-12-14 01:27:37 +03:00
|
|
|
?~ group.act
|
|
|
|
[~ writers.u.book subscribers.u.book]
|
2020-02-04 22:14:06 +03:00
|
|
|
?. ?=(%new -.u.group.act)
|
|
|
|
[~ write-pax.u.group.act read-pax.u.group.act]
|
|
|
|
:_ [write-pax.u.group.act read-pax.u.group.act]
|
|
|
|
%- make-groups
|
|
|
|
:* write-grp.u.group.act write-pax.u.group.act
|
|
|
|
read-grp.u.group.act read-pax.u.group.act
|
|
|
|
sec.u.group.act
|
|
|
|
==
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ new-info=notebook-info
|
|
|
|
:* title.act
|
|
|
|
about.act
|
|
|
|
coms.act
|
2020-02-04 22:14:06 +03:00
|
|
|
write-pax
|
|
|
|
read-pax
|
2019-12-06 02:42:38 +03:00
|
|
|
==
|
2019-12-19 01:45:37 +03:00
|
|
|
=/ pax=path /app/publish/notebooks/[book.act]/publish-info
|
2019-12-14 01:27:37 +03:00
|
|
|
:_ state
|
2019-12-19 01:45:37 +03:00
|
|
|
[(write-file pax %publish-info !>(new-info)) cards]
|
2019-12-06 02:42:38 +03:00
|
|
|
::
|
|
|
|
%edit-note
|
2019-12-14 01:27:37 +03:00
|
|
|
?: &(=(src.bol our.bol) !=(our.bol who.act))
|
|
|
|
:_ state
|
2020-01-09 02:13:42 +03:00
|
|
|
[%pass /forward %agent [who.act %publish] %poke %publish-action !>(act)]~
|
2020-01-08 21:45:16 +03:00
|
|
|
=/ book=(unit notebook) (~(get by books) book.act)
|
|
|
|
?~ book
|
|
|
|
~|("nonexistent notebook {<book.act>}" !!)
|
|
|
|
=/ note=(unit note) (~(get by notes.u.book) note.act)
|
|
|
|
?~ note
|
|
|
|
~|("nonexistent note: {<note.act>}" !!)
|
|
|
|
?. ?| (team:title our.bol src.bol)
|
|
|
|
?& =(author.u.note src.bol)
|
|
|
|
(allowed src.bol %write book.act)
|
|
|
|
==
|
|
|
|
==
|
|
|
|
~|("action not permitted" !!)
|
2019-12-06 02:42:38 +03:00
|
|
|
=/ pax=path /app/publish/notebooks/[book.act]/[note.act]/udon
|
|
|
|
=/ front=(map knot cord)
|
|
|
|
%- my
|
2019-12-14 01:27:37 +03:00
|
|
|
:~ title+title.act
|
2019-12-06 02:42:38 +03:00
|
|
|
author+(scot %p src.bol)
|
|
|
|
==
|
2019-12-14 01:27:37 +03:00
|
|
|
=. body.act (cat 3 body.act '\0a')
|
|
|
|
=/ file=@t (add-front-matter front body.act)
|
2019-12-06 02:42:38 +03:00
|
|
|
:_ state
|
|
|
|
[(write-file pax %udon !>(file))]~
|
|
|
|
::
|
|
|
|
%edit-comment
|
2019-12-14 01:27:37 +03:00
|
|
|
?: &(=(src.bol our.bol) !=(our.bol who.act))
|
|
|
|
:_ state
|
2020-01-09 02:13:42 +03:00
|
|
|
[%pass /forward %agent [who.act %publish] %poke %publish-action !>(act)]~
|
2020-01-08 21:45:16 +03:00
|
|
|
=/ book=(unit notebook) (~(get by books) book.act)
|
|
|
|
?~ book
|
|
|
|
~|("nonexistent notebook {<book.act>}" !!)
|
|
|
|
=/ not=(unit note) (~(get by notes.u.book) note.act)
|
|
|
|
?~ not
|
|
|
|
~|("nonexistent note {<note.act>}" !!)
|
|
|
|
=/ com=(unit comment)
|
|
|
|
(~(get by comments.u.not) (slav %da comment.act))
|
|
|
|
?~ com
|
|
|
|
~|("nonexistent comment {<comment.act>}" !!)
|
|
|
|
?. ?| (team:title our.bol src.bol)
|
|
|
|
?& =(author.u.com src.bol)
|
|
|
|
(allowed src.bol %read book.act)
|
|
|
|
==
|
|
|
|
==
|
|
|
|
~|("action not permitted" !!)
|
2019-12-06 02:42:38 +03:00
|
|
|
=/ pax=path
|
|
|
|
%+ weld /app/publish/notebooks
|
|
|
|
/[book.act]/[note.act]/[comment.act]/publish-comment
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ new-comment .^(comment %cx (weld our-beak pax))
|
|
|
|
=. content.new-comment body.act
|
2019-12-06 02:42:38 +03:00
|
|
|
:_ state
|
2019-12-14 01:27:37 +03:00
|
|
|
[(write-file pax %publish-comment !>(new-comment))]~
|
2019-12-06 02:42:38 +03:00
|
|
|
::
|
|
|
|
%del-book
|
2020-01-08 21:45:16 +03:00
|
|
|
?. (team:title our.bol src.bol)
|
|
|
|
~|("action not permitted" !!)
|
|
|
|
?. (~(has by books) book.act)
|
|
|
|
~|("nonexistent notebook {<book.act>}" !!)
|
2019-12-06 02:42:38 +03:00
|
|
|
=/ pax=path /app/publish/notebooks/[book.act]
|
2020-01-10 04:11:06 +03:00
|
|
|
:_ state
|
2019-12-06 02:42:38 +03:00
|
|
|
[(delete-dir pax)]~
|
|
|
|
::
|
|
|
|
%del-note
|
2019-12-14 01:27:37 +03:00
|
|
|
?: &(=(src.bol our.bol) !=(our.bol who.act))
|
|
|
|
:_ state
|
2020-01-09 02:13:42 +03:00
|
|
|
[%pass /forward %agent [who.act %publish] %poke %publish-action !>(act)]~
|
2020-01-08 21:45:16 +03:00
|
|
|
=/ book=(unit notebook) (~(get by books) book.act)
|
|
|
|
?~ book
|
|
|
|
~|("nonexistent notebook {<book.act>}" !!)
|
|
|
|
=/ note=(unit note) (~(get by notes.u.book) note.act)
|
|
|
|
?~ note
|
|
|
|
~|("nonexistent note: {<note.act>}" !!)
|
|
|
|
?. ?| (team:title our.bol src.bol)
|
|
|
|
?& =(author.u.note src.bol)
|
|
|
|
(allowed src.bol %write book.act)
|
|
|
|
==
|
|
|
|
==
|
|
|
|
~|("action not permitted" !!)
|
2019-12-06 02:42:38 +03:00
|
|
|
=/ pax=path /app/publish/notebooks/[book.act]/[note.act]/udon
|
|
|
|
:_ state
|
|
|
|
[(delete-file pax)]~
|
|
|
|
::
|
|
|
|
%del-comment
|
2019-12-14 01:27:37 +03:00
|
|
|
?: &(=(src.bol our.bol) !=(our.bol who.act))
|
|
|
|
:_ state
|
2020-01-09 02:13:42 +03:00
|
|
|
[%pass /forward %agent [who.act %publish] %poke %publish-action !>(act)]~
|
2020-01-08 21:45:16 +03:00
|
|
|
=/ book=(unit notebook) (~(get by books) book.act)
|
|
|
|
?~ book
|
|
|
|
~|("nonexistent notebook {<book.act>}" !!)
|
|
|
|
=/ note=(unit note) (~(get by notes.u.book) note.act)
|
|
|
|
?~ note
|
|
|
|
~|("nonexistent note {<note.act>}" !!)
|
|
|
|
=/ comment=(unit comment)
|
|
|
|
(~(get by comments.u.note) (slav %da comment.act))
|
|
|
|
?~ comment
|
|
|
|
~|("nonexistent comment {<comment.act>}" !!)
|
|
|
|
?. ?| (team:title our.bol src.bol)
|
|
|
|
?& =(author.u.comment src.bol)
|
|
|
|
(allowed src.bol %read book.act)
|
|
|
|
==
|
|
|
|
==
|
|
|
|
~|("action not permitted" !!)
|
2019-12-06 02:42:38 +03:00
|
|
|
=/ pax=path
|
|
|
|
%+ weld /app/publish/notebooks
|
|
|
|
/[book.act]/[note.act]/[comment.act]/publish-comment
|
|
|
|
:_ state
|
|
|
|
[(delete-file pax)]~
|
|
|
|
::
|
|
|
|
%subscribe
|
2019-12-14 01:27:37 +03:00
|
|
|
?> (team:title our.bol src.bol)
|
2019-12-06 02:42:38 +03:00
|
|
|
=/ wir=wire /subscribe/(scot %p who.act)/[book.act]
|
|
|
|
:_ state
|
|
|
|
[%pass wir %agent [who.act %publish] %watch /notebook/[book.act]]~
|
|
|
|
::
|
|
|
|
%unsubscribe
|
2019-12-14 01:27:37 +03:00
|
|
|
?> (team:title our.bol src.bol)
|
2019-12-06 02:42:38 +03:00
|
|
|
=/ wir=wire /subscribe/(scot %p who.act)/[book.act]
|
2019-12-19 01:45:37 +03:00
|
|
|
=/ del=primary-delta [%del-book who.act book.act]
|
2019-12-06 02:42:38 +03:00
|
|
|
:_ state(subs (~(del by subs) who.act book.act))
|
2020-01-10 04:11:06 +03:00
|
|
|
:~ `card`[%pass wir %agent [who.act %publish] %leave ~]
|
|
|
|
`card`[%give %fact [/primary]~ %publish-primary-delta !>(del)]
|
2019-12-19 01:45:37 +03:00
|
|
|
==
|
2020-01-09 02:13:42 +03:00
|
|
|
::
|
|
|
|
%read
|
|
|
|
?> (team:title our.bol src.bol)
|
|
|
|
=/ book=(unit notebook)
|
|
|
|
?: =(our.bol who.act)
|
|
|
|
(~(get by books) book.act)
|
|
|
|
(~(get by subs) who.act book.act)
|
|
|
|
?~ book
|
|
|
|
~|("nonexistent notebook: {<book.act>}" !!)
|
|
|
|
=/ not=(unit note) (~(get by notes.u.book) note.act)
|
|
|
|
?~ not
|
|
|
|
~|("nonexistent note: {<note.act>}" !!)
|
2020-01-10 04:11:06 +03:00
|
|
|
=? tile-num !read.u.not
|
|
|
|
(dec tile-num)
|
2020-01-09 02:13:42 +03:00
|
|
|
=. read.u.not %.y
|
|
|
|
=. notes.u.book (~(put by notes.u.book) note.act u.not)
|
|
|
|
=? books =(our.bol who.act)
|
|
|
|
(~(put by books) book.act u.book)
|
|
|
|
=? subs !=(our.bol who.act)
|
|
|
|
(~(put by subs) [who.act book.act] u.book)
|
2020-01-10 04:11:06 +03:00
|
|
|
=/ jon=json
|
|
|
|
(frond:enjs:format %notifications (numb:enjs:format tile-num))
|
2020-01-09 02:13:42 +03:00
|
|
|
:_ state
|
2020-01-10 04:11:06 +03:00
|
|
|
:~ [%give %fact [/primary]~ %publish-primary-delta !>(act)]
|
|
|
|
[%give %fact [/publishtile]~ %json !>(jon)]
|
|
|
|
==
|
2019-12-06 02:42:38 +03:00
|
|
|
==
|
|
|
|
::
|
2019-12-14 01:27:37 +03:00
|
|
|
++ get-notebook
|
2020-01-25 00:42:47 +03:00
|
|
|
|= [host=@p book-name=@tas sty=_state]
|
2019-12-14 01:27:37 +03:00
|
|
|
^- (unit notebook)
|
|
|
|
?: =(our.bol host)
|
2020-01-25 00:42:47 +03:00
|
|
|
(~(get by books.sty) book-name)
|
|
|
|
(~(get by subs.sty) host book-name)
|
2019-12-14 01:27:37 +03:00
|
|
|
::
|
2020-01-10 04:11:06 +03:00
|
|
|
++ get-unread
|
|
|
|
|= book=notebook
|
|
|
|
^- @ud
|
|
|
|
%+ roll ~(tap by notes.book)
|
|
|
|
|= [[nom=@tas not=note] out=@ud]
|
|
|
|
?: read.not
|
|
|
|
out
|
|
|
|
+(out)
|
|
|
|
::
|
2019-12-14 01:27:37 +03:00
|
|
|
++ emit-updates-and-state
|
2020-01-25 00:42:47 +03:00
|
|
|
|= [host=@p book-name=@tas book=notebook del=notebook-delta sty=_state]
|
2019-12-14 01:27:37 +03:00
|
|
|
^- (quip card _state)
|
|
|
|
?: =(our.bol host)
|
2020-01-25 00:42:47 +03:00
|
|
|
:_ sty(books (~(put by books.sty) book-name book))
|
2020-01-10 04:11:06 +03:00
|
|
|
:~ [%give %fact [/notebook/[book-name]]~ %publish-notebook-delta !>(del)]
|
|
|
|
[%give %fact [/primary]~ %publish-primary-delta !>(del)]
|
2019-12-14 01:27:37 +03:00
|
|
|
==
|
2020-01-10 04:11:06 +03:00
|
|
|
=/ jon=json
|
|
|
|
(frond:enjs:format %notifications (numb:enjs:format tile-num))
|
2020-01-25 00:42:47 +03:00
|
|
|
:_ sty(subs (~(put by subs.sty) [host book-name] book))
|
2020-01-10 04:11:06 +03:00
|
|
|
:~ [%give %fact [/primary]~ %publish-primary-delta !>(del)]
|
|
|
|
[%give %fact [/publishtile]~ %json !>(jon)]
|
|
|
|
==
|
2019-12-14 01:27:37 +03:00
|
|
|
::
|
2019-12-09 20:10:03 +03:00
|
|
|
++ handle-notebook-delta
|
2020-01-25 00:42:47 +03:00
|
|
|
|= [del=notebook-delta sty=_state]
|
2019-12-09 20:10:03 +03:00
|
|
|
^- (quip card _state)
|
|
|
|
?- -.del
|
2019-12-14 01:27:37 +03:00
|
|
|
%add-book
|
2020-01-10 04:11:06 +03:00
|
|
|
=. tile-num (add tile-num (get-unread data.del))
|
2020-01-25 00:42:47 +03:00
|
|
|
(emit-updates-and-state host.del book.del data.del del sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
::
|
|
|
|
%add-note
|
|
|
|
=/ book=(unit notebook)
|
2020-01-25 00:42:47 +03:00
|
|
|
(get-notebook host.del book.del sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
?~ book
|
2020-01-25 00:42:47 +03:00
|
|
|
[~ sty]
|
2019-12-19 01:45:37 +03:00
|
|
|
=. read.data.del =(our.bol author.data.del)
|
2020-01-25 00:42:47 +03:00
|
|
|
=? tile-num.sty !read.data.del
|
|
|
|
+(tile-num.sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
=. notes.u.book (~(put by notes.u.book) note.del data.del)
|
2020-01-25 00:42:47 +03:00
|
|
|
(emit-updates-and-state host.del book.del u.book del sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
::
|
|
|
|
%add-comment
|
|
|
|
=/ book=(unit notebook)
|
2020-01-25 00:42:47 +03:00
|
|
|
(get-notebook host.del book.del sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
?~ book
|
2020-01-25 00:42:47 +03:00
|
|
|
[~ sty]
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ note (~(get by notes.u.book) note.del)
|
|
|
|
?~ note
|
2020-01-25 00:42:47 +03:00
|
|
|
[~ sty]
|
2019-12-14 01:27:37 +03:00
|
|
|
=. comments.u.note (~(put by comments.u.note) comment-date.del data.del)
|
|
|
|
=. notes.u.book (~(put by notes.u.book) note.del u.note)
|
2020-01-25 00:42:47 +03:00
|
|
|
(emit-updates-and-state host.del book.del u.book del sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
::
|
|
|
|
%edit-book
|
|
|
|
=/ old-book=(unit notebook)
|
2020-01-25 00:42:47 +03:00
|
|
|
(get-notebook host.del book.del sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
?~ old-book
|
2020-01-25 00:42:47 +03:00
|
|
|
[~ sty]
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ new-book=notebook
|
|
|
|
%= data.del
|
|
|
|
date-created date-created.u.old-book
|
|
|
|
notes notes.u.old-book
|
|
|
|
order order.u.old-book
|
|
|
|
==
|
2020-01-25 00:42:47 +03:00
|
|
|
(emit-updates-and-state host.del book.del new-book del sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
::
|
|
|
|
%edit-note
|
|
|
|
=/ book=(unit notebook)
|
2020-01-25 00:42:47 +03:00
|
|
|
(get-notebook host.del book.del sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
?~ book
|
2020-01-25 00:42:47 +03:00
|
|
|
[~ sty]
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ old-note (~(get by notes.u.book) note.del)
|
|
|
|
?~ old-note
|
2020-01-25 00:42:47 +03:00
|
|
|
[~ sty]
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ new-note=note
|
|
|
|
%= data.del
|
|
|
|
date-created date-created.u.old-note
|
|
|
|
comments comments.u.old-note
|
2019-12-19 01:45:37 +03:00
|
|
|
read read.u.old-note
|
2019-12-14 01:27:37 +03:00
|
|
|
==
|
|
|
|
=. notes.u.book (~(put by notes.u.book) note.del new-note)
|
2020-01-25 00:42:47 +03:00
|
|
|
(emit-updates-and-state host.del book.del u.book del sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
::
|
|
|
|
%edit-comment
|
|
|
|
=/ book=(unit notebook)
|
2020-01-25 00:42:47 +03:00
|
|
|
(get-notebook host.del book.del sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
?~ book
|
2020-01-25 00:42:47 +03:00
|
|
|
[~ sty]
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ note (~(get by notes.u.book) note.del)
|
|
|
|
?~ note
|
2020-01-25 00:42:47 +03:00
|
|
|
[~ sty]
|
2019-12-14 01:27:37 +03:00
|
|
|
=. comments.u.note (~(put by comments.u.note) comment-date.del data.del)
|
|
|
|
=. notes.u.book (~(put by notes.u.book) note.del u.note)
|
2020-01-25 00:42:47 +03:00
|
|
|
(emit-updates-and-state host.del book.del u.book del sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
::
|
|
|
|
%del-book
|
2020-01-10 04:11:06 +03:00
|
|
|
=. tile-num
|
|
|
|
%+ sub tile-num
|
|
|
|
(get-unread (~(got by books) book.del))
|
2019-12-14 01:27:37 +03:00
|
|
|
?: =(our.bol host.del)
|
2020-01-25 00:42:47 +03:00
|
|
|
:_ sty(books (~(del by books.sty) book.del))
|
2020-01-10 04:11:06 +03:00
|
|
|
:~ [%give %fact [/notebook/[book.del]]~ %publish-notebook-delta !>(del)]
|
|
|
|
[%give %fact [/primary]~ %publish-primary-delta !>(del)]
|
2019-12-14 01:27:37 +03:00
|
|
|
==
|
2020-01-10 04:11:06 +03:00
|
|
|
=/ jon=json
|
2020-01-25 00:42:47 +03:00
|
|
|
(frond:enjs:format %notifications (numb:enjs:format tile-num.sty))
|
|
|
|
:_ sty(subs (~(del by subs.sty) host.del book.del))
|
2020-01-10 04:11:06 +03:00
|
|
|
:~ [%give %fact [/primary]~ %publish-primary-delta !>(del)]
|
|
|
|
[%give %fact [/publishtile]~ %json !>(jon)]
|
|
|
|
==
|
2019-12-09 20:10:03 +03:00
|
|
|
::
|
|
|
|
%del-note
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ book=(unit notebook)
|
2020-01-25 00:42:47 +03:00
|
|
|
(get-notebook host.del book.del sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
?~ book
|
2020-01-25 00:42:47 +03:00
|
|
|
[~ sty]
|
2020-01-10 04:11:06 +03:00
|
|
|
=/ not=note (~(got by notes.u.book) note.del)
|
|
|
|
=? tile-num !read.not
|
|
|
|
(dec tile-num)
|
2019-12-14 01:27:37 +03:00
|
|
|
=. notes.u.book (~(del by notes.u.book) note.del)
|
2020-01-25 00:42:47 +03:00
|
|
|
(emit-updates-and-state host.del book.del u.book del sty)
|
2019-12-09 20:10:03 +03:00
|
|
|
::
|
|
|
|
%del-comment
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ book=(unit notebook)
|
2020-01-25 00:42:47 +03:00
|
|
|
(get-notebook host.del book.del sty)
|
2019-12-14 01:27:37 +03:00
|
|
|
?~ book
|
2020-01-25 00:42:47 +03:00
|
|
|
[~ sty]
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ note (~(get by notes.u.book) note.del)
|
|
|
|
?~ note
|
2020-01-25 00:42:47 +03:00
|
|
|
[~ sty]
|
2019-12-14 01:27:37 +03:00
|
|
|
=. comments.u.note (~(del by comments.u.note) comment.del)
|
|
|
|
=. notes.u.book (~(put by notes.u.book) note.del u.note)
|
2020-01-25 00:42:47 +03:00
|
|
|
(emit-updates-and-state host.del book.del u.book del sty)
|
2019-12-09 20:10:03 +03:00
|
|
|
==
|
|
|
|
::
|
2020-01-24 21:58:18 +03:00
|
|
|
++ get-subscribers-json
|
|
|
|
|= book=@tas
|
|
|
|
^- json
|
|
|
|
:- %a
|
|
|
|
%+ roll ~(val by sup.bol)
|
|
|
|
|= [[who=@p pax=path] out=(list json)]
|
|
|
|
^- (list json)
|
|
|
|
?. ?=([%notebook @ ~] pax) out
|
|
|
|
?. =(book i.t.pax) out
|
|
|
|
[[%s (scot %p who)] out]
|
|
|
|
::
|
|
|
|
++ get-notebook-json
|
|
|
|
|= [host=@p book-name=@tas]
|
|
|
|
^- (unit json)
|
|
|
|
=, enjs:format
|
|
|
|
=/ book=(unit notebook)
|
|
|
|
?: =(our.bol host)
|
|
|
|
(~(get by books) book-name)
|
|
|
|
(~(get by subs) host book-name)
|
|
|
|
?~ book
|
|
|
|
~
|
|
|
|
=/ notebook-json (notebook-full-json host book-name u.book)
|
|
|
|
?> ?=(%o -.notebook-json)
|
|
|
|
=. p.notebook-json
|
2020-02-01 23:54:37 +03:00
|
|
|
(~(uni by p.notebook-json) (notes-page notes.u.book 0 50))
|
2020-01-24 21:58:18 +03:00
|
|
|
=. p.notebook-json
|
|
|
|
(~(put by p.notebook-json) %subscribers (get-subscribers-json book-name))
|
|
|
|
=/ notebooks-json (notebooks-map-json our.bol books subs)
|
|
|
|
?> ?=(%o -.notebooks-json)
|
|
|
|
=/ host-books-json (~(got by p.notebooks-json) (scot %p host))
|
|
|
|
?> ?=(%o -.host-books-json)
|
|
|
|
=. p.host-books-json (~(put by p.host-books-json) book-name notebook-json)
|
|
|
|
=. p.notebooks-json
|
|
|
|
(~(put by p.notebooks-json) (scot %p host) host-books-json)
|
|
|
|
`(pairs notebooks+notebooks-json ~)
|
|
|
|
::
|
|
|
|
++ get-note-json
|
|
|
|
|= [host=@p book-name=@tas note-name=@tas]
|
|
|
|
^- (unit json)
|
|
|
|
=, enjs:format
|
|
|
|
=/ book=(unit notebook)
|
|
|
|
?: =(our.bol host)
|
|
|
|
(~(get by books) book-name)
|
|
|
|
(~(get by subs) host book-name)
|
|
|
|
?~ book
|
|
|
|
~
|
|
|
|
=/ note=(unit note) (~(get by notes.u.book) note-name)
|
|
|
|
?~ note
|
|
|
|
~
|
|
|
|
=/ notebook-json (notebook-full-json host book-name u.book)
|
|
|
|
?> ?=(%o -.notebook-json)
|
|
|
|
=/ note-json (note-presentation-json u.book note-name u.note)
|
|
|
|
=. p.notebook-json (~(uni by p.notebook-json) note-json)
|
|
|
|
=/ notebooks-json (notebooks-map-json our.bol books subs)
|
|
|
|
?> ?=(%o -.notebooks-json)
|
|
|
|
=/ host-books-json (~(got by p.notebooks-json) (scot %p host))
|
|
|
|
?> ?=(%o -.host-books-json)
|
|
|
|
=. p.host-books-json (~(put by p.host-books-json) book-name notebook-json)
|
|
|
|
=. p.notebooks-json
|
|
|
|
(~(put by p.notebooks-json) (scot %p host) host-books-json)
|
|
|
|
`(pairs notebooks+notebooks-json ~)
|
|
|
|
::
|
2019-12-09 20:10:03 +03:00
|
|
|
++ handle-http-request
|
|
|
|
|= req=inbound-request:eyre
|
|
|
|
^- simple-payload:http
|
2019-12-14 01:27:37 +03:00
|
|
|
=/ url (parse-request-line url.request.req)
|
|
|
|
?+ url
|
|
|
|
not-found:gen
|
|
|
|
::
|
|
|
|
[[[~ %png] [%'~publish' @t ~]] ~]
|
|
|
|
=/ filename=@t i.t.site.url
|
|
|
|
=/ img=(unit @t) (~(get by images) filename)
|
|
|
|
?~ img
|
|
|
|
not-found:gen
|
|
|
|
(png-response:gen (as-octs:mimes:html u.img))
|
|
|
|
::
|
|
|
|
[[[~ %css] [%'~publish' %index ~]] ~]
|
|
|
|
(css-response:gen css)
|
|
|
|
::
|
|
|
|
[[[~ %js] [%'~publish' %index ~]] ~]
|
|
|
|
(js-response:gen js)
|
|
|
|
::
|
|
|
|
[[[~ %js] [%'~publish' %tile ~]] ~]
|
|
|
|
(js-response:gen tile-js)
|
|
|
|
::
|
|
|
|
:: pagination endpoints
|
|
|
|
::
|
|
|
|
:: all notebooks, short form
|
|
|
|
[[[~ %json] [%'~publish' %notebooks ~]] ~]
|
|
|
|
%- json-response:gen
|
|
|
|
%- json-to-octs
|
2019-12-19 01:45:37 +03:00
|
|
|
(notebooks-map-json our.bol books subs)
|
2019-12-14 01:27:37 +03:00
|
|
|
::
|
|
|
|
:: notes pagination
|
|
|
|
[[[~ %json] [%'~publish' %notes @ @ @ @ ~]] ~]
|
|
|
|
=/ host=(unit @p) (slaw %p i.t.t.site.url)
|
|
|
|
?~ host
|
|
|
|
not-found:gen
|
|
|
|
=/ book-name i.t.t.t.site.url
|
|
|
|
=/ book=(unit notebook)
|
|
|
|
?: =(our.bol u.host)
|
|
|
|
(~(get by books) book-name)
|
|
|
|
(~(get by subs) u.host book-name)
|
|
|
|
?~ book
|
|
|
|
not-found:gen
|
|
|
|
=/ start (rush i.t.t.t.t.site.url dem)
|
|
|
|
?~ start
|
|
|
|
not-found:gen
|
|
|
|
=/ length (rush i.t.t.t.t.t.site.url dem)
|
|
|
|
?~ length
|
|
|
|
not-found:gen
|
|
|
|
%- json-response:gen
|
|
|
|
%- json-to-octs
|
2019-12-19 01:45:37 +03:00
|
|
|
:- %o
|
2019-12-14 01:27:37 +03:00
|
|
|
(notes-page notes.u.book u.start u.length)
|
|
|
|
::
|
|
|
|
:: comments pagination
|
|
|
|
[[[~ %json] [%'~publish' %comments @ @ @ @ @ ~]] ~]
|
|
|
|
=/ host=(unit @p) (slaw %p i.t.t.site.url)
|
|
|
|
?~ host
|
|
|
|
not-found:gen
|
|
|
|
=/ book-name i.t.t.t.site.url
|
|
|
|
=/ book=(unit notebook)
|
|
|
|
?: =(our.bol u.host)
|
|
|
|
(~(get by books) book-name)
|
|
|
|
(~(get by subs) u.host book-name)
|
|
|
|
?~ book
|
|
|
|
not-found:gen
|
|
|
|
=/ note-name i.t.t.t.t.site.url
|
|
|
|
=/ note=(unit note) (~(get by notes.u.book) note-name)
|
|
|
|
?~ note
|
|
|
|
not-found:gen
|
|
|
|
=/ start (rush i.t.t.t.t.t.site.url dem)
|
|
|
|
?~ start
|
|
|
|
not-found:gen
|
|
|
|
=/ length (rush i.t.t.t.t.t.t.site.url dem)
|
|
|
|
?~ length
|
|
|
|
not-found:gen
|
|
|
|
%- json-response:gen
|
|
|
|
%- json-to-octs
|
|
|
|
(comments-page comments.u.note u.start u.length)
|
|
|
|
::
|
2019-12-19 01:45:37 +03:00
|
|
|
:: single notebook with initial 50 notes in short form, as json
|
|
|
|
[[[~ %json] [%'~publish' @ @ ~]] ~]
|
|
|
|
=, enjs:format
|
|
|
|
=/ host=(unit @p) (slaw %p i.t.site.url)
|
|
|
|
?~ host
|
|
|
|
not-found:gen
|
|
|
|
=/ book-name i.t.t.site.url
|
|
|
|
=/ book=(unit notebook)
|
|
|
|
?: =(our.bol u.host)
|
|
|
|
(~(get by books) book-name)
|
|
|
|
(~(get by subs) u.host book-name)
|
|
|
|
?~ book
|
|
|
|
not-found:gen
|
|
|
|
=/ notebook-json (notebook-full-json u.host book-name u.book)
|
|
|
|
?> ?=(%o -.notebook-json)
|
|
|
|
=. p.notebook-json
|
2020-02-01 23:54:37 +03:00
|
|
|
(~(uni by p.notebook-json) (notes-page notes.u.book 0 50))
|
2020-01-24 21:58:18 +03:00
|
|
|
=. p.notebook-json
|
|
|
|
(~(put by p.notebook-json) %subscribers (get-subscribers-json book-name))
|
2019-12-19 01:45:37 +03:00
|
|
|
=/ jon=json (pairs notebook+notebook-json ~)
|
|
|
|
(json-response:gen (json-to-octs jon))
|
|
|
|
::
|
|
|
|
:: single note, with initial 50 comments, as json
|
|
|
|
[[[~ %json] [%'~publish' @ @ @ ~]] ~]
|
|
|
|
=, enjs:format
|
|
|
|
=/ host=(unit @p) (slaw %p i.t.site.url)
|
|
|
|
?~ host
|
|
|
|
not-found:gen
|
|
|
|
=/ book-name i.t.t.site.url
|
|
|
|
=/ book=(unit notebook)
|
|
|
|
?: =(our.bol u.host)
|
|
|
|
(~(get by books) book-name)
|
|
|
|
(~(get by subs) u.host book-name)
|
|
|
|
?~ book
|
|
|
|
not-found:gen
|
|
|
|
=/ note-name i.t.t.t.site.url
|
|
|
|
=/ note=(unit note) (~(get by notes.u.book) note-name)
|
|
|
|
?~ note
|
|
|
|
not-found:gen
|
|
|
|
=/ jon=json o+(note-presentation-json u.book note-name u.note)
|
|
|
|
(json-response:gen (json-to-octs jon))
|
|
|
|
::
|
2019-12-14 01:27:37 +03:00
|
|
|
:: presentation endpoints
|
|
|
|
::
|
|
|
|
:: all notebooks, short form, wrapped in html
|
2020-01-24 21:58:18 +03:00
|
|
|
[[~ [%'~publish' ?(~ [%join ~] [%new ~])]] ~]
|
2019-12-14 01:27:37 +03:00
|
|
|
=, enjs:format
|
2019-12-19 01:45:37 +03:00
|
|
|
=/ jon=json (pairs notebooks+(notebooks-map-json our.bol books subs) ~)
|
2019-12-14 01:27:37 +03:00
|
|
|
(manx-response:gen (index jon))
|
|
|
|
::
|
|
|
|
:: single notebook, with initial 50 notes in short form, wrapped in html
|
2020-01-24 21:58:18 +03:00
|
|
|
[[~ [%'~publish' %notebook @ @ *]] ~]
|
|
|
|
=/ host=(unit @p) (slaw %p i.t.t.site.url)
|
2019-12-14 01:27:37 +03:00
|
|
|
?~ host
|
|
|
|
not-found:gen
|
2020-01-24 21:58:18 +03:00
|
|
|
=/ book-name i.t.t.t.site.url
|
|
|
|
=/ book-json=(unit json) (get-notebook-json u.host book-name)
|
|
|
|
?~ book-json
|
2019-12-14 01:27:37 +03:00
|
|
|
not-found:gen
|
2020-01-24 21:58:18 +03:00
|
|
|
(manx-response:gen (index u.book-json))
|
|
|
|
::
|
|
|
|
:: single notebook, with initial 50 notes in short form, wrapped in html
|
|
|
|
[[~ [%'~publish' %popout %notebook @ @ *]] ~]
|
|
|
|
=/ host=(unit @p) (slaw %p i.t.t.t.site.url)
|
|
|
|
?~ host
|
|
|
|
not-found:gen
|
|
|
|
=/ book-name i.t.t.t.t.site.url
|
|
|
|
=/ book-json=(unit json) (get-notebook-json u.host book-name)
|
|
|
|
?~ book-json
|
|
|
|
not-found:gen
|
|
|
|
(manx-response:gen (index u.book-json))
|
2019-12-14 01:27:37 +03:00
|
|
|
::
|
|
|
|
:: single note, with initial 50 comments, wrapped in html
|
2020-01-24 21:58:18 +03:00
|
|
|
[[~ [%'~publish' %note @ @ @ ~]] ~]
|
|
|
|
=/ host=(unit @p) (slaw %p i.t.t.site.url)
|
2019-12-14 01:27:37 +03:00
|
|
|
?~ host
|
|
|
|
not-found:gen
|
2020-01-24 21:58:18 +03:00
|
|
|
=/ book-name i.t.t.t.site.url
|
|
|
|
=/ note-name i.t.t.t.t.site.url
|
|
|
|
=/ note-json=(unit json) (get-note-json u.host book-name note-name)
|
|
|
|
?~ note-json
|
2019-12-14 01:27:37 +03:00
|
|
|
not-found:gen
|
2020-01-24 21:58:18 +03:00
|
|
|
(manx-response:gen (index u.note-json))
|
|
|
|
::
|
|
|
|
:: single note, with initial 50 comments, wrapped in html
|
|
|
|
[[~ [%'~publish' %popout %note @ @ @ ~]] ~]
|
|
|
|
=/ host=(unit @p) (slaw %p i.t.t.t.site.url)
|
|
|
|
?~ host
|
2019-12-14 01:27:37 +03:00
|
|
|
not-found:gen
|
2020-01-24 21:58:18 +03:00
|
|
|
=/ book-name i.t.t.t.t.site.url
|
|
|
|
=/ note-name i.t.t.t.t.t.site.url
|
|
|
|
=/ note-json=(unit json) (get-note-json u.host book-name note-name)
|
|
|
|
?~ note-json
|
|
|
|
not-found:gen
|
|
|
|
(manx-response:gen (index u.note-json))
|
2019-12-14 01:27:37 +03:00
|
|
|
==
|
|
|
|
::
|
2019-11-21 21:58:15 +03:00
|
|
|
--
|