From d91de5f2769060e81bd46c696f373064a9bf9033 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Sat, 1 Aug 2020 11:11:13 +1000 Subject: [PATCH 01/89] lib-hooks: document with comments --- pkg/arvo/lib/pull-hook.hoon | 38 ++++++++++++++++++++++-- pkg/arvo/lib/push-hook.hoon | 58 +++++++++++++++++++++++++++++++++++-- 2 files changed, 92 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/lib/pull-hook.hoon b/pkg/arvo/lib/pull-hook.hoon index 6fdbf1007c..19f861f809 100644 --- a/pkg/arvo/lib/pull-hook.hoon +++ b/pkg/arvo/lib/pull-hook.hoon @@ -1,3 +1,24 @@ +:: lib/pull-hook/hoon: helper for creating a push hook +:: +:: lib/pull-hook is a helper for automatically pulling data from a +:: corresponding push-hook to a store. +:: +:: ## Interfacing notes: +:: +:: lib/push-hook provides the inner door with its own separate state. +:: The inner door may interact with the library by producing cards or +:: scrying. Do not pass any cards on a wire beginning with /helper as +:: these wires are reserved by this library. Any watches/pokes/peeks +:: not listed below will be routed to the inner door. +:: +:: ## Subscription paths +:: +:: /tracking: The set of resources we are pulling +:: +:: ## Pokes +:: +:: %pull-hook-action: Add/remove a resource from pulling. +:: /- *pull-hook /+ default-agent, resource :: @@ -5,13 +26,24 @@ |% +$ card card:agent:gall :: +:: $config: configuration for the pull hook +:: +:: .store-name: name of the store to proxy subscriptions to. +:: .update-mark: mark that updates will be tagged with +:: .push-hook-name: name of the corresponding push-hook + +$ config $: store-name=term update=mold update-mark=term push-hook-name=term == +:: +:: $state-0: state for the pull hook :: +:: .tracking: a map of resources we are pulling, and the ships that +:: we are pulling them from. +:: .inner-state: state given to internal door +$ state-0 $: %0 tracking=(map resource ship) @@ -37,7 +69,7 @@ |* config $_ ^| |_ bowl:gall - :: + :: from agent:gall ++ on-init *[(list card) _^|(..on-init)] :: @@ -77,7 +109,9 @@ *[(list card) _^|(..on-init)] :: +on-pull-nack: handle failed pull subscription :: - :: This arm is called when a pull subscription fails. + :: This arm is called when a pull subscription fails. lib/pull-hook + :: will automatically delete the resource from .tracking by the + :: time this arm is called. :: ++ on-pull-nack |~ [resource tang] diff --git a/pkg/arvo/lib/push-hook.hoon b/pkg/arvo/lib/push-hook.hoon index 776aa0f597..e922283534 100644 --- a/pkg/arvo/lib/push-hook.hoon +++ b/pkg/arvo/lib/push-hook.hoon @@ -1,8 +1,42 @@ +:: lib/push-hook/hoon: helper for creating a push hook +:: +:: lib/push-hook is a helper for automatically pushing data from a +:: local store to the corresponding pull-hook on remote ships. It also +:: proxies remote pokes to the store. +:: +:: ## Interfacing notes: +:: +:: lib/push-hook provides the inner door with its own separate state. +:: The inner door may interact with the library by producing cards or +:: scrying. Do not pass any cards on a wire beginning with /helper as +:: these wires are reserved by this library. Any watches/pokes/peeks +:: not listed below will be routed to the inner door. +:: +:: ## Subscription paths +:: +:: /resource/[resource]: Receive initial state and updates to +:: .resource. .resource should be encoded with de-path:resource from +:: /lib/resource. Facts on this path will be of mark +:: update-mark.config +:: +:: ## Pokes +:: +:: %push-hook-action: Add/remove a resource from pushing. +:: [update-mark.config]: A poke to proxy to the local store +:: /- *push-hook /+ default-agent, resource |% +$ card card:agent:gall :: +:: $config: configuration for the push hook +:: +:: .store-name: name of the store to proxy pokes and +:: subscriptions to +:: .store-path: subscription path to receive updates on +:: .update-mark: mark that updates will be tagged with +:: .pull-hook-name: name of the corresponding pull-hook +:: +$ config $: store-name=term store-path=path @@ -10,6 +44,12 @@ update-mark=term pull-hook-name=term == +:: +:: $state-0: state for the push hook +:: +:: .sharing: resources that the push hook is proxying +:: .inner-state: state given to internal door +:: +$ state-0 $: %0 sharing=(set resource) @@ -20,6 +60,7 @@ |* =config $_ ^| |_ bowl:gall + :: from agent:gall :: ++ on-init *[(list card) _^|(..on-init)] @@ -58,14 +99,21 @@ ++ on-fail |~ [term tang] *[(list card) _^|(..on-init)] + :: :: +resource-for-update: get affected resource from an update + :: + :: Given a vase of the update, the mark of which is + :: update-mark.config, produce the affected resource, if any. + :: ++ resource-for-update |~ vase *(unit resource) :: :: +on-update: handle update from store :: - :: Do extra stuff on store update + :: Given an update from the store, do other things after proxying + :: the update + :: ++ take-update |~ vase *[(list card) _^|(..on-init)] @@ -81,7 +129,13 @@ :: +initial-watch: produce initial state for a subscription :: :: .resource is the resource being subscribed to. - :: .path is any additional information in the subscription wire + :: .path is any additional information in the subscription wire. + :: This would typically be used to encode state that the subscriber + :: already has. For example, a chat client might encode + :: the number of messages that it already has, or the date it last + :: received an update. + :: + :: If +initial-watch crashes, the subscription fails. :: ++ initial-watch |~ [path resource] From 531d53ddfc2b52512544f5206af47f8d28441a91 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Wed, 5 Aug 2020 13:55:12 +1000 Subject: [PATCH 02/89] lib-hooks: address mark review --- pkg/arvo/lib/pull-hook.hoon | 57 ++++++++++++------------ pkg/arvo/lib/push-hook.hoon | 88 ++++++++++++++++++------------------- 2 files changed, 73 insertions(+), 72 deletions(-) diff --git a/pkg/arvo/lib/pull-hook.hoon b/pkg/arvo/lib/pull-hook.hoon index 19f861f809..5afd0275d7 100644 --- a/pkg/arvo/lib/pull-hook.hoon +++ b/pkg/arvo/lib/pull-hook.hoon @@ -1,11 +1,10 @@ -:: lib/pull-hook/hoon: helper for creating a push hook +:: lib/pull-hook: helper for creating a push hook :: :: lib/pull-hook is a helper for automatically pulling data from a :: corresponding push-hook to a store. :: :: ## Interfacing notes: :: -:: lib/push-hook provides the inner door with its own separate state. :: The inner door may interact with the library by producing cards or :: scrying. Do not pass any cards on a wire beginning with /helper as :: these wires are reserved by this library. Any watches/pokes/peeks @@ -28,10 +27,10 @@ :: :: $config: configuration for the pull hook :: -:: .store-name: name of the store to proxy subscriptions to. +:: .store-name: name of the store to send subscription updates to. :: .update-mark: mark that updates will be tagged with :: .push-hook-name: name of the corresponding push-hook - +:: +$ config $: store-name=term update=mold @@ -44,6 +43,7 @@ :: .tracking: a map of resources we are pulling, and the ships that :: we are pulling them from. :: .inner-state: state given to internal door +:: +$ state-0 $: %0 tracking=(map resource ship) @@ -69,6 +69,28 @@ |* config $_ ^| |_ bowl:gall + :: +on-pull-nack: handle failed pull subscription + :: + :: This arm is called when a pull subscription fails. lib/pull-hook + :: will automatically delete the resource from .tracking by the + :: time this arm is called. + :: + ++ on-pull-nack + |~ [resource tang] + *[(list card) _^|(..on-init)] + :: +on-pull-kick: produce any additional resubscribe path + :: + :: If non-null, the produced path is appended to the original + :: subscription path. This should be used to encode extra + :: information onto the path in order to reduce the payload of a + :: kick and resubscribe. + :: + :: If null, a resubscribe is not attempted + :: + ++ on-pull-kick + |~ resource + *(unit path) + :: :: from agent:gall ++ on-init *[(list card) _^|(..on-init)] @@ -107,28 +129,6 @@ ++ on-fail |~ [term tang] *[(list card) _^|(..on-init)] - :: +on-pull-nack: handle failed pull subscription - :: - :: This arm is called when a pull subscription fails. lib/pull-hook - :: will automatically delete the resource from .tracking by the - :: time this arm is called. - :: - ++ on-pull-nack - |~ [resource tang] - *[(list card) _^|(..on-init)] - :: +on-pull-kick: produce any additional resubscribe path - :: - :: If non-null, the produced path is appended to the original - :: subscription path. This should be used to encode extra - :: information onto the path in order to reduce the payload of a - :: kick and resubscribe. - :: - :: If null, a resubscribe is not attempted - :: - ++ on-pull-kick - |~ resource - *(unit path) - :: :: -- ++ agent |* =config @@ -243,7 +243,10 @@ =^ cards pull-hook (on-fail:og term tang) [cards this] - ++ on-peek on-peek:def + ++ on-peek + |= =path + ^- (unit (unit cage)) + (on-peek:og path) -- |_ =bowl:gall +* og ~(. pull-hook bowl) diff --git a/pkg/arvo/lib/push-hook.hoon b/pkg/arvo/lib/push-hook.hoon index e922283534..1ddc07a76a 100644 --- a/pkg/arvo/lib/push-hook.hoon +++ b/pkg/arvo/lib/push-hook.hoon @@ -1,4 +1,4 @@ -:: lib/push-hook/hoon: helper for creating a push hook +:: lib/push-hook: helper for creating a push hook :: :: lib/push-hook is a helper for automatically pushing data from a :: local store to the corresponding pull-hook on remote ships. It also @@ -6,7 +6,6 @@ :: :: ## Interfacing notes: :: -:: lib/push-hook provides the inner door with its own separate state. :: The inner door may interact with the library by producing cards or :: scrying. Do not pass any cards on a wire beginning with /helper as :: these wires are reserved by this library. Any watches/pokes/peeks @@ -15,7 +14,7 @@ :: ## Subscription paths :: :: /resource/[resource]: Receive initial state and updates to -:: .resource. .resource should be encoded with de-path:resource from +:: .resource. .resource should be encoded with en-path:resource from :: /lib/resource. Facts on this path will be of mark :: update-mark.config :: @@ -60,6 +59,47 @@ |* =config $_ ^| |_ bowl:gall + :: + :: +resource-for-update: get affected resource from an update + :: + :: Given a vase of the update, the mark of which is + :: update-mark.config, produce the affected resource, if any. + :: + ++ resource-for-update + |~ vase + *(unit resource) + :: + :: +take-update: handle update from store + :: + :: Given an update from the store, do other things after proxying + :: the update + :: + ++ take-update + |~ vase + *[(list card) _^|(..on-init)] + :: +should-proxy-update: should forward update to store + :: + :: If %.y is produced, then the update is forwarded to the local + :: store. If %.n is produced then the update is not forwarded and + :: the poke fails. + :: + ++ should-proxy-update + |~ vase + *? + :: +initial-watch: produce initial state for a subscription + :: + :: .resource is the resource being subscribed to. + :: .path is any additional information in the subscription wire. + :: This would typically be used to encode state that the subscriber + :: already has. For example, a chat client might encode + :: the number of messages that it already has, or the date it last + :: received an update. + :: + :: If +initial-watch crashes, the subscription fails. + :: + ++ initial-watch + |~ [path resource] + *vase :: from agent:gall :: ++ on-init @@ -99,48 +139,6 @@ ++ on-fail |~ [term tang] *[(list card) _^|(..on-init)] - :: - :: +resource-for-update: get affected resource from an update - :: - :: Given a vase of the update, the mark of which is - :: update-mark.config, produce the affected resource, if any. - :: - ++ resource-for-update - |~ vase - *(unit resource) - :: - :: +on-update: handle update from store - :: - :: Given an update from the store, do other things after proxying - :: the update - :: - ++ take-update - |~ vase - *[(list card) _^|(..on-init)] - :: +should-proxy-update: should forward update to store - :: - :: If %.y is produced, then the update is forwarded to the local - :: store. If %.n is produced then the update is not forwarded and - :: the poke fails. - :: - ++ should-proxy-update - |~ vase - *? - :: +initial-watch: produce initial state for a subscription - :: - :: .resource is the resource being subscribed to. - :: .path is any additional information in the subscription wire. - :: This would typically be used to encode state that the subscriber - :: already has. For example, a chat client might encode - :: the number of messages that it already has, or the date it last - :: received an update. - :: - :: If +initial-watch crashes, the subscription fails. - :: - ++ initial-watch - |~ [path resource] - *vase - :: -- ++ agent |* =config From 96d2906edce45efa65106aad1cb11537adf5afcd Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 18 Aug 2020 13:32:04 -0400 Subject: [PATCH 03/89] link: graph validator compiles and runs --- pkg/arvo/mar/graph/validator/link.hoon | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 pkg/arvo/mar/graph/validator/link.hoon diff --git a/pkg/arvo/mar/graph/validator/link.hoon b/pkg/arvo/mar/graph/validator/link.hoon new file mode 100644 index 0000000000..006feda37e --- /dev/null +++ b/pkg/arvo/mar/graph/validator/link.hoon @@ -0,0 +1,27 @@ +/- *post +|_ i=indexed-post +++ grow + |% + ++ noun i + -- +++ grab + |% + ++ noun + |= p=* + =/ ip ;;(indexed-post p) + ?+ index.p.ip ~|(index+index.p.ip !!) + :: top-level link post + :: + [@ ~] + ?> ?=([[%text @] [%url @] [%text @] ~] contents.p.ip) + ip + :: + :: comment on link post + :: + [@ @ ~] + ?> ?=([[%text @] ~] contents.p.ip) + ip + == + -- +++ grad %noun +-- From dd2bae9320530ae564982d690ab268fc93f65db6 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 18 Aug 2020 15:41:24 -0400 Subject: [PATCH 04/89] links: data migration compiles; untested and still needs subscription migration --- pkg/arvo/app/link-store.hoon | 481 +++++-------------------- pkg/arvo/mar/graph/validator/link.hoon | 6 +- 2 files changed, 85 insertions(+), 402 deletions(-) diff --git a/pkg/arvo/app/link-store.hoon b/pkg/arvo/app/link-store.hoon index fed3d1206a..0253b413fe 100644 --- a/pkg/arvo/app/link-store.hoon +++ b/pkg/arvo/app/link-store.hoon @@ -50,10 +50,12 @@ :: ? :: /seen/wood-url/some-path have we seen this here :: -/- *link -/+ store=link-store, default-agent, verb, dbug +/- *link, gra=graph-store, *resource +/+ store=link-store, graph-store, default-agent, verb, dbug :: |% ++$ state-any $%(state-1 state-0) ++$ state-1 [%1 ~] +$ state-0 $: %0 by-group=(map path links) @@ -76,414 +78,95 @@ +$ card card:agent:gall -- :: -=| state-0 +=| 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) - [~ 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) - ::TODO move json conversion into mark once mark performance improves - %json (do-action:do (action:dejs:store !<(json vase))) - %link-action (do-action:do !<(action:store 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)) - :: - [%y ?(%annotations %discussions) *] - =/ [spath=^path surl=url] - (break-discussion-path:store t.t.path) - =- ``noun+!>(-) - :: - ?: =(~ surl) - :: no url, provide urls that have comments - :: - ^- (set url) - ?~ spath - :: no path, find urls accross all paths - :: - %- ~(rep by discussions) - |= [[* discussions=(map url discussion)] urls=(set url)] - %- ~(uni in urls) - ~(key by discussions) - :: specified path, find urls for that specific path - :: - %~ key by - (~(gut by discussions) spath *(map url *)) - :: specified url and path, nothing to list here - :: - ?^ spath !! - :: no path, find paths with comments for this url - :: - ^- (set ^path) - %- ~(rep by discussions) - |= [[=^path urls=(map url discussion)] paths=(set ^path)] - ?. (~(has by urls) surl) paths - (~(put in paths) path) - :: - [%x %annotations *] - ``noun+!>((get-annotations:do t.t.path)) - :: - [%x %discussions *] - ``noun+!>((get-discussions:do t.t.path)) - :: - [%x %seen @ ^] - ``noun+!>((is-seen:do t.t.path)) - :: - [%x %unseen ~] - ``noun+!>(get-all-unseen:do) - :: - [%x %unseen ^] - ``noun+!>((get-unseen:do t.t.path)) - == - :: - ++ on-watch - |= =path - ^- (quip card _this) - ?> (team:title [our src]:bowl) ::TODO /lib/store - :_ this - |^ ?+ path (on-watch:def path) - [%local-pages *] - %+ give %link-initial - ^- initial:store - [%local-pages (get-local-pages:do t.path)] - :: - [%submissions *] - %+ give %link-initial - ^- initial:store - [%submissions (get-submissions:do t.path)] - :: - [%annotations *] - %+ give %link-initial - ^- initial:store - [%annotations (get-annotations:do t.path)] - :: - [%discussions *] - %+ give %link-initial - ^- initial:store - [%discussions (get-discussions:do t.path)] - :: - [%seen ~] - ~ - == - :: - ++ give - |* [=mark =noun] - ^- (list card) - [%give %fact ~ mark !>(noun)]~ - :: - ++ give-single - |* [=mark =noun] - ^- 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 ++* this . + do ~(. +> bowl) + def ~(. (default-agent this %|) bowl) :: -:: writing -:: -++ do-action - |= =action:store - ^- (quip card _state) - ?- -.action - %save (save-page +.action) - %note (note-note +.action) - %seen (seen-submission +.action) +++ on-init on-init:def +++ on-save !>(state) +++ on-load + |= old=vase + ^- (quip card _this) + =/ s !<(state-any old) + ?: ?=(%1 -.s) + [~ this(state s)] :: - %hear (hear-submission +.action) - %read (read-comment +.action) + :_ this(state *state-1) + =/ orm orm:graph-store + |^ ^- (list card) + %+ murn ~(tap by by-group.s) + |= [=path =links] + ^- (unit card) + ?. ?=([@ @ *] path) + (on-bad-path path links) + :- ~ + %+ add-graph `resource`[(slav %p i.path) i.t.path] + ^- 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=~ == -:: +save-page: save a page ourselves -:: -++ save-page - |= [=path title=@t =url] - ^- (quip card _state) - ?< |(=(~ path) =(~ title) =(~ url)) - :: 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 + ++ on-bad-path + |= [=path =links] + ^- (unit card) + ~| discarding-malformed-links+[path links] + ~ :: - =^ submission-cards state - (hear-submission path [our.bowl page]) - :: mark page as seen (because we submitted it ourselves) - :: - =^ seen-cards state - (seen-submission path `url) - :: send updates to subscribers - :: - :_ state - :_ (weld submission-cards seen-cards) - :+ %give %fact - :+ :~ /local-pages - [%local-pages path] - == - %link-update - !>([%local-pages path [page]~]) -:: +note-note: save a note for a url -:: -++ note-note - |= [=path =url udon=@t] - ^- (quip card _state) - ?< |(=(~ path) =(~ url) =(~ udon)) - :: 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) - :_ cards - :+ %give %fact - :+ :~ /annotations - [%annotations %$ path] - [%annotations (build-discussion-path:store url)] - [%annotations (build-discussion-path:store path url)] - == - %link-update - !>([%annotations path url [note]~]) -:: +seen-submission: mark url as seen/read -:: -:: if no url specified, all under path are marked as read -:: -++ seen-submission - |= [=path murl=(unit url)] - ^- (quip card _state) - =/ =links (~(gut by by-group) path *links) - :: new: urls we want to, but haven't yet, marked as seen - :: - =/ new=(set url) - %. seen.links - %~ dif in - ^- (set url) - ?^ murl (sy ~[u.murl]) - %- ~(gas in *(set url)) - %+ turn submissions.links - |=(submission url) - ?: =(~ new) [~ state] - =. seen.links (~(uni in seen.links) new) - :_ state(by-group (~(put by by-group) path links)) - [%give %fact ~[/seen] %link-update !>([%observation path new])]~ -:: +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) - =^ added submissions.links - ?: ?=(^ (find ~[submission] submissions.links)) - [| submissions.links] - :- & - (submissions:merge:store submissions.links ~[submission]) - =. by-group (~(put by by-group) path links) - :: add submission to global sites - :: - =/ =site (site-from-url:store url.submission) - =. by-site (~(add ja by-site) site [path submission]) - :: send updates to subscribers - :: - :_ state - ?. added ~ - :_ ~ - :+ %give %fact - :+ :~ /submissions - [%submissions path] - == - %link-update - !>([%submissions path [submission]~]) -:: +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) - =^ added comments.discussion - ?: ?=(^ (find ~[comment] comments.discussion)) - [| comments.discussion] - :- & - (comments:merge:store comments.discussion ~[comment]) - =. urls (~(put by urls) url discussion) - =. discussions (~(put by discussions) path urls) - :: send updates to subscribers - :: - :_ state - ?. added ~ - :_ ~ - :+ %give %fact - :+ :~ /discussions - [%discussions '' path] - [%discussions (build-discussion-path:store url)] - [%discussions (build-discussion-path:store path url)] - == - %link-update - !>([%discussions path url [comment]~]) -:: -:: reading -:: -++ get-local-pages - |= =path - ^- (map ^path pages) - ?~ path - :: all paths - :: - %- ~(run by by-group) - |=(links ours) - :: specific path - :: - %+ ~(put by *(map ^path pages)) path - ours:(~(gut by by-group) path *links) -:: -++ get-submissions - |= =path - ^- (map ^path submissions) - ?~ path - :: all paths - :: - %- ~(run by by-group) - |=(links submissions) - :: specific path - :: - %+ ~(put by *(map ^path submissions)) path - submissions:(~(gut by by-group) path *links) -:: -++ get-all-unseen - ^- (jug path url) - %- ~(rut by by-group) - |= [=path *] - (get-unseen path) -:: -++ get-unseen - |= =path - ^- (set url) - =/ =links - (~(gut by by-group) path *links) - %- ~(gas in *(set url)) - %+ murn submissions.links - |= submission - ?: (~(has in seen.links) url) ~ - (some url) -:: -++ is-seen - |= =path - ^- ? - =/ [=^path =url] - (break-discussion-path:store path) - %. url - %~ has in - seen:(~(gut by by-group) path *links) -:: -:: -++ get-annotations - |= =path - ^- (per-path-url notes) - =/ args=[=^path =url] - (break-discussion-path:store path) - |^ ?~ path - :: all paths - :: - (~(run by discussions) get-ours) - :: specific path - :: - %+ ~(put by *(per-path-url notes)) path.args - %- get-ours - %+ ~(gut by discussions) path.args - *(map url discussion) - :: - ++ get-ours - |= m=(map url discussion) - ^- (map url notes) - ?: =(~ url.args) - :: all urls - :: - %- ~(run by m) - |=(discussion ours) - :: specific url - :: - %+ ~(put by *(map url notes)) url.args - ours:(~(gut by m) url.args *discussion) + ++ add-graph + |= [=resource =graph:gra] + ^- card + =- [%pass /migrate-link %agent [our.bowl %graph-store] -] + ^- task:agent:gall + :+ %poke %graph-update + !> ^- update:gra + [%0 now.bowl %add-graph resource graph `%graph-validator-link] -- :: -++ get-discussions - |= =path - ^- (per-path-url comments) - =/ args=[=^path =url] - (break-discussion-path:store path) - |^ ?~ path - :: all paths - :: - (~(run by discussions) get-comments) - :: specific path - :: - %+ ~(put by *(per-path-url comments)) path.args - %- get-comments - %+ ~(gut by discussions) path.args - *(map url discussion) - :: - ++ get-comments - |= m=(map url discussion) - ^- (map url comments) - ?: =(~ url.args) - :: all urls - :: - %- ~(run by m) - |=(discussion comments) - :: specific url - :: - %+ ~(put by *(map url comments)) url.args - comments:(~(gut by m) url.args *discussion) - -- +++ 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 -- diff --git a/pkg/arvo/mar/graph/validator/link.hoon b/pkg/arvo/mar/graph/validator/link.hoon index 006feda37e..a9c1cbb309 100644 --- a/pkg/arvo/mar/graph/validator/link.hoon +++ b/pkg/arvo/mar/graph/validator/link.hoon @@ -10,13 +10,13 @@ |= p=* =/ ip ;;(indexed-post p) ?+ index.p.ip ~|(index+index.p.ip !!) - :: top-level link post + :: top-level link post; title and url :: [@ ~] - ?> ?=([[%text @] [%url @] [%text @] ~] contents.p.ip) + ?> ?=([[%text @] [%url @] ~] contents.p.ip) ip :: - :: comment on link post + :: comment on link post; comment text :: [@ @ ~] ?> ?=([[%text @] ~] contents.p.ip) From 65b38121915ac7eeb0e014f714309b2dcb6c77da Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Tue, 18 Aug 2020 18:39:43 -0400 Subject: [PATCH 05/89] chat: restore 'copied' notice on copy Fixes #3326. --- .../src/views/apps/chat/components/lib/message.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/interface/src/views/apps/chat/components/lib/message.js b/pkg/interface/src/views/apps/chat/components/lib/message.js index 461423db79..c47d3f2abe 100644 --- a/pkg/interface/src/views/apps/chat/components/lib/message.js +++ b/pkg/interface/src/views/apps/chat/components/lib/message.js @@ -60,6 +60,15 @@ const renderWithSigil = (props, timestamp) => { name = cite(props.msg.author); } + let nameSpan = null; + + const copyNotice = (saveName) => { + nameSpan.innerText = 'Copied'; + setTimeout(() => { + nameSpan.innerText = saveName; + }, 800); + }; + return (
{ 'mw5 db truncate pointer ' + (contact.nickname ? '' : 'mono') } + ref={(e) => nameSpan = e} onClick={() => { + const saveName = name; writeText(props.msg.author); + copyNotice(saveName); }} title={`~${props.msg.author}`} > From 928e5f7362d2879efaa429382192ac3982f70e6c Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Wed, 19 Aug 2020 12:22:20 -0700 Subject: [PATCH 06/89] graph-hooks: initial sketch --- pkg/arvo/app/graph-pull-hook.hoon | 48 +++++++++++++ pkg/arvo/app/graph-push-hook.hoon | 116 ++++++++++++++++++++++++++++++ pkg/arvo/app/graph-store.hoon | 9 +++ pkg/arvo/lib/graph.hoon | 8 ++- 4 files changed, 180 insertions(+), 1 deletion(-) create mode 100644 pkg/arvo/app/graph-pull-hook.hoon create mode 100644 pkg/arvo/app/graph-push-hook.hoon diff --git a/pkg/arvo/app/graph-pull-hook.hoon b/pkg/arvo/app/graph-pull-hook.hoon new file mode 100644 index 0000000000..bb36868737 --- /dev/null +++ b/pkg/arvo/app/graph-pull-hook.hoon @@ -0,0 +1,48 @@ +/- *resource +/+ store=graph-store, graph, default-agent, verb, dbug, pull-hook +~% %graph-pull-hook-top ..is ~ +|% ++$ card card:agent:gall +++ config + ^- config:pull-hook + :* %graph-store + update:store + %graph-update + %graph-push-hook + == +-- +:: +%- agent:dbug +^- agent:gall +%- (agent:pull-hook config) +^- (pull-hook:pull-hook config) +|_ =bowl:gall ++* this . + def ~(. (default-agent this %|) bowl) + dep ~(. (default:pull-hook this config) bowl) +:: +++ on-init on-init:def +++ on-save !>(~) +++ on-load on-load:def +++ on-poke on-poke:def +++ on-peek on-peek:def +++ on-arvo on-arvo:def +++ on-fail on-fail:def +++ on-agent on-agent:def +++ on-watch on-watch:def +++ on-leave on-leave:def +++ on-pull-nack + |= [=resource =tang] + ^- (quip card _this) + :_ this + =- [%pass /pull-nack %agent [our.bowl %graph-store] %poke %graph-update -]~ + ^- update:store + !>([%0 now.bowl [%archive-graph resource]) +:: +++ on-pull-kick + |= =resource + ^- (unit path) + =/ maybe-time (peek-log:graph resource) + ?~ maybe-time `/ + `/(scot %da u.maybe-time) +-- diff --git a/pkg/arvo/app/graph-push-hook.hoon b/pkg/arvo/app/graph-push-hook.hoon new file mode 100644 index 0000000000..f93fefed7b --- /dev/null +++ b/pkg/arvo/app/graph-push-hook.hoon @@ -0,0 +1,116 @@ +/+ store=graph-store +/+ res=resource +/+ graph +/+ group +/+ default-agent +/+ dbug +/+ push-hook +~% %graph-push-hook-top ..is ~ +|% ++$ card card:agent:gall +++ config + ^- config:push-hook + :* %graph-store + /updates + update:store + %graph-update + %graph-pull-hook + == +:: ++$ agent (push-hook:push-hook config) +-- +:: +%- agent:dbug +^- agent:gall +%- (agent:push-hook config) +^- agent +|_ =bowl:gall ++* this . + def ~(. (default-agent this %|) bowl) + grp ~(. group bowl) + gra ~(. graph bowl) +:: +++ on-init on-init:def +++ on-save !>(~) +++ on-load on-load:def +++ 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 +:: +++ should-proxy-update + |= =vase + ^- ? + =/ =update:store !<(update:store vase) + ?- -.q.update + %add-graph %.y + %remove-graph %.y + %add-nodes %.y + %remove-nodes %.y + %add-signatures %.y + %remove-signatures %.y + %archive-graph %.y + %unarchive-graph %.n + %add-tag %.n + %remove-tag %.n + %keys %.n + %tags %.n + %tag-queries %.n + %run-updates %.y + == +:: +++ resource-for-update + |= =vase + ^- (unit resource:res) + =/ =update:store !<(update:store vase) + ?- -.q.update + %add-graph `resource.q.update + %remove-graph `resource.q.update + %add-nodes `resource.q.update + %remove-nodes `resource.q.update + %add-signatures `resource.uid.q.update + %remove-signatures `resource.uid.q.update + %archive-graph `resource.q.update + %unarchive-graph ~ + %add-tag ~ + %remove-tag ~ + %keys ~ + %tags ~ + %tag-queries ~ + %run-updates `resource.q.update + == +:: +++ initial-watch + |= [=path =resource:res] + ^- vase + ?> (can-join:grp resource src.bowl) + !> ^- update:store + ?~ path + :: new subscribe + :: + =/ [=graph:store mark=(unit mark:store)] + (get-graph:gra resource) + [%0 now.bowl [%add-graph resource graph mark]] + :: resubscribe + :: + =/ =time (slav %da i.path) + =/ =update-log:store (get-update-log-subset:gra resource time) + [%0 now.bowl [%run-updates resource update-log]] +:: +++ take-update + |= =vase + ^- [(list card) agent] + =/ =update:store !<(update:store vase) + ?+ -.q.update [~ this] + %remove-graph + :_ this + [%give %kick ~[resource+(en-path:res resource.q.update)] ~]~ + :: + %archive-graph + :_ this + [%give %kick ~[resource+(en-path:res resource.q.update)] ~]~ + == +-- diff --git a/pkg/arvo/app/graph-store.hoon b/pkg/arvo/app/graph-store.hoon index ab9a6b9710..3724b52d9d 100644 --- a/pkg/arvo/app/graph-store.hoon +++ b/pkg/arvo/app/graph-store.hoon @@ -511,6 +511,15 @@ %empty [~ ~] %graph ``noun+!>(`graph:store`(subset:orm p.children.u.node start end)) == + :: + [%x %update-log-subset @ @ @ @ ~] + =/ =ship (slav %p i.t.t.path) + =/ =term i.t.t.t.path + =/ start=(unit time) (slaw %da i.t.t.t.t.path) + =/ end=(unit time) (slaw %da i.t.t.t.t.t.path) + =/ update-log=(unit update-log:store) (~(get by update-logs) [ship term]) + ?~ update-log [~ ~] + ``noun+!>((subset:orm-log u.update-log start end)) :: [%x %update-log @ @ ~] =/ =ship (slav %p i.t.t.path) diff --git a/pkg/arvo/lib/graph.hoon b/pkg/arvo/lib/graph.hoon index 395c0554fa..6ea0ceba92 100644 --- a/pkg/arvo/lib/graph.hoon +++ b/pkg/arvo/lib/graph.hoon @@ -17,8 +17,14 @@ %+ scry-for marked-graph:store /graph/(scot %p entity.res)/[name.res] :: -++ peek-log +++ peek-update-log |= res=resource ^- (unit time) (scry-for (unit time) /peek-update-log/(scot %p entity.res)/[name.res]) +:: +++ get-update-log-subset + |= [res=resource start=@da] + ^- update-log:store + %+ scry-for update-log:store + /update-log-subset/(scot %p entity.res)/[name.res]/(scot %da start)/'~' -- From b70cae9d7765a42a70c5a7f018b0e310d07a5a43 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Wed, 19 Aug 2020 12:26:58 -0700 Subject: [PATCH 07/89] graph-hook: both hooks compile --- pkg/arvo/app/graph-pull-hook.hoon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/app/graph-pull-hook.hoon b/pkg/arvo/app/graph-pull-hook.hoon index bb36868737..5971ef9482 100644 --- a/pkg/arvo/app/graph-pull-hook.hoon +++ b/pkg/arvo/app/graph-pull-hook.hoon @@ -36,13 +36,13 @@ ^- (quip card _this) :_ this =- [%pass /pull-nack %agent [our.bowl %graph-store] %poke %graph-update -]~ - ^- update:store - !>([%0 now.bowl [%archive-graph resource]) + !> ^- update:store + [%0 now.bowl [%archive-graph resource]] :: ++ on-pull-kick |= =resource ^- (unit path) - =/ maybe-time (peek-log:graph resource) + =/ maybe-time (peek-update-log:graph resource) ?~ maybe-time `/ `/(scot %da u.maybe-time) -- From a4e21da3f0d3020c1e1e04b2d2434b471e692067 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Wed, 19 Aug 2020 12:31:47 -0700 Subject: [PATCH 08/89] hood: starts %graph-pull-hook and %graph-push-hook --- pkg/arvo/app/hood.hoon | 3 ++- pkg/arvo/lib/hood/drum.hoon | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/hood.hoon b/pkg/arvo/app/hood.hoon index 1bc70ed80d..a816843c0e 100644 --- a/pkg/arvo/app/hood.hoon +++ b/pkg/arvo/app/hood.hoon @@ -2,7 +2,7 @@ /+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln |% +$ state - $: %9 + $: %10 drum=state:drum helm=state:helm kiln=state:kiln @@ -12,6 +12,7 @@ [ver=?(%1 %2 %3 %4 %5 %6) lac=(map @tas fin-any-state)] [%7 drum=state:drum helm=state:helm kiln=state:kiln] [%8 drum=state:drum helm=state:helm kiln=state:kiln] + [%9 drum=state:drum helm=state:helm kiln=state:kiln] == +$ any-state-tuple $: drum=any-state:drum diff --git a/pkg/arvo/lib/hood/drum.hoon b/pkg/arvo/lib/hood/drum.hoon index e7b91cfbe2..a41c917a7c 100644 --- a/pkg/arvo/lib/hood/drum.hoon +++ b/pkg/arvo/lib/hood/drum.hoon @@ -105,6 +105,8 @@ %file-server %glob %graph-store + %graph-pull-hook + %graph-push-hook == :: ++ deft-fish :: default connects @@ -207,7 +209,7 @@ == :: ++ on-load - |= [hood-version=?(%1 %2 %3 %4 %5 %6 %7 %8 %9) old=any-state] + |= [hood-version=?(%1 %2 %3 %4 %5 %6 %7 %8 %9 %10) old=any-state] =< se-abet =< se-view =. sat old =. dev (~(gut by bin) ost *source) @@ -236,6 +238,9 @@ (se-born | %home %group-pull-hook) =? ..on-load (lte hood-version %9) (se-born | %home %graph-store) + =? ..on-load (lte hood-version %10) + => (se-born | %home %graph-push-hook) + (se-born | %home %graph-pull-hook) ..on-load :: ++ reap-phat :: ack connect From 291ec5526bf2d62510816f4453e75810cb4c83cf Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Wed, 19 Aug 2020 16:21:42 -0700 Subject: [PATCH 09/89] link-hooks: deactivated and deleted state --- pkg/arvo/app/link-listen-hook.hoon | 650 ++--------------------------- pkg/arvo/app/link-proxy-hook.hoon | 342 +-------------- 2 files changed, 47 insertions(+), 945 deletions(-) diff --git a/pkg/arvo/app/link-listen-hook.hoon b/pkg/arvo/app/link-listen-hook.hoon index 9fae8d98b7..feb5ffb1e3 100644 --- a/pkg/arvo/app/link-listen-hook.hoon +++ b/pkg/arvo/app/link-listen-hook.hoon @@ -1,644 +1,42 @@ -:: link-listen-hook: get your friends' bookmarks +:: link-listen-hook: no longer in use :: -:: keeps track of a listening=(set app-path). users can manually add to and -:: remove from this set. -:: -:: for all ships in groups associated with those resources, we subscribe to -:: their link's local-pages and annotations at the resource path (through -:: link-proxy-hook), and forward all entries into our link-store as -:: submissions and comments. -:: -:: if a subscription to a target fails, we assume it's because their -:: metadata+groups definition hasn't been updated to include us yet. -:: we retry with exponential backoff, maxing out at one hour timeouts. -:: to expede this process, we prod other potential listeners when we add -:: them to our metadata+groups definition. -:: -:: -/- listen-hook=link-listen-hook, *metadata-store, *group, *link -/+ mdl=metadata, default-agent, verb, dbug, group-store, grpl=group, resource, store=link-store +/+ default-agent, verb, dbug :: ~% %link-listen-hook-top ..is ~ |% +$ versioned-state - $% [%0 state-0] - [%1 state-1] - [%2 state-2] - [%3 state-3] + $% [%0 *] + [%1 *] + [%2 *] + [%3 *] + [%4 ~] == -+$ state-3 state-1 -+$ state-2 state-1 -+$ state-1 - $: listening=(set app-path) - state-0 - == -+$ state-0 - $: retry-timers=(map target @dr) - :: reasoning: the resources we're subscribed to, - :: and the groups that cause that. - :: - :: we don't strictly need to track this in state, but doing so heavily - :: simplifies logic and reduces the amount of big scries we do. - :: this also gives us the option to check & restore subscriptions, - :: should we ever need that. - :: - reasoning=(jug [ship app-path] group-path) - == -:: -+$ what-target ?(%local-pages %annotations) -+$ target - $: what=what-target - who=ship - where=path - == -++ wire-to-target - |= =wire - ^- target - ?> ?=([what-target @ ^] wire) - [i.wire (slav %p i.t.wire) t.t.wire] -++ target-to-wire - |= target - ^- wire - [what (scot %p who) where] -:: +$ card card:agent:gall -- :: -=| [%3 state-3] +=| [%4 ~] =* state - :: %- agent:dbug %+ verb | ^- agent:gall -=< - |_ =bowl:gall - +* this . - do ~(. +> bowl) - def ~(. (default-agent this %|) bowl) - :: - ++ on-init - ^- (quip card _this) - :_ this - ~[watch-metadata:do watch-groups:do] - :: - ++ on-save !>(state) - ++ on-load - |= =vase - ^- (quip card _this) - =/ old=versioned-state - !<(versioned-state vase) - =| cards=(list card) - |- - =* upgrade-loop $ - ?- -.old - %3 [cards this(state old)] - :: - %2 - :_ this(state [%3 +.old]) - %+ welp cards - :~ [%pass /groups %agent [our.bowl %group-store] %leave ~] - watch-groups:do - == - :: - %1 - :: the upgrade from 0 left out local-only collections. - :: here, we pull those back in. - :: - =. listening.old - (~(run in ~(key by reasoning.old)) tail) - =/ resources=(list [=group-path =app-path]) - %~ tap in - %. %link - %~ get ju - .^ (jug app-name [group-path app-path]) - %gy - (scot %p our.bowl) - %metadata-store - (scot %da now.bowl) - /app-indices - == - |- - ?~ resources - upgrade-loop(old [%2 +.old]) - =, i.resources - =/ members=(set ship) - (members-from-path:grp:do group-path) - :: if we're the only group member, this got incorrectly ignored - :: during 0's upgrade logic. watch it now. - :: - ?. &(=(1 ~(wyt in members)) (~(has in members) our.bowl)) - $(resources t.resources) - =^ more-cards state - (handle-listen-action:do %watch app-path) - $(resources t.resources, cards (weld more-cards cards)) - :: - %0 - =/ listening=(set app-path) - (~(run in ~(key by reasoning.old)) tail) - $(old [%1 listening +.old]) - == - :: - ++ on-agent - |= [=wire =sign:agent:gall] - ^- (quip card _this) - =^ cards state - ?+ wire ~|([dap.bowl %weird-agent-wire wire] !!) - [%metadata ~] - (take-metadata-sign:do sign) - :: - [%groups ~] - (take-groups-sign:do sign) - :: - [%links ?(%local-pages %annotations) @ ^] - (take-link-sign:do (wire-to-target t.wire) sign) - :: - [%forward ^] - (take-forward-sign:do t.wire sign) - :: - [%prod *] - ?> ?=(%poke-ack -.sign) - ?~ p.sign [~ state] - %- (slog leaf+"prod failed" u.p.sign) - [~ state] - == - [cards this] - :: - ++ on-poke - |= [=mark =vase] - ?+ mark (on-poke:def mark vase) - %link-listen-poke - =/ =path !<(path vase) - :_ this - %+ weld - (take-retry:do %local-pages src.bowl path) - (take-retry:do %annotations src.bowl path) - :: - %link-listen-action - ?> (team:title [our src]:bowl) - =^ cards state - ~| p.vase - (handle-listen-action:do !<(action:listen-hook vase)) - [cards this] - == - :: - ++ on-arvo - |= [=wire =sign-arvo] - ^- (quip card _this) - ?+ sign-arvo (on-arvo:def wire sign-arvo) - [%g %done *] - ?~ error.sign-arvo [~ this] - =/ =tank leaf+"{(trip dap.bowl)}'s message went wrong!" - %- (slog tank tang.u.error.sign-arvo) - [~ this] - :: - [%b %wake *] - ?> ?=([%retry @ @ ^] wire) - ?^ error.sign-arvo - =/ =tank leaf+"wake on {(spud wire)} went wrong!" - %- (slog tank u.error.sign-arvo) - [~ this] - :_ this - (take-retry:do (wire-to-target t.wire)) - == - :: - ++ on-peek - |= =path - ^- (unit (unit cage)) - ?+ path ~ - [%x %listening ~] ``noun+!>(listening) - [%x %listening ^] ``noun+!>((~(has in listening) t.t.path)) - == - :: - ++ on-watch - |= =path - ^- (quip card _this) - ?. ?=([%listening ~] path) (on-watch:def path) - ?> (team:title [our src]:bowl) - :_ this - [%give %fact ~ %link-listen-update !>([%listening listening])]~ - :: - ++ on-leave on-leave:def - ++ on-fail on-fail:def - -- -:: -:: |_ =bowl:gall -+* md ~(. mdl bowl) -++ grp ~(. grpl bowl) ++* this . + def ~(. (default-agent this %|) bowl) :: -:: user actions & updates +++ on-init [~ this] +++ on-save !>(state) +++ on-load + |= =vase + ^- (quip card _this) + :_ this + [%pass /groups %agent [our.bowl %group-store] %leave ~]~ :: -++ handle-listen-action - |= =action:listen-hook - ^- (quip card _state) - ::NOTE no-opping where appropriate happens further down the call stack. - :: we *could* no-op here, as %watch when we're already listening should - :: result in no-ops all the way down, but walking through everything - :: makes this a nice "resurrect if broken unexpectedly" option. - :: - =* app-path path.action - =^ cards listening - ^- (quip card _listening) - =/ had=? (~(has in listening) app-path) - ?- -.action - %watch - :_ (~(put in listening) app-path) - ?:(had ~ [(send-update action)]~) - :: - %leave - :_ (~(del in listening) app-path) - ?.(had ~ [(send-update action)]~) - == - =/ groups=(list group-path) - (groups-from-resource:md %link app-path) - |- - ?~ groups [cards state] - =^ more-cards state - ?- -.action - %watch (listen-to-group app-path i.groups) - %leave (leave-from-group app-path i.groups) - == - $(cards (weld cards more-cards), groups t.groups) -:: -++ send-update - |= =update:listen-hook - ^- card - [%give %fact ~[/listening] %link-listen-update !>(update)] -:: -:: metadata subscription -:: -++ watch-metadata - ^- card - [%pass /metadata %agent [our.bowl %metadata-store] %watch /app-name/link] -:: -++ take-metadata-sign - |= =sign:agent:gall - ^- (quip card _state) - ?- -.sign - %poke-ack ~|([dap.bowl %unexpected-poke-ack /metadata] !!) - %kick [[watch-metadata]~ state] - :: - %watch-ack - ?~ p.sign [~ state] - =/ =tank - :- %leaf - "{(trip dap.bowl)} failed subscribe to metadata store. very wrong!" - %- (slog tank u.p.sign) - [~ state] - :: - %fact - =* mark p.cage.sign - =* vase q.cage.sign - ?. ?=(%metadata-update mark) - ~| [dap.bowl %unexpected-mark mark] - !! - %- handle-metadata-update - !<(metadata-update vase) - == -:: -++ handle-metadata-update - |= upd=metadata-update - ^- (quip card _state) - ?+ -.upd [~ state] - %add - ?> =(%link app-name.resource.upd) - :: auto-listen to collections in unmanaged groups only - :: - =/ rid=resource - (de-path:resource group-path.upd) - =/ =group - (need (scry-group:grp rid)) - ?. hidden.group - [~ state] - =, resource.upd - =^ update listening - ^- (quip card _listening) - ?: (~(has in listening) app-path) - [~ listening] - :- [(send-update %watch app-path)]~ - (~(put in listening) app-path) - =^ cards state - (listen-to-group app-path group-path.upd) - [(weld update cards) state] - :: - %remove - ?> =(%link app-name.resource.upd) - =? listening - ?=(~ (groups-from-resource:md %link app-path.resource.upd)) - (~(del in listening) app-path.resource.upd) - (leave-from-group app-path.resource.upd group-path.upd) - == -:: -:: groups subscriptions -:: -++ watch-groups - ^- card - [%pass /groups %agent [our.bowl %group-store] %watch /groups] -:: -++ take-groups-sign - |= =sign:agent:gall - ^- (quip card _state) - ?- -.sign - %poke-ack ~|([dap.bowl %unexpected-poke-ack /groups] !!) - %kick [[watch-groups]~ state] - :: - %watch-ack - ?~ p.sign [~ state] - =/ =tank - :- %leaf - "{(trip dap.bowl)} failed subscribe to groups. very wrong!" - %- (slog tank u.p.sign) - [~ state] - :: - %fact - =* mark p.cage.sign - =* vase q.cage.sign - ?+ mark ~|([dap.bowl %unexpected-mark mark] !!) - %group-initial [~ state] ::NOTE initial handled using metadata - %group-update (handle-group-update !<(update:group-store vase)) - == - == -:: -++ handle-group-update - |= upd=update:group-store - ^- (quip card _state) - ?. ?=(?(%add-members %initial-group %remove-members) -.upd) - [~ state] - =/ =path - (en-path:resource resource.upd) - =/ socs=(list app-path) - (app-paths-from-group:md %link path) - =/ whos=(list ship) - ?- -.upd - %add-members ~(tap in ships.upd) - %remove-members ~(tap in ships.upd) - %initial-group ~(tap in members.group.upd) - == - =| cards=(list card) - |- - =* loop-socs $ - ?~ socs [cards state] - ?. (~(has in listening) i.socs) - loop-socs(socs t.socs) - |- - =* loop-whos $ - ?~ whos loop-socs(socs t.socs) - =^ caz state - ?. ?=(%remove-members -.upd) - (listen-to-peer i.socs path i.whos) - ?: =(our.bowl i.whos) - (handle-listen-action %leave i.socs) - (leave-from-peer i.socs path i.whos) - loop-whos(whos t.whos, cards (weld cards caz)) -:: -:: link subscriptions -:: -++ listen-to-group - |= [=app-path =group-path] - ^- (quip card _state) - =/ peers=(list ship) - ~| group-path - %~ tap in - (members-from-path:grp group-path) - =| cards=(list card) - |- - ?~ peers [cards state] - =^ caz state - (listen-to-peer app-path group-path i.peers) - $(peers t.peers, cards (weld cards caz)) -:: -++ leave-from-group - |= [=app-path =group-path] - ^- (quip card _state) - =/ peers=(list ship) - %~ tap in - (members-from-path:grp group-path) - =| cards=(list card) - |- - ?~ peers [cards state] - =^ caz state - (leave-from-peer app-path group-path i.peers) - $(peers t.peers, cards (weld cards caz)) -:: -++ listen-to-peer - |= [=app-path =group-path who=ship] - ^- (quip card _state) - ?: =(our.bowl who) - [~ state] - :_ =- state(reasoning -) - (~(put ju reasoning) [who app-path] group-path) - :- (prod-other-listener who app-path) - ?^ (~(get ju reasoning) [who app-path]) - ~ - (start-link-subscriptions who app-path) -:: -++ leave-from-peer - |= [=app-path =group-path who=ship] - ^- (quip card _state) - ?: =(our.bowl who) - [~ state] - =. reasoning (~(del ju reasoning) [who app-path] group-path) - ::NOTE leaving is always safe, so we just do it unconditionally - (end-link-subscriptions who app-path) -:: -++ start-link-subscriptions - |= [=ship =app-path] - ^- (list card) - :~ (start-link-subscription %local-pages ship app-path) - (start-link-subscription %annotations ship app-path) - == -:: -++ start-link-subscription - |= =target - ^- card - :* %pass - [%links (target-to-wire target)] - %agent - [who.target %link-proxy-hook] - %watch - ?- what.target - %local-pages [what where]:target - %annotations [what %$ where]:target - == - == -:: -++ end-link-subscriptions - |= [who=ship where=path] - ^- (quip card _state) - =. retry-timers (~(del by retry-timers) [%local-pages who where]) - =. retry-timers (~(del by retry-timers) [%annotations who where]) - :_ state - |^ ~[(end %local-pages) (end %annotations)] - :: - ++ end - |= what=what-target - :* %pass - [%links (target-to-wire what who where)] - %agent - [who %link-proxy-hook] - %leave - ~ - == - -- -:: -++ prod-other-listener - |= [who=ship where=path] - ^- card - :* %pass - [%prod (scot %p who) where] - %agent - [who %link-listen-hook] - %poke - %link-listen-poke - !>(where) - == -:: -++ take-link-sign - |= [=target =sign:agent:gall] - ^- (quip card _state) - ?- -.sign - %poke-ack ~|([dap.bowl %unexpected-poke-ack /links target] !!) - %kick [[(start-link-subscription target)]~ state] - :: - %watch-ack - ?~ p.sign - =. retry-timers (~(del by retry-timers) target) - [~ state] - :: our subscription request got rejected, - :: most likely because our group definition is out of sync with theirs. - :: set timer for retry. - :: - (start-retry target) - :: - %fact - =* mark p.cage.sign - =* vase q.cage.sign - ?+ mark ~|([dap.bowl %unexpected-mark mark] !!) - %link-initial - %- handle-link-initial - [who.target where.target !<(initial:store vase)] - :: - %link-update - %- handle-link-update - [who.target where.target !<(update:store vase)] - == - == -:: -++ start-retry - |= =target - ^- (quip card _state) - =/ timer=@dr - %+ min ~h1 - %+ mul 2 - (~(gut by retry-timers) target ~s15) - =. retry-timers - (~(put by retry-timers) target timer) - :_ state - :_ ~ - :* %pass - [%retry (target-to-wire target)] - [%arvo %b %wait (add now.bowl timer)] - == -:: -++ take-retry - |= =target - ^- (list card) - :: relevant: whether :who is still associated with resource :where - :: - =; relevant=? - ?. relevant ~ - [(start-link-subscription target)]~ - ?. (~(has in listening) where.target) - | - ?: %- ~(has by wex.bowl) - [[%links (target-to-wire target)] who.target %link-proxy-hook] - | - %+ lien (groups-from-resource:md %link where.target) - |= =group-path - ^- ? - %. who.target - ~(has in (members-from-path:grp group-path)) - -:: -++ do-link-action - |= [=wire =action:store] - ^- card - :* %pass - wire - %agent - [our.bowl %link-store] - %poke - %link-action - !>(action) - == -:: -++ handle-link-initial - |= [who=ship where=path =initial:store] - ^- (quip card _state) - ?> =(src.bowl who) - ?+ -.initial ~|([dap.bowl %unexpected-initial -.initial] !!) - %local-pages - =/ =pages (~(got by pages.initial) where) - (handle-link-update who where [%local-pages where pages]) - :: - %annotations - =/ urls=(list [=url =notes]) - ~(tap by (~(got by notes.initial) where)) - =| cards=(list card) - |- ^- (quip card _state) - ?~ urls [cards state] - =^ caz state - ^- (quip card _state) - =, i.urls - (handle-link-update who where [%annotations where url notes]) - $(urls t.urls, cards (weld cards caz)) - == -:: -++ handle-link-update - |= [who=ship where=path =update:store] - ^- (quip card _state) - ?> =(src.bowl who) - :_ state - ?+ -.update ~|([dap.bowl %unexpected-update -.update] !!) - %local-pages - %+ turn pages.update - |= =page - %+ do-link-action - [%forward %local-page (scot %p who) where] - [%hear where who page] - :: - %annotations - %+ turn notes.update - |= =note - ^- card - %+ do-link-action - `wire`[%forward %annotation (scot %p who) where] - `action:store`[%read where url.update `comment`[who note]] - == -:: -++ take-forward-sign - |= [=wire =sign:agent:gall] - ^- (quip card _state) - ~| [%unexpected-sign on=[%forward wire] -.sign] - ?> ?=(%poke-ack -.sign) - ?~ p.sign [~ state] - =/ =tank - :- %leaf - ;: weld - (trip dap.bowl) - " failed to save submission from " - (spud wire) - == - %- (slog tank u.p.sign) - [~ state] -:: -++ scry-for - |* [=mold =app-name =path] - .^ mold - %gx - (scot %p our.bowl) - app-name - (scot %da now.bowl) - (snoc `^path`path %noun) - == +++ on-agent on-agent:def +++ on-poke on-poke:def +++ on-arvo on-arvo:def +++ on-peek on-peek:def +++ on-watch on-watch:def +++ on-leave on-leave:def +++ on-fail on-fail:def -- diff --git a/pkg/arvo/app/link-proxy-hook.hoon b/pkg/arvo/app/link-proxy-hook.hoon index 98f61f6f8c..ffa822ee65 100644 --- a/pkg/arvo/app/link-proxy-hook.hoon +++ b/pkg/arvo/app/link-proxy-hook.hoon @@ -1,337 +1,41 @@ -:: link-proxy-hook: make local pages available to foreign ships +:: link-proxy-hook: no longer in use :: -:: this is a "proxy" style hook, relaying foreign subscriptions into local -:: stores if permission conditions are met. -:: the patterns herein should one day be generalized into a proxy-hook lib. -:: -:: this uses metadata-store to discover resources and their associated -:: groups. it sets the permission condition to be that a ship must be in a -:: group associated with the resource it's subscribing to. -:: we check this on-watch, but also subscribe to metadata & groups so that -:: we can kick subscriptions if needed (eg ship removed from group). -:: -:: we deduplicate incoming subscriptions on the same path, ensuring we have -:: exactly one local subscription per unique incoming subscription path. -:: this comes at the cost of assuming that the store's initial response is -:: whatever's returned by the scry at that path, but perhaps that should -:: become part of the stores standard anyway. -:: -:: when adding support for new paths, the only things you'll likely want -:: to touch are +permitted, +initial-response, & +kick-proxies. -:: -/- *link, *metadata-store, *group -/+ metadata, default-agent, verb, dbug, group-store, grpl=group, - resource, store=link-store +/+ default-agent, verb, dbug ~% %link-proxy-hook-top ..is ~ |% -+$ state-0 - $: %0 - ::TODO we use this to detect "first sub started" and "last sub left", - :: but can't we use [wex sup]:bowl for that? - active=(map path (set ship)) - == -+$ state-1 - $: %1 - active=(map path (set ship)) - == -:: +$ versioned-state - $% state-0 - state-1 + $% [%0 *] + [%1 *] + [%2 ~] == :: +$ card card:agent:gall -- :: -=| state-1 +=| [%2 ~] =* state - :: %- agent:dbug %+ verb | ^- agent:gall -=< - |_ =bowl:gall - +* this . - do ~(. +> bowl) - def ~(. (default-agent this %&) bowl) - :: - ++ on-init - ^- (quip card _this) - :_ this - ~[watch-groups:do watch-metadata:do] - :: - ++ on-save !>(state) - ++ on-load - |= old-vase=vase - ^- (quip card _this) - =/ old - !<(versioned-state old-vase) - ?- -.old - %1 [~ this(state old)] - :: - %0 - :_ this(state [%1 +.old]) - :~ [%pass /groups %agent [our.bowl %group-store] %leave ~] - watch-groups:do - == - == - - :: - ++ on-watch - |= =path - ^- (quip card _this) - :: the local ship should just use link-store directly - ::TODO do we want to allow this anyway, to avoid client-side target checks? - :: - ?< (team:title [our src]:bowl) - ?> (permitted:do src.bowl path) - =^ cards state - (start-proxy:do src.bowl path) - [cards this] - :: - ++ on-leave - |= =path - ^- (quip card _this) - =^ cards state - (stop-proxy:do src.bowl path) - [cards this] - :: - ++ on-agent - |= [=wire =sign:agent:gall] - ^- (quip card _this) - ?: ?=([%groups ~] wire) - =^ cards state - (take-groups-sign:do sign) - [cards this] - ?: ?=([%proxy ^] wire) - =^ cards state - (handle-proxy-sign t.wire sign) - [cards this] - ~| [dap.bowl %weird-wire wire] - !! - :: - ++ on-poke on-poke:def - ++ on-peek on-peek:def - ++ on-arvo on-arvo:def - ++ on-fail on-fail:def - -- -:: |_ =bowl:gall -+* md ~(. metadata bowl) - grp ~(. grpl bowl) ++* this . + def ~(. (default-agent this %&) bowl) :: -:: permissions +++ on-init on-init:def +++ on-save !>(state) +++ on-load + |= old-vase=vase + ^- (quip card _this) + :_ this + [%pass /groups %agent [our.bowl %group-store] %leave ~]~ :: -++ permitted - |= [who=ship =path] - ^- ? - :: we only expose /local-pages and /annotations, - :: to ships in the groups associated with the resource. - :: (no url-specific annotations subscriptions, either.) - :: - =/ target=(unit ^path) - ?: ?=([%local-pages ^] path) - `t.path - ?: ?=([%annotations ~ ^] path) - `t.t.path - ~ - ?~ target | - %+ lien (groups-from-resource:md %link u.target) - |= =group-path - ^- ? - (~(has in (members-from-path:grp group-path)) who) -:: -++ kick-revoked-permissions - |= [=path who=(list ship)] - ^- (list card) - %+ murn who - |= =ship - ^- (unit card) - :: no need to remove to ourselves - :: - ?: =(our.bowl ship) ~ - ?: (permitted ship path) ~ - `(kick-proxies ship path) -:: -:: metadata subscription -:: -++ watch-metadata - ^- card - [%pass /metadata %agent [our.bowl %metadata-store] %watch /app-name/link] -:: -++ take-metadata-sign - |= =sign:agent:gall - ^- (quip card _state) - ?- -.sign - %poke-ack ~|([dap.bowl %unexpected-poke-ack /metadata] !!) - %kick [[watch-metadata]~ state] - :: - %watch-ack - ?~ p.sign [~ state] - =/ =tank - :- %leaf - "{(trip dap.bowl)} failed subscribe to metadata store. very wrong!" - %- (slog tank u.p.sign) - [~ state] - :: - %fact - =* mark p.cage.sign - =* vase q.cage.sign - ?. ?=(%metadata-update mark) - ~| [dap.bowl %unexpected-mark mark] - !! - %- handle-metadata-update - !<(metadata-update vase) - == -:: -++ handle-metadata-update - |= upd=metadata-update - ^- (quip card _state) - :_ state - ?. ?=(%remove -.upd) ~ - ?> =(%link app-name.resource.upd) - :: if a group is no longer associated with a resource, - :: we need to re-check permissions for everyone in that group. - :: - %+ kick-revoked-permissions - app-path.resource.upd - %~ tap in - (members-from-path:grp group-path.upd) -:: -:: groups subscription -::TODO largely copied from link-listen-hook. maybe make a store-listener lib? -:: -++ watch-groups - ^- card - [%pass /groups %agent [our.bowl %group-store] %watch /groups] -:: -++ take-groups-sign - |= =sign:agent:gall - ^- (quip card _state) - ?- -.sign - %poke-ack ~|([dap.bowl %unexpected-poke-ack /groups] !!) - %kick [[watch-groups]~ state] - :: - %watch-ack - ?~ p.sign [~ state] - =/ =tank - :- %leaf - "{(trip dap.bowl)} failed subscribe to group store. very wrong!" - %- (slog tank u.p.sign) - [~ state] - :: - %fact - =* mark p.cage.sign - =* vase q.cage.sign - ?+ mark ~|([dap.bowl %unexpected-mark mark] !!) - %group-initial [~ state] - %group-update (handle-group-update !<(update:group-store vase)) - == - == -:: -++ handle-group-update - |= upd=update:group-store - ^- (quip card _state) - :_ state - ?. ?=(%remove-members -.upd) ~ - :: if someone was removed from a group, find all link resources associated - :: with that group, then kick their subscriptions if they're no longer - :: - %- zing - %+ turn (app-paths-from-group:md %link (en-path:resource resource.upd)) - |= =app-path - ^- (list card) - %+ kick-revoked-permissions - app-path - ~(tap in ships.upd) -:: -:: proxy subscriptions -:: -++ kick-proxies - |= [who=ship =path] - ^- card - =- [%give %kick - `who] - :~ [%local-pages path] - [%annotations %$ path] - == -:: -++ handle-proxy-sign - |= [=wire =sign:agent:gall] - ^- (quip card _state) - ?- -.sign - %poke-ack ~|([dap.bowl %unexpected-poke-ack wire] !!) - %fact [[%give %fact ~[wire] cage.sign]~ state] - %kick [[(proxy-pass-link-store wire %watch wire)]~ state] - :: - %watch-ack - ?~ p.sign [~ state] - =/ =tank - :- %leaf - "{(trip dap.bowl)} failed subscribe to link-store. very wrong!" - %- (slog tank u.p.sign) - [~ state] - == -:: -++ proxy-pass-link-store - |= [=path =task:agent:gall] - ^- card - :* %pass - [%proxy path] - %agent - [our.bowl %link-store] - task - == -:: -++ initial-response - |= =path - ^- card - =; =initial:store - [%give %fact ~ %link-initial !>(initial)] - ?+ path !! - [%local-pages ^] - [%local-pages (scry-for (map ^path pages) %link-store path)] - :: - [%annotations %$ ^] - [%annotations (scry-for (per-path-url notes) %link-store path)] - == -:: -++ start-proxy - |= [who=ship =path] - ^- (quip card _state) - :_ state(active (~(put ju active) path who)) - :_ ~ - :: if we already have a local subscription open, - :: - ?. =(~ (~(get ju active) path)) - :: gather the initial response ourselves, and send that. - :: - (initial-response path) - :: else, open a local subscription, - :: sending outward its initial response when we hear it. - :: - (proxy-pass-link-store path %watch path) -:: -++ stop-proxy - |= [who=ship =path] - ^- (quip card _state) - =. active (~(del ju active) path who) - :_ state - :: if there are still subscriptions remaining, do nothing. - :: - ?. =(~ (~(get ju active) path)) ~ - :: else, close the local subscription. - :: - [(proxy-pass-link-store path %leave ~)]~ -:: -:: helpers -:: -++ scry-for - |* [=mold =app-name =path] - .^ mold - %gx - (scot %p our.bowl) - app-name - (scot %da now.bowl) - (snoc `^path`path %noun) - == +++ 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 -- + From 5838b017f8f5cd2f72b7367c3d3c990a640c0265 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Wed, 19 Aug 2020 16:26:21 -0700 Subject: [PATCH 10/89] link: deactivated view --- pkg/arvo/app/link-view.hoon | 632 ++---------------------------------- 1 file changed, 23 insertions(+), 609 deletions(-) diff --git a/pkg/arvo/app/link-view.hoon b/pkg/arvo/app/link-view.hoon index 4e5fe6de7c..9ddb2b8811 100644 --- a/pkg/arvo/app/link-view.hoon +++ b/pkg/arvo/app/link-view.hoon @@ -1,626 +1,40 @@ -:: link-view: frontend endpoints -:: -:: endpoints, mapping onto link-store's paths. p is for page as in pagination. -:: only the /0/submissions endpoint provides updates. -:: as with link-store, urls are expected to use +wood encoding. -:: -:: /json/0/submissions initial + updates for all -:: /json/[p]/submissions/[collection] page for one collection -:: /json/[p]/discussions/[wood-url]/[collection] page for url in collection -:: /json/[n]/submission/[wood-url]/[collection] nth matching submission -:: /json/seen mark-as-read updates -:: -/- *link, view=link-view -/- *invite-store, group-store -/- listen-hook=link-listen-hook -/- group-hook, permission-hook, permission-group-hook -/- metadata-hook, contact-view -/- pull-hook, *group -/+ store=link-store, metadata, *server, default-agent, verb, dbug, grpl=group -/+ group-store, resource +:: link-view: no longer in use +/+ default-agent, verb, dbug ~% %link-view-top ..is ~ -:: -:: |% +$ versioned-state - $% state-0 - state-1 - == -+$ state-0 - $: %0 - ~ - == -:: -+$ state-1 - $: %1 - ~ + $% [%0 ~] + [%1 ~] + [%2 ~] == :: +$ card card:agent:gall -- :: -=| state-1 +=| [%2 ~] =* state - :: %+ verb | %- agent:dbug ^- agent:gall -=< - |_ =bowl:gall - +* this . - do ~(. +> bowl) - def ~(. (default-agent this %|) bowl) - :: - ++ on-init - ^- (quip card _this) - :_ this - :~ [%pass /submissions %agent [our.bowl %link-store] %watch /submissions] - [%pass /discussions %agent [our.bowl %link-store] %watch /discussions] - [%pass /seen %agent [our.bowl %link-store] %watch /seen] - :: - =+ [%invite-action !>([%create /link])] - [%pass /invitatory/create %agent [our.bowl %invite-store] %poke -] - :: - =+ /invitatory/link - [%pass - %agent [our.bowl %invite-store] %watch -] - :* %pass /srv %agent [our.bowl %file-server] - %poke %file-server-action - !>([%serve-dir /'~link' /app/landscape %.n]) - == - == - :: - ++ on-save !>(state) - ++ on-load - |= old-vase=vase - ^- (quip card _this) - =/ old !<(versioned-state old-vase) - ?- -.old - %1 [~ this] - %0 - :_ this(state [%1 ~]) - :- [%pass /connect %arvo %e %disconnect [~ /'~link']] - :~ :* %pass /srv %agent [our.bowl %file-server] - %poke %file-server-action - !>([%serve-dir /'~link' /app/landscape %.n]) - == == - == - :: - ++ on-poke - |= [=mark =vase] - ^- (quip card _this) - ?> (team:title our.bowl src.bowl) - :_ this - ?+ mark (on-poke:def mark vase) - %link-action - [(handle-action:do !<(action:store vase)) ~] - :: - %link-view-action - (handle-view-action:do !<(action:view vase)) - == - :: - ++ on-watch - |= =path - ^- (quip card _this) - ?: ?=([%json %seen ~] path) - [~ this] - ?: ?=([%tile ~] path) - :_ this - ~[give-tile-data:do] - ?. ?=([%json @ @ *] path) - (on-watch:def path) - =/ p=@ud (slav %ud i.t.path) - ?+ t.t.path (on-watch:def path) - [%submissions ~] - :_ this - (give-initial-submissions:do p ~) - :: - [%submissions ^] - :_ this - (give-initial-submissions:do p t.t.t.path) - :: - [%submission @ ^] - :_ this - (give-specific-submission:do p (break-discussion-path:store t.t.t.path)) - :: - [%discussions @ ^] - :_ this - (give-initial-discussions:do p (break-discussion-path:store t.t.t.path)) - == - :: - ++ on-agent - |= [=wire =sign:agent:gall] - ^- (quip card _this) - ?+ -.sign (on-agent:def wire sign) - %poke-ack - ?. ?=([%join-group @ @ @ @ ~] wire) - (on-agent:def wire sign) - ?^ p.sign - (on-agent:def wire sign) - =/ rid=resource - (de-path:resource t.t.wire) - =/ host=ship - (slav %p i.t.wire) - :_ this - (joined-group:do host rid) - :: - %kick - :_ this - =/ app=term - ?: ?=([%invites *] wire) - %invite-store - %link-store - [%pass wire %agent [our.bowl app] %watch wire]~ - :: - %fact - =* mark p.cage.sign - =* vase q.cage.sign - ?+ mark (on-agent:def wire sign) - %invite-update [(handle-invite-update:do !<(invite-update vase)) this] - %link-initial [~ this] - :: - %link-update - :_ this - :- (send-update:do !<(update:store vase)) - ?: =(/discussions wire) ~ - ~[give-tile-data:do] - == - == - :: - ++ on-arvo - |= [=wire =sign-arvo] - ^- (quip card _this) - ?. ?=([%e %bound *] sign-arvo) - (on-arvo:def wire sign-arvo) - ~? !accepted.sign-arvo - [dap.bowl "bind rejected!" binding.sign-arvo] - [~ this] - :: - ++ on-peek on-peek:def - ++ on-leave on-leave:def - ++ on-fail on-fail:def - -- -:: -~% %link-view-logic ..card ~ |_ =bowl:gall -+* md ~(. metadata bowl) - grp ~(. grpl bowl) ++* this . + def ~(. (default-agent this %|) bowl) :: -++ page-size 25 -++ get-paginated - |* [page=(unit @ud) list=(list)] - ^- [total=@ud pages=@ud page=_list] - =/ l=@ud (lent list) - :+ l - %+ add (div l page-size) - (min 1 (mod l page-size)) - ?~ page list - %+ swag - [(mul u.page page-size) page-size] - list +++ on-init [~ this] +++ on-save !>(state) +++ on-load + |= old-vase=vase + ^- (quip card _this) + :_ this(state [%2 ~]) + :: TODO: leave all subscriptions + [%pass /connect %arvo %e %disconnect [~ /'~link']]~ :: -++ page-to-json - =, enjs:format - |* $: page-number=@ud - [total-items=@ud total-pages=@ud page=(list)] - item-to-json=$-(* json) - == - ^- json - %- pairs - :~ 'totalItems'^(numb total-items) - 'totalPages'^(numb total-pages) - 'pageNumber'^(numb page-number) - 'page'^a+(turn page item-to-json) - == -++ do-poke - |= [app=term =mark =vase] - ^- card - [%pass /create/[app]/[mark] %agent [our.bowl app] %poke mark vase] -:: -++ joined-group - |= [host=ship rid=resource] - ^- (list card) - =/ =path - (en-path:resource rid) - :~ - :: sync the group - :: - %^ do-poke %group-pull-hook - %pull-hook-action - !> ^- action:pull-hook - [%add host rid] - :: - :: sync the metadata - :: - %^ do-poke %metadata-hook - %metadata-hook-action - !> ^- metadata-hook-action:metadata-hook - [%add-synced host path] - :: - :: sync the collection - :: - %^ do-poke %link-listen-hook - %link-listen-action - !> ^- action:listen-hook - [%watch ~[name.rid]] - == -:: -++ handle-invite-update - |= upd=invite-update - ^- (list card) - ?. ?=(%accepted -.upd) ~ - ?. =(/link path.upd) ~ - =/ rid=resource - (de-path:resource path.invite.upd) - :~ :: add self - :* %pass - [%join-group (scot %p ship.invite.upd) path.invite.upd] - %agent [entity.rid %group-push-hook] - %poke %group-update - !> ^- action:group-store - [%add-members rid (sy our.bowl ~)] - == == -:: -++ handle-action - |= =action:store - ^- card - [%pass /action %agent [our.bowl %link-store] %poke %link-action !>(action)] -:: -++ handle-view-action - |= act=action:view - ^- (list card) - ?- -.act - %create (handle-create +.act) - %delete (handle-delete +.act) - %invite (handle-invite +.act) - == -:: -++ handle-create - |= [=path title=@t description=@t members=create-members:view real-group=?] - ^- (list card) - =/ group-path=^path - ?- -.members - %group path.members - :: - %ships - [%ship (scot %p our.bowl) path] - == - =; group-setup=(list card) - %+ weld group-setup - :~ :: add collection to metadata-store - :: - %^ do-poke %metadata-hook - %metadata-action - !> ^- metadata-action:md - :^ %add group-path - [%link path] - %* . *metadata:md - title title - description description - date-created now.bowl - creator our.bowl - == - :: - :: expose the metadata - :: - %^ do-poke %metadata-hook - %metadata-hook-action - !> ^- metadata-hook-action:metadata-hook - [%add-owned group-path] - :: - :: watch the collection ourselves - :: - %^ do-poke %link-listen-hook - %link-listen-action - !> ^- action:listen-hook - [%watch path] - == - ?: ?=(%group -.members) ~ - :: if the group is "real", make contact-view do the heavy lifting - =/ rid=resource - (de-path:resource group-path) - ?: real-group - :- %^ do-poke %contact-view - %contact-view-action - !> ^- contact-view-action:contact-view - [%groupify rid title description] - %+ turn ~(tap in ships.members) - |= =ship - ^- card - %^ do-poke %invite-hook - %invite-action - !> ^- invite-action - :^ %invite /link - (sham group-path eny.bowl) - :* our.bowl - %group-hook - group-path - ship - title - == - :: for "unmanaged" groups, do it ourselves - :: - =/ =policy - [%invite ships.members] - :* :: create the new group - :: - %^ do-poke %group-store - %group-action - !> ^- action:group-store - [%add-group rid policy %.y] - :: - :: send invites - :: - %+ turn ~(tap in ships.members) - |= =ship - ^- card - %^ do-poke %invite-hook - %invite-action - !> ^- invite-action - :^ %invite /link - (sham group-path eny.bowl) - :* our.bowl - %group-hook - group-path - ship - title - == - == -:: -++ handle-delete - |= =path - ^- (list card) - =/ groups=(list ^path) - (groups-from-resource:md [%link path]) - %- zing - %+ turn groups - |= =group=^path - =/ rid=resource - (de-path:resource group-path) - %+ snoc - ^- (list card) - :: if it's a real group, we can't/shouldn't unsync it. this leaves us with - :: no way to stop propagation of collection deletion. - :: - ?. ?=([%'~' ^] group-path) ~ - :: if it's an unmanaged group, we just stop syncing the group & metadata, - :: and clean up the group (after un-hooking it, to not push deletion). - :: - :~ %^ do-poke %group-hook - %group-hook-action - !> ^- action:group-hook - [%remove rid] - :: - %^ do-poke %metadata-hook - %metadata-hook-action - !> ^- metadata-hook-action:metadata-hook - [%remove group-path] - :: - %^ do-poke %group-store - %group-action - !> ^- action:group-store - [%remove-group rid ~] - == - :: remove collection from metadata-store - :: - %^ do-poke %metadata-store - %metadata-action - !> ^- metadata-action:md - [%remove group-path [%link path]] -:: -++ handle-invite - |= [=path ships=(set ship)] - ^- (list card) - %- zing - %+ turn (groups-from-resource:md %link path) - |= =group=^path - ^- (list card) - =/ rid=resource - (de-path:resource group-path) - =/ =group - (need (scry-group:grp rid)) - %- zing - :~ - ?. ?=(%invite -.policy.group) - ~ - :~ %^ do-poke %group-store - %group-action - !> ^- action:group-store - [%change-policy rid %invite %add-invites ships] - == - :: - %+ turn ~(tap in ships) - |= =ship - ^- card - %^ do-poke %invite-hook - %invite-action - !> ^- invite-action - :^ %invite /link - (sham group-path eny.bowl) - :* our.bowl - %group-pull-hook - group-path - ship - (rsh 3 1 (spat path)) - == - == -:: +give-tile-data: total unread count as json object -:: -::NOTE the full recalc of totals here probably isn't the end of the world. -:: but in case it is, well, here it is. -:: -++ give-tile-data - ^- card - =; =json - [%give %fact ~[/tile] %json !>(json)] - %+ frond:enjs:format 'unseen' - %- numb:enjs:format - %- %~ rep in - (scry-for (jug path url) /unseen) - |= [[=path unseen=(set url)] total=@ud] - %+ add total - ~(wyt in unseen) -:: -:: +give-initial-submissions: page of submissions on path -:: -:: for the / path, give page for every path -:: -:: result is in the shape of: { -:: "/some/path": { -:: totalItems: 1, -:: totalPages: 1, -:: pageNumber: 0, -:: page: [ -:: { commentCount: 1, ...restOfTheSubmission } -:: ] -:: }, -:: "/maybe/more": { etc } -:: } -:: -++ give-initial-submissions - ~/ %link-view-initial-submissions - |= [p=@ud =requested=path] - ^- (list card) - :_ :: only keep the base case alive (for updates), kick all others - :: - ?: &(=(0 p) ?=(~ requested-path)) ~ - [%give %kick ~ ~]~ - =; =json - [%give %fact ~ %json !>(json)] - %+ frond:enjs:format 'link-update' - %+ frond:enjs:format 'initial-submissions' - %- pairs:enjs:format - %+ turn - %~ tap by - %+ scry-for (map path submissions) - [%submissions requested-path] - |= [=path =submissions] - ^- [@t json] - :- (spat path) - =; =json - :: add unseen count - :: - ?> ?=(%o -.json) - :- %o - %+ ~(put by p.json) 'unseenCount' - %- numb:enjs:format - %~ wyt in - %+ scry-for (set url) - [%unseen path] - ?: &(=(0 p) ?=(~ requested-path)) - :: for a broad-scope initial result, only give total counts - :: - =, enjs:format - %- pairs - =+ l=(lent submissions) - :~ 'totalItems'^(numb l) - 'totalPages'^(numb (div l page-size)) - == - %^ page-to-json p - %+ get-paginated `p - submissions - |= =submission - ^- json - =/ =json (submission:enjs:store submission) - ?> ?=([%o *] json) - :: add in seen status - :: - =. p.json - %+ ~(put by p.json) 'seen' - :- %b - %+ scry-for ? - [%seen (build-discussion-path:store path url.submission)] - :: add in comment count - :: - =; comment-count=@ud - :- %o - %+ ~(put by p.json) 'commentCount' - (numb:enjs:format comment-count) - %- lent - ~| [path url.submission] - ^- comments - =- (~(got by (~(got by -) path)) url.submission) - %+ scry-for (per-path-url comments) - :- %discussions - (build-discussion-path:store path url.submission) -:: -++ give-specific-submission - |= [n=@ud =path =url] - :_ [%give %kick ~ ~]~ - =; =json - [%give %fact ~ %json !>(json)] - %+ frond:enjs:format 'link-update' - %+ frond:enjs:format 'submission' - ^- json - =; sub=(unit submission) - ?~ sub ~ - (submission:enjs:store u.sub) - =/ =submissions - =- (~(got by -) path) - %+ scry-for (map ^path submissions) - [%submissions path] - |- - ?~ submissions ~ - =* sub i.submissions - ?. =(url.sub url) - $(submissions t.submissions) - ?: =(0 n) `sub - $(n (dec n), submissions t.submissions) -:: -++ give-initial-discussions - |= [p=@ud =path =url] - ^- (list card) - :_ ?: =(0 p) ~ - [%give %kick ~ ~]~ - =; =json - [%give %fact ~ %json !>(json)] - %+ frond:enjs:format 'link-update' - %+ frond:enjs:format 'initial-discussions' - %^ page-to-json p - %+ get-paginated `p - =- (~(got by (~(got by -) path)) url) - %+ scry-for (per-path-url comments) - [%discussions (build-discussion-path:store path url)] - comment:enjs:store -:: -++ send-update - |= =update:store - ^- card - ?+ -.update ~|([dap.bowl %unexpected-update -.update] !!) - %submissions - %+ give-json - %+ frond:enjs:format 'link-update' - (update:enjs:store update) - :~ /json/0/submissions - (weld /json/0/submissions path.update) - == - :: - %discussions - %+ give-json - %+ frond:enjs:format 'link-update' - (update:enjs:store update) - :_ ~ - %+ weld /json/0/discussions - (build-discussion-path:store [path url]:update) - :: - %observation - %+ give-json - %+ frond:enjs:format 'link-update' - (update:enjs:store update) - ~[/json/seen] - == -:: -++ give-json - |= [=json paths=(list path)] - ^- card - [%give %fact paths %json !>(json)] -:: -++ scry-for - |* [=mold =path] - .^ mold - %gx - (scot %p our.bowl) - %link-store - (scot %da now.bowl) - (snoc `^path`path %noun) - == +++ 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 -- From 1a419895a32d596313b79ed8efcf46ede077ab0b Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Wed, 19 Aug 2020 16:27:08 -0700 Subject: [PATCH 11/89] link-hooks: left TODO comments --- pkg/arvo/app/link-listen-hook.hoon | 1 + pkg/arvo/app/link-proxy-hook.hoon | 1 + 2 files changed, 2 insertions(+) diff --git a/pkg/arvo/app/link-listen-hook.hoon b/pkg/arvo/app/link-listen-hook.hoon index feb5ffb1e3..5c1fade7cf 100644 --- a/pkg/arvo/app/link-listen-hook.hoon +++ b/pkg/arvo/app/link-listen-hook.hoon @@ -29,6 +29,7 @@ ++ on-load |= =vase ^- (quip card _this) + :: TODO: get rid of all subscriptions in bowl :_ this [%pass /groups %agent [our.bowl %group-store] %leave ~]~ :: diff --git a/pkg/arvo/app/link-proxy-hook.hoon b/pkg/arvo/app/link-proxy-hook.hoon index ffa822ee65..0eab5a3923 100644 --- a/pkg/arvo/app/link-proxy-hook.hoon +++ b/pkg/arvo/app/link-proxy-hook.hoon @@ -27,6 +27,7 @@ ++ on-load |= old-vase=vase ^- (quip card _this) + :: TODO: get rid of all subscriptions in bowl :_ this [%pass /groups %agent [our.bowl %group-store] %leave ~]~ :: From c383d31c24f75a00fd0acb50fb8d4dfde37a1450 Mon Sep 17 00:00:00 2001 From: Tyler Brown Cifu Shuster Date: Fri, 21 Aug 2020 16:14:10 -0700 Subject: [PATCH 12/89] chat: updated Leave Group copy --- .../apps/chat/components/lib/delete-button.js | 97 ++++++++++--------- .../views/apps/chat/components/settings.js | 2 + 2 files changed, 52 insertions(+), 47 deletions(-) diff --git a/pkg/interface/src/views/apps/chat/components/lib/delete-button.js b/pkg/interface/src/views/apps/chat/components/lib/delete-button.js index cb7b75ae75..1abb19f7e9 100644 --- a/pkg/interface/src/views/apps/chat/components/lib/delete-button.js +++ b/pkg/interface/src/views/apps/chat/components/lib/delete-button.js @@ -1,51 +1,54 @@ -import React, { Component } from 'react'; +import React, { memo } from 'react'; +export const DeleteButton = memo(({ isOwner, station, changeLoading, association, contacts, api }) => { + const leaveButtonClasses = (!isOwner) ? 'pointer' : 'c-default'; + const deleteButtonClasses = (isOwner) ? + 'b--red2 red2 pointer bg-gray0-d' : + 'b--gray3 gray3 bg-gray0-d c-default'; -export const DeleteButton = (props) => { - const { isOwner, station, changeLoading, api } = props; - const leaveButtonClasses = (!isOwner) ? 'pointer' : 'c-default'; - const deleteButtonClasses = (isOwner) ? - 'b--red2 red2 pointer bg-gray0-d' : - 'b--gray3 gray3 bg-gray0-d c-default'; - - const deleteChat = () => { - changeLoading( - true, - true, - isOwner ? 'Deleting chat...' : 'Leaving chat...', - () => { - api.chat.delete(station); - } - ); - }; - - return ( -
-
-

Leave Chat

-

- Remove this chat from your chat list.{' '} - You will need to request for access again. -

- - Leave this chat - -
-
-

Delete Chat

-

- Permanently delete this chat.{' '} - All current members will no longer see this chat. -

- Delete this chat -
-
+ const deleteChat = () => { + changeLoading( + true, + true, + isOwner ? 'Deleting chat...' : 'Leaving chat...', + () => { + api.chat.delete(station); + } ); -}; + }; + const groupPath = association['group-path']; + const unmanagedVillage = !contacts[groupPath]; + + return ( +
+
+

Leave Chat

+

+ Remove this chat from your chat list.{' '} + {unmanagedVillage + ? 'You will need to request for access again' + : 'You will need to join again from the group page.' + } +

+ + Leave this chat + +
+
+

Delete Chat

+

+ Permanently delete this chat.{' '} + All current members will no longer see this chat. +

+ Delete this chat +
+
+ ); +}) \ No newline at end of file diff --git a/pkg/interface/src/views/apps/chat/components/settings.js b/pkg/interface/src/views/apps/chat/components/settings.js index 9b1b339367..6250ef7861 100644 --- a/pkg/interface/src/views/apps/chat/components/settings.js +++ b/pkg/interface/src/views/apps/chat/components/settings.js @@ -89,6 +89,8 @@ export class SettingsScreen extends Component { isOwner={isOwner} changeLoading={this.changeLoading} station={station} + association={association} + contacts={contacts} api={api} /> Date: Wed, 26 Aug 2020 18:29:19 -0400 Subject: [PATCH 13/89] arvo/README: update maintainers --- pkg/arvo/README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/arvo/README.md b/pkg/arvo/README.md index 8f1d068700..4331571774 100644 --- a/pkg/arvo/README.md +++ b/pkg/arvo/README.md @@ -41,20 +41,20 @@ Most parts of Arvo have dedicated maintainers. * `/sys/hoon`: @pilfer-pandex (~pilfer-pandex) * `/sys/zuse`: @pilfer-pandex (~pilfer-pandex) -* `/sys/arvo`: @jtobin (~nidsut-tomdun) -* `/sys/vane/ames`: @belisarius222 (~rovnys-ricfer) & @joemfb (~master-morzod) +* `/sys/arvo`: @joemfb (~master-morzod) +* `/sys/vane/ames`: @belisarius222 (~rovnys-ricfer) & @philipcmonk (~wicdev-wisryt) * `/sys/vane/behn`: @belisarius222 (~rovnys-ricfer) -* `/sys/vane/clay`: @philipcmonk (~wicdev-wisryt) -* `/sys/vane/dill`: @bernardodelaplaz (~rigdyn-sondur) +* `/sys/vane/clay`: @philipcmonk (~wicdev-wisryt) & @belisarius222 (~rovnys-ricfer) +* `/sys/vane/dill`: @joemfb (~master-morzod) * `/sys/vane/eyre`: @eglaysher (~littel-ponnys) -* `/sys/vane/ford`: @belisarius222 (~rovnys-ricfer) & @eglaysher (~littel-ponnys) -* `/sys/vane/gall`: @jtobin (~nidsut-tomdun) -* `/sys/vane/jael`: @fang- (~palfun-foslup) & @joemfb (~master-morzod) +* `/sys/vane/gall`: @philipcmonk (~wicdev-wisryt) +* `/sys/vane/jael`: @fang- (~palfun-foslup) & @philipcmonk (~wicdev-wisryt) * `/app/acme`: @joemfb (~master-morzod) * `/app/dns`: @joemfb (~master-morzod) -* `/app/hall`: @fang- (~palfun-foslup) -* `/app/talk`: @fang- (~palfun-foslup) * `/app/aqua`: @philipcmonk (~wicdev-wisryt) +* `/app/hood`: @belisarius222 (~rovnys-ricfer) +* `/lib/hood/drum`: @philipcmonk (~wicdev-wisryt) +* `/lib/hood/kiln`: @philipcmonk (~wicdev-wisryt) * `/lib/test`: @eglaysher (~littel-ponnys) ## Contributing From bafe213d458566b0910bdb0e993fab6e73591df4 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 1 Sep 2020 01:13:33 +1000 Subject: [PATCH 14/89] publish: check roles correctly for tags --- .../publish/components/lib/Subscribers.tsx | 25 +++++++++++-------- pkg/interface/src/views/components/Group.tsx | 4 +-- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/pkg/interface/src/views/apps/publish/components/lib/Subscribers.tsx b/pkg/interface/src/views/apps/publish/components/lib/Subscribers.tsx index 4ff86c82bf..069e851f33 100644 --- a/pkg/interface/src/views/apps/publish/components/lib/Subscribers.tsx +++ b/pkg/interface/src/views/apps/publish/components/lib/Subscribers.tsx @@ -1,11 +1,12 @@ import React, { Component } from 'react'; import { GroupView } from '~/views/components/Group'; -import { resourceFromPath } from '~/logic/lib/group'; +import { resourceFromPath, roleForShip } from '~/logic/lib/group'; import {Notebook} from '~/types/publish-update'; import GlobalApi from '~/logic/api/global'; import {Groups} from '~/types/group-update'; import {Associations} from '~/types/metadata-update'; import {Rolodex} from '~/types/contact-update'; +import {Box, Button} from '@tlon/indigo-react'; interface SubscribersProps { notebook: Notebook; @@ -71,16 +72,20 @@ export class Subscribers extends Component { addDesc: 'Allow user to write to this notebook' }, ]; - + + if(!group) { + return null; + } + + const role = roleForShip(group, window.ship) return ( -
- + + { role === 'admin' && ( + + )} { associations={this.props.associations} api={this.props.api} /> -
+ ); } } diff --git a/pkg/interface/src/views/components/Group.tsx b/pkg/interface/src/views/components/Group.tsx index e364c0aeb4..0b8dc9bf31 100644 --- a/pkg/interface/src/views/components/Group.tsx +++ b/pkg/interface/src/views/components/Group.tsx @@ -143,10 +143,8 @@ export class GroupView extends Component< } isAdmin(): boolean { - const us = `~${window.ship}`; const role = roleForShip(this.props.group, window.ship); - const resource = resourceFromPath(this.props.resourcePath); - return resource.ship == us || role === 'admin'; + return role === 'admin'; } optionsForShip(ship: Patp, missing: GroupViewAppTag[]) { From 149ffd32e64569cfa63a13fb15b96bbe03ff29a2 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 1 Sep 2020 01:25:51 +1000 Subject: [PATCH 15/89] publish: make input form expand to screen --- .../src/views/apps/publish/components/lib/MarkdownField.tsx | 2 +- .../src/views/apps/publish/components/lib/NoteForm.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/interface/src/views/apps/publish/components/lib/MarkdownField.tsx b/pkg/interface/src/views/apps/publish/components/lib/MarkdownField.tsx index efd4f0e475..b60af6a5cf 100644 --- a/pkg/interface/src/views/apps/publish/components/lib/MarkdownField.tsx +++ b/pkg/interface/src/views/apps/publish/components/lib/MarkdownField.tsx @@ -12,7 +12,7 @@ export const MarkdownField = ({ id, ...rest }: { id: string; } & Parameters + setTouched(true)} onBlur={() => setTouched(false)} diff --git a/pkg/interface/src/views/apps/publish/components/lib/NoteForm.tsx b/pkg/interface/src/views/apps/publish/components/lib/NoteForm.tsx index cc83d248d9..e4cc1f8ae6 100644 --- a/pkg/interface/src/views/apps/publish/components/lib/NoteForm.tsx +++ b/pkg/interface/src/views/apps/publish/components/lib/NoteForm.tsx @@ -31,10 +31,11 @@ export function PostForm(props: PostFormProps) { return ( Date: Mon, 31 Aug 2020 21:34:15 -0400 Subject: [PATCH 16/89] meta: add issue links to landscape, urbit-dev --- .github/ISSUE_TEMPLATE/config.yml | 8 ++++++++ .github/ISSUE_TEMPLATE/os1-bug-report.md | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000..63b3ea5fe0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: true +contact_links: + - name: Landscape feature request + url: https://github.com/urbit/landscape/issues/new?assignees=&labels=feature+request&template=feature_request.md&title= + about: Landscape is comprised of Tlon's user applications and client for Urbit. Submit Landscape feature requests here. + - name: urbit-dev mailing list + url: https://groups.google.com/a/urbit.org/g/dev + about: Developer questions and discussions also take place on the urbit-dev mailing list. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/os1-bug-report.md b/.github/ISSUE_TEMPLATE/os1-bug-report.md index 974acf0453..b6800a7a7f 100644 --- a/.github/ISSUE_TEMPLATE/os1-bug-report.md +++ b/.github/ISSUE_TEMPLATE/os1-bug-report.md @@ -1,6 +1,6 @@ --- -name: OS1 Bug report -about: 'Use this template to file a bug for any OS1 app: Chat, Publish, Links, Groups, +name: Landscape bug report +about: 'Use this template to file a bug for any Landscape app: Chat, Publish, Links, Groups, Weather or Clock' title: '' labels: landscape From 748a03bbae4b04fc4fae404538205573f10bc9ad Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Mon, 31 Aug 2020 21:35:04 -0400 Subject: [PATCH 17/89] README: general legibility changes Describes what's literally in this repository. --- README.md | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index c5018a871e..914815947c 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,38 @@ # Urbit -A personal server operating function. +[Urbit](https://urbit.org) is a personal server stack built from scratch. It +has an identity layer (Azimuth), virtual machine (Vere), and operating system +(Arvo). -> The Urbit address space, Azimuth, is now live on the Ethereum blockchain. You -> can find it at [`0x223c067f8cf28ae173ee5cafea60ca44c335fecb`][azim] or -> [`azimuth.eth`][aens]. Owners of Azimuth points (galaxies, stars, or planets) -> can view or manage them using [Bridge][brid], and can also use them to boot -> [Arvo][arvo], the Urbit OS. +A running Urbit "ship" is designed to operate with other ships peer-to-peer. +Urbit is a general-purpose, peer-to-peer computer and network. + +This repository contains: + +- The [Arvo OS][arvo] +- [herb][herb], a tool for Unix control of an Urbit ship +- Source code for [Landscape's web interface][land] +- Source code for the [vere][vere] virtual machine. + +For more on the identity layer, see [Azimuth][azim]. To manage your Urbit +identity, use [Bridge][brid]. -[azim]: https://etherscan.io/address/0x223c067f8cf28ae173ee5cafea60ca44c335fecb -[aens]: https://etherscan.io/address/azimuth.eth -[brid]: https://github.com/urbit/bridge [arvo]: https://github.com/urbit/urbit/tree/master/pkg/arvo +[azim]: https://github.com/urbit/azimuth +[brid]: https://github.com/urbit/bridge +[herb]: https://github.com/urbit/urbit/tree/master/pkg/herb +[land]: https://github.com/urbit/urbit/tree/master/pkg/interface +[vere]: https://github.com/urbit/urbit/tree/master/pkg/urbit ## Install To install and run Urbit, please follow the instructions at -[urbit.org/docs/getting-started/][start]. You'll be on the live network in a +[urbit.org/using/install][start]. You'll be on the live network in a few minutes. If you're interested in Urbit development, keep reading. -[start]: https://urbit.org/docs/getting-started/ +[start]: https://urbit.org/using/install/ ## Development @@ -38,7 +49,7 @@ The Makefile in the project's root directory contains useful phony targets for building, installing, testing, and so on. You can use it to avoid dealing with Nix explicitly. -To build Urbit, for example, use: +To build the Urbit virtual machine binary, for example, use: ``` make build @@ -68,12 +79,10 @@ Contributions of any form are more than welcome! Please take a look at our [contributing guidelines][cont] for details on our git practices, coding styles, how we manage issues, and so on. -You might also be interested in: +For instructions on contributing to Landscape, see [its][lcont] guidelines. -- joining the [urbit-dev][list] mailing list. -- [applying to Hoon School][mail], a course we run to teach the Hoon - programming language and Urbit application development. +You might also be interested in joining the [urbit-dev][list] mailing list. [list]: https://groups.google.com/a/urbit.org/forum/#!forum/dev -[mail]: mailto:support@urbit.org [cont]: https://github.com/urbit/urbit/blob/master/CONTRIBUTING.md +[lcont]: https://github.com/urbit/urbit/blob/master/pkg/interface/CONTRIBUTING.md \ No newline at end of file From 9b2f0b0e122ebf13957b69e7fd34ba6a9cec571d Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Mon, 31 Aug 2020 21:35:52 -0400 Subject: [PATCH 18/89] CONTRIBUTING: add link to maintainers in pkg/arvo Also removes a blurb about accepting emailed patches; this has never happened in practice, and we don't supply maintainers' emails. Sticking to what we know we support is best. --- CONTRIBUTING.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1a1b08a2d7..b64ef9c03f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,12 +2,14 @@ Thank you for your interest in contributing to Urbit. -See [urbit.org/docs/getting-started][start] for basic orientation and usage +See [urbit.org/using/install][start] for basic orientation and usage instructions. You may also want to subscribe to [urbit-dev][list], the Urbit development mailing list. For specific information on contributing to the Urbit interface, see its [contribution guidelines][interface]. -[start]: https://urbit.org/docs/getting-started/#arvo +For information on Arvo's maintainers, see [pkg/arvo][main]. + +[start]: https://urbit.org/using/install [interface]: /pkg/interface/CONTRIBUTING.md ## Fake ships @@ -45,11 +47,10 @@ The canonical source tree is the `master` branch of `master` when commencing new work; similarly, when we pull in your contribution, we'll do so by merging it to `master`. -Since we use GitHub, it's helpful (though not required) to contribute via a -GitHub pull request. You can also post patches to the [mailing list][list], -email them to maintainers, or request a maintainer pull from your tree directly --- but note that some maintainers will be more receptive to these methods than -others. +Since we use GitHub, we request you contribute via a GitHub pull request. Tag +the [maintainer][main] for the component. If you have a question for the +maintainer, you can direct message them from your Urbit ship using that +information. When contributing changes, via whatever means, make sure you describe them appropriately. You should attach a reasonably high-level summary of what the @@ -58,8 +59,8 @@ exist, e.g. a GitHub issue, a mailing list discussion, a UP, etc. [Here][jbpr] is a good example of a pull request with a useful, concise description. If your changes replace significant extant functionality, be sure to compare -them with the thing you're replacing. You may also want to cc maintainers, -reviewers, or other parties who might have a particular interest in what you're +them with the thing you're replacing. You may also want to cc reviewers, +or other parties who might have a particular interest in what you're contributing. [jbpr]: https://github.com/urbit/urbit/pull/1782 @@ -283,3 +284,4 @@ Questions or other communications about contributing to Urbit can go to [reba]: https://git-rebase.io/ [issu]: https://github.com/urbit/urbit/issues [hoon]: https://urbit.org/docs/learn/hoon/style/ +[main]: https://github.com/urbit/urbit/tree/master/pkg/arvo#maintainers \ No newline at end of file From a8cc26892b06814e5e638240ae8f8ef8a2e4fdf8 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Mon, 31 Aug 2020 21:41:12 -0400 Subject: [PATCH 19/89] interface/README: add README --- pkg/interface/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 pkg/interface/README.md diff --git a/pkg/interface/README.md b/pkg/interface/README.md new file mode 100644 index 0000000000..1af93b2b4f --- /dev/null +++ b/pkg/interface/README.md @@ -0,0 +1,17 @@ +## interface + +Landscape is Tlon's suite of userspace applications (and web interface), +currently bundled as part of Arvo. + +This directory comprises the source code for the web interface. For code related +to the Gall agents that make up the Landscape suite in Arvo, see +[pkg/arvo][arvo]. + +### Contributions and feature requests + +For information on how to contribute, see [CONTRIBUTING][cont]. To submit +a feature request, submit to the product board at [urbit/landscape][land]. + +[arvo]: https://github.com/urbit/urbit/tree/master/pkg/arvo +[cont]: https://github.com/urbit/urbit/blob/master/pkg/interface/CONTRIBUTING.md +[land]: https://github.com/urbit/landscape/issues/new?assignees=&labels=feature+request&template=feature_request.md&title= \ No newline at end of file From ef3b9282c2db0e25c72ad93ea4c42e2e8917e777 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Mon, 31 Aug 2020 21:54:39 -0400 Subject: [PATCH 20/89] various: add [landscape] marker to apps in arvo --- pkg/arvo/app/chat-hook.hoon | 4 ++-- pkg/arvo/app/chat-store.hoon | 4 +++- pkg/arvo/app/chat-view.hoon | 10 ++++++---- pkg/arvo/app/clock.hoon | 4 +++- pkg/arvo/app/contact-hook.hoon | 15 ++++++++------- pkg/arvo/app/contact-store.hoon | 6 ++++-- pkg/arvo/app/contact-view.hoon | 4 +++- pkg/arvo/app/file-server.hoon | 8 ++++++-- pkg/arvo/app/glob.hoon | 4 ++++ pkg/arvo/app/graph-store.hoon | 9 ++++++--- pkg/arvo/app/group-hook.hoon | 6 ++++-- pkg/arvo/app/group-pull-hook.hoon | 3 ++- pkg/arvo/app/group-push-hook.hoon | 3 ++- pkg/arvo/app/group-store.hoon | 14 ++++++++------ pkg/arvo/app/invite-hook.hoon | 4 +++- pkg/arvo/app/invite-store.hoon | 1 + pkg/arvo/app/invite-view.hoon | 4 ++++ pkg/arvo/app/launch.hoon | 4 ++++ pkg/arvo/app/link-listen-hook.hoon | 6 ++++-- pkg/arvo/app/link-proxy-hook.hoon | 4 +++- pkg/arvo/app/link-store.hoon | 4 +++- pkg/arvo/app/link-view.hoon | 4 +++- pkg/arvo/app/metadata-hook.hoon | 6 ++++-- pkg/arvo/app/metadata-store.hoon | 4 +++- pkg/arvo/app/permission-group-hook.hoon | 4 +++- pkg/arvo/app/permission-hook.hoon | 4 +++- pkg/arvo/app/permission-store.hoon | 4 +++- pkg/arvo/app/pool-group-hook.hoon | 4 +++- pkg/arvo/app/publish.hoon | 4 ++++ pkg/arvo/app/s3-store.hoon | 4 ++++ pkg/arvo/app/soto.hoon | 3 ++- pkg/arvo/app/weather.hoon | 4 ++++ 32 files changed, 119 insertions(+), 47 deletions(-) diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index fc8d546ec8..e6aa7e2e5e 100644 --- a/pkg/arvo/app/chat-hook.hoon +++ b/pkg/arvo/app/chat-hook.hoon @@ -1,4 +1,4 @@ -:: chat-hook: +:: chat-hook [landscape]: :: mirror chat data from foreign to local based on read permissions :: allow sending chat messages to foreign paths based on write perms :: @@ -114,7 +114,7 @@ i.syncs ?> ?=(^ pax) ?. =('~' i.pax) - $(syncs t.syncs) + $(syncs t.syncs) =/ new-path=path t.pax =. synced.old diff --git a/pkg/arvo/app/chat-store.hoon b/pkg/arvo/app/chat-store.hoon index 3004a1c5ff..5118babbcc 100644 --- a/pkg/arvo/app/chat-store.hoon +++ b/pkg/arvo/app/chat-store.hoon @@ -1,4 +1,6 @@ -:: chat-store: data store that holds linear sequences of chat messages +:: chat-store [landscape]: +:: +:: data store that holds linear sequences of chat messages :: /+ store=chat-store, default-agent, verb, dbug, group-store ~% %chat-store-top ..is ~ diff --git a/pkg/arvo/app/chat-view.hoon b/pkg/arvo/app/chat-view.hoon index 15b7bdf403..054c702403 100644 --- a/pkg/arvo/app/chat-view.hoon +++ b/pkg/arvo/app/chat-view.hoon @@ -1,4 +1,6 @@ -:: chat-view: sets up chat JS client, paginates data, and combines commands +:: chat-view [landscape]: +:: +:: sets up chat JS client, paginates data, and combines commands :: into semantic actions for the UI :: /- *permission-store, @@ -157,7 +159,7 @@ (on-arvo:def wire sign-arvo) :: ++ on-save !>(state) - ++ on-load + ++ on-load |= old-vase=vase ^- (quip card _this) =/ old ((soft state-0) q.old-vase) @@ -212,8 +214,8 @@ ?- -.act %create ?> ?=(^ app-path.act) - ?> ?| =(+:group-path.act app-path.act) - =(~(tap in members.act) ~) + ?> ?| =(+:group-path.act app-path.act) + =(~(tap in members.act) ~) == ?^ (chat-scry app-path.act) ~& %chat-already-exists diff --git a/pkg/arvo/app/clock.hoon b/pkg/arvo/app/clock.hoon index 74af060986..c4db5f62de 100644 --- a/pkg/arvo/app/clock.hoon +++ b/pkg/arvo/app/clock.hoon @@ -1,4 +1,6 @@ -:: clock: deprecated, should be removed +:: clock [landscape]: +:: +:: deprecated, should be removed :: /+ *server, default-agent, verb, dbug =, format diff --git a/pkg/arvo/app/contact-hook.hoon b/pkg/arvo/app/contact-hook.hoon index acb3b95724..4bc66de485 100644 --- a/pkg/arvo/app/contact-hook.hoon +++ b/pkg/arvo/app/contact-hook.hoon @@ -1,4 +1,5 @@ -:: contact-hook: +:: contact-hook [landscape] +:: :: /- group-hook, *contact-hook, @@ -54,7 +55,7 @@ =/ old !<(versioned-state old-vase) =| cards=(list card) |^ - |- ^- (quip card _this) + |- ^- (quip card _this) ?: ?=(%3 -.old) [cards this(state old)] ?: ?=(%2 -.old) @@ -80,7 +81,7 @@ %_ $ -.old %2 :: - synced.old + synced.old %- malt %+ turn ~(tap by synced.old) @@ -126,7 +127,7 @@ %json (poke-json:cc !<(json vase)) :: - %contact-action + %contact-action (poke-contact-action:cc !<(contact-action vase)) :: %contact-hook-action @@ -149,7 +150,7 @@ %kick [(kick:cc wire) this] %watch-ack =^ cards state - (watch-ack:cc wire p.sign) + (watch-ack:cc wire p.sign) [cards this] :: %fact @@ -301,8 +302,8 @@ [%pass /group %agent [our.bol %group-store] %watch /groups]~ :: [%contacts @ *] - =/ wir - ?: =(%ship i.t.wir) + =/ wir + ?: =(%ship i.t.wir) wir (migrate wir) ?> ?=([%contacts @ @ *] wir) diff --git a/pkg/arvo/app/contact-store.hoon b/pkg/arvo/app/contact-store.hoon index 50b6f9cfb7..6089cae80c 100644 --- a/pkg/arvo/app/contact-store.hoon +++ b/pkg/arvo/app/contact-store.hoon @@ -1,4 +1,6 @@ -:: contact-store: data store that holds group-based contact data +:: contact-store [landscape]: +:: +:: data store that holds group-based contact data :: /+ *contact-json, default-agent, dbug |% @@ -253,7 +255,7 @@ ++ send-diff |= [pax=path upd=contact-update] ^- (list card) - :~ :* + :~ :* %give %fact ~[/all /updates [%contacts pax]] %contact-update !>(upd) diff --git a/pkg/arvo/app/contact-view.hoon b/pkg/arvo/app/contact-view.hoon index 417b754524..9fab4648c8 100644 --- a/pkg/arvo/app/contact-view.hoon +++ b/pkg/arvo/app/contact-view.hoon @@ -1,4 +1,6 @@ -:: contact-view: sets up contact JS client and combines commands +:: contact-view [landscape]: +:: +:: sets up contact JS client and combines commands :: into semantic actions for the UI :: /- diff --git a/pkg/arvo/app/file-server.hoon b/pkg/arvo/app/file-server.hoon index 7969a37296..ddeb7b3d90 100644 --- a/pkg/arvo/app/file-server.hoon +++ b/pkg/arvo/app/file-server.hoon @@ -1,3 +1,7 @@ +:: file-server [landscape]: +:: +:: mounts HTTP endpoints for Landscape (and third-party) user applications +:: /- srv=file-server, glob /+ *server, default-agent, verb, dbug |% @@ -218,8 +222,8 @@ :: [~ %html] %. file - %* . html-response:gen - cache + %* . html-response:gen + cache !=(/app/landscape/index/html (slag 3 scry-path)) == == diff --git a/pkg/arvo/app/glob.hoon b/pkg/arvo/app/glob.hoon index cdaff45f24..dc1ae6e083 100644 --- a/pkg/arvo/app/glob.hoon +++ b/pkg/arvo/app/glob.hoon @@ -1,3 +1,7 @@ +:: glob [landscape]: +:: +:: prompts content delivery and Gall state storage for Landscape JS blob +:: /- glob /+ default-agent, verb, dbug |% diff --git a/pkg/arvo/app/graph-store.hoon b/pkg/arvo/app/graph-store.hoon index ab9a6b9710..8197f439ab 100644 --- a/pkg/arvo/app/graph-store.hoon +++ b/pkg/arvo/app/graph-store.hoon @@ -1,3 +1,6 @@ +:: graph-store [landscape] +:: +:: /+ store=graph-store, sigs=signatures, res=resource, default-agent, dbug ~% %graph-store-top ..is ~ |% @@ -282,7 +285,7 @@ ?~ index graph =* atom i.index =/ =node:store - ~| "node does not exist to add signatures to!" + ~| "node does not exist to add signatures to!" (need (get:orm graph atom)) :: last index in list :: @@ -327,7 +330,7 @@ ?~ index graph =* atom i.index =/ =node:store - ~| "node does not exist to add signatures to!" + ~| "node does not exist to add signatures to!" (need (get:orm graph atom)) :: last index in list :: @@ -525,7 +528,7 @@ =/ update-log=(unit update-log:store) (~(get by update-logs) [ship term]) ?~ update-log [~ ~] =/ result=(unit [time update:store]) - (peek:orm-log:store u.update-log) + (peek:orm-log:store u.update-log) ?~ result [~ ~] ``noun+!>([~ -.u.result]) == diff --git a/pkg/arvo/app/group-hook.hoon b/pkg/arvo/app/group-hook.hoon index 4b2d7a2204..5a29752e35 100644 --- a/pkg/arvo/app/group-hook.hoon +++ b/pkg/arvo/app/group-hook.hoon @@ -1,4 +1,6 @@ -:: group-hook: allow syncing group data from foreign paths to local paths +:: 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 @@ -58,7 +60,7 @@ :: ignore duplicate publish groups ?: =(4 (lent path)) ~& "ignoring: {}" - ~ + ~ =/ pax=^path ?: =('~' i.path) t.path diff --git a/pkg/arvo/app/group-pull-hook.hoon b/pkg/arvo/app/group-pull-hook.hoon index 5a8c639c13..4d6da63891 100644 --- a/pkg/arvo/app/group-pull-hook.hoon +++ b/pkg/arvo/app/group-pull-hook.hoon @@ -1,5 +1,6 @@ -:: group-hook: allow syncing group data from foreign paths to local paths +:: group-hook [landscape]: :: +:: allow syncing group data from foreign paths to local paths :: /- *group, hook=group-hook, *invite-store, *resource /+ default-agent, verb, dbug, store=group-store, grpl=group, pull-hook diff --git a/pkg/arvo/app/group-push-hook.hoon b/pkg/arvo/app/group-push-hook.hoon index 443889e883..7e5215fa02 100644 --- a/pkg/arvo/app/group-push-hook.hoon +++ b/pkg/arvo/app/group-push-hook.hoon @@ -1,5 +1,6 @@ -:: group-hook: allow syncing group data from foreign paths to local paths +:: 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, push-hook, diff --git a/pkg/arvo/app/group-store.hoon b/pkg/arvo/app/group-store.hoon index bec2254017..57552866af 100644 --- a/pkg/arvo/app/group-store.hoon +++ b/pkg/arvo/app/group-store.hoon @@ -1,4 +1,6 @@ -:: group-store: Store groups of ships +:: group-store [landscape]: +:: +:: Store groups of ships :: :: 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 @@ -128,7 +130,7 @@ ^- [resource group] =/ members=(set ship) (~(got by groups.old) pax) - =| =invite:policy + =| =invite:policy ?> ?=(^ pax) =/ rid=resource (resource-from-old-path t.pax) @@ -149,7 +151,7 @@ |= pax=path =/ members (~(got by groups.old) pax) - =| =invite:policy + =| =invite:policy =/ rid=resource (resource-from-old-path pax) =/ =tags @@ -239,7 +241,7 @@ (~(has in members.group) ship) == %open - ?! ?| + ?! ?| (~(has in banned.policy) ship) (~(has in ban-ranks.policy) (clan:title ship)) == @@ -285,7 +287,7 @@ ^- resource ?> ?=([@ @ *] path) :- (slav %p i.path) - i.t.path + i.t.path :: ++ add-new |= =permission:permission-store @@ -293,7 +295,7 @@ ?: ?=(%black kind.permission) [~ ~ [%open ~ who.permission] %.y] [who.permission ~ [%invite ~] %.y] - :: + :: ++ update-existing |= =permission:permission-store |= =group diff --git a/pkg/arvo/app/invite-hook.hoon b/pkg/arvo/app/invite-hook.hoon index 2e4cef97b9..0e7b93d97a 100644 --- a/pkg/arvo/app/invite-hook.hoon +++ b/pkg/arvo/app/invite-hook.hoon @@ -1,4 +1,6 @@ -:: invite-hook: receive invites from any source +:: invite-hook [landscape]: +:: +:: receive invites from any source :: :: only handles %invite actions. accepts json, but only from the host team. :: can be poked by the host team to send an invite out to someone. diff --git a/pkg/arvo/app/invite-store.hoon b/pkg/arvo/app/invite-store.hoon index f08bb6cbf4..c09bd4cbae 100644 --- a/pkg/arvo/app/invite-store.hoon +++ b/pkg/arvo/app/invite-store.hoon @@ -1,3 +1,4 @@ +:: invite-store [landscape] /+ *invite-json, default-agent, dbug |% +$ card card:agent:gall diff --git a/pkg/arvo/app/invite-view.hoon b/pkg/arvo/app/invite-view.hoon index 666ed54730..72f3a0cc5a 100644 --- a/pkg/arvo/app/invite-view.hoon +++ b/pkg/arvo/app/invite-view.hoon @@ -1,3 +1,7 @@ +:: invite-view [landscape]: +:: +:: deprecated +:: /+ default-agent ^- agent:gall |_ =bowl:gall diff --git a/pkg/arvo/app/launch.hoon b/pkg/arvo/app/launch.hoon index 2eb3b3e675..ee0b23964b 100644 --- a/pkg/arvo/app/launch.hoon +++ b/pkg/arvo/app/launch.hoon @@ -1,3 +1,7 @@ +:: launch [landscape]: +:: +:: registers Landscape (and third party) applications, tiles +:: /+ store=launch-store, default-agent, dbug |% +$ card card:agent:gall diff --git a/pkg/arvo/app/link-listen-hook.hoon b/pkg/arvo/app/link-listen-hook.hoon index 9fae8d98b7..8fe602d2d8 100644 --- a/pkg/arvo/app/link-listen-hook.hoon +++ b/pkg/arvo/app/link-listen-hook.hoon @@ -1,4 +1,6 @@ -:: link-listen-hook: get your friends' bookmarks +:: link-listen-hook [landscape]: +:: +:: get your friends' bookmarks :: :: keeps track of a listening=(set app-path). users can manually add to and :: remove from this set. @@ -118,7 +120,7 @@ /app-indices == |- - ?~ resources + ?~ resources upgrade-loop(old [%2 +.old]) =, i.resources =/ members=(set ship) diff --git a/pkg/arvo/app/link-proxy-hook.hoon b/pkg/arvo/app/link-proxy-hook.hoon index 98f61f6f8c..4d325e11fc 100644 --- a/pkg/arvo/app/link-proxy-hook.hoon +++ b/pkg/arvo/app/link-proxy-hook.hoon @@ -1,4 +1,6 @@ -:: link-proxy-hook: make local pages available to foreign ships +:: link-proxy-hook [landscape]: +:: +:: make local pages available to foreign ships :: :: this is a "proxy" style hook, relaying foreign subscriptions into local :: stores if permission conditions are met. diff --git a/pkg/arvo/app/link-store.hoon b/pkg/arvo/app/link-store.hoon index fed3d1206a..8fe1c54a25 100644 --- a/pkg/arvo/app/link-store.hoon +++ b/pkg/arvo/app/link-store.hoon @@ -1,4 +1,6 @@ -:: link: social bookmarking +:: link [landscape]: +:: +:: social bookmarking :: :: the paths under which links are submitted are generally expected to :: correspond to existing group paths. for strictly-local collections of diff --git a/pkg/arvo/app/link-view.hoon b/pkg/arvo/app/link-view.hoon index eaeefae07c..3487e4e92d 100644 --- a/pkg/arvo/app/link-view.hoon +++ b/pkg/arvo/app/link-view.hoon @@ -1,4 +1,6 @@ -:: link-view: frontend endpoints +:: link-view [landscape]: +:: +::frontend endpoints :: :: endpoints, mapping onto link-store's paths. p is for page as in pagination. :: only the /0/submissions endpoint provides updates. diff --git a/pkg/arvo/app/metadata-hook.hoon b/pkg/arvo/app/metadata-hook.hoon index e3acbd0129..5cad893191 100644 --- a/pkg/arvo/app/metadata-hook.hoon +++ b/pkg/arvo/app/metadata-hook.hoon @@ -1,4 +1,6 @@ -:: metadata-hook: allow syncing foreign metadata +:: metadata-hook [landscape]: +:: +:: allow syncing foreign metadata :: :: watch paths: :: /group/%group-path all updates related to this group @@ -37,7 +39,7 @@ [[%pass /updates %agent [our.bowl %metadata-store] %watch /updates]~ this] :: ++ on-save !>(state) - ++ on-load + ++ on-load |= =vase =/ old !<(versioned-state vase) diff --git a/pkg/arvo/app/metadata-store.hoon b/pkg/arvo/app/metadata-store.hoon index a0e88e2e6d..0a6c52db6e 100644 --- a/pkg/arvo/app/metadata-store.hoon +++ b/pkg/arvo/app/metadata-store.hoon @@ -1,4 +1,6 @@ -:: metadata-store: data store for application metadata and mappings +:: metadata-store [landscape]: +:: +:: data store for application metadata and mappings :: between groups and resources within applications :: :: group-paths are expected to be an existing group path diff --git a/pkg/arvo/app/permission-group-hook.hoon b/pkg/arvo/app/permission-group-hook.hoon index 266666a8c0..535b54caf7 100644 --- a/pkg/arvo/app/permission-group-hook.hoon +++ b/pkg/arvo/app/permission-group-hook.hoon @@ -1,4 +1,6 @@ -:: permission-group-hook: groups into permissions +:: permission-group-hook [landscape]: +:: +:: groups into permissions :: :: mirror the ships in specified groups to specified permission paths :: diff --git a/pkg/arvo/app/permission-hook.hoon b/pkg/arvo/app/permission-hook.hoon index 7c55bdc682..ba715b64c5 100644 --- a/pkg/arvo/app/permission-hook.hoon +++ b/pkg/arvo/app/permission-hook.hoon @@ -1,4 +1,6 @@ -:: permission-hook: mirror remote permissions +:: permission-hook [landscape]: +:: +:: mirror remote permissions :: :: allows mirroring permissions between local and foreign ships. :: local permission path are exposed according to the permssion paths diff --git a/pkg/arvo/app/permission-store.hoon b/pkg/arvo/app/permission-store.hoon index be9b2923e6..0d051aac75 100644 --- a/pkg/arvo/app/permission-store.hoon +++ b/pkg/arvo/app/permission-store.hoon @@ -1,4 +1,6 @@ -:: permission-store: track black- and whitelists of ships +:: permission-store [landscape]: +:: +:: track black- and whitelists of ships :: /- *permission-store /+ default-agent, verb, dbug diff --git a/pkg/arvo/app/pool-group-hook.hoon b/pkg/arvo/app/pool-group-hook.hoon index 74e9385d32..e858112c55 100644 --- a/pkg/arvo/app/pool-group-hook.hoon +++ b/pkg/arvo/app/pool-group-hook.hoon @@ -1,4 +1,6 @@ -:: pool-group-hook: maintain groups based on invite pool +:: pool-group-hook [landscape]: +:: +:: maintain groups based on invite pool :: :: looks at our invite tree, adds our siblings to group at +group-path :: diff --git a/pkg/arvo/app/publish.hoon b/pkg/arvo/app/publish.hoon index 00b5075bfb..2ec74fb1ca 100644 --- a/pkg/arvo/app/publish.hoon +++ b/pkg/arvo/app/publish.hoon @@ -1,3 +1,7 @@ +:: publish [landscape] +:: +:: stores notebooks in clay, subscribes and allow subscriptions to notebooks +:: /- *publish /- *group /- group-hook diff --git a/pkg/arvo/app/s3-store.hoon b/pkg/arvo/app/s3-store.hoon index 390ae8e7ff..5b0bf0c70c 100644 --- a/pkg/arvo/app/s3-store.hoon +++ b/pkg/arvo/app/s3-store.hoon @@ -1,3 +1,7 @@ +:: s3-store [landscape]: +:: +:: stores s3 keys for uploading and sharing images and objects +:: /- *s3 /+ s3-json, default-agent, verb, dbug ~% %s3-top ..is ~ diff --git a/pkg/arvo/app/soto.hoon b/pkg/arvo/app/soto.hoon index 98645dafde..2ca0c26202 100644 --- a/pkg/arvo/app/soto.hoon +++ b/pkg/arvo/app/soto.hoon @@ -1,5 +1,6 @@ :: -:: Soto: A Dojo relay for Urbit's Landscape interface +:: soto [landscape]: A Dojo relay for Urbit's Landscape interface +:: :: Relays sole-effects to subscribers and forwards sole-action pokes :: /- sole diff --git a/pkg/arvo/app/weather.hoon b/pkg/arvo/app/weather.hoon index 9c07b0faec..684956b151 100644 --- a/pkg/arvo/app/weather.hoon +++ b/pkg/arvo/app/weather.hoon @@ -1,3 +1,7 @@ +:: weather [landscape]: +:: +:: holds latlong, gets weather data from API, passes it on to subscribers +:: /+ *server, default-agent, verb, dbug =, format :: From 4b26b2dd7115f933698cbd74c436099e873e4e55 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 1 Sep 2020 13:57:19 -0400 Subject: [PATCH 21/89] link: archive graph on migration --- pkg/arvo/app/link-store.hoon | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/app/link-store.hoon b/pkg/arvo/app/link-store.hoon index 0253b413fe..485be958d1 100644 --- a/pkg/arvo/app/link-store.hoon +++ b/pkg/arvo/app/link-store.hoon @@ -101,13 +101,15 @@ :_ this(state *state-1) =/ orm orm:graph-store |^ ^- (list card) - %+ murn ~(tap by by-group.s) + %- zing + %+ turn ~(tap by by-group.s) |= [=path =links] - ^- (unit card) + ^- (list card) ?. ?=([@ @ *] path) (on-bad-path path links) - :- ~ - %+ add-graph `resource`[(slav %p i.path) i.t.path] + =/ =resource [(slav %p i.path) i.t.path] + :_ [(archive-graph resource)]~ + %+ add-graph resource ^- graph:gra %+ gas:orm ~ =/ comments (~(gut by discussions.s) path *(map url discussion)) @@ -155,11 +157,21 @@ ++ add-graph |= [=resource =graph:gra] ^- card - =- [%pass /migrate-link %agent [our.bowl %graph-store] -] - ^- task:agent:gall - :+ %poke %graph-update - !> ^- update:gra + %- poke-graph-store [%0 now.bowl %add-graph resource graph `%graph-validator-link] + :: + ++ 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 From 97e84f96f24c52793c2502d8b2d9c43d91c5e4ec Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Tue, 1 Sep 2020 14:43:05 -0400 Subject: [PATCH 22/89] leap: move leap to its own subfolder --- pkg/interface/src/views/App.js | 11 +++++------ .../src/views/components/{ => leap}/Omnibox.js | 0 .../src/views/components/{ => leap}/OmniboxInput.js | 0 .../src/views/components/{ => leap}/OmniboxResult.js | 0 4 files changed, 5 insertions(+), 6 deletions(-) rename pkg/interface/src/views/components/{ => leap}/Omnibox.js (100%) rename pkg/interface/src/views/components/{ => leap}/OmniboxInput.js (100%) rename pkg/interface/src/views/components/{ => leap}/OmniboxResult.js (100%) diff --git a/pkg/interface/src/views/App.js b/pkg/interface/src/views/App.js index 497c5677b9..e72d0b1d16 100644 --- a/pkg/interface/src/views/App.js +++ b/pkg/interface/src/views/App.js @@ -1,7 +1,7 @@ import { hot } from 'react-hot-loader/root'; import 'react-hot-loader'; import * as React from 'react'; -import { BrowserRouter as Router, Route, withRouter, Switch } from 'react-router-dom'; +import { BrowserRouter as Router, withRouter } from 'react-router-dom'; import styled, { ThemeProvider, createGlobalStyle } from 'styled-components'; import { sigil as sigiljs, stringRenderer } from 'urbit-sigil-js'; import Helmet from 'react-helmet'; @@ -16,8 +16,7 @@ import dark from './themes/old-dark'; import { Content } from './components/Content'; import StatusBar from './components/StatusBar'; -import Omnibox from './components/Omnibox'; -import ErrorComponent from './components/Error'; +import Omnibox from './components/leap/Omnibox'; import GlobalStore from '~/logic/store/store'; import GlobalSubscription from '~/logic/subscription/global'; @@ -36,7 +35,7 @@ const Root = styled.div` background-size: cover; ` : p.background?.type === 'color' ? ` background-color: ${p.background.color}; - ` : `` + ` : '' } display: flex; flex-flow: column nowrap; @@ -135,7 +134,8 @@ class App extends React.Component { ship={this.ship} api={this.api} subscription={this.subscription} - {...state} /> + {...state} + /> @@ -143,6 +143,5 @@ class App extends React.Component { } } - export default process.env.NODE_ENV === 'production' ? App : hot(App); diff --git a/pkg/interface/src/views/components/Omnibox.js b/pkg/interface/src/views/components/leap/Omnibox.js similarity index 100% rename from pkg/interface/src/views/components/Omnibox.js rename to pkg/interface/src/views/components/leap/Omnibox.js diff --git a/pkg/interface/src/views/components/OmniboxInput.js b/pkg/interface/src/views/components/leap/OmniboxInput.js similarity index 100% rename from pkg/interface/src/views/components/OmniboxInput.js rename to pkg/interface/src/views/components/leap/OmniboxInput.js diff --git a/pkg/interface/src/views/components/OmniboxResult.js b/pkg/interface/src/views/components/leap/OmniboxResult.js similarity index 100% rename from pkg/interface/src/views/components/OmniboxResult.js rename to pkg/interface/src/views/components/leap/OmniboxResult.js From 37786327f473ff9e9240ed5c74d30cc1088c8363 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Tue, 1 Sep 2020 16:01:29 -0400 Subject: [PATCH 23/89] leap: add "other" actions, prepopulate results --- pkg/interface/src/logic/lib/omnibox.js | 17 ++++- .../src/views/components/leap/Omnibox.js | 32 +++++++-- .../views/components/leap/OmniboxResult.js | 70 +++++++++++++------ 3 files changed, 86 insertions(+), 33 deletions(-) diff --git a/pkg/interface/src/logic/lib/omnibox.js b/pkg/interface/src/logic/lib/omnibox.js index 60dc95c01f..49bf777261 100644 --- a/pkg/interface/src/logic/lib/omnibox.js +++ b/pkg/interface/src/logic/lib/omnibox.js @@ -4,7 +4,8 @@ import defaultApps from './default-apps'; ['commands', []], ['subscriptions', []], ['groups', []], - ['apps', []] + ['apps', []], + ['other', []] ]); // result schematic @@ -41,8 +42,6 @@ const commandIndex = function () { } }); - commands.push(result('Profile', '/~profile', 'profile', null)); - return commands; }; @@ -54,6 +53,9 @@ const appIndex = function (apps) { .filter((e) => { return apps[e]?.type?.basic; }) + .sort((a,b) => { + return a.localeCompare(b); + }) .map((e) => { const obj = result( apps[e].type.basic.title, @@ -70,6 +72,14 @@ const appIndex = function (apps) { return applications; }; +const otherIndex = function() { + const other = []; + other.push(result('Profile and Settings', '/~profile/identity', 'profile', null)); + other.push(result('Log Out', '/~/logout', 'logout', null)); + + return other; +}; + export default function index(associations, apps) { // all metadata from all apps is indexed // into subscriptions and groups @@ -118,6 +128,7 @@ export default function index(associations, apps) { indexes.set('subscriptions', subscriptions); indexes.set('groups', groups); indexes.set('apps', appIndex(apps)); + indexes.set('other', otherIndex()); return indexes; }; diff --git a/pkg/interface/src/views/components/leap/Omnibox.js b/pkg/interface/src/views/components/leap/Omnibox.js index 624229d20a..190220f961 100644 --- a/pkg/interface/src/views/components/leap/Omnibox.js +++ b/pkg/interface/src/views/components/leap/Omnibox.js @@ -26,11 +26,15 @@ export class Omnibox extends Component { this.renderResults = this.renderResults.bind(this); } - componentDidUpdate(prevProps) { + componentDidUpdate(prevProps, prevState) { if (prevProps !== this.props) { this.setState({ index: index(this.props.associations, this.props.apps.tiles) }); } + if (prevProps && (prevProps.apps !== this.props.apps) && (this.state.query === '')) { + this.setState({ results: this.initialResults() }); + } + if (prevProps && this.props.show && prevProps.show !== this.props.show) { Mousetrap.bind('escape', () => this.props.api.local.setOmnibox()); document.addEventListener('mousedown', this.handleClickOutside); @@ -48,7 +52,7 @@ export class Omnibox extends Component { } getSearchedCategories() { - return ['apps', 'commands', 'groups', 'subscriptions']; + return ['apps', 'commands', 'groups', 'subscriptions', 'other']; } control(evt) { @@ -91,7 +95,18 @@ export class Omnibox extends Component { } initialResults() { - return new Map(this.getSearchedCategories().map(category => [category, []])); + return new Map(this.getSearchedCategories().map((category) => { + if (!this.state) { + return [category, []]; + } + if (category === 'apps') { + return ['apps', this.state.index.get('apps')]; + } + if (category === 'other') { + return ['other', this.state.index.get('other')]; + } + return [category, []]; + })); } navigate(link) { @@ -202,10 +217,12 @@ export class Omnibox extends Component { {this.getSearchedCategories() .map(category => Object({ category, categoryResults: state.results.get(category) })) .filter(category => category.categoryResults.length > 0) - .map(({ category, categoryResults }, i) => ( - + .map(({ category, categoryResults }, i) => { + const categoryTitle = (category === 'other') + ? null : {category.charAt(0).toUpperCase() + category.slice(1)}; + return ( - {category.charAt(0).toUpperCase() + category.slice(1)} + {categoryTitle} {categoryResults.map((result, i2) => ( ))} - )) + ); + }) } ; } diff --git a/pkg/interface/src/views/components/leap/OmniboxResult.js b/pkg/interface/src/views/components/leap/OmniboxResult.js index 589ab12b75..c8ccda3ed3 100644 --- a/pkg/interface/src/views/components/leap/OmniboxResult.js +++ b/pkg/interface/src/views/components/leap/OmniboxResult.js @@ -1,6 +1,7 @@ import React, { Component } from 'react'; import { Row, Icon, Text } from '@tlon/indigo-react'; import defaultApps from '~/logic/lib/default-apps'; +import Sigil from '~/logic/lib/sigil'; export class OmniboxResult extends Component { constructor(props) { @@ -24,35 +25,58 @@ export class OmniboxResult extends Component { } } - setHover(boolean) { - this.setState({ hovered: boolean }); - } - render() { - const { icon, text, subtext, link, navigate, selected, dark } = this.props; - - let invertGraphic = {}; + getIcon(icon, dark, selected, link) { + // graphicStyle is only necessary for pngs + // + //TODO can be removed after indigo-react 1.2 + //which includes icons for apps + let graphicStyle = {}; if (icon.toLowerCase() !== 'dojo') { - invertGraphic = (!dark && this.state.hovered) || - selected === link || - (dark && !(this.state.hovered || selected === link)) - ? { filter: 'invert(1)', paddingTop: 2 } - : { filter: 'invert(0)', paddingTop: 2 }; - } else { - invertGraphic = - (!dark && this.state.hovered) || + graphicStyle = (!dark && this.state.hovered) || selected === link || (dark && !(this.state.hovered || selected === link)) - ? { filter: 'invert(0)', paddingTop: 2 } - : { filter: 'invert(1)', paddingTop: 2 }; + ? { filter: 'invert(1)' } + : { filter: 'invert(0)' }; + } else { + graphicStyle = + (!dark && this.state.hovered) || + selected === link || + (dark && !(this.state.hovered || selected === link)) + ? { filter: 'invert(0)' } + : { filter: 'invert(1)' }; } + const iconFill = this.state.hovered || selected === link ? 'white' : 'black'; + const sigilFill = this.state.hovered || selected === link ? '#3a8ff7' : '#ffffff'; + let graphic =
; if (defaultApps.includes(icon.toLowerCase()) || icon.toLowerCase() === 'links') { - graphic = ; + graphic = + ; + } else if (icon === 'logout') { + graphic = ; + } else if (icon === 'profile') { + graphic = ; } else { - graphic = ; + graphic = ; } + + return graphic; + } + + setHover(boolean) { + this.setState({ hovered: boolean }); + } + + render() { + const { icon, text, subtext, link, navigate, selected, dark } = this.props; + + const graphic = this.getIcon(icon, dark, selected, link); + return ( {graphic} - + {text} - + {subtext} ) : ( <> {graphic} - {text} - + {text} + {subtext} From e2df23eca65731982e59d26ca045ff77b1615a51 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Tue, 1 Sep 2020 16:08:50 -0400 Subject: [PATCH 24/89] leap: show group's name, not the host ship --- pkg/interface/src/logic/lib/omnibox.js | 5 +++-- pkg/interface/src/views/components/leap/Omnibox.js | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/interface/src/logic/lib/omnibox.js b/pkg/interface/src/logic/lib/omnibox.js index 49bf777261..ee616ddc93 100644 --- a/pkg/interface/src/logic/lib/omnibox.js +++ b/pkg/interface/src/logic/lib/omnibox.js @@ -1,4 +1,5 @@ import defaultApps from './default-apps'; +import { cite } from '~/logic/lib/util'; const indexes = new Map([ ['commands', []], @@ -109,7 +110,7 @@ export default function index(associations, apps) { title, `/~${app}${each['app-path']}`, app.charAt(0).toUpperCase() + app.slice(1), - shipStart.slice(0, shipStart.indexOf('/')) + cite(shipStart.slice(0, shipStart.indexOf('/'))) ); groups.push(obj); } else { @@ -117,7 +118,7 @@ export default function index(associations, apps) { title, `/~${each['app-name']}/join${each['app-path']}`, app.charAt(0).toUpperCase() + app.slice(1), - shipStart.slice(0, shipStart.indexOf('/')) + (associations?.contacts?.[each['group-path']]?.metadata?.title || null) ); subscriptions.push(obj); } diff --git a/pkg/interface/src/views/components/leap/Omnibox.js b/pkg/interface/src/views/components/leap/Omnibox.js index 190220f961..4a4b484ace 100644 --- a/pkg/interface/src/views/components/leap/Omnibox.js +++ b/pkg/interface/src/views/components/leap/Omnibox.js @@ -6,8 +6,6 @@ import Mousetrap from 'mousetrap'; import OmniboxInput from './OmniboxInput'; import OmniboxResult from './OmniboxResult'; -import { cite } from '~/logic/lib/util'; - export class Omnibox extends Component { constructor(props) { super(props); @@ -228,7 +226,7 @@ export class Omnibox extends Component { key={i2} icon={result.app} text={result.title} - subtext={cite(result.host)} + subtext={result.host} link={result.link} navigate={() => this.navigate(result.link)} selected={this.state.selected} From 24753dd0c89c083820ba437da6d7f0f8dc986437 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Tue, 1 Sep 2020 16:23:42 -0400 Subject: [PATCH 25/89] leap: better compensate for long titles --- .../views/components/leap/OmniboxResult.js | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/pkg/interface/src/views/components/leap/OmniboxResult.js b/pkg/interface/src/views/components/leap/OmniboxResult.js index c8ccda3ed3..89dde65f1f 100644 --- a/pkg/interface/src/views/components/leap/OmniboxResult.js +++ b/pkg/interface/src/views/components/leap/OmniboxResult.js @@ -96,18 +96,45 @@ export class OmniboxResult extends Component { {this.state.hovered || selected === link ? ( <> {graphic} - + {text} - + {subtext} ) : ( <> {graphic} - {text} - + + {text} + + {subtext} From baf2226e3dc5e81bff991e02c509307883ae32e8 Mon Sep 17 00:00:00 2001 From: Tyler Brown Cifu Shuster Date: Tue, 1 Sep 2020 17:17:28 -0700 Subject: [PATCH 26/89] chat: break up inline code while maintaining multiline codeblocks --- pkg/interface/src/views/apps/chat/css/custom.css | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/interface/src/views/apps/chat/css/custom.css b/pkg/interface/src/views/apps/chat/css/custom.css index 052fb06282..6294427bd0 100644 --- a/pkg/interface/src/views/apps/chat/css/custom.css +++ b/pkg/interface/src/views/apps/chat/css/custom.css @@ -252,12 +252,13 @@ blockquote { font-family: 'Inter'; } -code { - white-space: normal; +pre, code { + background-color: var(--light-gray); } -code, pre.code { - background-color: var(--light-gray); +pre code { + background-color: transparent; + white-space: pre-wrap; } code, .code, .chat.code .react-codemirror2 .CodeMirror * { From 4389c635d1174ea94163743f4f1594c40538d9af Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Wed, 2 Sep 2020 11:20:00 +1000 Subject: [PATCH 27/89] chat: ensure joined chats are loaded before joining --- pkg/interface/src/views/apps/chat/app.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/interface/src/views/apps/chat/app.tsx b/pkg/interface/src/views/apps/chat/app.tsx index 2a3a761757..032211ba5f 100644 --- a/pkg/interface/src/views/apps/chat/app.tsx +++ b/pkg/interface/src/views/apps/chat/app.tsx @@ -194,6 +194,11 @@ export default class ChatApp extends React.Component { render={(props) => { let station = `/${props.match.params.ship}/${props.match.params.station}`; + // ensure we know joined chats + if(!chatInitialized) { + return null; + } + return ( Date: Wed, 2 Sep 2020 11:21:14 +1000 Subject: [PATCH 28/89] pull-hook: prevent from subscribing to ourselves --- pkg/arvo/lib/pull-hook.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/arvo/lib/pull-hook.hoon b/pkg/arvo/lib/pull-hook.hoon index 23903fda6e..e5d2fabac0 100644 --- a/pkg/arvo/lib/pull-hook.hoon +++ b/pkg/arvo/lib/pull-hook.hoon @@ -225,6 +225,7 @@ ++ add |= [=ship =resource] ~| resource + ?< |(=(our.bowl ship) =(our.bowl entity.resource)) ?: (~(has by tracking) resource) [~ state] =. tracking From b006e7f4ad9456829f6e33bd65ed0503ebdb7b36 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Wed, 2 Sep 2020 11:21:44 +1000 Subject: [PATCH 29/89] chat-view: crash on joining own chat --- pkg/arvo/app/chat-view.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/arvo/app/chat-view.hoon b/pkg/arvo/app/chat-view.hoon index 054c702403..609c29a773 100644 --- a/pkg/arvo/app/chat-view.hoon +++ b/pkg/arvo/app/chat-view.hoon @@ -298,6 +298,7 @@ ~[(chat-hook-poke %add-synced ship.act app-path.act ask-history.act)] =/ rid=resource (de-path:resource ship+app-path.act) + ?< =(our.bol entity.rid) =/ =cage :- %group-update !> ^- action:group-store From e96671b930a4260e4a930103c75681e2b124406c Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Wed, 2 Sep 2020 11:44:10 +1000 Subject: [PATCH 30/89] chat-view: no-op instead of crash on self-join --- pkg/arvo/app/chat-view.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/app/chat-view.hoon b/pkg/arvo/app/chat-view.hoon index 609c29a773..115b07648a 100644 --- a/pkg/arvo/app/chat-view.hoon +++ b/pkg/arvo/app/chat-view.hoon @@ -298,7 +298,7 @@ ~[(chat-hook-poke %add-synced ship.act app-path.act ask-history.act)] =/ rid=resource (de-path:resource ship+app-path.act) - ?< =(our.bol entity.rid) + ?: =(our.bol entity.rid) ~ =/ =cage :- %group-update !> ^- action:group-store From 3cce0f38300d2e9cae0b47ad1b6901050ba18152 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Wed, 2 Sep 2020 12:22:31 +1000 Subject: [PATCH 31/89] glob: update to 0v5.g2nge.n1pgc.v5326.ivfqv.7ici2 --- bin/solid.pill | 4 ++-- pkg/arvo/app/glob.hoon | 2 +- pkg/arvo/app/landscape/index.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 26952f2819..b17328bd83 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cfb556a9e6b473f6cf6c75b30a3b12cb986e57df1600dad4383b9d3380cffdb6 -size 6263010 +oid sha256:1c22402da73118aad41deafbefce58afcb642feee21fcf0619927a3ddc0fc3cc +size 6264167 diff --git a/pkg/arvo/app/glob.hoon b/pkg/arvo/app/glob.hoon index dc1ae6e083..e55e0407ff 100644 --- a/pkg/arvo/app/glob.hoon +++ b/pkg/arvo/app/glob.hoon @@ -5,7 +5,7 @@ /- glob /+ default-agent, verb, dbug |% -++ hash 0v6.8fpt6.7mcjg.nb019.df3fo.haav6 +++ hash 0v5.g2nge.n1pgc.v5326.ivfqv.7ici2 +$ state-0 [%0 hash=@uv glob=(unit (each glob:glob tid=@ta))] +$ all-states $% state-0 diff --git a/pkg/arvo/app/landscape/index.html b/pkg/arvo/app/landscape/index.html index 8ba549f11b..855f1d87f5 100644 --- a/pkg/arvo/app/landscape/index.html +++ b/pkg/arvo/app/landscape/index.html @@ -23,7 +23,7 @@
- + From 630b79ad372fe0dcd183a00550265eca11bcca71 Mon Sep 17 00:00:00 2001 From: Tyler Brown Cifu Shuster Date: Sun, 23 Aug 2020 21:40:31 -0700 Subject: [PATCH 32/89] links: added s3 integration --- pkg/interface/src/logic/store/links.js | 4 + .../apps/chat/components/lib/chat-input.js | 52 +++++---- .../apps/chat/components/lib/s3-upload.js | 105 ------------------ .../groups/components/lib/contact-card.js | 12 +- pkg/interface/src/views/apps/links/app.js | 3 +- .../apps/links/components/lib/link-submit.js | 103 ++++++++++------- .../views/apps/links/components/links-list.js | 2 +- .../src/views/apps/links/components/new.js | 5 +- pkg/interface/src/views/components/Spinner.js | 2 +- .../lib => components}/s3-upload.js | 72 +++++++----- 10 files changed, 159 insertions(+), 201 deletions(-) delete mode 100644 pkg/interface/src/views/apps/chat/components/lib/s3-upload.js rename pkg/interface/src/views/{apps/groups/components/lib => components}/s3-upload.js (54%) diff --git a/pkg/interface/src/logic/store/links.js b/pkg/interface/src/logic/store/links.js index d8d7fd7dd4..eb395603fa 100644 --- a/pkg/interface/src/logic/store/links.js +++ b/pkg/interface/src/logic/store/links.js @@ -6,6 +6,7 @@ import InviteReducer from '../reducers/invite-update'; import LinkReducer from '../reducers/link-update'; import ListenReducer from '../reducers/listen-update'; import LocalReducer from '../reducers/local'; +import S3Reducer from '../reducers/s3-update'; import BaseStore from './base'; @@ -21,6 +22,7 @@ export default class LinksStore extends BaseStore { this.localReducer = new LocalReducer(); this.linkReducer = new LinkReducer(); this.listenReducer = new ListenReducer(); + this.s3Reducer = new S3Reducer(); } initialState() { @@ -37,6 +39,7 @@ export default class LinksStore extends BaseStore { comments: {}, seen: {}, permissions: {}, + s3: {}, sidebarShown: true }; } @@ -50,6 +53,7 @@ export default class LinksStore extends BaseStore { this.localReducer.reduce(data, this.state); this.linkReducer.reduce(data, this.state); this.listenReducer.reduce(data, this.state); + this.s3Reducer.reduce(data, this.state); } } diff --git a/pkg/interface/src/views/apps/chat/components/lib/chat-input.js b/pkg/interface/src/views/apps/chat/components/lib/chat-input.js index c4919cefce..1cc8990422 100644 --- a/pkg/interface/src/views/apps/chat/components/lib/chat-input.js +++ b/pkg/interface/src/views/apps/chat/components/lib/chat-input.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import ChatEditor from './chat-editor'; -import { S3Upload } from './s3-upload' +import { S3Upload } from '~/views/components/s3-upload' ; import { uxToHex } from '~/logic/lib/util'; import { Sigil } from '~/logic/lib/sigil'; @@ -221,10 +221,10 @@ export class ChatInput extends Component { style={{ flexGrow: 1 }}>
+ marginTop: 6, + flexBasis: 24, + height: 24 + }}> {avatar}
+ height: '16px', + width: '16px', + flexBasis: 16, + marginTop: 10 + }}> + accept="image/*" + > + +
+ filter: state.inCodeMode && 'invert(100%)', + height: '14px', + width: '14px', + }} + onClick={this.toggleCode} + src="/~chat/img/CodeEval.png" + className="contrast-10-d bg-white bg-none-d ba b--gray1-d br1" />
); diff --git a/pkg/interface/src/views/apps/chat/components/lib/s3-upload.js b/pkg/interface/src/views/apps/chat/components/lib/s3-upload.js deleted file mode 100644 index b497413cfd..0000000000 --- a/pkg/interface/src/views/apps/chat/components/lib/s3-upload.js +++ /dev/null @@ -1,105 +0,0 @@ -import React, { Component } from 'react'; -import S3Client from '~/logic/lib/s3'; - -export class S3Upload extends Component { - constructor(props) { - super(props); - this.s3 = new S3Client(); - this.setCredentials(props.credentials, props.configuration); - this.inputRef = React.createRef(); - } - - isReady(creds, config) { - return ( - Boolean(creds) && - 'endpoint' in creds && - 'accessKeyId' in creds && - 'secretAccessKey' in creds && - creds.endpoint !== '' && - creds.accessKeyId !== '' && - creds.secretAccessKey !== '' && - Boolean(config) && - 'currentBucket' in config && - config.currentBucket !== '' - ); - } - - componentDidUpdate(prevProps) { - const { props } = this; - this.setCredentials(props.credentials, props.configuration); - } - - setCredentials(credentials, configuration) { - if (!this.isReady(credentials, configuration)) { - return; -} - this.s3.setCredentials( - credentials.endpoint, - credentials.accessKeyId, - credentials.secretAccessKey - ); - } - - getFileUrl(endpoint, filename) { - return endpoint + '/' + filename; - } - - onChange() { - const { props } = this; - if (!this.inputRef.current) { - return; -} - const files = this.inputRef.current.files; - if (files.length <= 0) { - return; -} - - const file = files.item(0); - const bucket = props.configuration.currentBucket; - - this.s3.upload(bucket, file.name, file).then((data) => { - if (!data || !('Location' in data)) { - return; - } - this.props.uploadSuccess(data.Location); - }).catch((err) => { - console.error(err); - this.props.uploadError(err); - }); - } - - onClick() { - if (!this.inputRef.current) { - return; - } - this.inputRef.current.click(); - } - - render() { - const { props } = this; - if (!this.isReady(props.credentials, props.configuration)) { - return
; - } else { - const classes = props.className ? - 'pointer ' + props.className : 'pointer'; - return ( -
- - -
- ); - } - } -} - diff --git a/pkg/interface/src/views/apps/groups/components/lib/contact-card.js b/pkg/interface/src/views/apps/groups/components/lib/contact-card.js index 572f2f2f06..40d44ae690 100644 --- a/pkg/interface/src/views/apps/groups/components/lib/contact-card.js +++ b/pkg/interface/src/views/apps/groups/components/lib/contact-card.js @@ -5,7 +5,7 @@ import { Link } from 'react-router-dom'; import { EditElement } from './edit-element'; import { Spinner } from '~/views/components/Spinner'; import { uxToHex } from '~/logic/lib/util'; -import { S3Upload } from './s3-upload'; +import { S3Upload } from '~/views/components/s3-upload'; export class ContactCard extends Component { constructor(props) { @@ -492,7 +492,15 @@ export class ContactCard extends Component { credentials={props.s3.credentials} uploadSuccess={this.uploadSuccess.bind(this)} uploadError={this.uploadError.bind(this)} - /> + accept="image/*" + > + + @@ -256,6 +256,7 @@ export class LinksApp extends Component { api={api} hideNicknames={hideNicknames} hideAvatars={hideAvatars} + s3={s3} /> ); diff --git a/pkg/interface/src/views/apps/links/components/lib/link-submit.js b/pkg/interface/src/views/apps/links/components/lib/link-submit.js index 780df3d88e..042ce804e5 100644 --- a/pkg/interface/src/views/apps/links/components/lib/link-submit.js +++ b/pkg/interface/src/views/apps/links/components/lib/link-submit.js @@ -1,5 +1,8 @@ import React, { Component } from 'react'; + +import { S3Upload } from '~/views/components/s3-upload'; import { Spinner } from '~/views/components/Spinner'; +import { Icon } from "@tlon/indigo-react"; export class LinkSubmit extends Component { constructor() { @@ -60,23 +63,29 @@ export class LinkSubmit extends Component { this.setState({ linkTitle: event.target.value }); } + uploadSuccess(url) { + this.setState({ linkValue: url }); + this.setLinkValid(url); + } + + uploadError(error) { + // no-op for now + } + render() { + console.log('s3', this.props.s3); const activeClasses = (this.state.linkValid && !this.state.disabled) ? 'green2 pointer' : 'gray2'; const focus = (this.state.submitFocus) ? 'b--black b--white-d' : 'b--gray4 b--gray2-d'; - + return (
-