diff options
Diffstat (limited to 'backupdesk/sur/trill')
-rw-r--r-- | backupdesk/sur/trill/feed.hoon | 16 | ||||
-rw-r--r-- | backupdesk/sur/trill/gate.hoon | 26 | ||||
-rw-r--r-- | backupdesk/sur/trill/post.hoon | 121 |
3 files changed, 163 insertions, 0 deletions
diff --git a/backupdesk/sur/trill/feed.hoon b/backupdesk/sur/trill/feed.hoon new file mode 100644 index 0000000..be7abb5 --- /dev/null +++ b/backupdesk/sur/trill/feed.hoon @@ -0,0 +1,16 @@ +/- post=trill-post +|% ++$ feeds (map ship feed) ++$ feed ((mop id:post post:post) gth) ++$ index (map @t (set pid:post)) +++ orm ((on id:post post:post) gth) ++$ full-graph ((mop id:post full-node:post) gth) +++ form ((on id:post full-node:post) gth) ++$ global ((mop pid:post post:post) ggth) +++ ggth |=([[ship a=time] [ship b=time]] (gth a b)) +++ gorm ((on pid:post post:post) ggth) + ++$ cursor (unit @da) ++$ fc [=feed:feed start=cursor end=cursor] ++$ gc [mix=global:feed start=cursor end=cursor] +-- diff --git a/backupdesk/sur/trill/gate.hoon b/backupdesk/sur/trill/gate.hoon new file mode 100644 index 0000000..ddc0adb --- /dev/null +++ b/backupdesk/sur/trill/gate.hoon @@ -0,0 +1,26 @@ +|% ++$ gate +$: =lock + begs=(set @p) :: follow requests + post-begs=(set post-beg) :: read requests for specific posts + :: TODO include whole thread? + mute=lock :: mute list to prevent request spamming + backlog=$~(50 @) :: size of backlog sent to followers by default +== ++$ post-beg [=ship id=@da] + ++$ lock +$: rank=[caveats=(set rank:title) locked=_| public=?] + luk=[caveats=(set ship) locked=_| public=?] + ship=[caveats=(set ship) locked=_| public=?] + tags=[caveats=(set @t) locked=_| public=?] + custom=[fn=(unit $-(@p ?)) public=?] +== ++$ change +$% [%set-rank set=(set rank:title) locked=? public=?] + [%set-luk set=(set ship) locked=? public=?] + [%set-ship set=(set ship) locked=? public=?] + [%set-tags set=(set @t) locked=? public=?] + [%set-custom term] :: Handle this and set in hoon +== +-- diff --git a/backupdesk/sur/trill/post.hoon b/backupdesk/sur/trill/post.hoon new file mode 100644 index 0000000..97912ce --- /dev/null +++ b/backupdesk/sur/trill/post.hoon @@ -0,0 +1,121 @@ +/- gate=trill-gate +|% ++$ id @da ++$ pid [=ship =id] +:: anon post type? ++$ tag @t ++$ post + $: =id + host=ship + author=ship + thread=id + parent=(unit id) + children=(set id) + contents=content-map + read=lock:gate + write=lock:gate + =engagement + =hash :: We'll reuse this for the Nostr pubkey + =signature + tags=(set tag) ::TODO make sure it's not infinite + == ++$ sent-post + $: host=ship + author=ship + thread=(unit id) + parent=(unit id) + contents=content-list + read=lock:gate + write=lock:gate + tags=(set tag) + == ++$ full-node + $: =id + host=ship + author=ship + thread=id + parent=(unit id) + children=internal-graph + contents=content-map + read=lock:gate + write=lock:gate + =engagement + =hash + =signature + tags=(set tag) + == +:: recursive types crash ++$ internal-graph + $~ [%empty ~] + $% [%full p=full-graph] + [%empty ~] + == ++$ full-graph ((mop id full-node) gth) +++ form ((on id full-node) gth) +:: from post:graph-store +:: +sham (half sha-256) hash of +validated-portion ++$ hash @uvH +:: ++$ signature [p=@uvH q=ship r=life] ++$ engagement + $: + =reacts + quoted=(set signed-pid) + shared=(set signed-pid) + == ++$ signed-pid [=signature =pid] ++$ react @t ++$ reacts (map ship signed-react-2) ++$ signed-react [=pid author=ship =react =signature] ++$ signed-react-2 [p=react q=signature] + + ++$ content-map ((mop time content-list) gth) +++ corm ((on time content-list) gth) +:: +$ content-list contents:contents-1 ++$ content-list contents ++$ li content-list ++$ contents (list block) ++$ paragraph (list inline) ++$ heading $?(%h1 %h2 %h3 %h4 %h5 %h6) ++$ block + $% [%paragraph p=(list inline)] + [%blockquote p=(list inline)] + [%table rows=(list (list contents))] + [%heading p=cord q=heading] + [%list p=(list inline) ordered=?] + [%media =media] + [%codeblock code=cord lang=cord] + [%eval hoon=cord] + :: + [%ref type=term =ship =path] + :: + [%json origin=term content=@t] + :: TODO get rid of this. should be a ref + [%poll id=@da] + == ++$ poll-opt [option=cord votes=@] ++$ media + $% [%images p=(list cord)] + [%video p=cord] + [%audio p=cord] + == ++$ inline + $% [%text p=cord] + [%italic p=cord] + [%bold p=cord] + [%strike p=cord] + [%codespan p=cord] + [%link href=cord show=cord] + [%break ~] + :: not strictly markdown + [%underline p=cord] + [%sup p=cord] + [%sub p=cord] + [%ruby p=cord q=cord] + :: custom types + [%ship p=ship] + :: TODO + :: [%date p=@da] + == +-- |