2019-11-19 19:26:05 +03:00
|
|
|
:: link: social bookmarking
|
|
|
|
::
|
|
|
|
:: the paths under which links are submitted are generally expected to
|
|
|
|
:: correspond to existing group paths. for strictly-local collections of
|
|
|
|
:: links, arbitrary paths are probably fair game, but could trip up
|
|
|
|
:: primitive ui implementations.
|
|
|
|
::
|
2019-12-21 02:51:49 +03:00
|
|
|
:: see link-listen-hook to see what's synced in, and similarly
|
|
|
|
:: see link-proxy-hook to see what's exposed.
|
|
|
|
::
|
2019-11-19 19:26:05 +03:00
|
|
|
:: scry and subscription paths:
|
|
|
|
::
|
2019-12-21 02:51:49 +03:00
|
|
|
:: urls
|
|
|
|
:: /local-pages/[some-group] all pages we saved by recency
|
|
|
|
:: /submissions/[some-group] all submissions by recency
|
|
|
|
:: comments
|
2020-01-08 04:38:39 +03:00
|
|
|
:: /annotations/[some-group]/[b64(url)] all our comments on url by recency
|
|
|
|
:: /discussions/[some-group]/[b64(url)] all known comments on url by recency
|
2019-11-19 19:26:05 +03:00
|
|
|
::
|
|
|
|
/+ *link, default-agent, verb
|
|
|
|
::
|
|
|
|
|%
|
|
|
|
+$ state-0
|
|
|
|
$: %0
|
|
|
|
by-group=(map path links)
|
|
|
|
by-site=(map site (list [path submission]))
|
2019-12-21 02:51:49 +03:00
|
|
|
discussions=(map path (map url discussion))
|
2019-11-19 19:26:05 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ links
|
|
|
|
$: ::NOTE all lists by recency
|
|
|
|
=submissions
|
|
|
|
ours=pages
|
|
|
|
==
|
|
|
|
::
|
2019-12-21 02:51:49 +03:00
|
|
|
+$ discussion
|
|
|
|
$: =comments
|
|
|
|
ours=notes
|
|
|
|
==
|
|
|
|
::
|
2019-11-19 19:26:05 +03:00
|
|
|
+$ card card:agent:gall
|
|
|
|
--
|
|
|
|
::
|
|
|
|
=| state-0
|
|
|
|
=* state -
|
|
|
|
::
|
2019-11-20 00:56:29 +03:00
|
|
|
%+ verb |
|
2019-11-19 19:26:05 +03:00
|
|
|
^- agent:gall
|
|
|
|
=<
|
|
|
|
|_ =bowl:gall
|
|
|
|
+* this .
|
|
|
|
do ~(. +> bowl)
|
|
|
|
def ~(. (default-agent this %|) bowl)
|
|
|
|
::
|
|
|
|
++ on-init on-init:def
|
|
|
|
++ on-save !>(state)
|
|
|
|
++ on-load
|
|
|
|
|= old=vase
|
|
|
|
^- (quip card _this)
|
|
|
|
[~ this(state !<(state-0 old))]
|
|
|
|
::
|
|
|
|
++ on-poke
|
|
|
|
|= [=mark =vase]
|
|
|
|
^- (quip card _this)
|
|
|
|
?> (team:title [our src]:bowl) ::TODO /lib/store
|
|
|
|
=^ cards state
|
|
|
|
?+ mark (on-poke:def mark vase)
|
2019-11-20 18:09:29 +03:00
|
|
|
::TODO move json conversion into mark once mark performance improves
|
2019-11-19 19:26:05 +03:00
|
|
|
%json (do-action:do (action:de-json !<(json vase)))
|
|
|
|
%link-action (do-action:do !<(action vase))
|
|
|
|
==
|
|
|
|
[cards this]
|
|
|
|
::
|
|
|
|
++ on-peek
|
|
|
|
|= =path
|
|
|
|
^- (unit (unit cage))
|
|
|
|
?+ path (on-peek:def path)
|
|
|
|
[%y ?(%local-pages %submissions) ~]
|
|
|
|
``noun+!>(~(key by by-group))
|
|
|
|
::
|
|
|
|
[%x %local-pages ^]
|
|
|
|
``noun+!>((get-local-pages:do t.t.path))
|
|
|
|
::
|
|
|
|
[%x %submissions ^]
|
|
|
|
``noun+!>((get-submissions:do t.t.path))
|
2019-12-21 02:51:49 +03:00
|
|
|
::
|
|
|
|
[%y ?(%annotations %discussions) ~]
|
|
|
|
``noun+!>(~(key by discussions))
|
|
|
|
::
|
|
|
|
[%y ?(%annotations %discussions) ^]
|
|
|
|
=/ urls (~(get by discussions) t.t.path)
|
|
|
|
?~ urls ~
|
|
|
|
``noun+!>(~(key by u.urls))
|
|
|
|
::
|
|
|
|
[%x %annotations @ ^]
|
|
|
|
``noun+!>((get-annotations:do t.t.path))
|
|
|
|
::
|
|
|
|
[%x %discussions @ ^]
|
|
|
|
``noun+!>((get-discussions:do t.t.path))
|
2019-11-19 19:26:05 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ on-watch
|
|
|
|
|= =path
|
|
|
|
^- (quip card _this)
|
|
|
|
?> (team:title [our src]:bowl) ::TODO /lib/store
|
|
|
|
:_ this
|
|
|
|
|^ ?+ path (on-watch:def path)
|
|
|
|
[%local-pages ^]
|
|
|
|
%+ give %link-update
|
|
|
|
[%local-pages t.path (get-local-pages:do t.path)]
|
|
|
|
::
|
|
|
|
[%submissions ^]
|
|
|
|
%+ give %link-update
|
|
|
|
[%submissions t.path (get-submissions:do t.path)]
|
2019-12-21 02:51:49 +03:00
|
|
|
::
|
|
|
|
[%annotations @ ^]
|
|
|
|
%+ give %link-update
|
|
|
|
[%annotations t.path (get-annotations:do t.path)]
|
|
|
|
::
|
|
|
|
[%discussions @ ^]
|
|
|
|
%+ give %link-update
|
|
|
|
[%discussions t.path (get-discussions:do t.path)]
|
2019-11-19 19:26:05 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ give
|
|
|
|
|* [=mark =noun]
|
|
|
|
^- (list card)
|
|
|
|
[%give %fact ~ mark !>(noun)]~
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ on-leave on-leave:def
|
|
|
|
++ on-agent on-agent:def
|
|
|
|
++ on-arvo on-arvo:def
|
|
|
|
++ on-fail on-fail:def
|
|
|
|
--
|
|
|
|
::
|
|
|
|
|_ =bowl:gall
|
|
|
|
::
|
|
|
|
:: writing
|
|
|
|
::
|
|
|
|
++ do-action
|
|
|
|
|= =action
|
|
|
|
^- (quip card _state)
|
|
|
|
?- -.action
|
2019-12-20 17:58:32 +03:00
|
|
|
%save (save-page +.action)
|
2019-12-21 02:51:49 +03:00
|
|
|
%note (note-note +.action)
|
|
|
|
::
|
2019-11-19 19:26:05 +03:00
|
|
|
%hear (hear-submission +.action)
|
2019-12-21 02:51:49 +03:00
|
|
|
%read (read-comment +.action)
|
2019-11-19 19:26:05 +03:00
|
|
|
==
|
2019-12-20 17:58:32 +03:00
|
|
|
:: +save-page: save a page ourselves
|
2019-11-19 19:26:05 +03:00
|
|
|
::
|
2019-12-20 17:58:32 +03:00
|
|
|
++ save-page
|
2019-11-19 19:26:05 +03:00
|
|
|
|= [=path title=@t =url]
|
|
|
|
^- (quip card _state)
|
|
|
|
?< =(~ path)
|
|
|
|
:: add page to group ours
|
|
|
|
::
|
|
|
|
=/ =links (~(gut by by-group) path *links)
|
|
|
|
=/ =page [title url now.bowl]
|
|
|
|
=. ours.links [page ours.links]
|
|
|
|
=. by-group (~(put by by-group) path links)
|
|
|
|
:: do generic submission logic
|
|
|
|
::
|
|
|
|
=^ cards state
|
|
|
|
(hear-submission path [our.bowl page])
|
|
|
|
:: send updates to subscribers
|
|
|
|
::
|
|
|
|
:_ state
|
|
|
|
:_ cards
|
|
|
|
:+ %give %fact
|
2019-12-22 23:12:28 +03:00
|
|
|
:+ [%local-pages path]~
|
2019-11-19 19:26:05 +03:00
|
|
|
%link-update
|
|
|
|
!>([%local-pages path [page]~])
|
2019-12-21 02:51:49 +03:00
|
|
|
:: +note-note: save a note for a url
|
|
|
|
::
|
|
|
|
++ note-note
|
|
|
|
|= [=path =url udon=@t]
|
|
|
|
^- (quip card _state)
|
|
|
|
:: add note to discussion ours
|
|
|
|
::
|
|
|
|
=/ urls (~(gut by discussions) path *(map ^url discussion))
|
|
|
|
=/ =discussion (~(gut by urls) url *discussion)
|
|
|
|
=/ =note [now.bowl udon]
|
|
|
|
=. ours.discussion [note ours.discussion]
|
|
|
|
=. urls (~(put by urls) url discussion)
|
|
|
|
=. discussions (~(put by discussions) path urls)
|
|
|
|
:: do generic comment logic
|
|
|
|
::
|
|
|
|
=^ cards state
|
|
|
|
(read-comment path url [our.bowl note])
|
|
|
|
:: send updates to subscribers
|
|
|
|
::
|
|
|
|
:_ state
|
|
|
|
^- (list card)
|
|
|
|
=/ fact
|
|
|
|
:- %link-update
|
|
|
|
!>([%annotations path url [note]~])
|
2020-01-08 00:30:55 +03:00
|
|
|
:* [%give %fact [%annotations (snoc path url)]~ fact]
|
|
|
|
[%give %fact [%annotations path]~ fact]
|
2019-12-21 02:51:49 +03:00
|
|
|
cards
|
|
|
|
==
|
2019-11-19 19:26:05 +03:00
|
|
|
:: +hear-submission: record page someone else saved
|
|
|
|
::
|
|
|
|
++ hear-submission
|
|
|
|
|= [=path =submission]
|
|
|
|
^- (quip card _state)
|
|
|
|
?< =(~ path)
|
|
|
|
:: add link to group submissions
|
|
|
|
::
|
|
|
|
=/ =links (~(gut by by-group) path *links)
|
|
|
|
=. submissions.links [submission submissions.links]
|
|
|
|
=. by-group (~(put by by-group) path links)
|
|
|
|
:: add submission to global sites
|
|
|
|
::
|
|
|
|
=/ =site (site-from-url url.submission)
|
|
|
|
=. by-site (~(add ja by-site) site [path submission])
|
|
|
|
:: send updates to subscribers
|
|
|
|
::
|
|
|
|
:_ state
|
|
|
|
:_ ~
|
|
|
|
:+ %give %fact
|
2019-12-22 23:12:28 +03:00
|
|
|
:+ [%submissions path]~
|
2019-11-19 19:26:05 +03:00
|
|
|
%link-update
|
|
|
|
!>([%submissions path [submission]~])
|
2019-12-21 02:51:49 +03:00
|
|
|
:: +read-comment: record a comment someone else made
|
|
|
|
::
|
|
|
|
++ read-comment
|
|
|
|
|= [=path =url =comment]
|
|
|
|
^- (quip card _state)
|
|
|
|
:: add comment to url's discussion
|
|
|
|
::
|
|
|
|
=/ urls (~(gut by discussions) path *(map ^url discussion))
|
|
|
|
=/ =discussion (~(gut by urls) url *discussion)
|
|
|
|
=. comments.discussion [comment comments.discussion]
|
|
|
|
=. urls (~(put by urls) url discussion)
|
|
|
|
=. discussions (~(put by discussions) path urls)
|
|
|
|
:: send updates to subscribers
|
|
|
|
::
|
|
|
|
:_ state
|
|
|
|
^- (list card)
|
|
|
|
=/ fact
|
|
|
|
:- %link-update
|
|
|
|
!>([%discussions path url [comment]~])
|
2020-01-08 00:30:55 +03:00
|
|
|
:~ [%give %fact [%discussions (snoc path url)]~ fact]
|
|
|
|
[%give %fact [%discussions path]~ fact]
|
2019-12-21 02:51:49 +03:00
|
|
|
==
|
2019-11-19 19:26:05 +03:00
|
|
|
::
|
|
|
|
:: reading
|
|
|
|
::
|
|
|
|
++ get-local-pages
|
|
|
|
|= =path
|
|
|
|
^- pages
|
|
|
|
ours:(~(gut by by-group) path *links)
|
|
|
|
::
|
|
|
|
++ get-submissions
|
|
|
|
|= =path
|
|
|
|
^- submissions
|
|
|
|
submissions:(~(gut by by-group) path *links)
|
2019-12-21 02:51:49 +03:00
|
|
|
::
|
|
|
|
++ get-annotations
|
|
|
|
|= =path
|
|
|
|
^- notes
|
|
|
|
ours:(get-discussion path)
|
|
|
|
::
|
|
|
|
++ get-discussions
|
|
|
|
|= =path
|
|
|
|
^- comments
|
|
|
|
comments:(get-discussion path)
|
|
|
|
::
|
|
|
|
++ get-discussion
|
|
|
|
|= =path
|
|
|
|
^- discussion
|
2020-01-08 04:38:39 +03:00
|
|
|
=/ [=^path =url]
|
|
|
|
(split-discussion-path path)
|
2019-12-21 02:51:49 +03:00
|
|
|
=- (~(gut by -) url *discussion)
|
|
|
|
%+ ~(gut by discussions) path
|
|
|
|
*(map ^url discussion)
|
2019-11-19 19:26:05 +03:00
|
|
|
--
|