Merge pull request #4065 from urbit/la/candidate

arvo: remove unused app files, libraries, and imports
This commit is contained in:
L 2020-12-02 22:27:57 -06:00 committed by GitHub
commit 0b7cb507d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 15 additions and 2715 deletions

View File

@ -10,7 +10,7 @@
:: and trust it to take care of the rest.
::
/- view=chat-view, hook=chat-hook, *group,
*permission-store, *group-store, inv=invite-store,
*group-store, inv=invite-store,
sole
/+ shoe, default-agent, verb, dbug, store=chat-store,
group-store, grpl=group, resource

View File

@ -1,12 +1,8 @@
:: chat-hook [landscape]:
:: mirror chat data from foreign to local based on read permissions
:: mirror chat data from foreign to local based on read
:: allow sending chat messages to foreign paths based on write perms
::
/- *permission-store, inv=invite-store, *metadata-store,
*permission-hook, *group-store, *permission-group-hook, ::TMP for upgrade
hook=chat-hook,
view=chat-view,
*group
/- inv=invite-store, *metadata-store, *group-store, hook=chat-hook, view=chat-view, *group
/+ default-agent, verb, dbug, store=chat-store, group-store, grpl=group,
resource
~% %chat-hook-top ..is ~
@ -51,7 +47,6 @@
::
+$ poke
$% [%chat-action action:store]
[%permission-action permission-action]
[%invite-action action:inv]
[%chat-view-action action:view]
==
@ -119,7 +114,6 @@
=. cards
%+ weld cards
:~ watch-groups:cc
[%pass /permissions %agent [our.bol %permission-store] %leave ~]
==
=^ new-cards=(list card) old
=| crds=(list card)
@ -223,15 +217,12 @@
^- (list card)
=/ host=ship (slav %p (snag 0 old-chat))
=/ new-chat [%'~' old-chat]
=/ newp=permission (unify-permissions old-chat)
=/ old-group=path [%chat old-chat]
%- zing
:~ :~ (delete-group host (snoc old-group %read))
(delete-group host (snoc old-group %write))
==
::
(create-group new-chat who.newp)
(hookup-group new-chat kind.newp)
[(record-group new-chat new-chat)]~
(recreate-chat host old-chat new-chat)
==
@ -253,38 +244,6 @@
[%add-synced host new-chat %.y]
==
::
++ unify-permissions
|= chat=path
^- permission
=/ read=(unit permission) (get-permission chat %read)
=/ write=(unit permission) (get-permission chat %write)
?. &(?=(^ read) ?=(^ write))
~& [%missing-permission chat read=?=(~ read) write=?=(~ write)]
[%white [(slav %p (snag 0 chat)) ~ ~]]
?+ [kind.u.read kind.u.write] !!
:: village: exclusive to writers
::
[%white %white] [%white who.u.write]
::
:: channel: merge blacklists
::
[%black %black] [%black (~(uni in who.u.read) who.u.write)]
::
:: journal: exclusive to writers
::
[%black %white] [%white who.u.write]
::
:: mailbox: exclusive to readers
::
[%white %black] [%white who.u.read]
==
::
++ get-permission
|= [chat=path what=?(%read %write)]
%^ scry:cc (unit permission)
%permission-store
[%permission %chat (snoc chat what)]
::
++ make-poke
|= [app=term =mark =vase]
^- card
@ -293,19 +252,10 @@
++ delete-group
|= [host=ship group=path]
^- card
:: if we host the group, delete it directly
::
?: =(our.bol host)
%^ make-poke %group-store
%group-action
!> ^- action:group-store
[%remove-group (de-path:resource group) ~]
:: else, just delete the sync in the hook
::
%^ make-poke %permission-hook
%permission-hook-action
!> ^- permission-hook-action
[%remove group]
%^ make-poke %group-store
%group-action
!> ^- action:group-store
[%remove-group (de-path:resource group) ~]
::
++ create-group
|= [group=path who=(set ship)]
@ -323,23 +273,6 @@
[%add-members rid who]
==
::
++ hookup-group
|= [group=path =kind]
^- (list card)
:* %^ make-poke %permission-group-hook
%permission-group-hook-action
!> ^- permission-group-hook-action
[%associate group [group^kind ~ ~]]
::
=/ =ship (slav %p (snag 1 group))
?. =(our.bol ship) ~
:_ ~
%^ make-poke %permission-hook
%permission-hook-action
!> ^- permission-hook-action
[%add-owned group group]
==
::
++ record-group
|= [group=path chat=path]
^- card
@ -830,10 +763,6 @@
++ kick
|= wir=wire
^- (quip card _state)
?: =(wir /permissions)
:_ state
[%pass /permissions %agent [our.bol %permission-store] %watch /updates]~
::
?+ wir !!
[%groups ~] [~[watch-groups] state]
::
@ -926,11 +855,6 @@
^- card
[%pass / %agent [our.bol %invite-store] %poke %invite-action !>(action)]
::
++ sec-to-perm
|= [pax=path =kind]
^- permission-action
[%create pax kind *(set ship)]
::
++ chat-scry
|= pax=path
^- (unit mailbox:store)

View File

@ -3,13 +3,9 @@
:: sets up chat JS client, paginates data, and combines commands
:: into semantic actions for the UI
::
/- *permission-store,
*permission-hook,
*group,
/- *group,
inv=invite-store,
*metadata-store,
group-hook,
*permission-group-hook,
*chat-hook,
*metadata-hook,
hook=chat-hook,
@ -37,8 +33,6 @@
$% [%chat-action action:store]
[%group-action action:group-store]
[%chat-hook-action action:hook]
[%permission-hook-action permission-hook-action]
[%permission-group-hook-action permission-group-hook-action]
==
::
+$ card card:agent:gall
@ -518,30 +512,11 @@
^- card
[%pass / %agent [entity.resource.act %group-push-hook] %poke %group-update !>(act)]
::
++ permission-poke
|= act=permission-action
^- card
[%pass / %agent [our.bol %permission-store] %poke %permission-action !>(act)]
::
++ chat-hook-poke
|= act=action:hook
^- card
[%pass / %agent [our.bol %chat-hook] %poke %chat-hook-action !>(act)]
::
++ permission-hook-poke
|= act=permission-hook-action
^- card
:* %pass / %agent [our.bol %permission-hook]
%poke %permission-hook-action !>(act)
==
::
++ perm-group-hook-poke
|= act=permission-group-hook-action
^- card
:* %pass / %agent [our.bol %permission-group-hook]
%poke %permission-group-hook-action !>(act)
==
::
++ metadata-hook-poke
|= act=metadata-hook-action
^- card

View File

@ -1,8 +1,7 @@
:: contact-hook [landscape]
::
::
/- group-hook,
*contact-hook,
/- *contact-hook,
*contact-view,
inv=invite-store,
*metadata-hook,

View File

@ -4,13 +4,10 @@
:: into semantic actions for the UI
::
/-
group-hook,
inv=invite-store,
*contact-hook,
*metadata-store,
*metadata-hook,
*permission-group-hook,
*permission-hook,
pull-hook,
push-hook
/+ *server, *contact-json, default-agent, dbug, verb,
@ -324,20 +321,6 @@
^- card
[%pass / %agent [our.bol %metadata-hook] %poke %metadata-hook-action !>(act)]
::
++ 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)
==
::
++ sync-metadata
|= [=ship =path]
^- card

View File

@ -1,114 +0,0 @@
:: group-hook [landscape]:
::
:: allow syncing group data from foreign paths to local paths
::
/- *group, hook=group-hook, *invite-store
/+ default-agent, verb, dbug, store=group-store, grpl=group, pull-hook, push-hook, resource
~% %group-hook-top ..is ~
|%
+$ card card:agent:gall
::
++ versioned-state
$% state-zero
state-one
==
::
::
+$ state-zero
$: %0
synced=(map path ship)
==
::
+$ state-one
$: %1
~
==
::
--
::
=| state-one
=* state -
::
%- agent:dbug
%+ verb |
^- agent:gall
|_ =bowl:gall
+* this .
group-core +>
gc ~(. group-core bowl)
def ~(. (default-agent this %|) bowl)
::
++ on-init on-init:def
:: ^- (quip card _this)
:: :_ this
:: ~[watch-store:gc]
++ on-save !>(state)
++ on-load
|= =vase
^- (quip card _this)
=/ old !<(versioned-state vase)
?- -.old
%1 [~ this(state old)]
%0
:_ this(state *state-one)
|^
%+ murn
~(tap by synced.old)
|= [=path host=ship]
^- (unit card)
?> ?=([@ @ *] path)
:: ignore duplicate publish groups
?: =(4 (lent path))
~& "ignoring: {<path>}"
~
=/ pax=^path
?: =('~' i.path)
t.path
path
=/ rid=resource
?> ?=([@ @ *] pax)
=/ ship
(slav %p i.pax)
[ship i.t.pax]
?: =(our.bowl host)
`(add-push rid)
`(add-pull rid host)
::
++ poke-our
|= [app=term =cage]
^- card
[%pass / %agent [our.bowl app] %poke cage]
++ add-pull
|= [rid=resource host=ship]
^- card
%+ poke-our
%group-pull-hook
:- %pull-hook-action
!> ^- action:pull-hook
[%add host rid]
::
++ add-push
|= rid=resource
^- card
%+ poke-our
%group-push-hook
:- %push-hook-action
!> ^- action:push-hook
[%add rid]
--
==
::
++ on-poke on-poke:def
::
++ on-agent on-agent:def
::
++ on-watch on-watch:def
::
++ on-leave on-leave:def
++ on-peek on-peek:def
++ on-arvo on-arvo:def
++ on-fail on-fail:def
--

View File

@ -2,7 +2,7 @@
::
:: allow syncing group data from foreign paths to local paths
::
/- *group, hook=group-hook, *invite-store, *resource
/- *group, *invite-store, *resource
/+ default-agent, verb, dbug, store=group-store, grpl=group, pull-hook
~% %group-hook-top ..is ~
|%

View File

@ -2,7 +2,7 @@
::
:: allow syncing group data from foreign paths to local paths
::
/- *group, hook=group-hook, *invite-store
/- *group, *invite-store
/+ default-agent, verb, dbug, store=group-store, grpl=group, push-hook,
resource
~% %group-hook-top ..is ~

View File

@ -4,7 +4,7 @@
::
:: group-store stores groups of ships, so that resources in other apps can be
:: associated with a group. The current model of group-store rolls
:: permissions and invites inside this store for simplicity reasons, although
:: and invites inside this store for simplicity reasons, although
:: these should be prised apart in a future revision of group store.
::
::
@ -29,7 +29,7 @@
:: Modify the group. Further documented in /sur/group-store.hoon
::
::
/- *group, permission-store
/- *group
/+ store=group-store, default-agent, verb, dbug, resource
|%
+$ card card:agent:gall
@ -166,8 +166,6 @@
?> (team:title our.bowl src.bowl)
=^ cards state
?+ mark (on-poke:def mark vase)
%noun (poke-noun:gc vase)
::
?(%group-update %group-action)
(poke-group-update:gc !<(update:store vase))
::
@ -246,92 +244,6 @@
(~(has in ban-ranks.policy) (clan:title ship))
==
==
++ poke-noun
|= =vase
^- (quip card _state)
=/ noun
!<(%perm-upgrade vase)
|^
=/ perms=(list path)
~(tap in scry-permissions)
|-
?~ perms
`state
=* pax i.perms
?> ?=(^ pax)
?: |(!=('~' i.pax) =(4 (lent pax)))
$(perms t.perms)
=/ rid=resource
(make-rid t.pax)
=/ perm
(scry-group-permissions pax)
?~ perm
$(perms t.perms)
?: (~(has by groups) rid)
%_ $
perms t.perms
::
groups
%+ ~(jab by groups) rid
(update-existing u.perm)
==
%_ $
perms t.perms
::
groups
%+ ~(put by groups) rid
(add-new u.perm)
==
++ make-rid
|= =path
^- resource
?> ?=([@ @ *] path)
:- (slav %p i.path)
i.t.path
::
++ add-new
|= =permission:permission-store
^- group
?: ?=(%black kind.permission)
[~ ~ [%open ~ who.permission] %.y]
[who.permission ~ [%invite ~] %.y]
::
++ update-existing
|= =permission:permission-store
|= =group
^+ group
?: ?=(%black kind.permission)
group
?> ?=(%invite -.policy.group)
%_ group
members (~(uni in members.group) who.permission)
==
::
++ scry-permissions
^- (set path)
.^ (set path)
%gx
(scot %p our.bol)
%permission-store
(scot %da now.bol)
/keys/noun
==
::
++ scry-group-permissions
|= pax=path
^- (unit permission:permission-store)
.^ (unit permission:permission-store)
%gx
(scot %p our.bol)
%permission-store
(scot %da now.bol)
;: weld
/permission
pax
/noun
==
==
--
::
++ poke-group-update
|= =update:store

View File

@ -1,52 +0,0 @@
:: link-listen-hook: no longer in use
::
/+ default-agent, verb, dbug
::
~% %link-listen-hook-top ..is ~
|%
+$ versioned-state
$% [%0 *]
[%1 *]
[%2 *]
[%3 *]
[%4 ~]
==
+$ card card:agent:gall
--
::
=| [%4 ~]
=* state -
::
%- agent:dbug
%+ verb |
^- agent:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
::
++ on-init [~ this]
++ on-save !>(state)
++ on-load
|= =vase
^- (quip card _this)
:_ this
:- [%pass /groups %agent [our.bowl %group-store] %leave ~]
%+ turn ~(tap in ~(key by wex.bowl))
|= [=wire =ship =term]
^- card
[%pass wire %agent [ship term] %leave ~]
::
++ on-arvo
|= [=wire =sign-arvo]
^- (quip card _this)
?+ sign-arvo (on-arvo:def wire sign-arvo)
[%b *] [~ this]
==
::
++ on-agent on-agent:def
++ on-poke on-poke:def
++ on-peek on-peek:def
++ on-watch on-watch:def
++ on-leave on-leave:def
++ on-fail on-fail:def
--

View File

@ -1,46 +0,0 @@
:: link-proxy-hook: no longer in use
::
/+ default-agent, verb, dbug
~% %link-proxy-hook-top ..is ~
|%
+$ versioned-state
$% [%0 *]
[%1 *]
[%2 ~]
==
::
+$ card card:agent:gall
--
::
=| [%2 ~]
=* state -
::
%- agent:dbug
%+ verb |
^- agent:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %&) bowl)
::
++ on-init on-init:def
++ on-save !>(state)
++ on-load
|= old-vase=vase
^- (quip card _this)
=/ paths
%+ turn ~(val by sup.bowl)
|=([=ship =path] path)
:_ this
:- [%pass /groups %agent [our.bowl %group-store] %leave ~]
?~ paths ~
[%give %kick paths ~]~
::
++ on-watch on-watch:def
++ on-leave on-leave:def
++ on-agent on-agent:def
++ on-poke on-poke:def
++ on-peek on-peek:def
++ on-arvo on-arvo:def
++ on-fail on-fail:def
--

View File

@ -1,148 +0,0 @@
:: link [landscape]:
::
/- *link, gra=graph-store, *resource
/+ store=link-store, graph-store, default-agent, verb, dbug
::
|%
+$ spore-any $%(spore-1 state-0)
+$ state-any $%(state-1 state-0)
+$ spore-1 [%1 cards=*]
+$ state-1 [%1 cards=(list card)]
+$ state-0
$: %0
by-group=(map path links)
by-site=(map site (list [path submission]))
discussions=(per-path-url discussion)
==
::
+$ links
$: ::NOTE all lists by recency
=submissions
ours=pages
seen=(set url)
==
::
+$ discussion
$: =comments
ours=notes
==
::
+$ card card:agent:gall
--
::
=| state-1
=* state -
::
%- agent:dbug
%+ verb |
^- 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)
::
=/ s !<(spore-any old)
?: ?=(%1 -.s)
[~ this(state s(cards ~))]
:: defer card emission to later event
::
=; [cards=(list card) that=_this]
:_ that(state [%1 cards])
[%pass /load %arvo %b %wait now.bowl]~
::
:_ this(state *state-1)
=/ orm orm:graph-store
|^ ^- (list card)
%- zing
%+ turn ~(tap by by-group.s)
|= [=path =links]
^- (list card)
?. ?=([@ ~] path)
(on-bad-path path links)
=/ =resource [our.bowl i.path]
:_ [(archive-graph resource)]~
%+ add-graph resource
^- graph:gra
%+ gas:orm ~
=/ comments (~(gut by discussions.s) path *(map url discussion))
%+ turn submissions.links
|= sub=submission
^- [atom node:gra]
:- time.sub
=/ contents ~[text+title.sub url+url.sub]
=/ parent-hash `@ux`(sham ~ ship.sub time.sub contents)
:- ^- post:gra
:* author=ship.sub
index=~[time.sub]
time-sent=time.sub
contents
hash=`parent-hash
signatures=~
==
^- internal-graph:gra
=/ dis (~(get by comments) url.sub)
?~ dis
[%empty ~]
:- %graph
^- graph:gra
%+ gas:orm ~
%+ turn comments.u.dis
|= [=ship =time udon=@t]
^- [atom node:gra]
:- time
:_ `internal-graph:gra`[%empty ~]
=/ contents ~[text+udon]
:* author=ship
index=~[time.sub time]
time-sent=time
contents
hash=``@ux`(sham `parent-hash ship time contents)
signatures=~
==
::
++ on-bad-path
|= [=path =links]
^- (list card)
~& discarding-malformed-links+[path links]
~
::
++ add-graph
|= [=resource =graph:gra]
^- card
%- poke-graph-store
[%0 now.bowl %add-graph resource graph `%graph-validator-link %.y]
::
++ archive-graph
|= =resource
^- card
%- poke-graph-store
[%0 now.bowl %archive-graph resource]
::
++ poke-graph-store
|= =update:gra
^- card
:* %pass /migrate-link %agent [our.bowl %graph-store]
%poke %graph-update !>(update)
==
--
::
++ on-poke on-poke:def
++ on-peek on-peek:def
++ on-watch on-watch:def
++ on-leave on-leave:def
++ on-agent on-agent:def
++ on-arvo
|= [=wire =sign-arvo]
^- (quip card _this)
?+ sign-arvo (on-arvo:def wire sign-arvo)
[%b %wake *]
[cards.state this]
==
++ on-fail on-fail:def
--

View File

@ -1,39 +0,0 @@
:: link-view: no longer in use
/+ default-agent, verb, dbug
~% %link-view-top ..is ~
|%
+$ versioned-state
$% [%0 ~]
[%1 ~]
[%2 ~]
==
::
+$ card card:agent:gall
--
::
=| [%2 ~]
=* state -
::
%+ verb |
%- agent:dbug
^- agent:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
::
++ on-init [~ this]
++ on-save !>(state)
++ on-load
|= old-vase=vase
^- (quip card _this)
:_ this(state [%2 ~])
[%pass /connect %arvo %e %disconnect [~ /'~link']]~
::
++ on-poke on-poke:def
++ on-watch on-watch:def
++ on-agent on-agent:def
++ on-arvo on-arvo:def
++ on-peek on-peek:def
++ on-leave on-leave:def
++ on-fail on-fail:def
--

View File

@ -1,26 +0,0 @@
:: permission-group-hook [landscape]: deprecated
::
/+ default-agent
::
=| [%1 ~]
=* state -
::
^- agent:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
::
++ on-init on-init:def
++ on-save !>(state)
++ on-load
|= old=vase
[~ this]
::
++ on-poke on-poke:def
++ on-agent on-agent:def
++ on-peek on-peek:def
++ on-watch on-watch:def
++ on-leave on-leave:def
++ on-arvo on-arvo:def
++ on-fail on-fail:def
--

View File

@ -1,26 +0,0 @@
:: permission-hook [landscape]: deprecated
::
/+ default-agent
::
=| [%1 ~]
=* state -
::
^- agent:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
::
++ on-init on-init:def
++ on-save !>(state)
++ on-load
|= old=vase
[~ this]
++ on-poke on-poke:def
++ on-watch on-watch:def
++ on-agent on-agent:def
++ on-leave on-leave:def
++ on-peek on-peek:def
++ on-arvo on-arvo:def
++ on-fail on-fail:def
--

View File

@ -1,36 +0,0 @@
:: permission-store [landscape]: deprecated
::
/+ default-agent
|%
+$ card card:agent:gall
+$ versioned-state
$% state-0
state-1
==
::
+$ state-0 [%0 *]
+$ state-1 [%1 ~]
--
::
=| state-1
=* state -
::
^- agent:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
::
++ on-init on-init:def
++ on-save !>(state)
++ on-load
|= old=vase
[~ this]
::
++ on-poke on-poke:def
++ on-peek on-peek:def
++ on-watch on-watch:def
++ on-leave on-leave:def
++ on-agent on-agent:def
++ on-arvo on-arvo:def
++ on-fail on-fail:def
--

View File

@ -1,691 +0,0 @@
:: publish [landscape]
::
:: stores notebooks in clay, subscribes and allow subscriptions to notebooks
::
/- *publish
/- *group
/- group-hook
/- *permission-hook
/- *permission-group-hook
/- *permission-store
/- inv=invite-store
/- *metadata-store
/- *metadata-hook
/- contact-view
/- pull-hook
/- push-hook
/+ *server
/+ *publish
/+ cram
/+ default-agent
/+ dbug
/+ verb
/+ grpl=group
/+ group-store
/+ graph-store
/+ resource
::
~% %publish ..is ~
|%
+$ card card:agent:gall
::
+$ collection-zero [* pos=(map @tas *) *]
::
+$ state-zero
$: pubs=(map @tas collection-zero)
*
==
::
+$ state-two
$: our-paths=(list path)
books=(map @tas notebook-2)
subs=(map [@p @tas] notebook-2)
tile-num=@ud
==
::
+$ state-three
$: our-paths=(list path)
books=(map [@p @tas] notebook)
tile-num=@ud
$= limbo
$: notes=(map [@p @tas @tas] note)
comments=(map [@p @tas @tas @da] comment)
==
==
::
+$ state-four
[state-three migrate=migration-state]
::
:: $migration-state: resources that are unavailable because their host
:: has not processed the ota, and number of times we've tried to reach
:: the host
+$ migration-state
(map resource @ud)
::
+$ versioned-state
$% [%1 state-two]
[%2 state-two]
[%3 state-three]
[%4 state-three]
[%5 state-three]
[%6 state-three]
[%7 state-four]
==
::
+$ metadata-delta
$% $: %add
group-path=path
app-path=path
title=@t
desc=@t
author=@p
created=@da
==
[%remove author=@p book=@tas]
==
--
::
=| [%7 state-four]
=* state -
%- agent:dbug
%+ verb |
^- agent:gall
=<
|_ bol=bowl:gall
+* this .
def ~(. (default-agent this %|) bol)
main ~(. +> bol)
::
++ on-init
^- (quip card _this)
`this
::
++ on-save !>(state)
::
++ on-load
|= old=vase
^- (quip card _this)
=/ old-state=(each versioned-state tang)
(mule |.(!<(versioned-state old)))
=| cards=(list card)
|^
?: ?=(%| -.old-state)
=/ zero !<(state-zero old)
=/ rav [%next %t [%da now.bol] /app/publish/notebooks]
=/ 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
==
[%pass /bind %arvo %e %disconnect [~ /'~publish']]
[%pass /view-bind %arvo %e %connect [~ /'publish-view'] %publish]
:* %pass /srv %agent [our.bol %file-server]
%poke %file-server-action
!>([%serve-dir /'~publish' /app/landscape %.n %.y])
==
==
=+ ^- [kick-cards=(list card) old-subs=(jug @tas @p)] kick-subs
=/ inv-scry-pax
/(scot %p our.bol)/invite-store/(scot %da now.bol)/invitatory/publish/noun
=/ invi=(unit invitatory:inv) .^((unit invitatory:inv) %gx inv-scry-pax)
=| new-state=state-two
=? tile-num.new-state ?=(^ invi)
~(wyt by u.invi)
%= $
old-state [%& %2 new-state]
::
cards
;: weld
kick-cards
init-cards
(move-files old-subs)
==
==
?- -.p.old-state
%1
%= $
-.p.old-state %2
::
cards
%- zing
%+ turn ~(tap by books.p.old-state)
|= [name=@tas book=notebook-2]
^- (list card)
=/ group-host=(unit @p)
?> ?=(^ writers.book)
(slaw %p i.writers.book)
?~ group-host ~
?: =(u.group-host our.bol) ~
:~ %- perm-group-hook-poke:main
[%associate writers.book [[writers.book %white] ~ ~]]
::
(perm-hook-poke:main [%add-owned writers.book writers.book])
==
==
::
%2
%= $
p.old-state
=/ new-books=(map [@p @tas] notebook)
%- %~ uni by
%- ~(run by subs.p.old-state)
|= old-notebook=notebook-2
^- notebook-3
(convert-notebook-2-3 old-notebook)
^- (map [@p @tas] notebook)
%- ~(rep by books.p.old-state)
|= [[key=@tas val=notebook-2] out=(map [@p @tas] notebook)]
^- (map [@p @tas] notebook)
%+ ~(put by out)
[our.bol key]
(convert-notebook-2-3 val)
[%3 our-paths.p.old-state new-books tile-num.p.old-state [~ ~]]
==
::
%3
%= $
-.p.old-state %4
::
cards
%+ welp cards
:~ [%pass /bind %arvo %e %disconnect [~ /'~publish']]
[%pass /view-bind %arvo %e %connect [~ /'publish-view'] %publish]
:* %pass /srving %agent [our.bol %file-server]
%poke %file-server-action
!>([%serve-dir /'~publish' /app/landscape %.n %.y])
== ==
==
::
%4
%= $
p.old-state
=/ new-books=(map [@p @tas] notebook)
%- ~(run by books.p.old-state)
|= old-notebook=notebook-3
^- notebook-3
(convert-notebook-3-4 old-notebook)
[%5 our-paths.p.old-state new-books tile-num.p.old-state [~ ~]]
::
cards
%+ welp cards
:~ [%pass /groups %agent [our.bol %group-store] %watch /groups]
==
==
::
%5
%= $
-.p.old-state %6
cards
%+ weld cards
%+ roll ~(tap by books.p.old-state)
|= [[[who=@p book=@tas] nb=notebook] out=(list card)]
^- (list card)
?. =(who our.bol)
out
=/ rid (de-path:resource writers.nb)
=/ grp=(unit group) (scry-group:grup:main rid)
?~ grp out
?: hidden.u.grp
out
=/ =tag [%publish (cat 3 'writers-' book)]
:_ out
(group-proxy-poke entity.rid %add-tag rid tag members.u.grp)
==
::
%6
=/ [ours=(set [rid=resource nb=notebook]) theirs=(set resource)]
%+ roll ~(tap by books.p.old-state)
|= [[[who=@p book=@tas] nb=notebook] [ours=(set [resource notebook]) theirs=(set resource)]]
^- [(set [resource notebook]) (set resource)]
=/ =resource
[who book]
?. =(who our.bol)
ours^(~(put in theirs) resource)
:_ theirs
(~(put in ours) [resource nb])
::
%_ $
p.old-state
:+ %7 +.p.old-state
%- ~(gas by *(map resource @ud))
(turn ~(tap in theirs) (late 0))
::
cards
;: weld
cards
:: move our books to graph-store
^- (list card)
%- zing
%+ turn ~(tap in ours)
|= [rid=resource nb=notebook]
^- (list card)
=/ =graph:graph-store
(notebook-to-graph nb)
:~
%- poke-graph-store
:* %0 date-created.nb %add-graph
rid
graph
`%graph-validator-publish
%.y
==
(poke-graph-push %add rid)
==
:: for their books, subscribe to graph-pull-hook, to see if host has migrated
^- (list card)
(turn ~(tap in theirs) check-host-migrate:main)
:: leave all subscriptions
^- (list card)
%+ turn ~(tap in ~(key by wex.bol))
|= [=wire =ship app=term]
^- card
[%pass wire %agent [ship app] %leave ~]
==
==
::
%7
[cards this(state p.old-state)]
==
++ blank-note-node
|= =note
%* . *node:graph-store
author.post author.note
time-sent.post date-created.note
==
::
++ notebook-to-graph
|= =notebook
^- graph:graph-store
%+ gas:orm:graph-store *graph:graph-store
%+ turn ~(tap by notes.notebook)
|= [@ta =note]
^- [atom node:graph-store]
:- date-created.note
%* . (blank-note-node note)
index.post ~[date-created.note]
::
children
:- %graph
(note-to-revision-container notebook note)
==
::
++ note-to-revision-container
|= [=notebook =note]
^- graph:graph-store
%+ gas:orm:graph-store *graph:graph-store
:~
:- %1
%* . (blank-note-node note)
index.post ~[date-created.note %1]
children graph+(note-to-revisions note)
==
::
:- %2
%* . (blank-note-node note)
index.post ~[date-created.note %2]
children (comments-to-internal-graph note)
==
==
::
++ note-to-revisions
|= =note
^- graph:graph-store
%^ put:orm:graph-store
*graph:graph-store %1
=/ body=@t
=/ file
(trip file.note)
=/ idx
(find ";>" file)
?~ idx
file.note
%- crip
(slag (add 2 u.idx) (trip file.note))
%* . (blank-note-node note)
index.post ~[date-created.note %1 %1]
contents.post ~[text+title.note text+body]
==
::
++ comments-to-internal-graph
|= =note
^- internal-graph:graph-store
?: =(~ comments.note)
[%empty ~]
:- %graph
%+ gas:orm:graph-store *graph:graph-store
%+ turn ~(tap by comments.note)
|= [when=@da =comment]
^- [atom node:graph-store]
:- when
%* . *node:graph-store
author.post author.comment
index.post ~[date-created.note %2 when]
time-sent.post when
contents.post [%text content.comment]~
==
::
++ poke-our
|= [app=term =cage]
[%pass / %agent [our.bol app] %poke cage]
::
++ poke-graph-pull
|= =action:pull-hook
(poke-our %graph-pull-hook pull-hook-action+!>(action))
::
++ poke-graph-store
|= =update:graph-store
(poke-our %graph-store graph-update+!>(update))
::
++ poke-graph-push
|= =action:push-hook
(poke-our %graph-push-hook push-hook-action+!>(action))
++ convert-notebook-3-4
|= prev=notebook-3
^- notebook-3
%= prev
writers
?> ?=(^ writers.prev)
:- %ship
?: =('~' i.writers.prev)
t.writers.prev
writers.prev
::
subscribers
?> ?=(^ subscribers.prev)
:- %ship
%+ scag 2
?: =('~' i.subscribers.prev)
t.subscribers.prev
subscribers.prev
==
::
++ convert-comment-2-3
|= prev=comment-2
^- comment-3
%= prev
content [content.prev %.n]
==
::
++ convert-note-2-3
|= prev=note-2
^- note-3
%= prev
comments
[(~(run by comments.prev) convert-comment-2-3) %.n]
==
::
++ convert-notebook-2-3
|= prev=notebook-2
^- notebook-3
%= prev
notes
%- ~(run by notes.prev)
|= =note-2
(convert-note-2-3 note-2)
==
::
++ 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)
?~ paths
[~ subs]
[[%give %kick paths ~]~ subs]
::
++ send-invites
|= [book=@tas subscribers=(set @p)]
^- (list card)
%+ turn ~(tap in subscribers)
|= who=@p
^- card
=/ uid (sham %publish who book eny.bol)
=/ =invite:inv
:* our.bol %publish [our.bol book] who
(crip "invite for notebook {<our.bol>}/{(trip book)}")
==
=/ =action:inv [%invite %publish uid invite]
[%pass /invite %agent [who %invite-hook] %poke %invite-action !>(action)]
::
++ move-files
|= old-subs=(jug @tas @p)
^- (list card)
=+ ^- [cards=(list card) sob=soba:clay]
%+ roll .^((list path) %ct (weld our-beak:main /web/publish))
|= [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
=/ old=old-info .^(old-info %cx (welp our-beak:main pax))
=/ group-pax /~/(scot %p our.bol)/[book-name]
=/ book=notebook-info
[title.old '' =(%open comments.old) / /]
=+ ^- [grp-car=(list card) write-pax=path read-pax=path]
(make-groups:main book-name [group-pax ~ %.n %.n] title.old '')
=. writers.book write-pax
=. subscribers.book read-pax
=/ 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
[%ins %udon !>(.^(@t %cx (welp our-beak:main pax)))]
sob
::
[%web %publish @ @ @ %publish-comment ~]
=/ book i.t.t.pax
=/ note i.t.t.t.pax
=/ comm i.t.t.t.t.pax
=/ old-com .^(old-comment %cx (welp our-beak:main pax))
=/ new=comment-2
[creator.old-com date-created.old-com content.old-com]
:- car
:+ [pax %del ~]
:- /app/publish/notebooks/[book]/[note]/[comm]/publish-comment
[%ins %publish-comment !>(new)]
sob
==
[[%pass /move-files %arvo %c %info q.byk.bol %& sob] cards]
--
::
++ on-poke on-poke:def
++ on-watch on-watch:def
++ on-leave on-leave:def
++ on-peek on-peek:def
++ on-agent
|= [=wire =sign:agent:gall]
^- (quip card _this)
?. ?=([%graph-migrate *] wire)
(on-agent:def wire sign)
=/ rid=resource
(de-path:resource t.wire)
?. ?=(%watch-ack -.sign)
~| "Expected error, please ignore"
(on-agent:def wire sign)
?~ p.sign
:: if watch acked successfully, then host has completed OTA, and
:: we are safe to add it to the pull-hook
:_ this(migrate (~(del by migrate) rid))
~[(poke-graph-pull:main %add entity.rid rid)]
:: if nacked, then set a exponential backoff and retry
=/ nack-count=@ud
+((~(gut by migrate) rid 0))
?: (gte nack-count 24)
~& >>> "failed to migrate notebook {<rid>} to graph-store"
[~ this]
:_ this(migrate (~(put by migrate) rid nack-count))
:: (bex 19) is roughly 6 days
=/ wakeup=@da
(add now.bol (mul ~s1 (bex (min 19 nack-count))))
[%pass wire %arvo %b %wait wakeup]~
::
++ on-arvo
|= [=wire =sign-arvo]
^- (quip card _this)
?. ?=([%graph-migrate *] wire)
(on-arvo:def wire sign-arvo)
=/ rid=resource
(de-path:resource t.wire)
?> ?=([%b %wake *] sign-arvo)
~? ?=(^ error.sign-arvo)
"behn errored in backoff timers, continuing anyway"
:_ this
~[(check-host-migrate:main rid)]
::
++ on-fail on-fail:def
--
::
|_ bol=bowl:gall
++ grup ~(. grpl bol)
::
++ our-beak /(scot %p our.bol)/[q.byk.bol]/(scot %da now.bol)
::
++ perm-hook-poke
|= act=permission-hook-action
^- card
:* %pass
/
%agent
[our.bol %permission-hook]
%poke
%permission-hook-action
!>(act)
==
::
++ invite-poke
|= act=action:inv
^- card
[%pass / %agent [our.bol %invite-store] %poke %invite-action !>(act)]
::
++ perm-group-hook-poke
|= act=permission-group-hook-action
^- card
:* %pass
/
%agent
[our.bol %permission-group-hook]
%poke
%permission-group-hook-action
!>(act)
==
::
++ generate-invites
|= [book=@tas invitees=(set ship)]
^- (list card)
%+ turn ~(tap in invitees)
|= who=ship
=/ uid (sham %publish who book eny.bol)
=/ =invite:inv
:* our.bol %publish [our.bol book] who
(crip "invite for notebook {<our.bol>}/{(trip book)}")
==
=/ act=action:inv [%invite %publish uid invite]
[%pass / %agent [our.bol %invite-hook] %poke %invite-action !>(act)]
::
++ make-groups
|= [book=@tas group=group-info title=@t about=@t]
^- [(list card) write=path read=path]
?> ?=(^ group-path.group)
=/ scry-path
;: welp
/(scot %p our.bol)/group-store/(scot %da now.bol)
[%groups group-path.group]
/noun
==
=/ rid=resource (de-path:resource group-path.group)
=/ grp=(unit ^group) (scry-group:grup rid)
?: use-preexisting.group
?~ grp !!
?. (is-managed group-path.group) !!
=/ =tag [%publish (cat 3 'writers-' book)]
:_ [group-path.group group-path.group]
[(group-proxy-poke entity.rid %add-tag rid tag members.u.grp)]~
::
=/ =policy
*open:policy
?: make-managed.group
?^ grp [~ group-path.group group-path.group]
?. (is-managed group-path.group) !!
=/ whole-grp (~(put in invitees.group) our.bol)
:_ [group-path.group group-path.group]
[(contact-view-create [group-path.group whole-grp policy title about])]~
:: make unmanaged group
=* group-path group-path.group
:_ [group-path group-path]
?^ grp ~
=/ rid=resource
(de-path:resource group-path)
:- (group-poke %add-group rid policy %.y)
(generate-invites book (~(del in invitees.group) our.bol))
::
++ is-managed
|= =path
^- ?
?> ?=(^ path)
!=(i.path '~')
::
++ group-poke
|= =update:group-store
^- card
[%pass / %agent [our.bol %group-store] %poke %group-update !>(update)]
::
++ group-proxy-poke
|= [=ship =update:group-store]
^- card
[%pass / %agent [ship %group-push-hook] %poke %group-update !>(update)]
++ contact-view-poke
|= act=contact-view-action:contact-view
^- card
[%pass / %agent [our.bol %contact-view] %poke %contact-view-action !>(act)]
::
++ contact-view-create
|= [=path ships=(set ship) =policy title=@t description=@t]
=/ rid=resource
(de-path:resource path)
=/ act=contact-view-action:contact-view
[%create name.rid policy title description]
(contact-view-poke act)
::
++ check-host-migrate
|= rid=resource
^- card
=/ res-path
(en-path:resource rid)
=- [%pass graph-migrate+res-path %agent -]
[[entity.rid %graph-push-hook] %watch resource+res-path]
::
::
++ poke-our
|= [app=term =cage]
[%pass / %agent [our.bol app] %poke cage]
::
++ poke-graph-pull
|= =action:pull-hook
(poke-our %graph-pull-hook pull-hook-action+!>(action))
::
--

View File

@ -1,4 +0,0 @@
:: soto [tombstone]: former dojo relay for urbit's landscape interface
::
/+ default-agent
(default-agent *agent:gall %|)

View File

@ -1,10 +0,0 @@
:: group-listen-hook|add: add a group
::
/- *group, *group-hook
:- %say
|= $: [now=@da eny=@uvJ =beak]
[[=ship =term ~] ~]
==
:- %group-hook-action
^- action
[%add ship term]

View File

@ -1,10 +0,0 @@
:: group-listen-hook|remove: add a group
::
/- *group, *group-hook
:- %say
|= $: [now=@da eny=@uvJ =beak]
[[=ship =term ~] ~]
==
:- %group-hook-action
^- action
[%remove ship term]

View File

@ -1,10 +0,0 @@
:: link-store|note: write a note on a link in a path
::
/- *link-store, *link
:- %say
|= $: [now=@da eny=@uvJ =beak]
[[=path =url note=@t ~] ~]
==
:- %link-action
^- action
[%note path url note]

View File

@ -1,10 +0,0 @@
:: link-store|save: save a link to a path
::
/- *link-store, *link
:- %say
|= $: [now=@da eny=@uvJ =beak]
[[=path title=@t =url ~] ~]
==
:- %link-action
^- action
[%save path title url]

View File

@ -1,4 +1,4 @@
/- *group, *metadata-store, hook=group-hook
/- *group, *metadata-store
/+ store=group-store, resource
::
|_ =bowl:gall

View File

@ -82,9 +82,6 @@
%group-store
%group-pull-hook
%group-push-hook
%permission-store
%permission-hook
%permission-group-hook
%invite-store
%invite-hook
%chat-store
@ -95,10 +92,6 @@
%contact-store
%contact-hook
%contact-view
%link-store
%link-proxy-hook
%link-listen-hook
%link-view
%metadata-store
%metadata-hook
%s3-store
@ -227,10 +220,6 @@
=? ..on-load (lte hood-version %4)
~> %slog.0^leaf+"drum: starting os1 agents"
=> (se-born | %home %s3-store)
=> (se-born | %home %link-view)
=> (se-born | %home %link-listen-hook)
=> (se-born | %home %link-store)
=> (se-born | %home %link-proxy-hook)
=> (se-born | %home %contact-view)
=> (se-born | %home %contact-hook)
=> (se-born | %home %contact-store)
@ -364,11 +353,9 @@
:~
:: set up stores with priority: depended on, but never depending
%- sy
:~ %permission-store
%chat-store
:~ %chat-store
%contact-store
%group-store
%link-store
%invite-store
%metadata-store
==

View File

@ -1,204 +0,0 @@
:: link: social bookmarking
::
/- sur=link-store, *link
::
^?
=< [. sur]
=, sur
|%
++ site-from-url
|= =url
^- site
=/ murl=(unit purl:eyre)
(de-purl:html url)
?~ murl 'http://example.com'
%^ cat 3
:: render protocol
::
=* sec p.p.u.murl
?:(sec 'https://' 'http://')
:: render host
::
=* host r.p.u.murl
?- -.host
%& (roll (join '.' p.host) (cury cat 3))
%| (rsh 3 1 (scot %if p.host))
==
::
++ build-discussion-path
|= args=$@(url [=path =url])
|^ ^- path
?@ args ~[(encode-url-for-path args)]
:_ path.args
(encode-url-for-path url.args)
::
++ encode-url-for-path
|= =url
(scot %ta (wood url))
--
::
++ break-discussion-path
|= =path
^- [=^path =url]
?~ path [/ '']
:- t.path
?: =(~ i.path) ''
~| path
(woad (slav %ta i.path))
::
:: zip sorted a into sorted b, maintaining sort order, avoiding duplicates
::
++ merge-sorted-unique
|* [sort=$-([* *] ?) a=(list) b=(list)]
|- ^- ?(_a _b)
?~ a b
?~ b a
?: =(i.a i.b)
[i.a $(a t.a, b t.b)]
?: (sort i.a i.b)
[i.a $(a t.a)]
[i.b $(b t.b)]
::
++ merge
|%
++ pages
::TODO we would just use +cury here but it don't work
|= [a=^pages b=^pages]
^+ a
%+ merge-sorted-unique
|= [a=page b=page]
(gth time.a time.b)
[a b]
::
++ submissions
|= [a=^submissions b=^submissions]
^+ a
%+ merge-sorted-unique
|= [a=submission b=submission]
(gth time.a time.b)
[a b]
::
++ notes
|= [a=^notes b=^notes]
^+ a
%+ merge-sorted-unique
|= [a=note b=note]
(gth time.a time.b)
[a b]
::
++ comments
|= [a=^comments b=^comments]
^+ a
%+ merge-sorted-unique
|= [a=comment b=comment]
(gth time.a time.b)
[a b]
--
::
++ enjs
=, enjs:format
^?
|%
++ update
|= upd=^update
^- json
%- frond
:- -.upd
?- -.upd
%local-pages
%- pairs
:~ 'path'^(path path.upd)
'pages'^a+(turn pages.upd page)
==
::
%submissions
%- pairs
:~ 'path'^(path path.upd)
'pages'^a+(turn submissions.upd submission)
==
::
%annotations
%- pairs
:~ 'path'^(path path.upd)
'url'^s+url.upd
'notes'^a+(turn notes.upd note)
==
::
%discussions
%- pairs
:~ 'path'^(path path.upd)
'url'^s+url.upd
'comments'^a+(turn comments.upd comment)
==
::
%observation
%- pairs
:~ 'path'^(path path.upd)
'urls'^a+(turn ~(tap in urls.upd) |=(=url s+url))
==
==
::
++ submission
|= sub=^submission
^- json
=+ p=(page +.sub)
?> ?=([%o *] p)
o+(~(put by p.p) 'ship' (ship ship.sub))
::
++ page
|= =^page
^- json
%- pairs
:~ 'title'^s+title.page
'url'^s+url.page
'time'^(time time.page)
==
::
++ comment
|= =^comment
^- json
=+ n=(note +.comment)
?> ?=([%o *] n)
o+(~(put by p.n) 'ship' (ship ship.comment))
::
++ note
|= =^note
^- json
%- pairs
:~ 'time'^(time time.note)
'udon'^s+udon.note ::TODO convert?
==
--
::
++ dejs
=, dejs:format
^?
|%
:: +action: json into action
::
:: formats:
:: {save: {path: '/path', title: 'title', url: 'url'}}
:: {note: {path: '/path', url: 'url', udon: 'text, maybe udon'}}
::
++ action
|= =json
^- ^action
::TODO the type system doesn't like +of here?
?+ json ~|(json !!)
[%o [%save *] ~ ~]
:- %save
%. q.n.p.json
(ot 'path'^pa 'title'^so 'url'^so ~)
::
[%o [%note *] ~ ~]
:- %note
%. q.n.p.json
(ot 'path'^pa 'url'^so 'udon'^so ~)
::
[%o [%seen *] ~ ~]
:- %seen
%. q.n.p.json
(ot 'path'^pa 'url'^(mu so) ~)
==
--
--

View File

@ -58,19 +58,4 @@
(scot %da now.bowl)
/resource-indices
==
::
++ check-resource-permissions
|= [=ship =md-resource]
^- ?
%+ lien (groups-from-resource md-resource)
|= =group-path
.^ ?
%gx
(scot %p our.bowl)
%permission-store
(scot %da now.bowl)
%permitted
(scot %p ship)
(snoc group-path %noun)
==
--

View File

@ -1,103 +0,0 @@
/- *permission-store
|%
++ update-to-json
|= upd=permission-update
^- json
=, enjs:format
%+ frond %permission-update
%- pairs
:~
?: =(%initial -.upd)
?> ?=(%initial -.upd)
[%initial (permission-to-json permissions.upd)]
::
:: %create
?: =(%create -.upd)
?> ?=(%create -.upd)
:- %create
%- pairs
:~ [%path (path path.upd)]
[%kind s+kind.permission.upd]
[%who [%a (turn ~(tap in who.permission.upd) ship)]]
==
::
:: %delete
?: =(%delete -.upd)
?> ?=(%delete -.upd)
[%delete (path path.upd)]
::
:: %add
?: =(%add -.upd)
?> ?=(%add -.upd)
:- %add
%- pairs
:~ [%path (path path.upd)]
[%who [%a (turn ~(tap in who.upd) ship)]]
==
::
:: %remove
?: =(%remove -.upd)
?> ?=(%remove -.upd)
:- %remove
%- pairs
:~ [%path (path path.upd)]
[%who [%a (turn ~(tap in who.upd) ship)]]
==
::
:: %noop
[*@t *^json]
==
::
++ permission-to-json
|= pem=permission-map
=, enjs:format
^- json
%- pairs
%+ turn ~(tap by pem)
|= [pax=^path =permission]
^- [cord json]
:- (spat pax)
%- pairs
:~ [%kind s+kind.permission]
[%who [%a (turn ~(tap in who.permission) ship)]]
==
::
++ ki
=, dejs:format
^- $-(json kind)
(su (perk %black %white ~))
::
++ json-to-set-path-kind
=, dejs:format
%- as
%- ot
:~ [%path pa]
[%kind ki]
==
::
++ json-to-perm-group-hook-action
|= jon=json
=, dejs:format
=< (parse-action jon)
|%
++ parse-action
%- of
:~ [%associate associate]
[%dissociate dissociate]
==
::
++ associate
%- ot
:~ [%group pa]
[%permissions json-to-set-path-kind]
==
::
++ dissociate
%- ot
:~ [%group pa]
[%permissions (as pa)]
==
::
--
--

View File

@ -1,99 +0,0 @@
/+ *sole
::
::TODO revert after #1946
::
|%
::
++ json-to-action
|= jon=json ^- sole-action
%- need %. jon
=> [dejs-soft:format ..sole-action]
|^ (ot id+so dat+(fo %ret (of det+change tab+ni ~)) ~)
++ fo
|* [a=term b=fist]
|=(c=json ?.(=([%s a] c) (b c) (some [a ~])))
::
++ ra
|* [a=[term fist] b=fist]
|= c=json %. c
?.(=(%a -.c) b (pe -.a (ar +.a)))
::
++ ke :: callbacks
|* [gar=* sef=(trap fist)]
|= jon=json ^- (unit _gar)
=- ~! gar ~! (need -) -
((sef) jon)
::
++ change (ot ler+(at ni ni ~) ted+(pe 0v0 edit) ~)
++ char (cu taft so)
++ edit
%+ ke *sole-edit |. ~+
%+ fo %nop
%+ ra mor+edit
(of del+ni set+(cu tuba sa) ins+(ot at+ni cha+char ~) ~)
--
::
++ effect-to-json
|= sef=sole-effect
|^ ^- json
=, enjs:format
?+ -.sef
~|(unsupported-effect+-.sef !!)
%mor [%a (turn p.sef |=(a=sole-effect ^$(sef a)))]
%err (frond %hop (numb p.sef))
%txt (frond %txt (tape p.sef))
%tan (frond %tan (tape (wush 160 p.sef)))
%det (frond %det json:~(grow mar-sole-change +.sef))
::
%pro
%+ frond %pro
(pairs vis+b+vis.sef tag+s+tag.sef cad+(tape (purge cad.sef)) ~)
::
%tab
:- %a
%+ turn p.sef
|= [=cord =^tank]
%+ frond %tab
%- pairs
:~ match+s+cord
info+(tape ~(ram re tank))
==
::
?(%bel %clr %nex)
(frond %act %s -.sef)
==
++ mar-sole-change
|_ cha=sole-change
++ grow
|% ++ json
^- ^json
=, enjs:format
=; edi
=,(cha (pairs ted+(edi ted) ler+a+~[(numb own.ler) (numb his.ler)] ~))
|= det=sole-edit
?- -.det
%nop [%s 'nop']
%mor [%a (turn p.det ..$)]
%del (frond %del (numb p.det))
%set (frond %set (tape (tufa p.det)))
%ins (frond %ins (pairs at+(numb p.det) cha+s+(tuft q.det) ~))
==
--
--
++ wush
|= [wid=@u tan=tang]
^- tape
%- of-wall:format
%+ turn (flop tan)
|= =tank
~! wid
~! tank
(of-wall:format (wash 0^wid tank))
::
++ purge
|= a=styx ^- tape
%- zing %+ turn a
|= a=_?>(?=(^ a) i.a)
?@(a (trip a) ^$(a q.a))
--
--

View File

@ -1,30 +0,0 @@
/- *group-hook
=, dejs:format
|_ act=action
++ grad %noun
++ grow
|%
++ noun act
--
++ grab
|%
++ noun action
++ json
|= jon=^json
=< (parse-action jon)
|%
++ parse-action
%- of
:~
[%add add-action]
[%remove pa]
==
::
++ add-action
%- ot
:~ [%ship (su ;~(pfix sig fed:ag))]
[%path pa]
==
--
--
--

View File

@ -1,17 +0,0 @@
:: link: subscription updates
::
::TODO this should include json conversion once mark performance improves
/+ *link-store
|_ =action
++ grad %noun
++ grow
|%
++ noun action
--
::
++ grab
|%
++ noun ^action
++ json action:dejs
--
--

View File

@ -1,15 +0,0 @@
:: link: initial subscription result
::
/- *link-store
|_ =initial
++ grad %noun
++ grow
|%
++ noun initial
--
::
++ grab
|%
++ noun ^initial
--
--

View File

@ -1,22 +0,0 @@
:: link-listen-action
::
/- *link-listen-hook
=, dejs:format
|_ act=action
++ grad %noun
++ grab
|%
++ noun action
++ json
=, dejs:format
%- of
:~ %watch^pa
%leave^pa
==
--
::
++ grow
|%
++ noun act
--
--

View File

@ -1,13 +0,0 @@
:: link-listen-poke: prod another listener into paying attention
::
|_ =path
++ grad %noun
++ grow
|%
++ noun path
--
++ grab
|%
++ noun ^path
--
--

View File

@ -1,24 +0,0 @@
:: link-listen-update
::
/- *link-listen-hook
=, dejs:format
|_ upd=update
++ grad %noun
++ grab
|%
++ noun update
--
::
++ grow
|%
++ noun upd
++ json
=, enjs:format
%+ frond 'link-listen-update'
%+ frond -.upd
?- -.upd
%listening a+(turn ~(tap in paths.upd) path)
?(%watch %leave) (path path.upd)
==
--
--

View File

@ -1,15 +0,0 @@
:: link: subscription updates
::
/- *link-store
|_ =update
++ grad %noun
++ grow
|%
++ noun update
--
::
++ grab
|%
++ noun ^update
--
--

View File

@ -1,42 +0,0 @@
/- *link-view
=, dejs:format
|_ act=action
++ grad %noun
++ grow
|%
++ noun act
--
++ grab
|%
++ noun action
++ json
|^ %- of
:~ %create^create
%delete^delete
%invite^invite
==
::
++ create
%- ot
:~ 'path'^pa
'title'^so
'description'^so
'members'^mems
'realGroup'^bo
==
::
++ mems
(of %group^pa %ships^ships ~)
::
++ delete
(ot 'path'^pa ~)
::
++ invite
(ot 'path'^pa 'ships'^ships ~)
::
::TODO stdlib
++ ships
(cu sy (ar (su ;~(pfix sig fed:ag))))
--
--
--

View File

@ -1,62 +0,0 @@
/+ *permission-json
=, dejs:format
|_ act=permission-action
++ grad %noun
++ grow
|%
++ noun act
--
++ grab
|%
++ noun permission-action
++ json
|= jon=^json
=< (parse-permission-action jon)
|%
++ parse-permission-action
%- of
:~ [%create create]
[%delete delete]
[%add add]
[%remove remove]
[%allow allow]
[%deny deny]
==
::
++ create
%- ot
:~ [%path pa]
[%kind ki]
[%who (as pa)]
==
::
++ delete
(ot [%path pa]~)
::
++ add
%- ot
:~ [%path pa]
[%who (as (su ;~(pfix sig fed:ag)))]
==
::
++ remove
%- ot
:~ [%path pa]
[%who (as (su ;~(pfix sig fed:ag)))]
==
::
++ allow
%- ot
:~ [%path pa]
[%who (as (su ;~(pfix sig fed:ag)))]
==
::
++ deny
%- ot
:~ [%path pa]
[%who (as (su ;~(pfix sig fed:ag)))]
==
::
--
--
--

View File

@ -1,16 +0,0 @@
/- *permission-group-hook
/+ *permission-json
|_ act=permission-group-hook-action
++ grad %noun
++ grow
|%
++ noun act
--
++ grab
|%
++ noun permission-group-hook-action
++ json
|= jon=^json
(json-to-perm-group-hook-action jon)
--
--

View File

@ -1,12 +0,0 @@
/- *permission-hook
|_ act=permission-hook-action
++ grad %noun
++ grow
|%
++ noun act
--
++ grab
|%
++ noun permission-hook-action
--
--

View File

@ -1,15 +0,0 @@
/+ *permission-json
|_ upd=permission-update
::
++ grad %noun
++ grow
|%
++ noun upd
++ json (update-to-json upd)
--
::
++ grab
|%
++ noun permission-update
--
--

View File

@ -1,20 +0,0 @@
::
:::: /hoon/action/publish/mar
:: tombstoned, now unused
/- *publish
=, format
::
|_ act=action
::
++ grad %noun
++ grow
|%
++ noun act
++ tank >act<
--
::
++ grab
|%
++ noun action
--
--

View File

@ -1,65 +0,0 @@
/- *publish
|_ com=?(comment-2 comment-3)
::
::
++ grow
|%
++ mime
:- /text/x-publish-comments
(as-octs:mimes:html (of-wain:format txt))
++ txt
^- wain
?: ?=(comment-2 com)
:* (cat 3 'author: ' (scot %p author.com))
(cat 3 'date-created: ' (scot %da date-created.com))
'-----'
(to-wain:format content.com)
==
?> ?=(comment-3 com)
:* (cat 3 'author: ' (scot %p author.com))
(cat 3 'date-created: ' (scot %da date-created.com))
'-----'
(to-wain:format content.com)
==
--
++ grab
|%
++ mime
|= [mite p=octs]
|^ (rash q.p both-parser)
++ key-val
|* [key=rule val=rule]
;~(sfix ;~(pfix key val) gaq)
++ old-parser
;~ plug
(key-val (jest 'creator: ~') fed:ag)
(key-val (jest 'collection: ') sym)
(key-val (jest 'post: ') sym)
(key-val (jest 'date-created: ~') (cook year when:so))
(key-val (jest 'last-modified: ~') (cook year when:so))
;~(pfix (jest (cat 3 '-----' 10)) (cook crip (star next)))
==
++ new-parser
;~ plug
(key-val (jest 'author: ~') fed:ag)
(key-val (jest 'date-created: ~') (cook year when:so))
;~(pfix (jest (cat 3 '-----' 10)) (cook crip (star next)))
==
++ both-parser
;~ pose
%+ cook
|= [author=@ date-created=@da content=@t]
^- comment
[author date-created content %.n]
new-parser
%+ cook
|= [author=@ @ @ date-created=@da @ content=@t]
^- comment
[author date-created content %.n]
old-parser
==
--
++ noun ?(comment-2 comment-3)
--
++ grad %mime
--

View File

@ -1,58 +0,0 @@
::
:::: /hoon/info/publish/mar
:: tombstoned, now unused
::
/- *publish
!:
|_ info=notebook-info
::
::
++ grab
|%
++ mime
|= [mite p=octs]
|^ (rash q.p both-parser)
++ key-val
|* [key=rule val=rule]
;~(sfix ;~(pfix key val) gaq)
++ old-parser
;~ plug
(key-val (jest 'owner: ~') fed:ag)
(key-val (jest 'title: ') (cook crip (star prn)))
(key-val (jest 'filename: ') sym)
%+ key-val (jest 'comments: ')
;~(pose (jest %open) (jest %closed) (jest %none))
%+ key-val (jest 'allow-edit: ')
;~(pose (jest %post) (jest %comment) (jest %all) (jest %none))
(key-val (jest 'date-created: ~') (cook year when:so))
;~ pose
(key-val (jest 'last-modified: ~') (cook year when:so))
;~(pfix (jest 'last-modified: ~') (cook year when:so))
==
==
++ new-parser
;~ plug
(key-val (jest 'title: ') (cook crip (star prn)))
(key-val (jest 'description: ') (cook crip (star prn)))
%+ key-val (jest 'comments: ')
(cook |=(a=@ =(%on a)) ;~(pose (jest %on) (jest %off)))
(key-val (jest 'writers: ') ;~(pfix fas (more fas urs:ab)))
;~ pose
(key-val (jest 'subscribers: ') ;~(pfix fas (more fas urs:ab)))
;~(pfix (jest 'subscribers: ') ;~(pfix fas (more fas urs:ab)))
==
==
++ both-parser
;~ pose
new-parser
%+ cook
|= [@ title=@t @ comments=@ *]
^- notebook-info
[title '' =('open' comments) / /]
old-parser
==
--
++ noun notebook-info
--
++ grad %mime
--

View File

@ -1,18 +0,0 @@
::
:::: /hoon/action/publish/mar
::
/- *publish
=, format
::
|_ del=notebook-delta
::
++ grad %noun
++ grow
|%
++ noun del
--
++ grab
|%
++ noun notebook-delta
--
--

View File

@ -1,17 +0,0 @@
::
:::: /hoon/action/publish/mar
::
/+ *publish
::
|_ del=primary-delta
::
++ grad %noun
++ grab
|%
++ noun primary-delta
--
++ grow
|%
++ noun del
--
--

View File

@ -1,16 +0,0 @@
/- *group, store=group-store, *resource
|%
:: $action: request to change group-hook state
::
:: %add:
:: if ship is ours make group available to sync, else sync foreign group
:: to group-store.
:: %remove:
:: if ship is ours make unavailable to sync, else stop syncing foreign
:: group.
::
+$ action
$% [%add rid=resource]
[%remove rid=resource]
==
--

View File

@ -1,17 +0,0 @@
:: link-listen-hook: actions for getting your friends' bookmarks
::
:: Note that /app/link-listen-hook auto-joins any new collections in groups
:: you're a part of. You only need the watch action here for leaving and
:: re-joining.
::
|%
+$ action
$% [%watch =path]
[%leave =path]
==
::
+$ update
$% [%listening paths=(set path)]
action
==
--

View File

@ -1,50 +0,0 @@
:: link-store: store specific types
::
/- *link
^?
|%
::
:: +action: local actions
::
+$ action
$% :: user actions
::
:: %save: save page to path on our ship
::
[%save =path title=@t =url]
:: %note: save a note for a url
::
[%note =path =url udon=@t]
:: %seen: mark item as read (~ for all in path)
::
[%seen =path url=(unit url)]
:: hook actions
::
:: %hear: hear about page at path on other ship
::
[%hear =path submission]
:: %read: hear about note on url from ship
::
[%read =path =url comment]
==
::
:: +initial: local result
::
+$ initial
$% [%local-pages pages=(map path pages)]
[%submissions submissions=(map path submissions)]
[%annotations notes=(per-path-url notes)]
[%discussions comments=(per-path-url comments)]
==
:: +update: local updates
::
::NOTE we include paths/urls to support the "subscribed to all" case
::
+$ update
$% [%local-pages =path =pages]
[%submissions =path =submissions]
[%annotations =path =url =notes]
[%discussions =path =url =comments]
[%observation =path urls=(set url)]
==
--

View File

@ -1,34 +0,0 @@
:: link-view: encapsulating link management
::
|%
++ action
$% :: %create: create a new link collection
::
:: with specified metadata and group. %ships creates a new group,
:: :real-group indicates whether it's global (&) or local (|).
::
$: %create
=path
title=@t
description=@t
members=create-members
real-group=?
==
::
:: %delete: remove collection from local metadata & stop syncing
::
:: if the resource is associated with a real group, and we're the owner,
:: this deletes it for everyone
::
[%delete =path]
::
:: %invite: add to resource's group and send invite
::
[%invite =path ships=(set ship)]
==
::
++ create-members
$% [%group =path]
[%ships ships=(set ship)]
==
--

View File

@ -1,49 +0,0 @@
:: link: social bookmarking
::
:: link operates on the core structure of "pages", which are URLs saved at a
:: specific time with a specific title.
:: submissions, then, are pages received from a specific ship.
::
|%
:: primitives
::
+$ url @t
+$ site @t :: domain, host, etc.
:: +page: a saved URL with timestamp and custom title
::
+$ page
$: title=@t
=url
=time
==
:: +submission: a page saved by a ship
::
+$ submission
$: =ship
page
==
:: +note: a comment on some url
::
+$ note
$: =time
udon=@t
==
:: +comment: a comment by a ship on some url
::
+$ comment
$: =ship
note
==
:: lists, reverse chronological / newest first
::
+$ pages (list page)
+$ submissions (list submission)
+$ notes (list note)
+$ comments (list comment)
::
:: state builder
::
++ per-path-url
|$ [value]
(map path (map url value))
--

View File

@ -1,17 +0,0 @@
|%
+$ kind ?(%black %white)
::
+$ permission-group-hook-action
$% :: %associate: cause a group of ships to be mirrored onto some
:: set of permission paths.
:: note: this deletes any existing data at those permission paths first.
::
[%associate group=path permissions=(set [path kind])]
::
:: %dissociate: stop mirroring between a group and a set
:: of permission paths.
::
[%dissociate group=path permissions=(set path)]
==
--

View File

@ -1,15 +0,0 @@
|%
+$ permission-hook-action
$% :: %add-owned: make a permission set accessible to foreign ships
:: who are allowed by the permission set at the access path.
::
[%add-owned owned=path access=path]
:: %add-synced: mirror a foreign permission set to our permission-store
::
[%add-synced =ship =path]
:: %remove: stop mirroring a foreign permission set or allowing a local
:: permission set to be mirrored
::
[%remove =path]
==
--

View File

@ -1,28 +0,0 @@
|%
+$ kind ?(%black %white)
::
+$ permission
$: =kind
who=(set ship)
==
::
+$ permission-map (map path permission)
::
+$ permission-update
$% [%create =path =permission] :: create perm at path
[%delete =path] :: delete perm at path
[%add =path who=(set ship)] :: add ships to perm path
[%remove =path who=(set ship)] :: remove ships from perm path
[%initial permissions=permission-map]
==
::
+$ permission-action
$% permission-update
[%allow =path who=(set ship)] :: if %black, remove
:: if %white, add
[%deny =path who=(set ship)] :: if %black, add
:: if %white, remove
==
::
--

View File

@ -1,146 +0,0 @@
/- *rw-security
^?
|%
::
+$ group-info
$: group-path=path
invitees=(set ship)
use-preexisting=?
make-managed=?
==
::
+$ action
$% [%new-book book=@tas title=@t about=@t coms=? group=group-info]
[%new-note who=@p book=@tas note=@tas title=@t body=@t]
[%new-comment who=@p book=@tas note=@tas body=@t]
::
[%edit-book book=@tas title=@t about=@t coms=? group=(unit group-info)]
[%edit-note who=@p book=@tas note=@tas title=@t body=@t]
[%edit-comment who=@p book=@tas note=@tas comment=@tas body=@t]
::
[%del-book book=@tas]
[%del-note who=@p book=@tas note=@tas]
[%del-comment who=@p book=@tas note=@tas comment=@tas]
::
[%subscribe who=@p book=@tas]
[%unsubscribe who=@p book=@tas]
::
[%read who=@p book=@tas note=@tas]
::
[%groupify book=@tas target=(unit path) inclusive=?]
==
::
+$ comment comment-3
::
+$ comment-2
$: author=@p
date-created=@da
content=@t
==
::
+$ comment-3
$: author=@p
date-created=@da
content=@t
pending=?
==
::
+$ note note-3
::
+$ note-2
$: author=@p
title=@t
filename=@tas
date-created=@da
last-edit=@da
read=?
file=@t
snippet=@t
comments=(map @da comment-2)
==
::
+$ note-3
$: author=@p
title=@t
filename=@tas
date-created=@da
last-edit=@da
read=?
file=@t
snippet=@t
comments=(map @da comment)
pending=?
==
::
+$ notebook notebook-3
::
+$ notebook-2
$: title=@t
description=@t
comments=?
writers=path
subscribers=path
date-created=@da
notes=(map @tas note-2)
order=(list @tas)
unread=(set @tas)
==
::
+$ notebook-3
$: title=@t
description=@t
comments=?
writers=path
subscribers=path
date-created=@da
notes=(map @tas note)
order=(list @tas)
unread=(set @tas)
==
::
+$ notebook-info
$: title=@t
description=@t
comments=?
writers=path
subscribers=path
==
::
+$ old-info
$: owner=@p
title=@t
filename=@tas
comments=?(%open %closed %none)
allow-edit=?(%post %comment %all %none)
date-created=@da
last-modified=@da
==
+$ old-comment
$: $: creator=@p
collection=@tas
post=@tas
date-created=@da
last-modified=@da
==
content=@t
==
::
+$ notebook-delta
$% [%add-book host=@p book=@tas data=notebook]
[%add-note host=@p book=@tas note=@tas data=note]
[%add-comment host=@p book=@tas note=@tas comment-date=@da data=comment]
::
[%edit-book host=@p book=@tas data=notebook]
[%edit-note host=@p book=@tas note=@tas data=note]
[%edit-comment host=@p book=@tas note=@tas comment-date=@da data=comment]
::
[%del-book host=@p book=@tas]
[%del-note host=@p book=@tas note=@tas]
[%del-comment host=@p book=@tas note=@tas comment=@da]
==
::
+$ primary-delta
$% notebook-delta
[%read who=@p book=@tas note=@tas]
==
--

View File

@ -36,7 +36,6 @@
=/ m (strand:spider ,~)
^- form:m
;< ~ bind:m (start-agent ship %group-store)
;< ~ bind:m (start-agent ship %group-hook)
(pure:m ~)
--
=, strand=strand:spider
@ -59,14 +58,11 @@
;< ~ bind:m (start-group-agents ~marzod)
;< ~ bind:m (dojo ~marbud ":group-store|create 'test-group'")
;< ~ bind:m (wait-for-output ~marbud ">=")
;< ~ bind:m (dojo ~marzod ":group-hook|add ~marbud 'test-group'")
;< ~ bind:m (wait-for-output ~marzod ">=")
;< ~ bind:m (sleep ~s1)
;< ~ bind:m (breach-and-hear az ~marzod ~marbud)
;< ~ bind:m (real-ship az ~marzod)
;< ~ bind:m (wait-for-goad ~marzod)
;< ~ bind:m (start-group-agents ~marzod)
;< ~ bind:m (dojo ~marzod ":group-hook|add ~marbud 'test-group'")
;< ~ bind:m (sleep ~s3)
;< ~ bind:m end-azimuth
(pure:m *vase)