summaryrefslogtreecommitdiff
path: root/desk/sur
diff options
context:
space:
mode:
Diffstat (limited to 'desk/sur')
-rw-r--r--desk/sur/gate.hoon26
-rw-r--r--desk/sur/nostril.hoon28
-rw-r--r--desk/sur/post.hoon120
-rw-r--r--desk/sur/spider.hoon27
4 files changed, 201 insertions, 0 deletions
diff --git a/desk/sur/gate.hoon b/desk/sur/gate.hoon
new file mode 100644
index 0000000..ddc0adb
--- /dev/null
+++ b/desk/sur/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/desk/sur/nostril.hoon b/desk/sur/nostril.hoon
new file mode 100644
index 0000000..1e51695
--- /dev/null
+++ b/desk/sur/nostril.hoon
@@ -0,0 +1,28 @@
+|%
+++ shim-url 'http://localhost:8888/shim'
++$ state state-0
++$ state-0
+ $: %0
+ relays=(set @t)
+ events=(list event) :: let's limit it to 100
+ keys=(set keys)
+ ==
++$ keys [pub=@ priv=@]
+++ default ^- state-0 =/ s *state-0 s(relays (silt ~['wss://relay.damus.io' 'wss://nos.lol']))
+:: NOSTR structs
+::
+++ event
+$: id=@ux :: 32bytes
+ pubkey=@ux :: 32bytes
+ created-at=@ud :: seconds
+ kind=@ud
+ tags=(list tag)
+ content=@t
+ sig=@ux :: 64bytes
+==
+++ tag
+$: key=@t
+ value=@t
+ rest=(list @t)
+==
+--
diff --git a/desk/sur/post.hoon b/desk/sur/post.hoon
new file mode 100644
index 0000000..f7bdde6
--- /dev/null
+++ b/desk/sur/post.hoon
@@ -0,0 +1,120 @@
+/- 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
+ =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
+++ contents-1
+|%
++$ contents (list block)
++$ block
+ $% [%paragraph p=(list inline)]
+ [%blockquote p=(list inline)]
+ [%table rows=(list (list contents))]
+ [%heading p=cord q=@]
+ [%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]
+ ==
+--
+--
diff --git a/desk/sur/spider.hoon b/desk/sur/spider.hoon
new file mode 100644
index 0000000..7c21268
--- /dev/null
+++ b/desk/sur/spider.hoon
@@ -0,0 +1,27 @@
+/+ libstrand=strand
+=, strand=strand:libstrand
+|%
++$ thread $-(vase shed:khan)
++$ input [=tid =cage]
++$ tid tid:strand
++$ bowl bowl:strand
++$ http-error
+ $? %bad-request :: 400
+ %forbidden :: 403
+ %nonexistent :: 404
+ %offline :: 504
+ ==
++$ start-args
+ $: parent=(unit tid)
+ use=(unit tid)
+ =beak
+ file=term
+ =vase
+ ==
++$ inline-args
+ $: parent=(unit tid)
+ use=(unit tid)
+ =beak
+ =shed:khan
+ ==
+--