Liking cljdoc? Tell your friends :D

dk.simongray.podcast.comments.activitypub

Threads of comments over ActivityPub, the protocol of Mastodon, PeerTube and the podcast host Castopod.

Each post is a JSON document at its own URL. A root post can start a conversation and name a collection of all its posts. This collection is the context of FEP-f228, or the comments of a PeerTube video. A reading asks for that collection, or else for the replies collection of each post, down the tree. It asks for each post that a collection names by URL at the post's own server, and for each author too. A server speaks only for its own posts and authors, as FEP-fe34 asks, and a post that isn't public is left out.

Some servers answer only signed requests, and Mastodon lets no page on another site read its posts. For such a root post, the reading asks the Mastodon API of its server for the thread. Many servers answer this API, which speaks only for its own server too.

Threads of comments over ActivityPub, the protocol of Mastodon, PeerTube
and the podcast host Castopod.

Each post is a JSON document at its own URL. A root post can start a
conversation and name a collection of all its posts. This collection is
the context of FEP-f228, or the comments of a PeerTube video. A reading
asks for that collection, or else for the replies collection of each
post, down the tree. It asks for each post that a collection names by
URL at the post's own server, and for each author too. A server speaks
only for its own posts and authors, as FEP-fe34 asks, and a post that
isn't public is left out.

Some servers answer only signed requests, and Mastodon lets no page on
another site read its posts. For such a root post, the reading asks the
Mastodon API of its server for the thread. Many servers answer this API,
which speaks only for its own server too.
raw docstring

hiccupclj/s

(hiccup source)
(hiccup {:keys [base] :as source} {:keys [link-fn emoji?] :as opts})

The content of source, the source of an ActivityPub comment, as sanitized Hiccup by opts, with its links fit as the :content of a comment has them.

The result is a sequence of nodes to put inside a parent element. The opts are these:

  • :link-fn, a function of a part. It gives the URL that a mention or a hashtag links to, or nil for the link that the post has. So a mention leads to a page of the app, and not to the server of the mentioned account.
  • :emoji?, to show each custom emoji as an image. The image loads from the server of the author, which can then see who reads the thread.
The content of `source`, the source of an ActivityPub comment, as
sanitized Hiccup by `opts`, with its links fit as the :content of a
comment has them.

The result is a sequence of nodes to put inside a parent element. The
`opts` are these:

- :link-fn, a function of a part. It gives the URL that a mention or a
  hashtag links to, or nil for the link that the post has. So a
  mention leads to a page of the app, and not to the server of the
  mentioned account.
- :emoji?, to show each custom emoji as an image. The image loads from
  the server of the author, which can then see who reads the thread.
sourceraw docstring

next-pageclj/s

(next-page {:keys [request response] :as exchange})

The request for the page after the one in exchange, an exchange of the reading of a collection with a :request and a :response. It's nil after the last page, and for any other exchange.

It's the page that the answer names next, on the same server, unless the reading read that page before.

The request for the page after the one in `exchange`, an exchange of
the reading of a collection with a :request and a :response. It's nil
after the last page, and for any other exchange.

It's the page that the answer names next, on the same server, unless
the reading read that page before.
sourceraw docstring

partsclj/s

(parts {:keys [base] :as source})

The parts of the content of source, the source of an ActivityPub comment, in their order. Each part is a map with its :type and the :text that the post shows for it:

{:type :text :text "Good episode, "}
{:type :mention :text "@dave" :id "https://example.social/users/dave"
 :url "https://example.social/@dave"}
{:type :hashtag :text "#podcast" :tag "podcast"
 :url "https://example.social/tags/podcast"}
{:type :link :text "example.org" :url "https://example.org/"}
{:type :emoji :text ":blobcat:" :shortcode "blobcat"
 :url "https://example.social/emoji/blobcat.png"}

The content of a post is HTML, and the parts are its text in one line of parts. A line break of the text is a line break in a text part, and a blank line comes after a paragraph.

The parts of the content of `source`, the source of an ActivityPub
comment, in their order. Each part is a map with its :type and the
:text that the post shows for it:

    {:type :text :text "Good episode, "}
    {:type :mention :text "@dave" :id "https://example.social/users/dave"
     :url "https://example.social/@dave"}
    {:type :hashtag :text "#podcast" :tag "podcast"
     :url "https://example.social/tags/podcast"}
    {:type :link :text "example.org" :url "https://example.org/"}
    {:type :emoji :text ":blobcat:" :shortcode "blobcat"
     :url "https://example.social/emoji/blobcat.png"}

The content of a post is HTML, and the parts are its text in one line
of parts. A line break of the text is a line break in a text part, and
a blank line comes after a paragraph.
sourceraw docstring

readable?clj/s

(readable? {:keys [uri] :as interact})

Whether the thread of interact can be read: its URI is an http or https URL.

Whether the thread of `interact` can be read: its URI is an http or
https URL.
sourceraw docstring

requestsclj/s

(requests {:keys [uri root read-at comments]
           :dk.simongray.podcast.comments/keys [api held]
           :as thread}
          {:keys [max-comments] :as opts}
          ask-pred)

The requests that the ActivityPub thread needs next with opts, of those whose URLs ask-pred takes. They ask for no more posts than the :max-comments of opts allows, counted from the start of the reading.

The root post comes first. When its server keeps it from the reader, the Mastodon API of that server comes next. Then come the pages of the collections and the posts that they name, nearest the root first, and then the authors. No more pages are asked for while the posts that wait fill the room that :max-comments leaves.

The URL of the root post tells its id in the Mastodon API, by status-paths or by the :status-paths of opts.

The requests that the ActivityPub `thread` needs next with `opts`, of
those whose URLs `ask-pred` takes. They ask for no more posts than the
:max-comments of `opts` allows, counted from the start of the reading.

The root post comes first. When its server keeps it from the reader, the
Mastodon API of that server comes next. Then come the pages of the
collections and the posts that they name, nearest the root first, and
then the authors. No more pages are asked for while the posts that wait
fill the room that :max-comments leaves.

The URL of the root post tells its id in the Mastodon API, by
status-paths or by the :status-paths of `opts`.
sourceraw docstring

resumedclj/s

(resumed {:keys [comments]
          :dk.simongray.podcast.comments/keys [api conversation]
          :as thread})

The ActivityPub thread as a new reading of it starts: unread again where a failure that can pass with time stopped the last reading.

This is the root, a post, an author, a page of a collection, and the answer of the Mastodon API.

The ActivityPub `thread` as a new reading of it starts: unread again
where a failure that can pass with time stopped the last reading.

This is the root, a post, an author, a page of a collection, and the
answer of the Mastodon API.
sourceraw docstring

status-pathsclj/s

The paths of statuses on the servers that answer the Mastodon API, as of October 2026.

They're the paths of the web pages and of the ActivityPub ids. Each is a regular expression of the whole path, and its one group is the id of the status in the API.

They're the paths of Mastodon, of GoToSocial, of the ActivityPub ids of both, the numeric ids of newer Mastodon servers included, and of Pleroma and Akkoma, unless the options give the paths of other servers as :status-paths.

The paths of statuses on the servers that answer the Mastodon API, as of
October 2026.

They're the paths of the web pages and of the ActivityPub ids. Each is a
regular expression of the whole path, and its one group is the id of
the status in the API.

They're the paths of Mastodon, of GoToSocial, of the ActivityPub ids of
both, the numeric ids of newer Mastodon servers included, and of Pleroma
and Akkoma, unless the options give the paths of other servers as
:status-paths.
sourceraw docstring

with-exchangesclj/s

(with-exchanges thread exchanges at)

The ActivityPub thread with the exchanges of one of its requests read into it at at.

The ActivityPub `thread` with the `exchanges` of one of its requests
read into it at `at`.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close