From 328ebe85135912678bdacd3381126ffd66ef2761 Mon Sep 17 00:00:00 2001 From: polwex Date: Fri, 27 Jun 2025 22:53:52 +0700 Subject: init --- desk/sur/boke.hoon | 113 ++++ desk/sur/contact.hoon | 51 ++ desk/sur/polls.hoon | 57 ++ desk/sur/spider.hoon | 27 + desk/sur/tlon-chat.hoon | 1268 +++++++++++++++++++++++++++++++++++++++++++ desk/sur/tlon/channels.hoon | 464 ++++++++++++++++ desk/sur/tlon/cite.hoon | 57 ++ desk/sur/tlon/groups.hoon | 383 +++++++++++++ desk/sur/trill/gate.hoon | 26 + desk/sur/trill/post.hoon | 115 ++++ desk/sur/twatter/json.hoon | 105 ++++ desk/sur/twatter/test.json | 1 + 12 files changed, 2667 insertions(+) create mode 100644 desk/sur/boke.hoon create mode 100644 desk/sur/contact.hoon create mode 100644 desk/sur/polls.hoon create mode 100644 desk/sur/spider.hoon create mode 100644 desk/sur/tlon-chat.hoon create mode 100644 desk/sur/tlon/channels.hoon create mode 100644 desk/sur/tlon/cite.hoon create mode 100644 desk/sur/tlon/groups.hoon create mode 100644 desk/sur/trill/gate.hoon create mode 100644 desk/sur/trill/post.hoon create mode 100644 desk/sur/twatter/json.hoon create mode 100644 desk/sur/twatter/test.json (limited to 'desk/sur') diff --git a/desk/sur/boke.hoon b/desk/sur/boke.hoon new file mode 100644 index 0000000..6af312d --- /dev/null +++ b/desk/sur/boke.hoon @@ -0,0 +1,113 @@ +/- tp=trill-post, tlonc=tlon-channels, polls +|% ++$ action +$% [%add p=post:tp] + [%del p=id:tp] + :: approve comments? + [%add-board name=@t] + [%del-board name=@t] +== ++$ kaji-req +$% [%board-redi =post:tp] + [%blog-redi =post:tp] + [%redi url=@t] + [%tv-chat p=@t q=post:tp] + [%radio-chat p=@p q=*] + [%chat-msg p=flag:tlonc q=memo:tlonc] +== ++$ state state-0 ++$ tags-table (map @t pidmap) ++$ pathmap (map path pid:tp) ++$ threadsf ((mop pid:tp thread:tp) ggth:tp) ++$ pidmap ((mop pid:tp pid:tp) ggth:tp) ++$ external ((mop esrc epost) extc) +++ erm ((on id:tp post:tp) gth) ++$ esrc +$: time=@da + id=@t :: whatever +== ++$ epost + $: =pid:tp + url=@t + service=@t + json=@t +== +++ extc |= [a=esrc b=esrc] (gth time.a time.b) +:: in active threads the pid is the pid of the last reply ++$ state-0 +$: %0 + :: all data here. flat structure. fk'it + feed=gfeed:tp + threads=threadsf + active-threads=pidmap :: same as above but ordered by last reply + paths=pathmap + tags=tags-table + tv=tv-table + polls=polls-table + notifications=hark-table + external=(map @t external) :: twitter etc, tagged or named +== ++$ tv-table + $: urbit=(map @p urbit-radio) + here=(map @t bstv) + == ++$ hark-table (map @p t-hark) ++$ t-hark + $: last-online=@da + tracking=(map pid:tp post:tp) + == ++$ polls-table (map pid:tp poll:polls) ++$ bstv + $: name=@t + owner=@p + current=[playing=@t started=@da] :: should point to the schedule + schedule=(map @da tv-station) + == ++$ tv-station + $: description=cord + src=cord :: source file + started=@da + ended=(unit @da) + viewers=(map @p (list presence)) + chat=(list post:tp) + perms=* + == ++$ presence [came=@da left=@da] ++$ twr $%([%our name=@t owner=@p tv=tv-station] [%urb name=@t owner=@p p=urbit-radio]) ++$ urbit-radio + $: + description=cord + location=ship + time=@da + viewers=@ud + == ++$ radio-event + $% [%put p=urbit-radio] + [%remove =ship] + [%request ~] + [%response minitowers=(map ship urbit-radio)] + == + ++$ admin +$: banned=(set address:eyre) + settings=(map @p setting) +== ++$ setting +$: thing=* +== + +:: fetching stuff, shouldn't be here really but whatever ++$ section $?(%blog %comments %chat %threads %replies) ++$ chat-page [p=scan:tlonc older=(unit @da) newer=(unit @da) count=@ud] ++$ search-res $%([%chat chat-page] [%trill search-page]) ++$ search-page + $: res=(list post-snip) + newer=cursor:tp + older=cursor:tp + == ++$ post-snip + $: fn=full-node:tp + snip=@t + == + +-- diff --git a/desk/sur/contact.hoon b/desk/sur/contact.hoon new file mode 100644 index 0000000..973f954 --- /dev/null +++ b/desk/sur/contact.hoon @@ -0,0 +1,51 @@ +/+ sr=sortug +|% +++ get-contacts +|= =bowl:gall +=/ io ~(. io:sr bowl) +(scry:io %whom /1/contacts/mars whoms) +:: fuck it ++$ res +$: p=@p + contact=(unit contact) + whom=(unit whom) +== +:: %contacts ++$ foreign [for=$@(~ prof) sag=*] ++$ prof [wen=@da con=$@(~ contact)] ++$ rolodex (map ship foreign) ++$ contact +$: nickname=@t + bio=@t + status=@t + color=@ux + avatar=(unit @t) + cover=(unit @t) + groups=(set (pair ship term)) +== +:: %whom ++$ whoms (map (each @p @t) whom) ++$ whom +$: info=(map @tas info-field) + profile=(unit profile) +== ++$ access-level ?(%public %mutual) +:: ++$ profile + $: info=(map @tas [value=info-field access=access-level]) + fields=(map @tas field-def) + == ++$ field-def [name=@t type=field-type-tag] +:: ++$ field-type-tag ?(%text %date %look %tint %coll) +:: ++$ info-field + $% [%text @t] + [%date @da] + [%look @t] :: link to image + [%tint @ux] :: color (0-255) + [%coll coll] :: collection of items on Urbit (groups, apps, wikis, etc) + == +:: ++$ coll (set [=ship slug=@ta]) +-- diff --git a/desk/sur/polls.hoon b/desk/sur/polls.hoon new file mode 100644 index 0000000..93085c2 --- /dev/null +++ b/desk/sur/polls.hoon @@ -0,0 +1,57 @@ +/- gate=trill-gate +|% ++$ pid [ship=@p id=@da] ++$ id @da ++$ expiry @da ++$ text @t ++$ poll +$: author=ship + =time + =expiry + =text + options=(list @t) + =votes + read=lock:gate + write=lock:gate +== ++$ votes +$% excl + incl +== ++$ excl [%exc p=(map ship @ud)] ++$ incl [%inc p=(map @ud (map @p (set @ud)))] +:: some helpers + +++ new-poll +|= [=pid =text =expiry options=(list @t) inc=?] +=/ votes ?. inc *excl *incl +^- poll +:* author=-.pid + time=+.pid + expiry + text + options + votes + read=*lock:gate + write=*lock:gate +== +:: comms ++$ ui-action +$% [%propose text=@t =expiry options=(list @t) exc=?] + [%cancel =id] + [%change-expiry =id =expiry] + [%vote =pid option=@ comment=@t] + [%cancel-vote =pid] +== ++$ update +$% [%new-poll =poll] + [%ded-poll p=pid] + [%old-poll p=poll q=upd] +== ++$ upd +$? [%new-vote p=@ud] + [%expiry-changed q=expiry] + [%vote-changed p=@p old=@ new=@] + [%vote-canceled p=@p q=@] +== +-- 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 + == +-- diff --git a/desk/sur/tlon-chat.hoon b/desk/sur/tlon-chat.hoon new file mode 100644 index 0000000..dd82833 --- /dev/null +++ b/desk/sur/tlon-chat.hoon @@ -0,0 +1,1268 @@ +|% +++ meta +|% ++$ data + $: title=cord + description=cord + image=cord + cover=cord + == ++$ diff + $% [%title =cord] + [%description =cord] + [%image =cord] + [%cover =cord] + == +-- +++ d +|% +:: $flag: identifier for a diary channel ++$ flag (pair ship term) +:: $feel: either an emoji identifier like :diff or a URL for custom ++$ feel @ta +:: $view: the persisted display format for a diary ++$ view ?(%grid %list) +:: $sort: the persisted sort type for a diary ++$ sort ?(%alpha %time) +:: $shelf: my ship's diaries ++$ shelf (map flag diary) +:: $said: used for references ++$ said (pair flag outline) +:: $plan: index into diary state +:: p: Note being referred to +:: q: Quip being referred to, if any +:: ++$ plan + (pair time (unit time)) +:: +:: $diary: written longform communication +:: +:: net: an indicator of whether I'm a host or subscriber +:: log: the history of all modifications +:: perm: holds the diary's permissions +:: view: what format to display +:: sort: how to order posts +:: notes: the actual contents of the diary +:: remark: what is the last thing we've read +:: banter: comments organized by post +:: ++$ diary + $: =net + =log + =perm + =view + =sort + =notes + =remark + == +:: +:: $notes: a set of time ordered diary posts +:: +++ notes + =< rock + |% + +$ rock + ((mop time note) lte) + ++ on + ((^on time note) lte) + +$ diff + (pair time delta) + +$ delta + $% [%add p=essay] + [%edit p=essay] + [%del ~] + [%quips p=diff:quips] + [%add-feel p=ship q=feel] + [%del-feel p=ship] + == + -- +:: +:: $quips: a set of time ordered note comments +:: +++ quips + =< rock + |% + +$ rock + ((mop time quip) lte) + ++ on + ((^on time quip) lte) + +$ diff + (pair time delta) + +$ delta + $% [%add p=memo] + [%del ~] + [%add-feel p=ship q=feel] + [%del-feel p=ship] + == + -- +:: +:: $outline: abridged $note +:: .quips: number of comments +:: ++$ outline + [quips=@ud quippers=(set ship) essay] +:: +++ outlines + =< outlines + |% + +$ outlines ((mop time outline) lte) + ++ on ((^on time outline) lte) + -- +:: +:: $note: a diary post +:: ++$ note [seal essay] +:: $quip: a post comment +:: ++$ quip [cork memo] +:: +:: $seal: host-side data for a note +:: ++$ seal + $: =time + =quips + feels=(map ship feel) + == +:: +:: $cork: host-side data for a quip +:: ++$ cork + $: =time + feels=(map ship feel) + == +:: $essay: the post data itself +:: +:: title: the name of the post +:: image: a visual displayed as a header +:: content: the body of the post +:: author: the ship that wrote the post +:: sent: the client-side time the post was made +:: ++$ essay + $: title=@t + image=@t + content=(list verse) + author=ship + sent=time + == ++$ story (pair (list block) (list inline)) +:: $memo: the comment data itself +:: +:: content: the body of the comment +:: author: the ship that wrote the comment +:: sent: the client-side time the comment was made +:: ++$ memo + $: content=story + author=ship + sent=time + == +:: $verse: a chunk of post content +:: +:: blocks stand on their own. inlines come in groups and get wrapped +:: into a paragraph +:: ++$ verse + $% [%block p=block] + [%inline p=(list inline)] + == +:: $listing: recursive type for infinitely nested